Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzCK committed Oct 15, 2013
1 parent 11cf162 commit 1ab262d
Show file tree
Hide file tree
Showing 28 changed files with 2,704 additions and 118 deletions.
5 changes: 2 additions & 3 deletions .hgignore
Expand Up @@ -5,6 +5,5 @@ glob:publish/*
glob:*Thumbs.db
glob:*.psd
glob:Installer/OnTopReplica-Setup.exe
syntax: glob
*.Designer.cs
*.suo
glob:*.Designer.cs
glob:*.suo
Binary file added Graphics/Raster/help.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Graphics/Raster/minimize.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Graphics/Vector/help.psd
Binary file not shown.
Binary file added Graphics/Vector/minimize.psd
Binary file not shown.
2 changes: 2 additions & 0 deletions Installer/wix-compile.bat
@@ -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 changes: 71 additions & 0 deletions Installer/wix-package.wxs
@@ -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>
117 changes: 117 additions & 0 deletions OnTopReplica/FullscreenFormManager.cs
@@ -0,0 +1,117 @@
using OnTopReplica.Properties;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace OnTopReplica {
class FullscreenFormManager {

private readonly MainForm _mainForm;

public FullscreenFormManager(MainForm form) {
_mainForm = form;
IsFullscreen = false;
}

Point _preFullscreenLocation;
Size _preFullscreenSize;
FormBorderStyle _preFullscreenBorderStyle;

public bool IsFullscreen {
get;
private set;
}

public void SwitchFullscreen() {
SwitchFullscreen(Settings.Default.GetFullscreenMode());
}

public void SwitchFullscreen(FullscreenMode mode) {
if (IsFullscreen) {
MoveToFullscreenMode(mode);
return;
}

if (!_mainForm.ThumbnailPanel.IsShowingThumbnail)
return;

//On switch, always hide side panels
_mainForm.CloseSidePanel();

//Store state
_preFullscreenLocation = _mainForm.Location;
_preFullscreenSize = _mainForm.ClientSize;
_preFullscreenBorderStyle = _mainForm.FormBorderStyle;

//Change state to fullscreen
_mainForm.FormBorderStyle = FormBorderStyle.None;
MoveToFullscreenMode(mode);

CommonCompleteSwitch(true);
}

private void MoveToFullscreenMode(FullscreenMode mode) {
var screens = Screen.AllScreens;

var currentScreen = Screen.FromControl(_mainForm);
Size size = _mainForm.Size;
Point location = _mainForm.Location;

switch (mode) {
case FullscreenMode.Standard:
default:
size = currentScreen.WorkingArea.Size;
location = currentScreen.WorkingArea.Location;
break;

case FullscreenMode.Fullscreen:
size = currentScreen.Bounds.Size;
location = currentScreen.Bounds.Location;
break;

case FullscreenMode.AllScreens:
size = SystemInformation.VirtualScreen.Size;
location = SystemInformation.VirtualScreen.Location;
break;
}

_mainForm.Size = size;
_mainForm.Location = location;
}

public void SwitchBack() {
if (!IsFullscreen)
return;

//Restore state
_mainForm.FormBorderStyle = _preFullscreenBorderStyle;
_mainForm.Location = _preFullscreenLocation;
_mainForm.ClientSize = _preFullscreenSize;
_mainForm.RefreshAspectRatio();

CommonCompleteSwitch(false);
}

private void CommonCompleteSwitch(bool enabled) {
//UI stuff switching
_mainForm.GlassEnabled = !enabled;
_mainForm.TopMost = !enabled;
_mainForm.HandleMouseMove = !enabled;

IsFullscreen = enabled;

Program.Platform.OnFormStateChange(_mainForm);
}

public void Toggle() {
if (IsFullscreen)
SwitchBack();
else
SwitchFullscreen(Settings.Default.GetFullscreenMode());
}

}
}
39 changes: 39 additions & 0 deletions OnTopReplica/FullscreenMode.cs
@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using OnTopReplica.Properties;

namespace OnTopReplica {
/// <summary>
/// Describes a fullscreen mode.
/// </summary>
enum FullscreenMode {
Standard,
Fullscreen,
AllScreens
}

static class FullscreenModeExtensions {

/// <summary>
/// Gets the fullscreen mode as an enumeration value.
/// </summary>
public static FullscreenMode GetFullscreenMode(this Settings settings) {
FullscreenMode retMode = FullscreenMode.Standard;

Enum.TryParse<FullscreenMode>(settings.FullscreenMode, out retMode);

return retMode;
}

/// <summary>
/// Sets the fullscreen mode.
/// </summary>
public static void SetFullscreenMode(this Settings settings, FullscreenMode mode) {
settings.FullscreenMode = mode.ToString();
}

}
}

0 comments on commit 1ab262d

Please sign in to comment.