Browse Source

Fixed SD2-1632 - Fullscreen mode not implemented in WpfWorkbench

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5465 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
Daniel Grunwald 16 years ago
parent
commit
87a4d497b0
  1. 1
      src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
  2. 3
      src/Main/Base/Project/Src/Commands/ToolsCommands.cs
  3. 5
      src/Main/Base/Project/Src/Gui/IWorkbench.cs
  4. 76
      src/Main/Base/Project/Src/Gui/Workbench/FullScreenEnabledWindow.cs
  5. 2
      src/Main/Base/Project/Src/Gui/Workbench/WpfWorkbench.cs
  6. 23
      src/Main/Base/Project/Src/Gui/Workbench/WpfWorkbench.xaml

1
src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj

@ -202,6 +202,7 @@ @@ -202,6 +202,7 @@
<Compile Include="Src\Gui\Pads\ProjectBrowser\TreeNodes\DirectoryNodeFactory.cs" />
<Compile Include="Src\Gui\Pads\TaskList\TaskListPadCommands.cs" />
<Compile Include="Src\Gui\Pads\ToolsPad.cs" />
<Compile Include="Src\Gui\Workbench\FullScreenEnabledWindow.cs" />
<Compile Include="Src\Gui\Workbench\Layouts\AvalonDockLayout.cs" />
<Compile Include="Src\Gui\Workbench\Layouts\AvalonPadContent.cs" />
<Compile Include="Src\Gui\Workbench\Layouts\AvalonWorkbenchWindow.cs" />

3
src/Main/Base/Project/Src/Commands/ToolsCommands.cs

@ -46,8 +46,7 @@ namespace ICSharpCode.SharpDevelop.Commands @@ -46,8 +46,7 @@ namespace ICSharpCode.SharpDevelop.Commands
{
public override void Run()
{
throw new NotImplementedException();
// ((DefaultWorkbench)WorkbenchSingleton.Workbench).FullScreen = !((DefaultWorkbench)WorkbenchSingleton.Workbench).FullScreen;
WorkbenchSingleton.Workbench.FullScreen = !WorkbenchSingleton.Workbench.FullScreen;
}
}
}

5
src/Main/Base/Project/Src/Gui/IWorkbench.cs

@ -35,6 +35,11 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -35,6 +35,11 @@ namespace ICSharpCode.SharpDevelop.Gui
/// </summary>
Window MainWindow { get; }
/// <summary>
/// Gets/Sets whether the window is displayed in full-screen mode.
/// </summary>
bool FullScreen { get; set; }
/// <summary>
/// The title shown in the title bar.
/// </summary>

76
src/Main/Base/Project/Src/Gui/Workbench/FullScreenEnabledWindow.cs

@ -0,0 +1,76 @@ @@ -0,0 +1,76 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Daniel Grunwald"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Windows;
using System.Windows.Forms;
using System.Windows.Interop;
namespace ICSharpCode.SharpDevelop.Gui
{
using WindowState = System.Windows.WindowState;
/// <summary>
///
/// </summary>
class FullScreenEnabledWindow : Window
{
public static readonly DependencyProperty FullScreenProperty =
DependencyProperty.Register("FullScreen", typeof(bool), typeof(FullScreenEnabledWindow));
public bool FullScreen {
get { return (bool)GetValue(FullScreenProperty); }
set { SetValue(FullScreenProperty, value); }
}
System.Windows.WindowState previousWindowState = WindowState.Maximized;
double oldLeft, oldTop, oldWidth, oldHeight;
protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
{
base.OnPropertyChanged(e);
if (e.Property == FullScreenProperty) {
if ((bool)e.NewValue) {
// enable fullscreen mode
// remember previous window state
if (this.WindowState == WindowState.Normal || this.WindowState == WindowState.Maximized)
previousWindowState = this.WindowState;
oldLeft = this.Left;
oldTop = this.Top;
oldWidth = this.Width;
oldHeight = this.Height;
WindowInteropHelper interop = new WindowInteropHelper(this);
interop.EnsureHandle();
Screen screen = Screen.FromHandle(interop.Handle);
Rect bounds = screen.Bounds.ToWpf().TransformFromDevice(this);
this.ResizeMode = ResizeMode.NoResize;
this.Left = bounds.Left;
this.Top = bounds.Top;
this.Width = bounds.Width;
this.Height = bounds.Height;
this.WindowState = WindowState.Normal;
this.WindowStyle = WindowStyle.None;
} else {
ClearValue(WindowStyleProperty);
ClearValue(ResizeModeProperty);
ClearValue(MaxWidthProperty);
ClearValue(MaxHeightProperty);
this.WindowState = previousWindowState;
this.Left = oldLeft;
this.Top = oldTop;
this.Width = oldWidth;
this.Height = oldHeight;
}
}
}
}
}

2
src/Main/Base/Project/Src/Gui/Workbench/WpfWorkbench.cs

@ -28,7 +28,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -28,7 +28,7 @@ namespace ICSharpCode.SharpDevelop.Gui
/// <summary>
/// Workbench implementation using WPF and AvalonDock.
/// </summary>
sealed partial class WpfWorkbench : Window, IWorkbench, System.Windows.Forms.IWin32Window
sealed partial class WpfWorkbench : FullScreenEnabledWindow, IWorkbench, System.Windows.Forms.IWin32Window
{
const string mainMenuPath = "/SharpDevelop/Workbench/MainMenu";
const string viewContentPath = "/SharpDevelop/Workbench/Pads";

23
src/Main/Base/Project/Src/Gui/Workbench/WpfWorkbench.xaml

@ -1,12 +1,15 @@ @@ -1,12 +1,15 @@
<Window x:Class = "ICSharpCode.SharpDevelop.Gui.WpfWorkbench"
xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x = "http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:core = "http://icsharpcode.net/sharpdevelop/core"
Title = "{core:Localize MainWindow.DialogName}"
WindowStartupLocation = "Manual"
Background = "{DynamicResource {x:Static SystemColors.ControlBrushKey}}"
AllowDrop = "True"
Style = "{x:Static core:GlobalStyles.WindowStyle}"
<gui:FullScreenEnabledWindow
x:Class = "ICSharpCode.SharpDevelop.Gui.WpfWorkbench"
x:ClassModifier = "internal"
xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x = "http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:core = "http://icsharpcode.net/sharpdevelop/core"
xmlns:gui = "clr-namespace:ICSharpCode.SharpDevelop.Gui"
Title = "{core:Localize MainWindow.DialogName}"
WindowStartupLocation = "Manual"
Background = "{DynamicResource {x:Static SystemColors.ControlBrushKey}}"
AllowDrop = "True"
Style = "{x:Static core:GlobalStyles.WindowStyle}"
>
<DockPanel Name="dockPanel">
<Menu Name="mainMenu" DockPanel.Dock="Top"/>
@ -14,4 +17,4 @@ @@ -14,4 +17,4 @@
<!-- Statusbar will be inserted here (index: Count-2) -->
<ContentPresenter Name="mainContent" />
</DockPanel>
</Window>
</gui:FullScreenEnabledWindow>
Loading…
Cancel
Save