Added files to ignore.
7
Docs/Settings List.txt
Normal file
|
@ -0,0 +1,7 @@
|
|||
OPTIONS
|
||||
|
||||
+ Language
|
||||
Drop down list with icons
|
||||
Restart notice
|
||||
|
||||
+ Shortcuts
|
32
Installer/DotNet.nsh
Normal file
|
@ -0,0 +1,32 @@
|
|||
# .NET Installation checker
|
||||
|
||||
!macro HasDotNet4 OutVar
|
||||
Push "Install" ;reg key
|
||||
Push "Software\Microsoft\NET Framework Setup\NDP\v4\Client" ;v4.0 client reg node
|
||||
Call HasDotNet4Core
|
||||
Pop ${OutVar}
|
||||
!macroend
|
||||
|
||||
!define HasDotNet4 "!insertmacro HasDotNet4"
|
||||
|
||||
Function HasDotNet4Core
|
||||
Pop $R0 ;reg node to check
|
||||
Pop $R1 ;reg key
|
||||
|
||||
ReadRegDWORD $R3 HKLM $R0 $R1
|
||||
|
||||
;MessageBox MB_OK "$R0 \ $R1 value is $R3"
|
||||
;IntOp $R8 $R3 % 1 ;logical AND with 1 (should evaluate to 1 in $R8)
|
||||
|
||||
IntCmp $R3 1 has hasNot has ;jump if >= 1
|
||||
|
||||
has:
|
||||
Push 1
|
||||
Goto exit
|
||||
|
||||
hasNot:
|
||||
Push 0
|
||||
Goto exit
|
||||
|
||||
exit:
|
||||
FunctionEnd
|
BIN
Installer/header.bmp
Normal file
After Width: | Height: | Size: 25 KiB |
140
Installer/script.nsi
Normal file
|
@ -0,0 +1,140 @@
|
|||
# INCLUDES
|
||||
!include MUI2.nsh ;Modern interface
|
||||
!include LogicLib.nsh ;nsDialogs
|
||||
!include "DotNet.nsh"
|
||||
|
||||
# INIT
|
||||
Name "OnTopReplica"
|
||||
InstallDir "$LOCALAPPDATA\OnTopReplica"
|
||||
OutFile "OnTopReplica-Setup.exe"
|
||||
RequestExecutionLevel user
|
||||
|
||||
# REFS
|
||||
!define REG_UNINSTALL "Software\Microsoft\Windows\CurrentVersion\Uninstall\OnTopReplica"
|
||||
!define START_LINK_DIR "$STARTMENU\Programs\OnTopReplica"
|
||||
!define START_LINK_RUN "$STARTMENU\Programs\OnTopReplica\OnTopReplica.lnk"
|
||||
!define START_LINK_UNINSTALLER "$STARTMENU\Programs\OnTopReplica\Uninstall OnTopReplica.lnk"
|
||||
!define UNINSTALLER_NAME "OnTopReplica-Uninstall.exe"
|
||||
!define WEBSITE_LINK "http://www.klopfenstein.net/lorenz.aspx/ontopreplica"
|
||||
|
||||
# GRAPHICS
|
||||
!define MUI_ICON "..\OnTopReplica\Assets\icon-new.ico"
|
||||
!define MUI_UNICON "..\OnTopReplica\Assets\icon-new-red.ico"
|
||||
!define MUI_HEADERIMAGE
|
||||
!define MUI_HEADERIMAGE_RIGHT
|
||||
!define MUI_HEADERIMAGE_BITMAP "header.bmp"
|
||||
!define MUI_HEADERIMAGE_UNBITMAP "header.bmp"
|
||||
#!define MUI_WELCOMEFINISHPAGE_BITMAP "banner.bmp"
|
||||
#!define MUI_UNWELCOMEFINISHPAGE_BITMAP "banner.bmp"
|
||||
|
||||
# TEXT AND SETTINGS
|
||||
!define MUI_PAGE_HEADER_TEXT "OnTopReplica"
|
||||
|
||||
!define MUI_FINISHPAGE_RUN "$INSTDIR\OnTopReplica.exe"
|
||||
;!define MUI_FINISHPAGE_RUN_TEXT "Run OnTopReplica now."
|
||||
|
||||
;Do not skip to finish automatially
|
||||
!define MUI_FINISHPAGE_NOAUTOCLOSE
|
||||
!define MUI_UNFINISHPAGE_NOAUTOCLOSE
|
||||
|
||||
# PAGE DEFINITIONS
|
||||
!insertmacro MUI_PAGE_WELCOME
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
!insertmacro MUI_PAGE_FINISH
|
||||
|
||||
!insertmacro MUI_UNPAGE_CONFIRM
|
||||
!insertmacro MUI_UNPAGE_INSTFILES
|
||||
|
||||
# LANGUAGES
|
||||
!insertmacro MUI_LANGUAGE "English"
|
||||
|
||||
# INITIALIZATION AND ERROR CHECKING
|
||||
Function .onInit
|
||||
${HasDotNet4} $R0
|
||||
${If} $R0 == 1
|
||||
;noop
|
||||
${Else}
|
||||
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "Microsoft .NET Framework 4.0 appears not to be installed.$\n$\nOnTopReplica requires .NET 4.0 to run: please install it before running the installer.$\n$\nDo you wish to proceed anyway?" IDOK proceedAnyway
|
||||
Abort ".NET 4.0 required to install"
|
||||
proceedAnyway:
|
||||
${EndIf}
|
||||
FunctionEnd
|
||||
|
||||
# CALLBACKS
|
||||
Function RegisterApplication
|
||||
;Register uninstaller into Add/Remove panel (for local user only)
|
||||
WriteRegStr HKCU "${REG_UNINSTALL}" "DisplayName" "OnTopReplica"
|
||||
WriteRegStr HKCU "${REG_UNINSTALL}" "DisplayIcon" "$\"$INSTDIR\OnTopReplica.exe$\""
|
||||
WriteRegStr HKCU "${REG_UNINSTALL}" "Publisher" "Lorenz Cuno Klopfenstein"
|
||||
WriteRegStr HKCU "${REG_UNINSTALL}" "DisplayVersion" "3.4"
|
||||
WriteRegDWord HKCU "${REG_UNINSTALL}" "EstimatedSize" 992 ;KB
|
||||
WriteRegStr HKCU "${REG_UNINSTALL}" "HelpLink" "${WEBSITE_LINK}"
|
||||
WriteRegStr HKCU "${REG_UNINSTALL}" "URLInfoAbout" "${WEBSITE_LINK}"
|
||||
WriteRegStr HKCU "${REG_UNINSTALL}" "InstallLocation" "$\"$INSTDIR$\""
|
||||
WriteRegStr HKCU "${REG_UNINSTALL}" "InstallSource" "$\"$EXEDIR$\""
|
||||
WriteRegDWord HKCU "${REG_UNINSTALL}" "NoModify" 1
|
||||
WriteRegDWord HKCU "${REG_UNINSTALL}" "NoRepair" 1
|
||||
WriteRegStr HKCU "${REG_UNINSTALL}" "UninstallString" "$\"$INSTDIR\${UNINSTALLER_NAME}$\""
|
||||
WriteRegStr HKCU "${REG_UNINSTALL}" "Comments" "Uninstalls OnTopReplica."
|
||||
|
||||
;Links
|
||||
SetShellVarContext current
|
||||
CreateDirectory "${START_LINK_DIR}"
|
||||
CreateShortCut "${START_LINK_RUN}" "$INSTDIR\OnTopReplica.exe"
|
||||
CreateShortCut "${START_LINK_UNINSTALLER}" "$INSTDIR\${UNINSTALLER_NAME}"
|
||||
FunctionEnd
|
||||
|
||||
Function un.DeregisterApplication
|
||||
;Deregister uninstaller from Add/Remove panel
|
||||
DeleteRegKey HKCU "${REG_UNINSTALL}"
|
||||
|
||||
;Start menu links
|
||||
SetShellVarContext current
|
||||
RMDir /r "${START_LINK_DIR}"
|
||||
FunctionEnd
|
||||
|
||||
# INSTALL SECTIONS
|
||||
Section "!OnTopReplica" OnTopReplica
|
||||
SectionIn RO
|
||||
|
||||
SetOutPath $INSTDIR
|
||||
SetOverwrite on
|
||||
|
||||
;Ensure that old VistaControls.dll is removed
|
||||
Delete "$INSTDIR\VistaControls.dll"
|
||||
|
||||
;Main installation
|
||||
File "..\OnTopReplica\bin\Release\OnTopReplica.exe"
|
||||
File "..\OnTopReplica\bin\Release\OnTopReplica.exe.config"
|
||||
File "..\OnTopReplica\bin\Release\WindowsFormsAero.dll"
|
||||
|
||||
;Text stuff
|
||||
File "..\OnTopReplica\bin\Release\CREDITS.txt"
|
||||
File "..\OnTopReplica\bin\Release\LICENSE.txt"
|
||||
|
||||
;Install localization files
|
||||
SetOutPath "$INSTDIR\it"
|
||||
File "..\OnTopReplica\bin\Release\it\OnTopReplica.resources.dll"
|
||||
SetOutPath "$INSTDIR\cs"
|
||||
File "..\OnTopReplica\bin\Release\cs\OnTopReplica.resources.dll"
|
||||
SetOutPath "$INSTDIR\da"
|
||||
File "..\OnTopReplica\bin\Release\da\OnTopReplica.resources.dll"
|
||||
SetOutPath "$INSTDIR\de"
|
||||
File "..\OnTopReplica\bin\Release\de\OnTopReplica.resources.dll"
|
||||
SetOutPath "$INSTDIR\es"
|
||||
File "..\OnTopReplica\bin\Release\es\OnTopReplica.resources.dll"
|
||||
SetOutPath "$INSTDIR\pl"
|
||||
File "..\OnTopReplica\bin\Release\pl\OnTopReplica.resources.dll"
|
||||
|
||||
;Uninstaller
|
||||
WriteUninstaller "$INSTDIR\${UNINSTALLER_NAME}"
|
||||
Call RegisterApplication
|
||||
SectionEnd
|
||||
|
||||
Section "Uninstall"
|
||||
;Remove whole directory (no data is stored there anyway)
|
||||
RMDir /r "$INSTDIR"
|
||||
|
||||
;Remove uninstaller
|
||||
Call un.DeregisterApplication
|
||||
SectionEnd
|
6
Installer/update.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<UpdateInformation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<latestVersion>3.3.2.0</latestVersion>
|
||||
<latestVersionRelease>2011-06-07T01:00:00Z</latestVersionRelease>
|
||||
<downloadPage>http://www.klopfenstein.net/lorenz.aspx/ontopreplica</downloadPage>
|
||||
</UpdateInformation>
|
2
Installer/wix-compile.bat
Normal file
|
@ -0,0 +1,2 @@
|
|||
"C:\Program Files (x86)\WiX Toolset v3.7\bin\candle.exe" wix-package.wxs
|
||||
"C:\Program Files (x86)\WiX Toolset v3.7\bin\light.exe" wix-package.wixobj
|
71
Installer/wix-package.wxs
Normal file
|
@ -0,0 +1,71 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
|
||||
|
||||
<Product
|
||||
Name="OnTopReplica"
|
||||
Id="c6982522-aa7f-476d-be20-f739c2111408"
|
||||
UpgradeCode="eeaf5a3d-bc48-4fd6-8503-450afdead792"
|
||||
Language="1033" Codepage="1252"
|
||||
Version="1.0.0"
|
||||
Manufacturer="Lorenz Cuno Klopfenstein"
|
||||
>
|
||||
|
||||
<Package
|
||||
Id="*"
|
||||
Keywords="Installer"
|
||||
Description="OnTopReplica installer"
|
||||
Manufacturer="Lorenz Cuno Klopfenstein"
|
||||
InstallScope="perUser"
|
||||
InstallerVersion="100"
|
||||
Languages="1033"
|
||||
Compressed="yes"
|
||||
SummaryCodepage="1252"
|
||||
/>
|
||||
|
||||
<!--<UIRef Id="WixUI_Minimal" />-->
|
||||
|
||||
<!--<Icon Id="Foobar10.exe" SourceFile="FoobarAppl10.exe" />-->
|
||||
|
||||
<Media Id="1" Cabinet="OTR.cab" EmbedCab="yes" />
|
||||
|
||||
<!-- Directories declaration -->
|
||||
<Directory Id="TARGETDIR" Name="SourceDir">
|
||||
<Directory Id="LocalAppDataFolder">
|
||||
<Directory Id="APPLICATIONINSTALLDIR" Name="OnTopReplica-Test" />
|
||||
<Directory Id="OldApplicationInstallDir" Name="Lorenz_Cuno_Klopfenstein2" />
|
||||
</Directory>
|
||||
|
||||
<!--<Directory Id="ProgramMenuFolder" Name="Programs">
|
||||
<Directory Id="ProgramMenuDir" Name="OnTopReplica-MenuDir">
|
||||
<Component Id="ProgramMenuDir" Guid="64c6a89e-9f2f-49cb-b742-c3503668c23d">
|
||||
<RemoveFolder Id="ProgramMenuDir" On="uninstall" />
|
||||
<RegistryValue Root="HKCU" Key="Software\[ProductName]" Type="string" Value="" KeyPath="yes" />
|
||||
</Component>
|
||||
</Directory>
|
||||
</Directory>
|
||||
|
||||
<Directory Id="DesktopFolder" Name="Desktop" />-->
|
||||
</Directory>
|
||||
|
||||
<!-- Components -->
|
||||
<DirectoryRef Id="APPLICATIONINSTALLDIR">
|
||||
<Component Id="OnTopReplica.exe" Guid="a0cd6179-95a5-4055-87bd-c326ee307f1b">
|
||||
<File Id="OnTopReplica.exe" Name="OnTopReplica.exe" DiskId="1" Source="..\OnTopReplica\bin\Release\OnTopReplica.exe" Checksum="yes" />
|
||||
<RemoveFolder Id="APPLICATIONINSTALLDIR" On="uninstall" />
|
||||
<RegistryValue Root="HKCU" Key="Software\[ProductName]" Type="string" Value="" KeyPath="yes" />
|
||||
</Component>
|
||||
|
||||
<Component Id="OldOnTopReplicaRemoval" Guid="17692986-3678-4155-9ae6-155ab44d226b">
|
||||
<RemoveFolder Id="OldApplicationInstallDir" On="install" />
|
||||
</Component>
|
||||
</DirectoryRef>
|
||||
|
||||
<!-- Features -->
|
||||
<Feature Id="FeatureMainApplication" Title="Application" Level="1">
|
||||
<ComponentRef Id="OnTopReplica.exe" />
|
||||
<ComponentRef Id="OldOnTopReplicaRemoval" />
|
||||
</Feature>
|
||||
|
||||
</Product>
|
||||
|
||||
</Wix>
|
BIN
Lib/WindowsFormsAero.dll
Normal file
BIN
Lib/WindowsFormsAero.pdb
Normal file
1131
Lib/WindowsFormsAero.xml
Normal file
20
OnTopReplica.sln
Normal file
|
@ -0,0 +1,20 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual C# Express 2010
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OnTopReplica", "OnTopReplica\OnTopReplica.csproj", "{E626BD6E-BF38-4EB7-A128-5CA6F40EF557}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{E626BD6E-BF38-4EB7-A128-5CA6F40EF557}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E626BD6E-BF38-4EB7-A128-5CA6F40EF557}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E626BD6E-BF38-4EB7-A128-5CA6F40EF557}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E626BD6E-BF38-4EB7-A128-5CA6F40EF557}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
238
OnTopReplica/AspectRatioForm.cs
Normal file
|
@ -0,0 +1,238 @@
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
using OnTopReplica.Native;
|
||||
using WindowsFormsAero.Dwm.Helpers;
|
||||
|
||||
namespace OnTopReplica {
|
||||
|
||||
/// <summary>
|
||||
/// Form that automatically keeps a certain aspect ratio and resizes without flickering.
|
||||
/// </summary>
|
||||
public class AspectRatioForm : GlassForm {
|
||||
|
||||
bool _keepAspectRatio = true;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether the form should keep its aspect ratio.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Refreshes the window's size if set to true.
|
||||
/// </remarks>
|
||||
[Description("Enables fixed aspect ratio for this form."), Category("Appearance"), DefaultValue(true)]
|
||||
public bool KeepAspectRatio {
|
||||
get {
|
||||
return _keepAspectRatio;
|
||||
}
|
||||
set {
|
||||
_keepAspectRatio = value;
|
||||
|
||||
if (value)
|
||||
RefreshAspectRatio();
|
||||
}
|
||||
}
|
||||
|
||||
double _aspectRatio = 1.0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the form's aspect ratio that will be kept automatically when resizing.
|
||||
/// </summary>
|
||||
[Description("Determines this form's fixed aspect ratio."), Category("Appearance"), DefaultValue(1.0)]
|
||||
public double AspectRatio {
|
||||
get {
|
||||
return _aspectRatio;
|
||||
}
|
||||
set {
|
||||
if (value <= 0.0 || Double.IsInfinity(value))
|
||||
return;
|
||||
|
||||
_aspectRatio = value;
|
||||
}
|
||||
}
|
||||
|
||||
Padding _extraPadding;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets some additional internal padding of the form that is ignored when keeping the aspect ratio.
|
||||
/// </summary>
|
||||
[Description("Sets some padding inside the form's client area that is ignored when keeping the aspect ratio."),
|
||||
Category("Appearance")]
|
||||
public Padding ExtraPadding {
|
||||
get {
|
||||
return _extraPadding;
|
||||
}
|
||||
set {
|
||||
_extraPadding = value;
|
||||
|
||||
if(KeepAspectRatio)
|
||||
RefreshAspectRatio();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Forces the form to update its height based on the current aspect ratio setting.
|
||||
/// </summary>
|
||||
public void RefreshAspectRatio() {
|
||||
int newWidth = ClientSize.Width;
|
||||
int newHeight = (int)((ClientSize.Width - ExtraPadding.Horizontal) / AspectRatio) + ExtraPadding.Vertical;
|
||||
|
||||
//Adapt height if it doesn't respect the form's minimum size
|
||||
Size clientMinimumSize = FromSizeToClientSize(MinimumSize);
|
||||
if (newHeight < clientMinimumSize.Height) {
|
||||
newHeight = clientMinimumSize.Height;
|
||||
newWidth = (int)((newHeight - ExtraPadding.Vertical) * AspectRatio) + ExtraPadding.Horizontal;
|
||||
}
|
||||
|
||||
//Adapt height if it exceeds the screen's height
|
||||
var workingArea = Screen.GetWorkingArea(this);
|
||||
if (newHeight >= workingArea.Height) {
|
||||
newHeight = workingArea.Height;
|
||||
newWidth = (int)((newHeight - ExtraPadding.Vertical) * AspectRatio) + ExtraPadding.Horizontal;
|
||||
}
|
||||
|
||||
//Update size
|
||||
ClientSize = new Size(newWidth, newHeight);
|
||||
|
||||
//Move form vertically to adapt to new size
|
||||
//REMOVED: allows the window to correctly be restored slightly off screen
|
||||
/*if (Location.Y + Size.Height > workingArea.Y + workingArea.Height) {
|
||||
int offsetY = (workingArea.Y + workingArea.Height) - (Location.Y + Size.Height);
|
||||
Location = new Point(Location.X, Location.Y - offsetY);
|
||||
}*/
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adjusts the size of the form by a pixel increment while keeping its aspect ratio.
|
||||
/// </summary>
|
||||
/// <param name="pixelIncrement">Change of size in pixels.</param>
|
||||
public void AdjustSize(int pixelOffset) {
|
||||
Size origSize = Size;
|
||||
|
||||
//Resize to new width (clamped to max allowed size and minimum form size)
|
||||
int newWidth = Math.Max(Math.Min(origSize.Width + pixelOffset,
|
||||
SystemInformation.MaxWindowTrackSize.Width),
|
||||
MinimumSize.Width);
|
||||
|
||||
//Determine new height while keeping aspect ratio
|
||||
int newHeight = (int)((newWidth - ExtraPadding.Horizontal - clientSizeConversionWidth) / AspectRatio) + ExtraPadding.Vertical + clientSizeConversionHeight;
|
||||
|
||||
//Apply and move form to recenter
|
||||
Size = new Size(newWidth, newHeight);
|
||||
int deltaX = Size.Width - origSize.Width;
|
||||
int deltaY = Size.Height - origSize.Height;
|
||||
Location = new System.Drawing.Point(Location.X - (deltaX / 2), Location.Y - (deltaY / 2));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the aspect ratio of the form and optionally forces a refresh.
|
||||
/// </summary>
|
||||
/// <param name="aspectRatioSource">Size from which aspect ratio should be computed.</param>
|
||||
/// <param name="forceRefresh">True if the size of the form should be refreshed to match the new aspect ratio.</param>
|
||||
public void SetAspectRatio(Size aspectRatioSource, bool forceRefresh) {
|
||||
AspectRatio = ((double)aspectRatioSource.Width / (double)aspectRatioSource.Height);
|
||||
_keepAspectRatio = true;
|
||||
|
||||
#if DEBUG
|
||||
System.Diagnostics.Trace.WriteLine(string.Format("Setting aspect ratio of {0} (for {1}).", AspectRatio, aspectRatioSource));
|
||||
#endif
|
||||
|
||||
if (forceRefresh) {
|
||||
RefreshAspectRatio();
|
||||
}
|
||||
}
|
||||
|
||||
#region Event overriding
|
||||
|
||||
protected override void OnResizeEnd(EventArgs e) {
|
||||
base.OnResizeEnd(e);
|
||||
|
||||
//Ensure that the ClientSize of the form is always respected
|
||||
//(not ensured by the WM_SIZING message alone because of rounding errors and the chrome space)
|
||||
if (KeepAspectRatio) {
|
||||
var newHeight = (int)Math.Round(((ClientSize.Width - ExtraPadding.Horizontal) / AspectRatio) + ExtraPadding.Vertical);
|
||||
ClientSize = new Size(ClientSize.Width, newHeight);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override WM_SIZING message to restrict resizing.
|
||||
/// Taken from: http://www.vcskicks.com/maintain-aspect-ratio.php
|
||||
/// Improved with code from: http://stoyanoff.info/blog/2010/06/27/resizing-forms-while-keeping-aspect-ratio/
|
||||
/// </summary>
|
||||
protected override void WndProc(ref Message m) {
|
||||
if (KeepAspectRatio && m.Msg == WM.SIZING) {
|
||||
var rc = (Native.NRectangle)Marshal.PtrToStructure(m.LParam, typeof(Native.NRectangle));
|
||||
int res = m.WParam.ToInt32();
|
||||
|
||||
int width = (rc.Right - rc.Left) - clientSizeConversionWidth - ExtraPadding.Horizontal;
|
||||
int height = (rc.Bottom - rc.Top) - clientSizeConversionHeight - ExtraPadding.Vertical;
|
||||
|
||||
if (res == WMSZ.LEFT || res == WMSZ.RIGHT) {
|
||||
//Left or right resize, adjust top and bottom
|
||||
int targetHeight = (int)(width / AspectRatio);
|
||||
int diffHeight = height - targetHeight;
|
||||
|
||||
rc.Top += (int)(diffHeight / 2.0);
|
||||
rc.Bottom = rc.Top + targetHeight + ExtraPadding.Vertical + clientSizeConversionHeight;
|
||||
}
|
||||
else if (res == WMSZ.TOP || res == WMSZ.BOTTOM) {
|
||||
//Up or down resize, adjust left and right
|
||||
int targetWidth = (int)(height * AspectRatio);
|
||||
int diffWidth = width - targetWidth;
|
||||
|
||||
rc.Left += (int)(diffWidth / 2.0);
|
||||
rc.Right = rc.Left + targetWidth + ExtraPadding.Horizontal + clientSizeConversionWidth;
|
||||
}
|
||||
else if (res == WMSZ.RIGHT + WMSZ.BOTTOM || res == WMSZ.LEFT + WMSZ.BOTTOM) {
|
||||
//Lower corner resize, adjust bottom
|
||||
rc.Bottom = rc.Top + (int)(width / AspectRatio) + ExtraPadding.Vertical + clientSizeConversionHeight;
|
||||
}
|
||||
else if (res == WMSZ.LEFT + WMSZ.TOP || res == WMSZ.RIGHT + WMSZ.TOP) {
|
||||
//Upper corner resize, adjust top
|
||||
rc.Top = rc.Bottom - (int)(width / AspectRatio) - ExtraPadding.Vertical - clientSizeConversionHeight;
|
||||
}
|
||||
|
||||
Marshal.StructureToPtr(rc, m.LParam, false);
|
||||
}
|
||||
|
||||
base.WndProc(ref m);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ClientSize/Size conversion helpers
|
||||
|
||||
int clientSizeConversionWidth, clientSizeConversionHeight;
|
||||
|
||||
/// <summary>
|
||||
/// Converts a client size measurement to a window size measurement.
|
||||
/// </summary>
|
||||
/// <param name="clientSize">Size of the window's client area.</param>
|
||||
/// <returns>Size of the whole window.</returns>
|
||||
public Size FromClientSizeToSize(Size clientSize) {
|
||||
return new Size(clientSize.Width + clientSizeConversionWidth, clientSize.Height + clientSizeConversionHeight);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a window size measurement to a client size measurement.
|
||||
/// </summary>
|
||||
/// <param name="size">Size of the whole window.</param>
|
||||
/// <returns>Size of the window's client area.</returns>
|
||||
public Size FromSizeToClientSize(Size size) {
|
||||
return new Size(size.Width - clientSizeConversionWidth, size.Height - clientSizeConversionHeight);
|
||||
}
|
||||
|
||||
protected override void OnShown(EventArgs e) {
|
||||
base.OnShown(e);
|
||||
|
||||
clientSizeConversionWidth = Size.Width - ClientSize.Width;
|
||||
clientSizeConversionHeight = Size.Height - ClientSize.Height;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
}
|
BIN
OnTopReplica/Assets/25.png
Normal file
After Width: | Height: | Size: 639 B |
BIN
OnTopReplica/Assets/arrow_down.png
Normal file
After Width: | Height: | Size: 218 B |
BIN
OnTopReplica/Assets/arrow_up.png
Normal file
After Width: | Height: | Size: 209 B |
BIN
OnTopReplica/Assets/back.png
Normal file
After Width: | Height: | Size: 147 KiB |
BIN
OnTopReplica/Assets/clickforwarding.png
Normal file
After Width: | Height: | Size: 951 B |
BIN
OnTopReplica/Assets/component.png
Normal file
After Width: | Height: | Size: 731 B |
BIN
OnTopReplica/Assets/desktop.png
Normal file
After Width: | Height: | Size: 794 B |
BIN
OnTopReplica/Assets/empty-window.ico
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
OnTopReplica/Assets/flag_czech.png
Normal file
After Width: | Height: | Size: 241 B |
BIN
OnTopReplica/Assets/flag_danish.png
Normal file
After Width: | Height: | Size: 347 B |
BIN
OnTopReplica/Assets/flag_germany.png
Normal file
After Width: | Height: | Size: 202 B |
BIN
OnTopReplica/Assets/flag_ita.png
Normal file
After Width: | Height: | Size: 209 B |
BIN
OnTopReplica/Assets/flag_poland.png
Normal file
After Width: | Height: | Size: 183 B |
BIN
OnTopReplica/Assets/flag_spanish.png
Normal file
After Width: | Height: | Size: 300 B |
BIN
OnTopReplica/Assets/flag_usa.png
Normal file
After Width: | Height: | Size: 355 B |
BIN
OnTopReplica/Assets/flags.pdn
Normal file
BIN
OnTopReplica/Assets/fullscreen.png
Normal file
After Width: | Height: | Size: 396 B |
BIN
OnTopReplica/Assets/groupmode.png
Normal file
After Width: | Height: | Size: 837 B |
BIN
OnTopReplica/Assets/icon-new-red.ico
Normal file
After Width: | Height: | Size: 85 KiB |
BIN
OnTopReplica/Assets/icon-new.ico
Normal file
After Width: | Height: | Size: 85 KiB |
BIN
OnTopReplica/Assets/icon.ico
Normal file
After Width: | Height: | Size: 7.2 KiB |
BIN
OnTopReplica/Assets/icon.png
Normal file
After Width: | Height: | Size: 7.2 KiB |
BIN
OnTopReplica/Assets/list.png
Normal file
After Width: | Height: | Size: 681 B |
BIN
OnTopReplica/Assets/newicon.png
Normal file
After Width: | Height: | Size: 770 B |
BIN
OnTopReplica/Assets/pos_bottomleft.pdn
Normal file
BIN
OnTopReplica/Assets/pos_bottomleft.png
Normal file
After Width: | Height: | Size: 267 B |
BIN
OnTopReplica/Assets/pos_bottomright.png
Normal file
After Width: | Height: | Size: 267 B |
BIN
OnTopReplica/Assets/pos_center.png
Normal file
After Width: | Height: | Size: 231 B |
BIN
OnTopReplica/Assets/pos_null.png
Normal file
After Width: | Height: | Size: 250 B |
BIN
OnTopReplica/Assets/pos_topleft.png
Normal file
After Width: | Height: | Size: 280 B |
BIN
OnTopReplica/Assets/pos_topright.png
Normal file
After Width: | Height: | Size: 278 B |
BIN
OnTopReplica/Assets/reduce.png
Normal file
After Width: | Height: | Size: 259 B |
BIN
OnTopReplica/Assets/regions.png
Normal file
After Width: | Height: | Size: 296 B |
BIN
OnTopReplica/Assets/regions_new.png
Normal file
After Width: | Height: | Size: 207 B |
BIN
OnTopReplica/Assets/screenshot-icon.ico
Normal file
After Width: | Height: | Size: 97 KiB |
BIN
OnTopReplica/Assets/window16.png
Normal file
After Width: | Height: | Size: 862 B |
BIN
OnTopReplica/Assets/window_border16.png
Normal file
After Width: | Height: | Size: 683 B |
BIN
OnTopReplica/Assets/window_multiple.pdn
Normal file
BIN
OnTopReplica/Assets/window_multiple16.ico
Normal file
After Width: | Height: | Size: 894 B |
BIN
OnTopReplica/Assets/window_multiple16.png
Normal file
After Width: | Height: | Size: 1,012 B |
BIN
OnTopReplica/Assets/window_multiple48.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
OnTopReplica/Assets/window_opacity16.png
Normal file
After Width: | Height: | Size: 894 B |
BIN
OnTopReplica/Assets/window_opacity_new.png
Normal file
After Width: | Height: | Size: 810 B |
BIN
OnTopReplica/Assets/window_switch.pdn
Normal file
BIN
OnTopReplica/Assets/window_switch.png
Normal file
After Width: | Height: | Size: 456 B |
BIN
OnTopReplica/Assets/windows.png
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
OnTopReplica/Assets/x-oblique.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
OnTopReplica/Assets/xiao_add.png
Normal file
After Width: | Height: | Size: 753 B |
BIN
OnTopReplica/Assets/xiao_arrow.png
Normal file
After Width: | Height: | Size: 437 B |
BIN
OnTopReplica/Assets/xiao_delete.png
Normal file
After Width: | Height: | Size: 715 B |
BIN
OnTopReplica/Assets/xiao_down.png
Normal file
After Width: | Height: | Size: 761 B |
BIN
OnTopReplica/Assets/xiao_help.png
Normal file
After Width: | Height: | Size: 752 B |
BIN
OnTopReplica/Assets/xiao_ok.png
Normal file
After Width: | Height: | Size: 752 B |
BIN
OnTopReplica/Assets/xiao_up.png
Normal file
After Width: | Height: | Size: 744 B |
BIN
OnTopReplica/Assets/xiao_wrench.png
Normal file
After Width: | Height: | Size: 459 B |
12
OnTopReplica/CREDITS.txt
Normal file
|
@ -0,0 +1,12 @@
|
|||
OnTopReplica credits
|
||||
--------------------
|
||||
|
||||
This application was inspired by Switcher (http://insentient.net) and other DWM based application.
|
||||
|
||||
All Aero controls are part of the open-source WindowsFormsAero (http://windowsformsaero.codeplex.com) library for .NET.
|
||||
|
||||
Some DWM example code has ben taken from user Ookii (http://www.ookii.org) on Channel 9 MSDN.
|
||||
|
||||
The NativeToolstripRenderer class has been taken from asztal.net (http://wp.asztal.net/2007/12/vista-style-menus-in-dotnet).
|
||||
|
||||
Some of the icons used by OnTopReplica have been taken from VistaICO.com and the Xiao icon set.
|
32
OnTopReplica/CloneClickEventArgs.cs
Normal file
|
@ -0,0 +1,32 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace OnTopReplica {
|
||||
/// <summary>
|
||||
/// EventArgs structure for clicks on a cloned window.
|
||||
/// </summary>
|
||||
public class CloneClickEventArgs : EventArgs {
|
||||
|
||||
public Point ClientClickLocation { get; set; }
|
||||
|
||||
public bool IsDoubleClick { get; set; }
|
||||
|
||||
public MouseButtons Buttons { get; set; }
|
||||
|
||||
public CloneClickEventArgs(Point location, MouseButtons buttons) {
|
||||
ClientClickLocation = location;
|
||||
Buttons = buttons;
|
||||
IsDoubleClick = false;
|
||||
}
|
||||
|
||||
public CloneClickEventArgs(Point location, MouseButtons buttons, bool doubleClick) {
|
||||
ClientClickLocation = location;
|
||||
Buttons = buttons;
|
||||
IsDoubleClick = doubleClick;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
14
OnTopReplica/CloseRequestEventArgs.cs
Normal file
|
@ -0,0 +1,14 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
|
||||
namespace OnTopReplica {
|
||||
public class CloseRequestEventArgs : EventArgs {
|
||||
|
||||
public WindowHandle LastWindowHandle { get; set; }
|
||||
|
||||
public Rectangle? LastRegion { get; set; }
|
||||
|
||||
}
|
||||
}
|
70
OnTopReplica/FocusedTextBox.cs
Normal file
|
@ -0,0 +1,70 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using WindowsFormsAero;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace OnTopReplica {
|
||||
|
||||
class FocusedTextBox : System.Windows.Forms.TextBox {
|
||||
|
||||
protected override bool IsInputChar(char charCode) {
|
||||
if (charCode == '\n' || charCode == '\r')
|
||||
return true;
|
||||
|
||||
return base.IsInputChar(charCode);
|
||||
}
|
||||
|
||||
protected override void OnKeyUp(KeyEventArgs e) {
|
||||
if (e.KeyCode == Keys.Return) {
|
||||
if(!string.IsNullOrEmpty(Text))
|
||||
OnConfirmInput();
|
||||
|
||||
e.Handled = true;
|
||||
e.SuppressKeyPress = true;
|
||||
}
|
||||
else if (e.KeyCode == Keys.Escape) {
|
||||
OnAbortInput();
|
||||
|
||||
e.Handled = true;
|
||||
e.SuppressKeyPress = true;
|
||||
}
|
||||
|
||||
//Console.WriteLine("{0} ({1})", e.KeyCode, e.KeyValue);
|
||||
|
||||
base.OnKeyUp(e);
|
||||
}
|
||||
|
||||
//List of characters to ignore on KeyPress events (because they generate bell rings)
|
||||
readonly char[] IgnoreChars = new char[] {
|
||||
(char)27, (char)13
|
||||
};
|
||||
|
||||
protected override void OnKeyPress(KeyPressEventArgs e) {
|
||||
if (IgnoreChars.Contains(e.KeyChar)) {
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
base.OnKeyPress(e);
|
||||
}
|
||||
|
||||
public event EventHandler ConfirmInput;
|
||||
|
||||
protected virtual void OnConfirmInput() {
|
||||
var evt = ConfirmInput;
|
||||
if (evt != null)
|
||||
evt(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
public event EventHandler AbortInput;
|
||||
|
||||
protected virtual void OnAbortInput() {
|
||||
var evt = AbortInput;
|
||||
if (evt != null)
|
||||
evt(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
74
OnTopReplica/GeometryExtensions.cs
Normal file
|
@ -0,0 +1,74 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace OnTopReplica {
|
||||
|
||||
/// <summary>
|
||||
/// Common geometry extension methods.
|
||||
/// </summary>
|
||||
static class GeometryExtensions {
|
||||
|
||||
/// <summary>
|
||||
/// Returns the difference (offset vector) between two points.
|
||||
/// </summary>
|
||||
public static Point Difference(this Point a, Point b) {
|
||||
return new Point(a.X - b.X, a.Y - b.Y);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Expands a size value by a padding distance.
|
||||
/// </summary>
|
||||
public static Size Expand(this Size size, Padding padding) {
|
||||
return new Size(size.Width + padding.Horizontal, size.Height + padding.Vertical);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Expands a size value by a size distance.
|
||||
/// </summary>
|
||||
public static Size Expand(this Size size, Size expandSize) {
|
||||
return new Size(size.Width + expandSize.Width, size.Height + expandSize.Height);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Computes the difference between two size values.
|
||||
/// </summary>
|
||||
public static Size Difference(this Size a, Size b) {
|
||||
return new Size(a.Width - b.Width, a.Height - b.Height);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ensures that the minimum size of a control respects a minimum
|
||||
/// client size area.
|
||||
/// </summary>
|
||||
/// <param name="ctrl">Control whose MinimumSize should be altered.</param>
|
||||
/// <param name="minimumClientSize">Minimum client size value to ensure.</param>
|
||||
public static void EnsureMinimumClientSize(this Control ctrl, Size minimumClientSize) {
|
||||
Size offset = ctrl.Size.Difference(ctrl.ClientSize);
|
||||
ctrl.MinimumSize = minimumClientSize.Expand(offset);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to fit a size structure to another fixed destination size, by maintaining
|
||||
/// the original aspect ratio.
|
||||
/// </summary>
|
||||
public static Size Fit(this Size sourceSize, Size destinationSize) {
|
||||
double sourceRatio = (double)sourceSize.Width / (double)sourceSize.Height;
|
||||
double clientRatio = (double)destinationSize.Width / (double)destinationSize.Height;
|
||||
|
||||
Size ret;
|
||||
if (sourceRatio >= clientRatio) {
|
||||
ret = new Size(destinationSize.Width, (int)((double)destinationSize.Width / sourceRatio));
|
||||
}
|
||||
else {
|
||||
ret = new Size((int)((double)destinationSize.Height * sourceRatio), destinationSize.Height);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
56
OnTopReplica/HotKeyTextBox.cs
Normal file
|
@ -0,0 +1,56 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace OnTopReplica {
|
||||
|
||||
class HotKeyTextBox : TextBox {
|
||||
|
||||
protected override void OnCreateControl() {
|
||||
ReadOnly = true;
|
||||
|
||||
base.OnCreateControl();
|
||||
}
|
||||
|
||||
readonly Keys[] IgnoredKeys = new Keys[] {
|
||||
Keys.ControlKey,
|
||||
Keys.Control,
|
||||
Keys.Alt,
|
||||
Keys.Menu,
|
||||
Keys.ShiftKey,
|
||||
Keys.Shift,
|
||||
Keys.LWin,
|
||||
Keys.RWin
|
||||
};
|
||||
|
||||
readonly Keys[] CancelKeys = new Keys[] {
|
||||
Keys.Back,
|
||||
Keys.Escape
|
||||
};
|
||||
|
||||
protected override void OnKeyUp(KeyEventArgs e) {
|
||||
if (CancelKeys.Contains(e.KeyCode)) {
|
||||
Text = string.Empty;
|
||||
}
|
||||
else if (!IgnoredKeys.Contains(e.KeyCode)) {
|
||||
var sb = new StringBuilder();
|
||||
if (e.Control)
|
||||
sb.Append("[CTRL]+");
|
||||
if (e.Alt)
|
||||
sb.Append("[ALT]+");
|
||||
if (e.Shift)
|
||||
sb.Append("[SHIFT]+");
|
||||
sb.Append(e.KeyCode.ToString());
|
||||
|
||||
Text = sb.ToString();
|
||||
}
|
||||
|
||||
e.Handled = true;
|
||||
base.OnKeyUp(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
15
OnTopReplica/IMessagePumpProcessor.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace OnTopReplica {
|
||||
|
||||
interface IMessagePumpProcessor : IDisposable {
|
||||
|
||||
void Initialize(MainForm form);
|
||||
|
||||
bool Process(ref Message msg);
|
||||
|
||||
}
|
||||
}
|
77
OnTopReplica/ImageComboBox.cs
Normal file
|
@ -0,0 +1,77 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
|
||||
namespace OnTopReplica {
|
||||
class ImageComboBox : ComboBox {
|
||||
|
||||
public ImageComboBox() {
|
||||
DrawMode = DrawMode.OwnerDrawFixed;
|
||||
}
|
||||
|
||||
protected override void OnDrawItem(DrawItemEventArgs ea) {
|
||||
ea.DrawBackground();
|
||||
ea.DrawFocusRectangle();
|
||||
|
||||
if (ea.Index == -1)
|
||||
return;
|
||||
|
||||
Rectangle bounds = ea.Bounds;
|
||||
var foreBrush = new SolidBrush(ea.ForeColor);
|
||||
int textLeftBound = (IconList == null) ? bounds.Left : bounds.Left + IconList.ImageSize.Width;
|
||||
|
||||
var drawObject = Items[ea.Index];
|
||||
if (drawObject is ImageComboBoxItem) {
|
||||
var drawItem = (ImageComboBoxItem)drawObject;
|
||||
|
||||
if (drawItem.ImageListIndex != -1 && IconList != null) {
|
||||
//ea.Graphics.FillRectangle(Brushes.Gray, bounds.Left, bounds.Top, IconList.ImageSize.Width, IconList.ImageSize.Height);
|
||||
ea.Graphics.DrawImage(IconList.Images[drawItem.ImageListIndex], bounds.Left, bounds.Top);
|
||||
}
|
||||
|
||||
ea.Graphics.DrawString(drawItem.Text, ea.Font, foreBrush, textLeftBound, bounds.Top);
|
||||
}
|
||||
else {
|
||||
ea.Graphics.DrawString(drawObject.ToString(), ea.Font, foreBrush, textLeftBound, bounds.Top);
|
||||
}
|
||||
|
||||
base.OnDrawItem(ea);
|
||||
}
|
||||
|
||||
public ImageList IconList { get; set; }
|
||||
|
||||
}
|
||||
|
||||
class ImageComboBoxItem {
|
||||
|
||||
public ImageComboBoxItem() {
|
||||
Text = "";
|
||||
ImageListIndex = -1;
|
||||
}
|
||||
|
||||
public ImageComboBoxItem(string text) {
|
||||
if (text == null)
|
||||
throw new ArgumentNullException();
|
||||
|
||||
Text = text;
|
||||
ImageListIndex = -1;
|
||||
}
|
||||
|
||||
public ImageComboBoxItem(string text, int imageListIndex) {
|
||||
if (text == null)
|
||||
throw new ArgumentNullException();
|
||||
|
||||
Text = text;
|
||||
ImageListIndex = imageListIndex;
|
||||
}
|
||||
|
||||
public string Text { get; private set; }
|
||||
|
||||
public int ImageListIndex { get; private set; }
|
||||
|
||||
public object Tag { get; set; }
|
||||
|
||||
}
|
||||
}
|
21
OnTopReplica/LICENSE.txt
Normal file
|
@ -0,0 +1,21 @@
|
|||
Microsoft Reciprocal License (Ms-RL)
|
||||
|
||||
This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software.
|
||||
|
||||
1. Definitions
|
||||
The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law.
|
||||
A "contribution" is the original software, or any additions or changes to the software.
|
||||
A "contributor" is any person that distributes its contribution under this license.
|
||||
"Licensed patents" are a contributor's patent claims that read directly on its contribution.
|
||||
|
||||
2. Grant of Rights
|
||||
(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.
|
||||
(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.
|
||||
|
||||
3. Conditions and Limitations
|
||||
(A) Reciprocal Grants- For any file you distribute that contains code from the software (in source code or binary format), you must provide recipients the source code to that file along with a copy of this license, which license will govern that file. You may license other files that are entirely your own work and do not contain code from the software under any terms you choose.
|
||||
(B) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks.
|
||||
(C) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically.
|
||||
(D) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software.
|
||||
(E) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.
|
||||
(F) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.
|
560
OnTopReplica/MainForm.Designer.cs
generated
Normal file
|
@ -0,0 +1,560 @@
|
|||
namespace OnTopReplica
|
||||
{
|
||||
partial class MainForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing) {
|
||||
if (disposing && (components != null)) {
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent() {
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
|
||||
this.menuContext = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.menuContextWindows = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.menuWindows = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.noneToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.fullSelectWindowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.switchToWindowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.selectRegionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.advancedToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.clickForwardingToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.clickThroughToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.groupSwitchModeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.restoreLastClonedWindowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.menuContextOpacity = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.menuOpacity = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem4 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.resizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.menuResize = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.doubleToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.fitToWindowToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.halfToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.quarterToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.fullscreenToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.restorePositionAndSizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.dockToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.disabledToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.topLeftToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.topRightToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.centerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.bottomLeftToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.bottomRightToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.chromeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.reduceToIconToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.settingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.menuContextClose = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.fullOpacityToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.menuFullscreenContext = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.enableClickthroughToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.fullExitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.menuContext.SuspendLayout();
|
||||
this.menuWindows.SuspendLayout();
|
||||
this.menuOpacity.SuspendLayout();
|
||||
this.menuResize.SuspendLayout();
|
||||
this.menuFullscreenContext.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// menuContext
|
||||
//
|
||||
this.menuContext.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.menuContextWindows,
|
||||
this.switchToWindowToolStripMenuItem,
|
||||
this.selectRegionToolStripMenuItem,
|
||||
this.advancedToolStripMenuItem,
|
||||
this.menuContextOpacity,
|
||||
this.resizeToolStripMenuItem,
|
||||
this.dockToolStripMenuItem,
|
||||
this.chromeToolStripMenuItem,
|
||||
this.reduceToIconToolStripMenuItem,
|
||||
this.toolStripSeparator1,
|
||||
this.settingsToolStripMenuItem,
|
||||
this.aboutToolStripMenuItem,
|
||||
this.menuContextClose});
|
||||
this.menuContext.Name = "menuContext";
|
||||
this.menuContext.Size = new System.Drawing.Size(187, 296);
|
||||
this.menuContext.Opening += new System.ComponentModel.CancelEventHandler(this.Menu_opening);
|
||||
//
|
||||
// menuContextWindows
|
||||
//
|
||||
this.menuContextWindows.DropDown = this.menuWindows;
|
||||
this.menuContextWindows.Image = global::OnTopReplica.Properties.Resources.list;
|
||||
this.menuContextWindows.Name = "menuContextWindows";
|
||||
this.menuContextWindows.Size = new System.Drawing.Size(186, 22);
|
||||
this.menuContextWindows.Text = global::OnTopReplica.Strings.MenuWindows;
|
||||
this.menuContextWindows.ToolTipText = global::OnTopReplica.Strings.MenuWindowsTT;
|
||||
//
|
||||
// menuWindows
|
||||
//
|
||||
this.menuWindows.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.noneToolStripMenuItem});
|
||||
this.menuWindows.Name = "menuWindows";
|
||||
this.menuWindows.OwnerItem = this.menuContextWindows;
|
||||
this.menuWindows.Size = new System.Drawing.Size(118, 26);
|
||||
//
|
||||
// noneToolStripMenuItem
|
||||
//
|
||||
this.noneToolStripMenuItem.Name = "noneToolStripMenuItem";
|
||||
this.noneToolStripMenuItem.Size = new System.Drawing.Size(117, 22);
|
||||
this.noneToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuWindowsNone;
|
||||
//
|
||||
// fullSelectWindowToolStripMenuItem
|
||||
//
|
||||
this.fullSelectWindowToolStripMenuItem.DropDown = this.menuWindows;
|
||||
this.fullSelectWindowToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.list;
|
||||
this.fullSelectWindowToolStripMenuItem.Name = "fullSelectWindowToolStripMenuItem";
|
||||
this.fullSelectWindowToolStripMenuItem.Size = new System.Drawing.Size(189, 22);
|
||||
this.fullSelectWindowToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuWindows;
|
||||
this.fullSelectWindowToolStripMenuItem.ToolTipText = global::OnTopReplica.Strings.MenuWindowsTT;
|
||||
//
|
||||
// switchToWindowToolStripMenuItem
|
||||
//
|
||||
this.switchToWindowToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.xiao_arrow;
|
||||
this.switchToWindowToolStripMenuItem.Name = "switchToWindowToolStripMenuItem";
|
||||
this.switchToWindowToolStripMenuItem.Size = new System.Drawing.Size(186, 22);
|
||||
this.switchToWindowToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuSwitch;
|
||||
this.switchToWindowToolStripMenuItem.ToolTipText = global::OnTopReplica.Strings.MenuSwitchTT;
|
||||
this.switchToWindowToolStripMenuItem.Click += new System.EventHandler(this.Menu_Switch_click);
|
||||
//
|
||||
// selectRegionToolStripMenuItem
|
||||
//
|
||||
this.selectRegionToolStripMenuItem.Enabled = false;
|
||||
this.selectRegionToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.regions;
|
||||
this.selectRegionToolStripMenuItem.Name = "selectRegionToolStripMenuItem";
|
||||
this.selectRegionToolStripMenuItem.Size = new System.Drawing.Size(186, 22);
|
||||
this.selectRegionToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuRegion;
|
||||
this.selectRegionToolStripMenuItem.ToolTipText = global::OnTopReplica.Strings.MenuRegionTT;
|
||||
this.selectRegionToolStripMenuItem.Click += new System.EventHandler(this.Menu_Region_click);
|
||||
//
|
||||
// advancedToolStripMenuItem
|
||||
//
|
||||
this.advancedToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.clickForwardingToolStripMenuItem,
|
||||
this.clickThroughToolStripMenuItem,
|
||||
this.groupSwitchModeToolStripMenuItem,
|
||||
this.restoreLastClonedWindowToolStripMenuItem});
|
||||
this.advancedToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.xiao_wrench;
|
||||
this.advancedToolStripMenuItem.Name = "advancedToolStripMenuItem";
|
||||
this.advancedToolStripMenuItem.Size = new System.Drawing.Size(186, 22);
|
||||
this.advancedToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuAdvanced;
|
||||
this.advancedToolStripMenuItem.DropDownOpening += new System.EventHandler(this.Menu_Advanced_opening);
|
||||
//
|
||||
// clickForwardingToolStripMenuItem
|
||||
//
|
||||
this.clickForwardingToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.clickforwarding;
|
||||
this.clickForwardingToolStripMenuItem.Name = "clickForwardingToolStripMenuItem";
|
||||
this.clickForwardingToolStripMenuItem.Size = new System.Drawing.Size(218, 22);
|
||||
this.clickForwardingToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuClickForwarding;
|
||||
this.clickForwardingToolStripMenuItem.ToolTipText = global::OnTopReplica.Strings.MenuClickForwardingTT;
|
||||
this.clickForwardingToolStripMenuItem.Click += new System.EventHandler(this.Menu_ClickForwarding_click);
|
||||
//
|
||||
// clickThroughToolStripMenuItem
|
||||
//
|
||||
this.clickThroughToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.window_opacity;
|
||||
this.clickThroughToolStripMenuItem.Name = "clickThroughToolStripMenuItem";
|
||||
this.clickThroughToolStripMenuItem.Size = new System.Drawing.Size(218, 22);
|
||||
this.clickThroughToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuClickThrough;
|
||||
this.clickThroughToolStripMenuItem.ToolTipText = global::OnTopReplica.Strings.MenuClickThroughTT;
|
||||
this.clickThroughToolStripMenuItem.Click += new System.EventHandler(this.Menu_ClickThrough_click);
|
||||
//
|
||||
// groupSwitchModeToolStripMenuItem
|
||||
//
|
||||
this.groupSwitchModeToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.groupmode;
|
||||
this.groupSwitchModeToolStripMenuItem.Name = "groupSwitchModeToolStripMenuItem";
|
||||
this.groupSwitchModeToolStripMenuItem.Size = new System.Drawing.Size(218, 22);
|
||||
this.groupSwitchModeToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuGroupSwitch;
|
||||
this.groupSwitchModeToolStripMenuItem.ToolTipText = global::OnTopReplica.Strings.MenuGroupSwitchTT;
|
||||
this.groupSwitchModeToolStripMenuItem.Click += new System.EventHandler(this.Menu_GroupSwitchMode_click);
|
||||
//
|
||||
// restoreLastClonedWindowToolStripMenuItem
|
||||
//
|
||||
this.restoreLastClonedWindowToolStripMenuItem.Name = "restoreLastClonedWindowToolStripMenuItem";
|
||||
this.restoreLastClonedWindowToolStripMenuItem.Size = new System.Drawing.Size(218, 22);
|
||||
this.restoreLastClonedWindowToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuRestoreLast;
|
||||
this.restoreLastClonedWindowToolStripMenuItem.ToolTipText = global::OnTopReplica.Strings.MenuRestoreLastTT;
|
||||
this.restoreLastClonedWindowToolStripMenuItem.Click += new System.EventHandler(this.Menu_RestoreLastWindow_click);
|
||||
//
|
||||
// menuContextOpacity
|
||||
//
|
||||
this.menuContextOpacity.DropDown = this.menuOpacity;
|
||||
this.menuContextOpacity.Image = global::OnTopReplica.Properties.Resources.window_opacity;
|
||||
this.menuContextOpacity.Name = "menuContextOpacity";
|
||||
this.menuContextOpacity.Size = new System.Drawing.Size(186, 22);
|
||||
this.menuContextOpacity.Text = global::OnTopReplica.Strings.MenuOpacity;
|
||||
//
|
||||
// menuOpacity
|
||||
//
|
||||
this.menuOpacity.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.toolStripMenuItem1,
|
||||
this.toolStripMenuItem2,
|
||||
this.toolStripMenuItem3,
|
||||
this.toolStripMenuItem4});
|
||||
this.menuOpacity.Name = "menuOpacity";
|
||||
this.menuOpacity.OwnerItem = this.fullOpacityToolStripMenuItem;
|
||||
this.menuOpacity.ShowCheckMargin = true;
|
||||
this.menuOpacity.ShowImageMargin = false;
|
||||
this.menuOpacity.Size = new System.Drawing.Size(154, 92);
|
||||
this.menuOpacity.Opening += new System.ComponentModel.CancelEventHandler(this.Menu_Opacity_opening);
|
||||
//
|
||||
// toolStripMenuItem1
|
||||
//
|
||||
this.toolStripMenuItem1.Checked = true;
|
||||
this.toolStripMenuItem1.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
|
||||
this.toolStripMenuItem1.Size = new System.Drawing.Size(153, 22);
|
||||
this.toolStripMenuItem1.Tag = 1D;
|
||||
this.toolStripMenuItem1.Text = global::OnTopReplica.Strings.MenuOp100;
|
||||
this.toolStripMenuItem1.ToolTipText = global::OnTopReplica.Strings.MenuOp100TT;
|
||||
this.toolStripMenuItem1.Click += new System.EventHandler(this.Menu_Opacity_click);
|
||||
//
|
||||
// toolStripMenuItem2
|
||||
//
|
||||
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
|
||||
this.toolStripMenuItem2.Size = new System.Drawing.Size(153, 22);
|
||||
this.toolStripMenuItem2.Tag = 0.75D;
|
||||
this.toolStripMenuItem2.Text = global::OnTopReplica.Strings.MenuOp75;
|
||||
this.toolStripMenuItem2.ToolTipText = global::OnTopReplica.Strings.MenuOp75TT;
|
||||
this.toolStripMenuItem2.Click += new System.EventHandler(this.Menu_Opacity_click);
|
||||
//
|
||||
// toolStripMenuItem3
|
||||
//
|
||||
this.toolStripMenuItem3.Name = "toolStripMenuItem3";
|
||||
this.toolStripMenuItem3.Size = new System.Drawing.Size(153, 22);
|
||||
this.toolStripMenuItem3.Tag = 0.5D;
|
||||
this.toolStripMenuItem3.Text = global::OnTopReplica.Strings.MenuOp50;
|
||||
this.toolStripMenuItem3.ToolTipText = global::OnTopReplica.Strings.MenuOp50TT;
|
||||
this.toolStripMenuItem3.Click += new System.EventHandler(this.Menu_Opacity_click);
|
||||
//
|
||||
// toolStripMenuItem4
|
||||
//
|
||||
this.toolStripMenuItem4.Name = "toolStripMenuItem4";
|
||||
this.toolStripMenuItem4.Size = new System.Drawing.Size(153, 22);
|
||||
this.toolStripMenuItem4.Tag = 0.25D;
|
||||
this.toolStripMenuItem4.Text = global::OnTopReplica.Strings.MenuOp25;
|
||||
this.toolStripMenuItem4.ToolTipText = global::OnTopReplica.Strings.MenuOp25TT;
|
||||
this.toolStripMenuItem4.Click += new System.EventHandler(this.Menu_Opacity_click);
|
||||
//
|
||||
// resizeToolStripMenuItem
|
||||
//
|
||||
this.resizeToolStripMenuItem.DropDown = this.menuResize;
|
||||
this.resizeToolStripMenuItem.Enabled = false;
|
||||
this.resizeToolStripMenuItem.Name = "resizeToolStripMenuItem";
|
||||
this.resizeToolStripMenuItem.Size = new System.Drawing.Size(186, 22);
|
||||
this.resizeToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuResize;
|
||||
//
|
||||
// menuResize
|
||||
//
|
||||
this.menuResize.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.doubleToolStripMenuItem1,
|
||||
this.fitToWindowToolStripMenuItem1,
|
||||
this.halfToolStripMenuItem1,
|
||||
this.quarterToolStripMenuItem1,
|
||||
this.toolStripSeparator3,
|
||||
this.fullscreenToolStripMenuItem1,
|
||||
this.toolStripSeparator2,
|
||||
this.restorePositionAndSizeToolStripMenuItem});
|
||||
this.menuResize.Name = "menuResize";
|
||||
this.menuResize.OwnerItem = this.resizeToolStripMenuItem;
|
||||
this.menuResize.Size = new System.Drawing.Size(218, 170);
|
||||
this.menuResize.Opening += new System.ComponentModel.CancelEventHandler(this.Menu_Resize_opening);
|
||||
//
|
||||
// doubleToolStripMenuItem1
|
||||
//
|
||||
this.doubleToolStripMenuItem1.Name = "doubleToolStripMenuItem1";
|
||||
this.doubleToolStripMenuItem1.Size = new System.Drawing.Size(217, 22);
|
||||
this.doubleToolStripMenuItem1.Text = global::OnTopReplica.Strings.MenuFitDouble;
|
||||
this.doubleToolStripMenuItem1.Click += new System.EventHandler(this.Menu_Resize_Double);
|
||||
//
|
||||
// fitToWindowToolStripMenuItem1
|
||||
//
|
||||
this.fitToWindowToolStripMenuItem1.Name = "fitToWindowToolStripMenuItem1";
|
||||
this.fitToWindowToolStripMenuItem1.Size = new System.Drawing.Size(217, 22);
|
||||
this.fitToWindowToolStripMenuItem1.Text = global::OnTopReplica.Strings.MenuFitOriginal;
|
||||
this.fitToWindowToolStripMenuItem1.Click += new System.EventHandler(this.Menu_Resize_FitToWindow);
|
||||
//
|
||||
// halfToolStripMenuItem1
|
||||
//
|
||||
this.halfToolStripMenuItem1.Name = "halfToolStripMenuItem1";
|
||||
this.halfToolStripMenuItem1.Size = new System.Drawing.Size(217, 22);
|
||||
this.halfToolStripMenuItem1.Text = global::OnTopReplica.Strings.MenuFitHalf;
|
||||
this.halfToolStripMenuItem1.Click += new System.EventHandler(this.Menu_Resize_Half);
|
||||
//
|
||||
// quarterToolStripMenuItem1
|
||||
//
|
||||
this.quarterToolStripMenuItem1.Name = "quarterToolStripMenuItem1";
|
||||
this.quarterToolStripMenuItem1.Size = new System.Drawing.Size(217, 22);
|
||||
this.quarterToolStripMenuItem1.Text = global::OnTopReplica.Strings.MenuFitQuarter;
|
||||
this.quarterToolStripMenuItem1.Click += new System.EventHandler(this.Menu_Resize_Quarter);
|
||||
//
|
||||
// toolStripSeparator3
|
||||
//
|
||||
this.toolStripSeparator3.Name = "toolStripSeparator3";
|
||||
this.toolStripSeparator3.Size = new System.Drawing.Size(214, 6);
|
||||
//
|
||||
// fullscreenToolStripMenuItem1
|
||||
//
|
||||
this.fullscreenToolStripMenuItem1.Image = global::OnTopReplica.Properties.Resources.fullscreen;
|
||||
this.fullscreenToolStripMenuItem1.Name = "fullscreenToolStripMenuItem1";
|
||||
this.fullscreenToolStripMenuItem1.Size = new System.Drawing.Size(217, 22);
|
||||
this.fullscreenToolStripMenuItem1.Text = global::OnTopReplica.Strings.MenuFitFullscreen;
|
||||
this.fullscreenToolStripMenuItem1.Click += new System.EventHandler(this.Menu_Resize_Fullscreen);
|
||||
//
|
||||
// toolStripSeparator2
|
||||
//
|
||||
this.toolStripSeparator2.Name = "toolStripSeparator2";
|
||||
this.toolStripSeparator2.Size = new System.Drawing.Size(214, 6);
|
||||
//
|
||||
// restorePositionAndSizeToolStripMenuItem
|
||||
//
|
||||
this.restorePositionAndSizeToolStripMenuItem.Name = "restorePositionAndSizeToolStripMenuItem";
|
||||
this.restorePositionAndSizeToolStripMenuItem.Size = new System.Drawing.Size(217, 22);
|
||||
this.restorePositionAndSizeToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuRecall;
|
||||
this.restorePositionAndSizeToolStripMenuItem.ToolTipText = global::OnTopReplica.Strings.MenuRecallTT;
|
||||
this.restorePositionAndSizeToolStripMenuItem.Click += new System.EventHandler(this.Menu_Resize_RecallPosition_click);
|
||||
//
|
||||
// dockToolStripMenuItem
|
||||
//
|
||||
this.dockToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.disabledToolStripMenuItem,
|
||||
this.topLeftToolStripMenuItem,
|
||||
this.topRightToolStripMenuItem,
|
||||
this.centerToolStripMenuItem,
|
||||
this.bottomLeftToolStripMenuItem,
|
||||
this.bottomRightToolStripMenuItem});
|
||||
this.dockToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.pos_null;
|
||||
this.dockToolStripMenuItem.Name = "dockToolStripMenuItem";
|
||||
this.dockToolStripMenuItem.Size = new System.Drawing.Size(186, 22);
|
||||
this.dockToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuPosition;
|
||||
this.dockToolStripMenuItem.ToolTipText = global::OnTopReplica.Strings.MenuPositionTT;
|
||||
this.dockToolStripMenuItem.DropDownOpening += new System.EventHandler(this.Menu_Position_Opening);
|
||||
//
|
||||
// disabledToolStripMenuItem
|
||||
//
|
||||
this.disabledToolStripMenuItem.Checked = true;
|
||||
this.disabledToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.disabledToolStripMenuItem.Name = "disabledToolStripMenuItem";
|
||||
this.disabledToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
|
||||
this.disabledToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuPosDisabled;
|
||||
this.disabledToolStripMenuItem.Click += new System.EventHandler(this.Menu_Position_Disable);
|
||||
//
|
||||
// topLeftToolStripMenuItem
|
||||
//
|
||||
this.topLeftToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.pos_topleft;
|
||||
this.topLeftToolStripMenuItem.Name = "topLeftToolStripMenuItem";
|
||||
this.topLeftToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
|
||||
this.topLeftToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuPosTopLeft;
|
||||
this.topLeftToolStripMenuItem.Click += new System.EventHandler(this.Menu_Position_TopLeft);
|
||||
//
|
||||
// topRightToolStripMenuItem
|
||||
//
|
||||
this.topRightToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.pos_topright;
|
||||
this.topRightToolStripMenuItem.Name = "topRightToolStripMenuItem";
|
||||
this.topRightToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
|
||||
this.topRightToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuPosTopRight;
|
||||
this.topRightToolStripMenuItem.Click += new System.EventHandler(this.Menu_Position_TopRight);
|
||||
//
|
||||
// centerToolStripMenuItem
|
||||
//
|
||||
this.centerToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.pos_center;
|
||||
this.centerToolStripMenuItem.Name = "centerToolStripMenuItem";
|
||||
this.centerToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
|
||||
this.centerToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuPosCenter;
|
||||
this.centerToolStripMenuItem.Click += new System.EventHandler(this.Menu_Position_Center);
|
||||
//
|
||||
// bottomLeftToolStripMenuItem
|
||||
//
|
||||
this.bottomLeftToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.pos_bottomleft;
|
||||
this.bottomLeftToolStripMenuItem.Name = "bottomLeftToolStripMenuItem";
|
||||
this.bottomLeftToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
|
||||
this.bottomLeftToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuPosBottomLeft;
|
||||
this.bottomLeftToolStripMenuItem.Click += new System.EventHandler(this.Menu_Position_BottomLeft);
|
||||
//
|
||||
// bottomRightToolStripMenuItem
|
||||
//
|
||||
this.bottomRightToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.pos_bottomright;
|
||||
this.bottomRightToolStripMenuItem.Name = "bottomRightToolStripMenuItem";
|
||||
this.bottomRightToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
|
||||
this.bottomRightToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuPosBottomRight;
|
||||
this.bottomRightToolStripMenuItem.Click += new System.EventHandler(this.Menu_Position_BottomRight);
|
||||
//
|
||||
// chromeToolStripMenuItem
|
||||
//
|
||||
this.chromeToolStripMenuItem.Name = "chromeToolStripMenuItem";
|
||||
this.chromeToolStripMenuItem.Size = new System.Drawing.Size(186, 22);
|
||||
this.chromeToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuChrome;
|
||||
this.chromeToolStripMenuItem.ToolTipText = global::OnTopReplica.Strings.MenuChromeTT;
|
||||
this.chromeToolStripMenuItem.Click += new System.EventHandler(this.Menu_Chrome_click);
|
||||
//
|
||||
// reduceToIconToolStripMenuItem
|
||||
//
|
||||
this.reduceToIconToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.reduce;
|
||||
this.reduceToIconToolStripMenuItem.Name = "reduceToIconToolStripMenuItem";
|
||||
this.reduceToIconToolStripMenuItem.Size = new System.Drawing.Size(186, 22);
|
||||
this.reduceToIconToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuReduce;
|
||||
this.reduceToIconToolStripMenuItem.ToolTipText = global::OnTopReplica.Strings.MenuReduceTT;
|
||||
this.reduceToIconToolStripMenuItem.Click += new System.EventHandler(this.Menu_Reduce_click);
|
||||
//
|
||||
// toolStripSeparator1
|
||||
//
|
||||
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
||||
this.toolStripSeparator1.Size = new System.Drawing.Size(183, 6);
|
||||
//
|
||||
// settingsToolStripMenuItem
|
||||
//
|
||||
this.settingsToolStripMenuItem.Name = "settingsToolStripMenuItem";
|
||||
this.settingsToolStripMenuItem.Size = new System.Drawing.Size(186, 22);
|
||||
this.settingsToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuSettings;
|
||||
this.settingsToolStripMenuItem.ToolTipText = global::OnTopReplica.Strings.MenuSettingsTT;
|
||||
this.settingsToolStripMenuItem.Click += new System.EventHandler(this.Menu_Settings_click);
|
||||
//
|
||||
// aboutToolStripMenuItem
|
||||
//
|
||||
this.aboutToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.xiao_help;
|
||||
this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem";
|
||||
this.aboutToolStripMenuItem.Size = new System.Drawing.Size(186, 22);
|
||||
this.aboutToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuAbout;
|
||||
this.aboutToolStripMenuItem.ToolTipText = global::OnTopReplica.Strings.MenuAboutTT;
|
||||
this.aboutToolStripMenuItem.Click += new System.EventHandler(this.Menu_About_click);
|
||||
//
|
||||
// menuContextClose
|
||||
//
|
||||
this.menuContextClose.Image = global::OnTopReplica.Properties.Resources.close_new;
|
||||
this.menuContextClose.Name = "menuContextClose";
|
||||
this.menuContextClose.Size = new System.Drawing.Size(186, 22);
|
||||
this.menuContextClose.Text = global::OnTopReplica.Strings.MenuClose;
|
||||
this.menuContextClose.Click += new System.EventHandler(this.Menu_Close_click);
|
||||
//
|
||||
// fullOpacityToolStripMenuItem
|
||||
//
|
||||
this.fullOpacityToolStripMenuItem.DropDown = this.menuOpacity;
|
||||
this.fullOpacityToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.window_opacity;
|
||||
this.fullOpacityToolStripMenuItem.Name = "fullOpacityToolStripMenuItem";
|
||||
this.fullOpacityToolStripMenuItem.Size = new System.Drawing.Size(189, 22);
|
||||
this.fullOpacityToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuOpacity;
|
||||
//
|
||||
// menuFullscreenContext
|
||||
//
|
||||
this.menuFullscreenContext.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.fullSelectWindowToolStripMenuItem,
|
||||
this.fullOpacityToolStripMenuItem,
|
||||
this.enableClickthroughToolStripMenuItem,
|
||||
this.fullExitToolStripMenuItem});
|
||||
this.menuFullscreenContext.Name = "menuFullscreenContext";
|
||||
this.menuFullscreenContext.Size = new System.Drawing.Size(190, 92);
|
||||
//
|
||||
// enableClickthroughToolStripMenuItem
|
||||
//
|
||||
this.enableClickthroughToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.clickforwarding;
|
||||
this.enableClickthroughToolStripMenuItem.Name = "enableClickthroughToolStripMenuItem";
|
||||
this.enableClickthroughToolStripMenuItem.Size = new System.Drawing.Size(189, 22);
|
||||
this.enableClickthroughToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuClickThrough;
|
||||
this.enableClickthroughToolStripMenuItem.ToolTipText = global::OnTopReplica.Strings.MenuClickThroughTT;
|
||||
this.enableClickthroughToolStripMenuItem.Click += new System.EventHandler(this.Menu_ClickThrough_click);
|
||||
//
|
||||
// fullExitToolStripMenuItem
|
||||
//
|
||||
this.fullExitToolStripMenuItem.Image = global::OnTopReplica.Properties.Resources.close_new;
|
||||
this.fullExitToolStripMenuItem.Name = "fullExitToolStripMenuItem";
|
||||
this.fullExitToolStripMenuItem.Size = new System.Drawing.Size(189, 22);
|
||||
this.fullExitToolStripMenuItem.Text = global::OnTopReplica.Strings.MenuQuitFullscreen;
|
||||
this.fullExitToolStripMenuItem.Click += new System.EventHandler(this.Menu_Fullscreen_ExitFullscreen_click);
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.ClientSize = new System.Drawing.Size(318, 226);
|
||||
this.ControlBox = false;
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
|
||||
this.HideCaption = true;
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.MinimumSize = new System.Drawing.Size(44, 44);
|
||||
this.Name = "MainForm";
|
||||
this.Text = "OnTopReplica";
|
||||
this.TopMost = true;
|
||||
this.menuContext.ResumeLayout(false);
|
||||
this.menuWindows.ResumeLayout(false);
|
||||
this.menuOpacity.ResumeLayout(false);
|
||||
this.menuResize.ResumeLayout(false);
|
||||
this.menuFullscreenContext.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.ContextMenuStrip menuContext;
|
||||
private System.Windows.Forms.ToolStripMenuItem menuContextWindows;
|
||||
private System.Windows.Forms.ToolStripMenuItem menuContextClose;
|
||||
private System.Windows.Forms.ContextMenuStrip menuWindows;
|
||||
private System.Windows.Forms.ToolStripMenuItem menuContextOpacity;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
|
||||
private System.Windows.Forms.ContextMenuStrip menuOpacity;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem2;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem3;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem4;
|
||||
private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem reduceToIconToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem selectRegionToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem resizeToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem noneToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem switchToWindowToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem dockToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem topLeftToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem topRightToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem bottomLeftToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem bottomRightToolStripMenuItem;
|
||||
private System.Windows.Forms.ContextMenuStrip menuResize;
|
||||
private System.Windows.Forms.ToolStripMenuItem doubleToolStripMenuItem1;
|
||||
private System.Windows.Forms.ToolStripMenuItem fitToWindowToolStripMenuItem1;
|
||||
private System.Windows.Forms.ToolStripMenuItem halfToolStripMenuItem1;
|
||||
private System.Windows.Forms.ToolStripMenuItem quarterToolStripMenuItem1;
|
||||
private System.Windows.Forms.ToolStripMenuItem fullscreenToolStripMenuItem1;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
|
||||
private System.Windows.Forms.ToolStripMenuItem chromeToolStripMenuItem;
|
||||
private System.Windows.Forms.ContextMenuStrip menuFullscreenContext;
|
||||
private System.Windows.Forms.ToolStripMenuItem fullSelectWindowToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem fullOpacityToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem fullExitToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem advancedToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem clickForwardingToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem clickThroughToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem groupSwitchModeToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem enableClickthroughToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem centerToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem disabledToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
|
||||
private System.Windows.Forms.ToolStripMenuItem restorePositionAndSizeToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem restoreLastClonedWindowToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem settingsToolStripMenuItem;
|
||||
}
|
||||
}
|
||||
|
474
OnTopReplica/MainForm.cs
Normal file
|
@ -0,0 +1,474 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using OnTopReplica.Native;
|
||||
using OnTopReplica.Properties;
|
||||
using OnTopReplica.StartupOptions;
|
||||
using OnTopReplica.Update;
|
||||
using OnTopReplica.WindowSeekers;
|
||||
using WindowsFormsAero.Dwm;
|
||||
using WindowsFormsAero.TaskDialog;
|
||||
|
||||
namespace OnTopReplica {
|
||||
|
||||
partial class MainForm : AspectRatioForm {
|
||||
|
||||
//GUI elements
|
||||
ThumbnailPanel _thumbnailPanel;
|
||||
|
||||
//Managers
|
||||
MessagePumpManager _msgPumpManager = new MessagePumpManager();
|
||||
WindowListMenuManager _windowListManager;
|
||||
|
||||
Options _startupOptions;
|
||||
|
||||
public MainForm(Options startupOptions) {
|
||||
_startupOptions = startupOptions;
|
||||
|
||||
//WinForms init pass
|
||||
InitializeComponent();
|
||||
|
||||
//Store default values
|
||||
DefaultNonClickTransparencyKey = this.TransparencyKey;
|
||||
DefaultBorderStyle = this.FormBorderStyle;
|
||||
|
||||
//Thumbnail panel
|
||||
_thumbnailPanel = new ThumbnailPanel {
|
||||
Location = Point.Empty,
|
||||
Dock = DockStyle.Fill
|
||||
};
|
||||
_thumbnailPanel.CloneClick += new EventHandler<CloneClickEventArgs>(Thumbnail_CloneClick);
|
||||
Controls.Add(_thumbnailPanel);
|
||||
|
||||
//Set native renderer on context menus
|
||||
Asztal.Szótár.NativeToolStripRenderer.SetToolStripRenderer(
|
||||
menuContext, menuWindows, menuOpacity, menuResize, menuFullscreenContext
|
||||
);
|
||||
|
||||
//Set to Key event preview
|
||||
this.KeyPreview = true;
|
||||
}
|
||||
|
||||
#region Event override
|
||||
|
||||
protected override void OnHandleCreated(EventArgs e){
|
||||
base.OnHandleCreated(e);
|
||||
|
||||
//Window init
|
||||
KeepAspectRatio = false;
|
||||
GlassEnabled = true;
|
||||
GlassMargins = new Margins(-1);
|
||||
|
||||
//Managers
|
||||
_msgPumpManager.Initialize(this);
|
||||
_windowListManager = new WindowListMenuManager(this, menuWindows);
|
||||
_windowListManager.ParentMenus = new System.Windows.Forms.ContextMenuStrip[] {
|
||||
menuContext, menuFullscreenContext
|
||||
};
|
||||
|
||||
//Platform specific form initialization
|
||||
Program.Platform.PostHandleFormInit(this);
|
||||
}
|
||||
|
||||
protected override void OnShown(EventArgs e) {
|
||||
base.OnShown(e);
|
||||
|
||||
//Apply startup options
|
||||
_startupOptions.Apply(this);
|
||||
}
|
||||
|
||||
protected override void OnClosing(CancelEventArgs e) {
|
||||
//Store last thumbnail, if any
|
||||
if (_thumbnailPanel.IsShowingThumbnail && CurrentThumbnailWindowHandle != null) {
|
||||
Settings.Default.RestoreLastWindowTitle = CurrentThumbnailWindowHandle.Title;
|
||||
Settings.Default.RestoreLastWindowHwnd = CurrentThumbnailWindowHandle.Handle.ToInt64();
|
||||
Settings.Default.RestoreLastWindowClass = CurrentThumbnailWindowHandle.Class;
|
||||
}
|
||||
else {
|
||||
Settings.Default.RestoreLastWindowTitle = string.Empty;
|
||||
Settings.Default.RestoreLastWindowHwnd = 0;
|
||||
Settings.Default.RestoreLastWindowClass = string.Empty;
|
||||
}
|
||||
|
||||
_msgPumpManager.Dispose();
|
||||
Program.Platform.CloseForm(this);
|
||||
|
||||
base.OnClosing(e);
|
||||
}
|
||||
|
||||
protected override void OnMove(EventArgs e) {
|
||||
base.OnMove(e);
|
||||
|
||||
AdjustSidePanelLocation();
|
||||
}
|
||||
|
||||
protected override void OnResizeEnd(EventArgs e) {
|
||||
base.OnResizeEnd(e);
|
||||
|
||||
RefreshScreenLock();
|
||||
}
|
||||
|
||||
protected override void OnActivated(EventArgs e) {
|
||||
base.OnActivated(e);
|
||||
|
||||
//Deactivate click-through if form is reactivated
|
||||
if (ClickThroughEnabled) {
|
||||
ClickThroughEnabled = false;
|
||||
}
|
||||
|
||||
Program.Platform.RestoreForm(this);
|
||||
}
|
||||
|
||||
protected override void OnDeactivate(EventArgs e) {
|
||||
base.OnDeactivate(e);
|
||||
|
||||
//HACK: sometimes, even if TopMost is true, the window loses its "always on top" status.
|
||||
// This is a fix attempt that probably won't work...
|
||||
if (!IsFullscreen) { //fullscreen mode doesn't use TopMost
|
||||
TopMost = false;
|
||||
TopMost = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnMouseWheel(MouseEventArgs e) {
|
||||
base.OnMouseWheel(e);
|
||||
|
||||
if (!IsFullscreen) {
|
||||
int change = (int)(e.Delta / 6.0); //assumes a mouse wheel "tick" is in the 80-120 range
|
||||
AdjustSize(change);
|
||||
RefreshScreenLock();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnMouseDoubleClick(MouseEventArgs e) {
|
||||
base.OnMouseDoubleClick(e);
|
||||
|
||||
//This is handled by the WM_NCLBUTTONDBLCLK msg handler usually (because the GlassForm translates
|
||||
//clicks on client to clicks on caption). But if fullscreen mode disables GlassForm dragging, we need
|
||||
//this auxiliary handler to switch mode.
|
||||
IsFullscreen = !IsFullscreen;
|
||||
}
|
||||
|
||||
protected override void OnMouseClick(MouseEventArgs e) {
|
||||
base.OnMouseClick(e);
|
||||
|
||||
//Same story as above (OnMouseDoubleClick)
|
||||
if (e.Button == System.Windows.Forms.MouseButtons.Right) {
|
||||
OpenContextMenu(null);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void WndProc(ref Message m) {
|
||||
if (_msgPumpManager != null) {
|
||||
if (_msgPumpManager.PumpMessage(ref m)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
switch (m.Msg) {
|
||||
case WM.NCRBUTTONUP:
|
||||
//Open context menu if right button clicked on caption (i.e. all of the window area because of glass)
|
||||
if (m.WParam.ToInt32() == HT.CAPTION) {
|
||||
OpenContextMenu(null);
|
||||
|
||||
m.Result = IntPtr.Zero;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM.NCLBUTTONDBLCLK:
|
||||
//Toggle fullscreen mode if double click on caption (whole glass area)
|
||||
if (m.WParam.ToInt32() == HT.CAPTION) {
|
||||
IsFullscreen = !IsFullscreen;
|
||||
|
||||
m.Result = IntPtr.Zero;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM.NCHITTEST:
|
||||
//Make transparent to hit-testing if in click through mode
|
||||
if (ClickThroughEnabled && (ModifierKeys & Keys.Alt) != Keys.Alt) {
|
||||
m.Result = (IntPtr)HT.TRANSPARENT;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
base.WndProc(ref m);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Keyboard event handling
|
||||
|
||||
protected override void OnKeyUp(KeyEventArgs e) {
|
||||
base.OnKeyUp(e);
|
||||
|
||||
//ALT
|
||||
if (e.Modifiers == Keys.Alt) {
|
||||
if (e.KeyCode == Keys.Enter) {
|
||||
e.Handled = true;
|
||||
IsFullscreen = !IsFullscreen;
|
||||
}
|
||||
|
||||
else if (e.KeyCode == Keys.D1 || e.KeyCode == Keys.NumPad1) {
|
||||
FitToThumbnail(0.25);
|
||||
}
|
||||
|
||||
else if (e.KeyCode == Keys.D2 || e.KeyCode == Keys.NumPad2) {
|
||||
FitToThumbnail(0.5);
|
||||
}
|
||||
|
||||
else if (e.KeyCode == Keys.D3 || e.KeyCode == Keys.NumPad3 ||
|
||||
e.KeyCode == Keys.D0 || e.KeyCode == Keys.NumPad0) {
|
||||
FitToThumbnail(1.0);
|
||||
}
|
||||
|
||||
else if (e.KeyCode == Keys.D4 || e.KeyCode == Keys.NumPad4) {
|
||||
FitToThumbnail(2.0);
|
||||
}
|
||||
}
|
||||
|
||||
//F11 Fullscreen switch
|
||||
else if (e.KeyCode == Keys.F11) {
|
||||
e.Handled = true;
|
||||
IsFullscreen = !IsFullscreen;
|
||||
}
|
||||
|
||||
//ESCAPE
|
||||
else if (e.KeyCode == Keys.Escape) {
|
||||
//Disable click-through
|
||||
if (ClickThroughEnabled) {
|
||||
ClickThroughEnabled = false;
|
||||
}
|
||||
//Toggle fullscreen
|
||||
else if (IsFullscreen) {
|
||||
IsFullscreen = false;
|
||||
}
|
||||
//Disable click forwarding
|
||||
else if (ClickForwardingEnabled) {
|
||||
ClickForwardingEnabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Fullscreen
|
||||
|
||||
bool _isFullscreen = false;
|
||||
Point _preFullscreenLocation;
|
||||
Size _preFullscreenSize;
|
||||
FormBorderStyle _preFullscreenBorderStyle;
|
||||
|
||||
public bool IsFullscreen {
|
||||
get {
|
||||
return _isFullscreen;
|
||||
}
|
||||
set {
|
||||
if (IsFullscreen == value)
|
||||
return;
|
||||
if (value && !_thumbnailPanel.IsShowingThumbnail)
|
||||
return;
|
||||
|
||||
CloseSidePanel(); //on switch, always hide side panels
|
||||
|
||||
//Location and size
|
||||
if (value) {
|
||||
_preFullscreenLocation = Location;
|
||||
_preFullscreenSize = ClientSize;
|
||||
_preFullscreenBorderStyle = FormBorderStyle;
|
||||
|
||||
FormBorderStyle = FormBorderStyle.None;
|
||||
var currentScreen = Screen.FromControl(this);
|
||||
Size = currentScreen.WorkingArea.Size;
|
||||
Location = currentScreen.WorkingArea.Location;
|
||||
}
|
||||
else {
|
||||
FormBorderStyle = _preFullscreenBorderStyle;
|
||||
Location = _preFullscreenLocation;
|
||||
ClientSize = _preFullscreenSize;
|
||||
RefreshAspectRatio();
|
||||
}
|
||||
|
||||
//Common
|
||||
GlassEnabled = !value;
|
||||
TopMost = !value;
|
||||
HandleMouseMove = !value;
|
||||
|
||||
_isFullscreen = value;
|
||||
|
||||
Program.Platform.OnFormStateChange(this);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Thumbnail operation
|
||||
|
||||
/// <summary>
|
||||
/// Sets a new thumbnail.
|
||||
/// </summary>
|
||||
/// <param name="handle">Handle to the window to clone.</param>
|
||||
/// <param name="region">Region of the window to clone or null.</param>
|
||||
public void SetThumbnail(WindowHandle handle, ThumbnailRegion region) {
|
||||
try {
|
||||
System.Diagnostics.Trace.WriteLine(string.Format("Cloning window HWND {0} of class {1}.", handle.Handle, handle.Class));
|
||||
|
||||
CurrentThumbnailWindowHandle = handle;
|
||||
_thumbnailPanel.SetThumbnailHandle(handle, region);
|
||||
|
||||
//Set aspect ratio (this will resize the form), do not refresh if in fullscreen
|
||||
SetAspectRatio(_thumbnailPanel.ThumbnailPixelSize, !IsFullscreen);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
System.Diagnostics.Trace.Fail("Unable to set thumbnail.", ex.ToString());
|
||||
|
||||
ThumbnailError(ex, false, Strings.ErrorUnableToCreateThumbnail);
|
||||
_thumbnailPanel.UnsetThumbnail();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enables group mode on a list of window handles.
|
||||
/// </summary>
|
||||
/// <param name="handles">List of window handles.</param>
|
||||
public void SetThumbnailGroup(IList<WindowHandle> handles) {
|
||||
if (handles.Count == 0)
|
||||
return;
|
||||
|
||||
//At last one thumbnail
|
||||
SetThumbnail(handles[0], null);
|
||||
|
||||
//Handle if no real group
|
||||
if (handles.Count == 1)
|
||||
return;
|
||||
|
||||
CurrentThumbnailWindowHandle = null;
|
||||
_msgPumpManager.Get<MessagePumpProcessors.GroupSwitchManager>().EnableGroupMode(handles);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disables the cloned thumbnail.
|
||||
/// </summary>
|
||||
public void UnsetThumbnail() {
|
||||
//Unset handle
|
||||
CurrentThumbnailWindowHandle = null;
|
||||
_thumbnailPanel.UnsetThumbnail();
|
||||
|
||||
//Disable aspect ratio
|
||||
KeepAspectRatio = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the region displayed of the current thumbnail.
|
||||
/// </summary>
|
||||
public ThumbnailRegion SelectedThumbnailRegion {
|
||||
get {
|
||||
if (!_thumbnailPanel.IsShowingThumbnail || !_thumbnailPanel.ConstrainToRegion)
|
||||
return null;
|
||||
|
||||
return _thumbnailPanel.SelectedRegion;
|
||||
}
|
||||
set {
|
||||
if (!_thumbnailPanel.IsShowingThumbnail)
|
||||
return;
|
||||
|
||||
_thumbnailPanel.SelectedRegion = value;
|
||||
|
||||
SetAspectRatio(_thumbnailPanel.ThumbnailPixelSize, true);
|
||||
|
||||
FixPositionAndSize();
|
||||
}
|
||||
}
|
||||
|
||||
const int FixMargin = 10;
|
||||
|
||||
/// <summary>
|
||||
/// Fixes the form's position and size, ensuring it is fully displayed in the current screen.
|
||||
/// </summary>
|
||||
private void FixPositionAndSize() {
|
||||
var screen = Screen.FromControl(this);
|
||||
|
||||
if (Width > screen.WorkingArea.Width) {
|
||||
Width = screen.WorkingArea.Width - FixMargin;
|
||||
}
|
||||
if (Height > screen.WorkingArea.Height) {
|
||||
Height = screen.WorkingArea.Height - FixMargin;
|
||||
}
|
||||
if (Location.X + Width > screen.WorkingArea.Right) {
|
||||
Location = new Point(screen.WorkingArea.Right - Width - FixMargin, Location.Y);
|
||||
}
|
||||
if (Location.Y + Height > screen.WorkingArea.Bottom) {
|
||||
Location = new Point(Location.X, screen.WorkingArea.Bottom - Height - FixMargin);
|
||||
}
|
||||
}
|
||||
|
||||
private void ThumbnailError(Exception ex, bool suppress, string title) {
|
||||
if (!suppress) {
|
||||
ShowErrorDialog(title, Strings.ErrorGenericThumbnailHandleError, ex.Message);
|
||||
}
|
||||
|
||||
UnsetThumbnail();
|
||||
}
|
||||
|
||||
/// <summary>Automatically sizes the window in order to accomodate the thumbnail p times.</summary>
|
||||
/// <param name="p">Scale of the thumbnail to consider.</param>
|
||||
private void FitToThumbnail(double p) {
|
||||
try {
|
||||
Size originalSize = _thumbnailPanel.ThumbnailPixelSize;
|
||||
Size fittedSize = new Size((int)(originalSize.Width * p), (int)(originalSize.Height * p));
|
||||
ClientSize = fittedSize;
|
||||
RefreshScreenLock();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
ThumbnailError(ex, false, Strings.ErrorUnableToFit);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Accessors
|
||||
|
||||
/// <summary>
|
||||
/// Gets the form's thumbnail panel.
|
||||
/// </summary>
|
||||
public ThumbnailPanel ThumbnailPanel {
|
||||
get {
|
||||
return _thumbnailPanel;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the form's message pump manager.
|
||||
/// </summary>
|
||||
public MessagePumpManager MessagePumpManager {
|
||||
get {
|
||||
return _msgPumpManager;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the form's window list drop down menu.
|
||||
/// </summary>
|
||||
public ContextMenuStrip MenuWindows {
|
||||
get {
|
||||
return menuWindows;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the window handle of the currently cloned thumbnail.
|
||||
/// </summary>
|
||||
public WindowHandle CurrentThumbnailWindowHandle {
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
321
OnTopReplica/MainForm.resx
Normal file
|
@ -0,0 +1,321 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="menuContext.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="menuWindows.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>142, 17</value>
|
||||
</metadata>
|
||||
<metadata name="menuOpacity.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>275, 17</value>
|
||||
</metadata>
|
||||
<metadata name="menuResize.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>578, 17</value>
|
||||
</metadata>
|
||||
<metadata name="menuFullscreenContext.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>399, 17</value>
|
||||
</metadata>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
AAABAAIAMDAAAAEAIACoJQAAJgAAABAQAAABACAAaAQAAM4lAAAoAAAAMAAAAGAAAAABACAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAYAAAAOAAAAFwAAACAAAAAnAAAAKwAAACwAAAAsAAAALAAA
|
||||
ACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAA
|
||||
ACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAA
|
||||
ACwAAAAsAAAAKwAAACcAAAAfAAAAFwAAAA0AAAAGAAAABgAAAA4AAAAdAAAALQAAAD0AAABIAAAATgAA
|
||||
AE8AAABPAAAATwAAAE8AAABPAAAATwAAAE8AAABPAAAATwAAAE8AAABPAAAATwAAAE8AAABPAAAATwAA
|
||||
AE8AAABPAAAATwAAAE8AAABPAAAATwAAAE8AAABPAAAATwAAAE8AAABPAAAATwAAAE8AAABPAAAATwAA
|
||||
AE8AAABPAAAATwAAAE8AAABPAAAATgAAAEgAAAA9AAAALQAAABwAAAANAAAACwAAABkAAAAwAAAARwAA
|
||||
AFsAAABpAAAAcAAAAHEAAABxAAAAcQAAAHEAAABxAAAAcQAAAHEAAABxAAAAcQAAAHEAAABxAAAAcQAA
|
||||
AHEAAABx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FP+FdyH/pZ+OwQYGCWMZFBhQkKiR1EuNRv9dlDr/bZgu/4CWHv98iBT/eoUR/4SQ
|
||||
Ev+CihD/iYoP/4F9D/97cQ//hHYc/6Wgj8MGBgljGBQZUJasidReozD/Y40i/3OHGP+MlRX/gYgO/4iP
|
||||
Df+RmA3/jZEM/42JCv+Cewr/gXQK/4l6F/+noo/EBgYJYxgUGlCXroXVWI8f/2J4Ff97iBD/jZIO/4OF
|
||||
CP+TlQf/mJkI/5WSCP+PiAb/g3oF/31yBf+KfhP/p6OOxQYGCWMZFhtQlaOB1VeCFf9idRD/eoQK/4qM
|
||||
C/+CggT/mJYF/5iVBv+WkAX/jIQF/4J4BP92bgP/h4AR/6ajjcYGBgljGRYcUJaif9ZYgA//YHAM/3d/
|
||||
CP+Ghwv/gIAE/5mVBv+UjQb/kogG/4h9BP99cwT/cGsB/4B+D/+joYzGBgYKYxoXHVCWoH7XU3cG/1tq
|
||||
Bf9yeAL/fX4I/317AP+TjgH/ioIB/4p+Af+AdQD/dWwA/21pAP90cgn/oJ2MyAcHCmQaGB1RoaiK1maC
|
||||
HP9teh3/gYYb/4mKIf+Nixr/m5Yb/5KKG/+Uihv/i4Eb/4F7Gv9+exf/fHoi/6WilMcHBwpjBgYHMXp5
|
||||
dKCcnZG2mZiNtJqZjbWZl4yzmJaIsJiWiLCYlYiwmZaJsZmVirGYlYqylpSJs5mXjbRqaGadAQEBPQAA
|
||||
AAUAAAAeAAAAKgAAACkAAAApAAAAKQAAACkAAAApAAAAKQAAACkAAAApAAAAKQAAACkAAAArAAAAIwAA
|
||||
AAoAAKxBAACsQQAArEEAAKxBAACsQQAArEEAAKxBAACsQQAArEEAAKxBAACsQQAArEEAAKxBAACsQQAA
|
||||
rEEAAKxB
|
||||
</value>
|
||||
</data>
|
||||
</root>
|
93
OnTopReplica/MainForm_ChildForms.cs
Normal file
|
@ -0,0 +1,93 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
|
||||
namespace OnTopReplica {
|
||||
|
||||
partial class MainForm {
|
||||
|
||||
//SidePanel _currentSidePanel = null;
|
||||
SidePanelContainer _sidePanelContainer = null;
|
||||
|
||||
/// <summary>
|
||||
/// Opens a new side panel.
|
||||
/// </summary>
|
||||
/// <param name="panel">The side panel to embed.</param>
|
||||
public void SetSidePanel(SidePanel panel) {
|
||||
if (IsSidePanelOpen) {
|
||||
CloseSidePanel();
|
||||
}
|
||||
|
||||
_sidePanelContainer = new SidePanelContainer(this);
|
||||
_sidePanelContainer.SetSidePanel(panel);
|
||||
_sidePanelContainer.Location = ComputeSidePanelLocation(_sidePanelContainer);
|
||||
_sidePanelContainer.Show(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Closes the current side panel.
|
||||
/// </summary>
|
||||
public void CloseSidePanel() {
|
||||
if (_sidePanelContainer == null || _sidePanelContainer.IsDisposed) {
|
||||
_sidePanelContainer = null;
|
||||
return;
|
||||
}
|
||||
|
||||
_sidePanelContainer.Hide();
|
||||
_sidePanelContainer.FreeSidePanel();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether a side panel is currently shown.
|
||||
/// </summary>
|
||||
public bool IsSidePanelOpen {
|
||||
get {
|
||||
if (_sidePanelContainer == null)
|
||||
return false;
|
||||
if (_sidePanelContainer.IsDisposed) {
|
||||
_sidePanelContainer = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
return _sidePanelContainer.Visible;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Moves the side panel based on the main form's current location.
|
||||
/// </summary>
|
||||
protected void AdjustSidePanelLocation() {
|
||||
if (!IsSidePanelOpen)
|
||||
return;
|
||||
|
||||
_sidePanelContainer.Location = ComputeSidePanelLocation(_sidePanelContainer);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Computes the target location of a side panel form that ensures it is visible on the current
|
||||
/// screen that contains the main form.
|
||||
/// </summary>
|
||||
private Point ComputeSidePanelLocation(Form sidePanel) {
|
||||
//Check if moving the panel on the form's right would put it off-screen
|
||||
var screen = Screen.FromControl(this);
|
||||
if (Location.X + Width + sidePanel.Width > screen.WorkingArea.Right) {
|
||||
return new Point(Location.X - sidePanel.Width, Location.Y);
|
||||
}
|
||||
else {
|
||||
return new Point(Location.X + Width, Location.Y);
|
||||
}
|
||||
}
|
||||
|
||||
void SidePanel_RequestClosing(object sender, EventArgs e) {
|
||||
CloseSidePanel();
|
||||
}
|
||||
|
||||
void Thumbnail_CloneClick(object sender, CloneClickEventArgs e) {
|
||||
Win32Helper.InjectFakeMouseClick(CurrentThumbnailWindowHandle.Handle, e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
130
OnTopReplica/MainForm_Features.cs
Normal file
|
@ -0,0 +1,130 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OnTopReplica.Properties;
|
||||
using WindowsFormsAero.TaskDialog;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace OnTopReplica {
|
||||
//Contains some feature implementations of MainForm
|
||||
partial class MainForm {
|
||||
|
||||
#region Click forwarding
|
||||
|
||||
public bool ClickForwardingEnabled {
|
||||
get {
|
||||
return _thumbnailPanel.ReportThumbnailClicks;
|
||||
}
|
||||
set {
|
||||
if (value && Settings.Default.FirstTimeClickForwarding) {
|
||||
TaskDialog dlg = new TaskDialog(Strings.InfoClickForwarding, Strings.InfoClickForwardingTitle, Strings.InfoClickForwardingContent) {
|
||||
CommonButtons = TaskDialogButton.Yes | TaskDialogButton.No
|
||||
};
|
||||
if (dlg.Show(this).CommonButton == Result.No)
|
||||
return;
|
||||
|
||||
Settings.Default.FirstTimeClickForwarding = false;
|
||||
}
|
||||
|
||||
_thumbnailPanel.ReportThumbnailClicks = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Click-through
|
||||
|
||||
bool _clickThrough = false;
|
||||
readonly Color DefaultNonClickTransparencyKey;
|
||||
|
||||
public bool ClickThroughEnabled {
|
||||
get {
|
||||
return _clickThrough;
|
||||
}
|
||||
set {
|
||||
//Adjust opacity if fully opaque
|
||||
/*if (value && Opacity == 1.0)
|
||||
Opacity = 0.75;
|
||||
if (!value)
|
||||
Opacity = 1.0;*/
|
||||
|
||||
//Enable transparency and force as top-most
|
||||
TransparencyKey = (value) ? Color.Black : DefaultNonClickTransparencyKey;
|
||||
if (value)
|
||||
TopMost = true;
|
||||
|
||||
_clickThrough = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Chrome
|
||||
|
||||
readonly FormBorderStyle DefaultBorderStyle; // = FormBorderStyle.Sizable; // FormBorderStyle.SizableToolWindow;
|
||||
|
||||
public bool IsChromeVisible {
|
||||
get {
|
||||
return (FormBorderStyle == DefaultBorderStyle);
|
||||
}
|
||||
set {
|
||||
//Cancel hiding chrome if no thumbnail is shown
|
||||
if (!value && !_thumbnailPanel.IsShowingThumbnail)
|
||||
return;
|
||||
|
||||
if (!value) {
|
||||
Location = new Point {
|
||||
X = Location.X + SystemInformation.FrameBorderSize.Width,
|
||||
Y = Location.Y + SystemInformation.FrameBorderSize.Height
|
||||
};
|
||||
FormBorderStyle = FormBorderStyle.None;
|
||||
}
|
||||
else if(value) {
|
||||
Location = new Point {
|
||||
X = Location.X - SystemInformation.FrameBorderSize.Width,
|
||||
Y = Location.Y - SystemInformation.FrameBorderSize.Height
|
||||
};
|
||||
FormBorderStyle = DefaultBorderStyle;
|
||||
}
|
||||
|
||||
Program.Platform.OnFormStateChange(this);
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Position lock
|
||||
|
||||
ScreenPosition? _positionLock = null;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the screen position where the window is currently locked in.
|
||||
/// </summary>
|
||||
public ScreenPosition? PositionLock {
|
||||
get {
|
||||
return _positionLock;
|
||||
}
|
||||
set {
|
||||
if (value != null)
|
||||
this.SetScreenPosition(value.Value);
|
||||
|
||||
_positionLock = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Refreshes window position if in lock mode.
|
||||
/// </summary>
|
||||
private void RefreshScreenLock() {
|
||||
//If locked in position, move accordingly
|
||||
if (PositionLock.HasValue) {
|
||||
this.SetScreenPosition(PositionLock.Value);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
118
OnTopReplica/MainForm_Gui.cs
Normal file
|
@ -0,0 +1,118 @@
|
|||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using WindowsFormsAero.TaskDialog;
|
||||
|
||||
namespace OnTopReplica {
|
||||
partial class MainForm {
|
||||
|
||||
/// <summary>
|
||||
/// Opens the context menu.
|
||||
/// </summary>
|
||||
/// <param name="position">Optional position of the mouse, relative to which the menu is shown.</param>
|
||||
public void OpenContextMenu(Point? position) {
|
||||
Point menuPosition = MousePosition;
|
||||
if (position.HasValue)
|
||||
menuPosition = position.Value;
|
||||
|
||||
if (IsFullscreen) {
|
||||
menuFullscreenContext.Show(menuPosition);
|
||||
}
|
||||
else {
|
||||
menuContext.Show(menuPosition);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the window's vertical chrome size.
|
||||
/// </summary>
|
||||
public int ChromeBorderVertical {
|
||||
get {
|
||||
if (IsChromeVisible)
|
||||
return SystemInformation.FrameBorderSize.Height;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the window's horizontal chrome size.
|
||||
/// </summary>
|
||||
public int ChromeBorderHorizontal {
|
||||
get {
|
||||
if (IsChromeVisible)
|
||||
return SystemInformation.FrameBorderSize.Width;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Displays an error task dialog.
|
||||
/// </summary>
|
||||
/// <param name="mainInstruction">Main instruction of the error dialog.</param>
|
||||
/// <param name="explanation">Detailed informations about the error.</param>
|
||||
/// <param name="errorMessage">Expanded error codes/messages.</param>
|
||||
private void ShowErrorDialog(string mainInstruction, string explanation, string errorMessage) {
|
||||
TaskDialog dlg = new TaskDialog(mainInstruction, Strings.ErrorGenericTitle, explanation) {
|
||||
CommonIcon = TaskDialogIcon.Stop,
|
||||
IsExpanded = false
|
||||
};
|
||||
|
||||
if (!string.IsNullOrEmpty(errorMessage)) {
|
||||
dlg.ExpandedInformation = Strings.ErrorGenericInfoText + errorMessage;
|
||||
dlg.ExpandedControlText = Strings.ErrorGenericInfoButton;
|
||||
}
|
||||
|
||||
dlg.Show(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ensures that the main form is visible (either closing the fullscreen mode or reactivating from task icon).
|
||||
/// </summary>
|
||||
public void EnsureMainFormVisible() {
|
||||
//Reset special modes
|
||||
IsFullscreen = false;
|
||||
ClickThroughEnabled = false;
|
||||
Opacity = 1.0;
|
||||
|
||||
//Restore main form in a platform-dependent method
|
||||
Program.Platform.RestoreForm(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens a confirmation dialog to confirm whether to reset the main form or not.
|
||||
/// </summary>
|
||||
public void ResetMainFormWithConfirmation() {
|
||||
var dlg = new TaskDialog(Strings.AskReset, Strings.AskResetTitle, Strings.AskResetContent);
|
||||
dlg.UseCommandLinks = true;
|
||||
dlg.CustomButtons = new CustomButton[] {
|
||||
new CustomButton(Result.OK, Strings.AskResetButtonOk),
|
||||
new CustomButton(Result.Cancel, Strings.ButtonCancel)
|
||||
};
|
||||
dlg.CommonIcon = TaskDialogIcon.Information;
|
||||
|
||||
if (dlg.Show(this).CommonButton == Result.OK) {
|
||||
ResetMainForm();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the main form to its initial state.
|
||||
/// </summary>
|
||||
public void ResetMainForm() {
|
||||
//Reset form settings
|
||||
UnsetThumbnail();
|
||||
CloseSidePanel();
|
||||
|
||||
//Reset location and size (edge of the screen, min size)
|
||||
Point nuLoc = Screen.PrimaryScreen.WorkingArea.Location;
|
||||
nuLoc.Offset(40, 40);
|
||||
Location = nuLoc;
|
||||
Size = new Size(240, 220);
|
||||
|
||||
this.Show();
|
||||
this.Activate();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
180
OnTopReplica/MainForm_MenuEvents.cs
Normal file
|
@ -0,0 +1,180 @@
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using OnTopReplica.Properties;
|
||||
using WindowsFormsAero.TaskDialog;
|
||||
using OnTopReplica.SidePanels;
|
||||
|
||||
namespace OnTopReplica {
|
||||
partial class MainForm {
|
||||
|
||||
private void Menu_opening(object sender, CancelEventArgs e) {
|
||||
//Cancel if currently in "fullscreen" mode or a side panel is open
|
||||
if (IsFullscreen || IsSidePanelOpen) {
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
|
||||
bool showing = _thumbnailPanel.IsShowingThumbnail;
|
||||
|
||||
selectRegionToolStripMenuItem.Enabled = showing;
|
||||
switchToWindowToolStripMenuItem.Enabled = showing;
|
||||
resizeToolStripMenuItem.Enabled = showing;
|
||||
chromeToolStripMenuItem.Checked = IsChromeVisible;
|
||||
clickForwardingToolStripMenuItem.Checked = ClickForwardingEnabled;
|
||||
chromeToolStripMenuItem.Enabled = showing;
|
||||
clickThroughToolStripMenuItem.Enabled = showing;
|
||||
clickForwardingToolStripMenuItem.Enabled = showing;
|
||||
}
|
||||
|
||||
private void Menu_Switch_click(object sender, EventArgs e) {
|
||||
if (CurrentThumbnailWindowHandle == null)
|
||||
return;
|
||||
|
||||
Program.Platform.HideForm(this);
|
||||
Native.WindowManagerMethods.SetForegroundWindow(CurrentThumbnailWindowHandle.Handle);
|
||||
}
|
||||
|
||||
private void Menu_Advanced_opening(object sender, EventArgs e) {
|
||||
restoreLastClonedWindowToolStripMenuItem.Checked = Settings.Default.RestoreLastWindow;
|
||||
}
|
||||
|
||||
private void Menu_GroupSwitchMode_click(object sender, EventArgs e) {
|
||||
SetSidePanel(new SidePanels.GroupSwitchPanel());
|
||||
}
|
||||
|
||||
private void Menu_RestoreLastWindow_click(object sender, EventArgs e) {
|
||||
Settings.Default.RestoreLastWindow = !Settings.Default.RestoreLastWindow;
|
||||
}
|
||||
|
||||
private void Menu_ClickForwarding_click(object sender, EventArgs e) {
|
||||
ClickForwardingEnabled = !ClickForwardingEnabled;
|
||||
}
|
||||
|
||||
private void Menu_ClickThrough_click(object sender, EventArgs e) {
|
||||
ClickThroughEnabled = true;
|
||||
}
|
||||
|
||||
private void Menu_Opacity_opening(object sender, CancelEventArgs e) {
|
||||
ToolStripMenuItem[] items = {
|
||||
toolStripMenuItem1,
|
||||
toolStripMenuItem2,
|
||||
toolStripMenuItem3,
|
||||
toolStripMenuItem4
|
||||
};
|
||||
|
||||
foreach (ToolStripMenuItem i in items) {
|
||||
if (((double)i.Tag) == this.Opacity)
|
||||
i.Checked = true;
|
||||
else
|
||||
i.Checked = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void Menu_Opacity_click(object sender, EventArgs e) {
|
||||
//Get clicked menu item
|
||||
ToolStripMenuItem tsi = sender as ToolStripMenuItem;
|
||||
|
||||
if (tsi != null && this.Visible) {
|
||||
//Get opacity from the tag
|
||||
this.Opacity = (double)tsi.Tag;
|
||||
Program.Platform.OnFormStateChange(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void Menu_Region_click(object sender, EventArgs e) {
|
||||
SetSidePanel(new OnTopReplica.SidePanels.RegionPanel());
|
||||
}
|
||||
|
||||
private void Menu_Resize_opening(object sender, CancelEventArgs e) {
|
||||
if (!_thumbnailPanel.IsShowingThumbnail)
|
||||
e.Cancel = true;
|
||||
|
||||
restorePositionAndSizeToolStripMenuItem.Checked = Settings.Default.RestoreSizeAndPosition;
|
||||
}
|
||||
|
||||
private void Menu_Resize_Double(object sender, EventArgs e) {
|
||||
FitToThumbnail(2.0);
|
||||
}
|
||||
|
||||
private void Menu_Resize_FitToWindow(object sender, EventArgs e) {
|
||||
FitToThumbnail(1.0);
|
||||
}
|
||||
|
||||
private void Menu_Resize_Half(object sender, EventArgs e) {
|
||||
FitToThumbnail(0.5);
|
||||
}
|
||||
|
||||
private void Menu_Resize_Quarter(object sender, EventArgs e) {
|
||||
FitToThumbnail(0.25);
|
||||
}
|
||||
|
||||
private void Menu_Resize_Fullscreen(object sender, EventArgs e) {
|
||||
IsFullscreen = true;
|
||||
}
|
||||
|
||||
private void Menu_Resize_RecallPosition_click(object sender, EventArgs e) {
|
||||
Settings.Default.RestoreSizeAndPosition = !Settings.Default.RestoreSizeAndPosition;
|
||||
}
|
||||
|
||||
private void Menu_Position_Opening(object sender, EventArgs e) {
|
||||
disabledToolStripMenuItem.Checked = (PositionLock == null);
|
||||
topLeftToolStripMenuItem.Checked = (PositionLock == ScreenPosition.TopLeft);
|
||||
topRightToolStripMenuItem.Checked = (PositionLock == ScreenPosition.TopRight);
|
||||
centerToolStripMenuItem.Checked = (PositionLock == ScreenPosition.Center);
|
||||
bottomLeftToolStripMenuItem.Checked = (PositionLock == ScreenPosition.BottomLeft);
|
||||
bottomRightToolStripMenuItem.Checked = (PositionLock == ScreenPosition.BottomRight);
|
||||
}
|
||||
|
||||
private void Menu_Position_Disable(object sender, EventArgs e) {
|
||||
PositionLock = null;
|
||||
}
|
||||
|
||||
private void Menu_Position_TopLeft(object sender, EventArgs e) {
|
||||
PositionLock = ScreenPosition.TopLeft;
|
||||
}
|
||||
|
||||
private void Menu_Position_TopRight(object sender, EventArgs e) {
|
||||
PositionLock = ScreenPosition.TopRight;
|
||||
}
|
||||
|
||||
private void Menu_Position_Center(object sender, EventArgs e) {
|
||||
PositionLock = ScreenPosition.Center;
|
||||
}
|
||||
|
||||
private void Menu_Position_BottomLeft(object sender, EventArgs e) {
|
||||
PositionLock = ScreenPosition.BottomLeft;
|
||||
}
|
||||
|
||||
private void Menu_Position_BottomRight(object sender, EventArgs e) {
|
||||
PositionLock = ScreenPosition.BottomRight;
|
||||
}
|
||||
|
||||
private void Menu_Reduce_click(object sender, EventArgs e) {
|
||||
//Hide form in a platform specific way
|
||||
Program.Platform.HideForm(this);
|
||||
}
|
||||
|
||||
private void Menu_Chrome_click(object sender, EventArgs e) {
|
||||
IsChromeVisible = !IsChromeVisible;
|
||||
}
|
||||
|
||||
private void Menu_Settings_click(object sender, EventArgs e) {
|
||||
this.SetSidePanel(new OptionsPanel());
|
||||
}
|
||||
|
||||
private void Menu_About_click(object sender, EventArgs e) {
|
||||
this.SetSidePanel(new AboutPanel());
|
||||
}
|
||||
|
||||
private void Menu_Close_click(object sender, EventArgs e) {
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void Menu_Fullscreen_ExitFullscreen_click(object sender, EventArgs e) {
|
||||
IsFullscreen = false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
84
OnTopReplica/MessagePumpManager.cs
Normal file
|
@ -0,0 +1,84 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using OnTopReplica.MessagePumpProcessors;
|
||||
using OnTopReplica.Native;
|
||||
|
||||
namespace OnTopReplica {
|
||||
class MessagePumpManager : IDisposable {
|
||||
|
||||
Dictionary<Type, IMessagePumpProcessor> _processors = new Dictionary<Type, IMessagePumpProcessor>();
|
||||
|
||||
public MainForm Form { get; private set; }
|
||||
|
||||
private void Register(IMessagePumpProcessor processor, MainForm form) {
|
||||
_processors[processor.GetType()] = processor;
|
||||
processor.Initialize(form);
|
||||
|
||||
System.Diagnostics.Trace.WriteLine(string.Format("Registered message pump processor: {0}", processor.GetType()));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Instantiates all message pump processors and registers them on the main form.
|
||||
/// </summary>
|
||||
/// <param name="form"></param>
|
||||
public void Initialize(MainForm form) {
|
||||
Form = form;
|
||||
|
||||
//Register window shell hook
|
||||
if (!HookMethods.RegisterShellHookWindow(form.Handle)) {
|
||||
Console.Error.WriteLine("Failed to register shell hook window.");
|
||||
}
|
||||
else {
|
||||
System.Diagnostics.Trace.WriteLine("Shell hook window registered successfully.");
|
||||
}
|
||||
|
||||
//Register message pump processors
|
||||
Register(new WindowKeeper(), form);
|
||||
Register(new HotKeyManager(), form);
|
||||
Register(new GroupSwitchManager(), form);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Run the registered message pump processors.
|
||||
/// </summary>
|
||||
/// <param name="msg">Message to process.</param>
|
||||
/// <returns>True if the message has been handled internally.</returns>
|
||||
public bool PumpMessage(ref Message msg) {
|
||||
foreach (var processor in _processors.Values) {
|
||||
if (processor.Process(ref msg))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the instance of a registered message pump processor.
|
||||
/// Throws if instance not found.
|
||||
/// </summary>
|
||||
public T Get<T>() {
|
||||
return (T)_processors[typeof(T)];
|
||||
}
|
||||
|
||||
#region IDisposable Members
|
||||
|
||||
public void Dispose() {
|
||||
if (!HookMethods.DeregisterShellHookWindow(Form.Handle)) {
|
||||
Console.Error.WriteLine("Failed to deregister shell hook window.");
|
||||
}
|
||||
else {
|
||||
System.Diagnostics.Trace.WriteLine("Deregistered shell hook window successfully.");
|
||||
}
|
||||
|
||||
foreach (var processor in _processors.Values) {
|
||||
processor.Dispose();
|
||||
}
|
||||
_processors.Clear();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace OnTopReplica.MessagePumpProcessors {
|
||||
abstract class BaseMessagePumpProcessor : IMessagePumpProcessor {
|
||||
|
||||
protected MainForm Form { get; private set; }
|
||||
|
||||
#region IMessagePumpProcessor Members
|
||||
|
||||
public virtual void Initialize(MainForm form) {
|
||||
Form = form;
|
||||
}
|
||||
|
||||
public abstract bool Process(ref Message msg);
|
||||
|
||||
#endregion
|
||||
|
||||
protected abstract void Shutdown();
|
||||
|
||||
bool _isDisposed = false;
|
||||
|
||||
#region IDisposable Members
|
||||
|
||||
public void Dispose() {
|
||||
if (_isDisposed)
|
||||
return;
|
||||
|
||||
Shutdown();
|
||||
|
||||
_isDisposed = true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
136
OnTopReplica/MessagePumpProcessors/GroupSwitchManager.cs
Normal file
|
@ -0,0 +1,136 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using OnTopReplica.Native;
|
||||
|
||||
namespace OnTopReplica.MessagePumpProcessors {
|
||||
|
||||
class GroupSwitchManager : BaseMessagePumpProcessor {
|
||||
|
||||
bool _active = false;
|
||||
List<WindowHandleWrapper> _lruHandles;
|
||||
|
||||
/// <summary>
|
||||
/// Enables group switch mode.
|
||||
/// </summary>
|
||||
/// <param name="handles">List of window handles to track.</param>
|
||||
public void EnableGroupMode(IList<WindowHandle> handles) {
|
||||
if (handles == null || handles.Count == 0)
|
||||
return;
|
||||
|
||||
//Okey dokey, will now track handles
|
||||
TrackHandles(handles);
|
||||
_active = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the LRU sorted list of window handles.
|
||||
/// </summary>
|
||||
private void TrackHandles(IList<WindowHandle> handles) {
|
||||
_lruHandles = new List<WindowHandleWrapper>(handles.Count);
|
||||
var now = DateTime.Now;
|
||||
|
||||
foreach(var h in handles){
|
||||
_lruHandles.Add(new WindowHandleWrapper {
|
||||
WindowHandle = h,
|
||||
LastTimeUsed = now
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disables group switch mode.
|
||||
/// </summary>
|
||||
public void Disable() {
|
||||
if (!_active)
|
||||
return;
|
||||
|
||||
_lruHandles = null;
|
||||
_active = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the message pump.
|
||||
/// </summary>
|
||||
public override bool Process(ref Message msg) {
|
||||
if (_active && msg.Msg == HookMethods.WM_SHELLHOOKMESSAGE) {
|
||||
int hookCode = msg.WParam.ToInt32();
|
||||
if (hookCode == HookMethods.HSHELL_WINDOWACTIVATED ||
|
||||
hookCode == HookMethods.HSHELL_RUDEAPPACTIVATED) {
|
||||
|
||||
IntPtr activeHandle = msg.LParam;
|
||||
HandleForegroundWindowChange(activeHandle);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void HandleForegroundWindowChange(IntPtr activeWindow) {
|
||||
System.Diagnostics.Trace.WriteLine(string.Format("New active window (h {0}). ", activeWindow));
|
||||
|
||||
//Seek window in tracked handles
|
||||
WindowHandleWrapper activated = null;
|
||||
foreach (var i in _lruHandles) {
|
||||
if (i.WindowHandle.Handle == activeWindow)
|
||||
activated = i;
|
||||
}
|
||||
|
||||
if (activated == null) {
|
||||
//New foreground window is not tracked
|
||||
System.Diagnostics.Trace.WriteLine("Active window is not tracked.");
|
||||
return;
|
||||
}
|
||||
|
||||
//Update tracked handle
|
||||
activated.LastTimeUsed = DateTime.Now;
|
||||
_lruHandles.Sort(new LruDateTimeComparer());
|
||||
|
||||
//Get least recently used
|
||||
var next = _lruHandles[0];
|
||||
|
||||
System.Diagnostics.Trace.WriteLine(string.Format("Tracked. Switching to {0} (last use: {1}).", next.WindowHandle.Title, next.LastTimeUsed));
|
||||
|
||||
Form.SetThumbnail(next.WindowHandle, null);
|
||||
}
|
||||
|
||||
protected override void Shutdown() {
|
||||
Disable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the group switch manager ia active.
|
||||
/// </summary>
|
||||
public bool IsActive {
|
||||
get {
|
||||
return _active;
|
||||
}
|
||||
}
|
||||
|
||||
#region List sorting stuff
|
||||
|
||||
class WindowHandleWrapper {
|
||||
public WindowHandle WindowHandle { get; set; }
|
||||
public DateTime LastTimeUsed { get; set; }
|
||||
}
|
||||
|
||||
class LruDateTimeComparer : IComparer<WindowHandleWrapper> {
|
||||
|
||||
#region IComparer<WindowHandleWrapper> Members
|
||||
|
||||
public int Compare(WindowHandleWrapper x, WindowHandleWrapper y) {
|
||||
return x.LastTimeUsed.CompareTo(y.LastTimeUsed);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
}
|
168
OnTopReplica/MessagePumpProcessors/HotKeyManager.cs
Normal file
|
@ -0,0 +1,168 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using OnTopReplica.Native;
|
||||
using OnTopReplica.Properties;
|
||||
|
||||
namespace OnTopReplica.MessagePumpProcessors {
|
||||
|
||||
/// <summary>
|
||||
/// HotKey registration helper.
|
||||
/// </summary>
|
||||
class HotKeyManager : BaseMessagePumpProcessor {
|
||||
|
||||
public HotKeyManager() {
|
||||
Enabled = true;
|
||||
}
|
||||
|
||||
delegate void HotKeyHandler();
|
||||
|
||||
/// <summary>
|
||||
/// Wraps hot key handler registration data.
|
||||
/// </summary>
|
||||
private class HotKeyHandlerRegistration : IDisposable {
|
||||
private HotKeyHandlerRegistration() {
|
||||
}
|
||||
|
||||
private HotKeyHandlerRegistration(IntPtr hwnd, int key, HotKeyHandler handler) {
|
||||
if (hwnd == IntPtr.Zero)
|
||||
throw new ArgumentException();
|
||||
if (handler == null)
|
||||
throw new ArgumentNullException();
|
||||
|
||||
_hwnd = hwnd;
|
||||
RegistrationKey = key;
|
||||
Handler = handler;
|
||||
}
|
||||
|
||||
static int _lastUsedKey = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Registers a new hotkey and returns a handle to the registration.
|
||||
/// </summary>
|
||||
/// <returns>Returns null on failure.</returns>
|
||||
public static HotKeyHandlerRegistration Register(Form owner, int keyCode, int modifiers, HotKeyHandler handler) {
|
||||
var key = ++_lastUsedKey;
|
||||
|
||||
if (!HotKeyMethods.RegisterHotKey(owner.Handle, key, modifiers, keyCode)) {
|
||||
Console.Error.WriteLine("Failed to create hotkey on keys {0}.", keyCode);
|
||||
return null;
|
||||
}
|
||||
|
||||
return new HotKeyHandlerRegistration(owner.Handle, key, handler);
|
||||
}
|
||||
|
||||
IntPtr _hwnd;
|
||||
public int RegistrationKey { get; private set; }
|
||||
public HotKeyHandler Handler { get; private set; }
|
||||
|
||||
public void Dispose() {
|
||||
if (!HotKeyMethods.UnregisterHotKey(_hwnd, RegistrationKey)) {
|
||||
Console.Error.WriteLine("Failed to unregister hotkey #{0}.", RegistrationKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Dictionary<int, HotKeyHandlerRegistration> _handlers = new Dictionary<int, HotKeyHandlerRegistration>();
|
||||
|
||||
public override void Initialize(MainForm form) {
|
||||
base.Initialize(form);
|
||||
|
||||
RefreshHotkeys();
|
||||
}
|
||||
|
||||
public override bool Process(ref Message msg) {
|
||||
if (Enabled && msg.Msg == HotKeyMethods.WM_HOTKEY) {
|
||||
int keyId = msg.WParam.ToInt32();
|
||||
if (!_handlers.ContainsKey(keyId))
|
||||
return false;
|
||||
|
||||
_handlers[keyId].Handler.Invoke();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool Enabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Refreshes registered hotkeys from Settings.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Application settings contain hotkey registration strings that are used
|
||||
/// automatically by this registration process.
|
||||
/// </remarks>
|
||||
public void RefreshHotkeys() {
|
||||
ClearHandlers();
|
||||
|
||||
RegisterHandler(Settings.Default.HotKeyCloneCurrent, HotKeyCloneHandler);
|
||||
RegisterHandler(Settings.Default.HotKeyShowHide, HotKeyShowHideHandler);
|
||||
}
|
||||
|
||||
private void RegisterHandler(string spec, HotKeyHandler handler) {
|
||||
if (string.IsNullOrEmpty(spec))
|
||||
return; //this can happen and is allowed => simply don't register
|
||||
if (handler == null)
|
||||
throw new ArgumentNullException();
|
||||
|
||||
int modifiers = 0, keyCode = 0;
|
||||
|
||||
try {
|
||||
HotKeyMethods.TranslateStringToKeyValues(spec, out modifiers, out keyCode);
|
||||
}
|
||||
catch (ArgumentException) {
|
||||
//TODO: swallowed exception
|
||||
return;
|
||||
}
|
||||
|
||||
var reg = HotKeyHandlerRegistration.Register(Form, keyCode, modifiers, handler);
|
||||
if(reg != null)
|
||||
_handlers.Add(reg.RegistrationKey, reg);
|
||||
}
|
||||
|
||||
private void ClearHandlers() {
|
||||
foreach (var hotkey in _handlers) {
|
||||
hotkey.Value.Dispose();
|
||||
}
|
||||
_handlers.Clear();
|
||||
}
|
||||
|
||||
protected override void Shutdown() {
|
||||
ClearHandlers();
|
||||
}
|
||||
|
||||
#region Hotkey callbacks
|
||||
|
||||
/// <summary>
|
||||
/// Handles "show/hide" hotkey. Ensures the form is in restored state and switches
|
||||
/// between shown and hidden states.
|
||||
/// </summary>
|
||||
void HotKeyShowHideHandler() {
|
||||
if (Form.IsFullscreen)
|
||||
Form.IsFullscreen = false;
|
||||
|
||||
if (!Program.Platform.IsHidden(Form)) {
|
||||
Program.Platform.HideForm(Form);
|
||||
}
|
||||
else {
|
||||
Form.EnsureMainFormVisible();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the "clone current" hotkey.
|
||||
/// </summary>
|
||||
void HotKeyCloneHandler() {
|
||||
var handle = Win32Helper.GetCurrentForegroundWindow();
|
||||
if (handle.Handle == Form.Handle)
|
||||
return;
|
||||
|
||||
Form.SetThumbnail(handle, null);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using OnTopReplica.Native;
|
||||
|
||||
namespace OnTopReplica.MessagePumpProcessors {
|
||||
|
||||
#if DEBUG
|
||||
|
||||
/// <summary>
|
||||
/// Basic shell message interceptor to use for debugging.
|
||||
/// </summary>
|
||||
class ShellInterceptProcessor : BaseMessagePumpProcessor {
|
||||
|
||||
public override bool Process(ref Message msg) {
|
||||
if (msg.Msg == HookMethods.WM_SHELLHOOKMESSAGE) {
|
||||
int hookCode = msg.WParam.ToInt32();
|
||||
|
||||
System.Diagnostics.Trace.WriteLine(string.Format("Hook msg #{0}: {1}", hookCode, msg.LParam));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected override void Shutdown() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}
|
40
OnTopReplica/MessagePumpProcessors/WindowKeeper.cs
Normal file
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using OnTopReplica.Native;
|
||||
|
||||
namespace OnTopReplica.MessagePumpProcessors {
|
||||
|
||||
/// <summary>
|
||||
/// Listens for shell events and closes the thumbnail if a cloned window is destroyed.
|
||||
/// </summary>
|
||||
class WindowKeeper : BaseMessagePumpProcessor {
|
||||
|
||||
public override bool Process(ref Message msg) {
|
||||
if (Form.CurrentThumbnailWindowHandle != null &&
|
||||
msg.Msg == HookMethods.WM_SHELLHOOKMESSAGE) {
|
||||
int hookCode = msg.WParam.ToInt32();
|
||||
|
||||
if (hookCode == HookMethods.HSHELL_WINDOWDESTROYED) {
|
||||
//Check whether the destroyed window is the one we were cloning
|
||||
IntPtr destroyedHandle = msg.LParam;
|
||||
if (destroyedHandle == Form.CurrentThumbnailWindowHandle.Handle) {
|
||||
//Disable group switch mode, since a window of the group has been destroyed
|
||||
Form.MessagePumpManager.Get<GroupSwitchManager>().Disable();
|
||||
|
||||
//Disable cloning
|
||||
Form.UnsetThumbnail();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected override void Shutdown() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
1042
OnTopReplica/NDesk/Options/Options.cs
Normal file
30
OnTopReplica/Native/CommonControls.cs
Normal file
|
@ -0,0 +1,30 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace OnTopReplica.Native {
|
||||
public static class CommonControls {
|
||||
|
||||
[DllImport("comctl32.dll", EntryPoint = "InitCommonControlsEx", CallingConvention = CallingConvention.StdCall)]
|
||||
static extern bool InitCommonControlsEx(ref INITCOMMONCONTROLSEX iccex);
|
||||
|
||||
const int ICC_STANDARD_CLASSES = 0x00004000;
|
||||
const int ICC_WIN95_CLASSES = 0x000000FF;
|
||||
|
||||
public static bool InitStandard() {
|
||||
INITCOMMONCONTROLSEX ex = new INITCOMMONCONTROLSEX();
|
||||
ex.dwSize = 8;
|
||||
ex.dwICC = ICC_STANDARD_CLASSES | ICC_WIN95_CLASSES;
|
||||
|
||||
return InitCommonControlsEx(ref ex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
struct INITCOMMONCONTROLSEX {
|
||||
public int dwSize;
|
||||
public int dwICC;
|
||||
}
|
||||
|
||||
}
|
37
OnTopReplica/Native/ErrorMethods.cs
Normal file
|
@ -0,0 +1,37 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace OnTopReplica.Native {
|
||||
/// <summary>
|
||||
/// Common Win32 error handling methods.
|
||||
/// </summary>
|
||||
static class ErrorMethods {
|
||||
|
||||
[DllImport("kernel32.dll")]
|
||||
static extern uint FormatMessage(uint dwFlags, IntPtr lpSource,
|
||||
int dwMessageId, uint dwLanguageId, [Out] StringBuilder lpBuffer,
|
||||
uint nSize, IntPtr Arguments);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a string representation of a Win32 error code.
|
||||
/// </summary>
|
||||
/// <param name="msgCode">ID of the Win32 error code.</param>
|
||||
/// <returns>String representation of the error.</returns>
|
||||
public static string GetErrorMessage(int msgCode) {
|
||||
var sb = new StringBuilder(300);
|
||||
FormatMessage((uint)(0x00001000), IntPtr.Zero, msgCode, 0, sb, 299, IntPtr.Zero);
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a string representation of the last Win32 error on this thread.
|
||||
/// </summary>
|
||||
public static string GetLastErrorMessage() {
|
||||
int errorCode = Marshal.GetLastWin32Error();
|
||||
return GetErrorMessage(errorCode);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
51
OnTopReplica/Native/FilesystemMethods.cs
Normal file
|
@ -0,0 +1,51 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.IO;
|
||||
|
||||
namespace OnTopReplica.Native {
|
||||
|
||||
/// <summary>
|
||||
/// Native methods for filesystem interop.
|
||||
/// </summary>
|
||||
static class FilesystemMethods {
|
||||
|
||||
/// <summary>
|
||||
/// Gets the path to the current user's download path.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Code taken from http://stackoverflow.com/questions/3795023/downloads-folder-not-special-enough
|
||||
/// </remarks>
|
||||
public static string DownloadsPath {
|
||||
get {
|
||||
string path = null;
|
||||
|
||||
//Requires Vista or superior
|
||||
if (Environment.OSVersion.Version.Major >= 6) {
|
||||
IntPtr pathPtr;
|
||||
Guid folderId = FolderDownloads;
|
||||
int hr = SHGetKnownFolderPath(ref folderId, 0, IntPtr.Zero, out pathPtr);
|
||||
if (hr == 0) {
|
||||
path = Marshal.PtrToStringUni(pathPtr);
|
||||
Marshal.FreeCoTaskMem(pathPtr);
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
//Fallback code
|
||||
path = Path.GetDirectoryName(Environment.GetFolderPath(Environment.SpecialFolder.Personal));
|
||||
path = Path.Combine(path, "Downloads");
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static readonly Guid FolderDownloads = new Guid("374DE290-123F-4565-9164-39C4925E467B");
|
||||
|
||||
[DllImport("shell32.dll", CharSet = CharSet.Auto)]
|
||||
private static extern int SHGetKnownFolderPath(ref Guid id, int flags, IntPtr token, out IntPtr path);
|
||||
|
||||
}
|
||||
|
||||
}
|
14
OnTopReplica/Native/HT.cs
Normal file
|
@ -0,0 +1,14 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OnTopReplica.Native {
|
||||
/// <summary>
|
||||
/// Native Win32 Hit Testing codes.
|
||||
/// </summary>
|
||||
static class HT {
|
||||
public const int TRANSPARENT = -1;
|
||||
public const int CLIENT = 1;
|
||||
public const int CAPTION = 2;
|
||||
}
|
||||
}
|
50
OnTopReplica/Native/HookMethods.cs
Normal file
|
@ -0,0 +1,50 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace OnTopReplica.Native {
|
||||
|
||||
/// <summary>
|
||||
/// Helpers for interop with native Windows hooks.
|
||||
/// </summary>
|
||||
static class HookMethods {
|
||||
|
||||
static HookMethods() {
|
||||
WM_SHELLHOOKMESSAGE = RegisterWindowMessage("SHELLHOOK");
|
||||
if (WM_SHELLHOOKMESSAGE == 0)
|
||||
Console.Error.WriteLine("Failed to register SHELLHOOK Windows message.");
|
||||
}
|
||||
|
||||
public static int WM_SHELLHOOKMESSAGE {
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public const int HSHELL_WINDOWACTIVATED = 4;
|
||||
public const int HSHELL_RUDEAPPACTIVATED = HSHELL_WINDOWACTIVATED | HSHELL_HIGHBIT;
|
||||
const int HSHELL_HIGHBIT = 0x8000;
|
||||
public const int HSHELL_WINDOWDESTROYED = 2;
|
||||
public const int HSHELL_WINDOWCREATED = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Registers the WM_ID for a window message.
|
||||
/// </summary>
|
||||
/// <param name="wndMessageName">Name of the window message.</param>
|
||||
[DllImport("User32.dll")]
|
||||
public static extern int RegisterWindowMessage(string wndMessageName);
|
||||
|
||||
/// <summary>
|
||||
/// Registers a window as a shell hook window.
|
||||
/// </summary>
|
||||
[DllImport("User32.dll")]
|
||||
public static extern bool RegisterShellHookWindow(IntPtr hwnd);
|
||||
|
||||
/// <summary>
|
||||
/// Deregisters a window as a shell hook window.
|
||||
/// </summary>
|
||||
[DllImport("User32.dll")]
|
||||
public static extern bool DeregisterShellHookWindow(IntPtr hwnd);
|
||||
|
||||
}
|
||||
}
|
78
OnTopReplica/Native/HotKeyMethods.cs
Normal file
|
@ -0,0 +1,78 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace OnTopReplica.Native {
|
||||
|
||||
[Flags]
|
||||
public enum HotKeyModifiers : int {
|
||||
Alt = 0x1,
|
||||
Control = 0x2,
|
||||
Shift = 0x4,
|
||||
Windows = 0x8
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Static native methods for HotKey management.
|
||||
/// </summary>
|
||||
static class HotKeyMethods {
|
||||
|
||||
public const int WM_HOTKEY = 0x312;
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern bool RegisterHotKey(IntPtr hWnd, int id, int fsModifiers, int vlc);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern bool UnregisterHotKey(IntPtr hWnd, int id);
|
||||
|
||||
/// <summary>
|
||||
/// Translates a key combination specification into key code values.
|
||||
/// </summary>
|
||||
/// <param name="hotkeySpec">Key combination specification (see remarks).</param>
|
||||
/// <param name="modifiers">Modifier values.</param>
|
||||
/// <param name="keys">Key values.</param>
|
||||
/// <remarks>
|
||||
/// Specification can contain one single key value (from the enumeration System.Windows.Forms.Keys)
|
||||
/// preceded by modifier strings (each one separated by a single '+').
|
||||
/// For instance:
|
||||
/// [CTRL]+[ALT]+A
|
||||
/// or
|
||||
/// [ALT]+[SHIFT]+O
|
||||
/// </remarks>
|
||||
public static void TranslateStringToKeyValues(string hotkeySpec, out int modifiers, out int keys) {
|
||||
if (string.IsNullOrEmpty(hotkeySpec))
|
||||
throw new ArgumentNullException();
|
||||
|
||||
modifiers = 0;
|
||||
keys = 0;
|
||||
|
||||
if (ExtractModifier(ref hotkeySpec, "[CTRL]+"))
|
||||
modifiers |= (int)HotKeyModifiers.Control;
|
||||
if (ExtractModifier(ref hotkeySpec, "[ALT]+"))
|
||||
modifiers |= (int)HotKeyModifiers.Alt;
|
||||
if (ExtractModifier(ref hotkeySpec, "[SHIFT]+"))
|
||||
modifiers |= (int)HotKeyModifiers.Shift;
|
||||
|
||||
//Attempt to translate last part (should be single key)
|
||||
try {
|
||||
var keyValue = Enum.Parse(typeof(Keys), hotkeySpec, true);
|
||||
keys = (int)keyValue;
|
||||
}
|
||||
catch (ArgumentException) {
|
||||
throw new ArgumentException("Couldn't parse key value '" + hotkeySpec + "'.");
|
||||
}
|
||||
}
|
||||
|
||||
private static bool ExtractModifier(ref string spec, string modifier) {
|
||||
int modIndex = spec.IndexOf(modifier);
|
||||
if (modIndex == -1)
|
||||
return false;
|
||||
|
||||
spec = spec.Remove(modIndex, modifier.Length);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
45
OnTopReplica/Native/ITaskBarList.cs
Normal file
|
@ -0,0 +1,45 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace OnTopReplica.Native {
|
||||
[ComImport,
|
||||
Guid("56fdf342-fd6d-11d0-958a-006097c9a090"),
|
||||
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
public interface ITaskbarList {
|
||||
/// <summary>
|
||||
/// Initializes the taskbar list object. This method must be called before any other ITaskbarList methods can be called.
|
||||
/// </summary>
|
||||
void HrInit();
|
||||
|
||||
/// <summary>
|
||||
/// Adds an item to the taskbar.
|
||||
/// </summary>
|
||||
/// <param name="hWnd">A handle to the window to be added to the taskbar.</param>
|
||||
void AddTab([In] IntPtr hWnd);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes an item from the taskbar.
|
||||
/// </summary>
|
||||
/// <param name="hWnd">A handle to the window to be deleted from the taskbar.</param>
|
||||
void DeleteTab([In] IntPtr hWnd);
|
||||
|
||||
/// <summary>
|
||||
/// Activates an item on the taskbar. The window is not actually activated; the window's item on the taskbar is merely displayed as active.
|
||||
/// </summary>
|
||||
/// <param name="hWnd">A handle to the window on the taskbar to be displayed as active.</param>
|
||||
void ActivateTab([In] IntPtr hWnd);
|
||||
|
||||
/// <summary>
|
||||
/// Marks a taskbar item as active but does not visually activate it.
|
||||
/// </summary>
|
||||
/// <param name="hWnd">A handle to the window to be marked as active.</param>
|
||||
void SetActiveAlt([In] IntPtr hWnd);
|
||||
}
|
||||
|
||||
[ComImport]
|
||||
[Guid("56fdf344-fd6d-11d0-958a-006097c9a090")]
|
||||
public class CoTaskbarList {
|
||||
}
|
||||
}
|
25
OnTopReplica/Native/InputMethods.cs
Normal file
|
@ -0,0 +1,25 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace OnTopReplica.Native {
|
||||
static class InputMethods {
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
static extern short GetKeyState(VirtualKeyState nVirtKey);
|
||||
|
||||
const int KeyToggled = 0x1;
|
||||
|
||||
const int KeyPressed = 0x8000;
|
||||
|
||||
public static bool IsKeyPressed(VirtualKeyState virtKey) {
|
||||
return (GetKeyState(virtKey) & KeyPressed) != 0;
|
||||
}
|
||||
|
||||
public static bool IsKeyToggled(VirtualKeyState virtKey) {
|
||||
return (GetKeyState(virtKey) & KeyToggled) != 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
14
OnTopReplica/Native/MK.cs
Normal file
|
@ -0,0 +1,14 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OnTopReplica.Native {
|
||||
/// <summary>
|
||||
/// Native Mouse click codes.
|
||||
/// </summary>
|
||||
static class MK {
|
||||
public const int LBUTTON = 0x0001;
|
||||
public const int RBUTTON = 0x0002;
|
||||
public const int MBUTTON = 0x0010;
|
||||
}
|
||||
}
|