• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

githubのコードからのfolk


Commit MetaInfo

Revisione83c570f4856660bbb120998546333aa4308a43f (tree)
Time2011-02-27 01:24:38
Authorsr55 <sr55@b64f...>
Commitersr55

Log Message

WinGui:
- Started designing the Picture Settings Panel
- Added a WindowManager.

git-svn-id: svn://localhost/HandBrake/trunk@3810 b64f7644-9d1e-0410-96f1-a4d463321fa5

Change Summary

Incremental Difference

--- a/win/C#/HandBrakeWPF/App.xaml.cs
+++ b/win/C#/HandBrakeWPF/App.xaml.cs
@@ -5,8 +5,10 @@
55
66 namespace HandBrakeWPF
77 {
8+ using Caliburn.PresentationFramework;
89 using Caliburn.PresentationFramework.ApplicationModel;
910
11+ using HandBrakeWPF.Services;
1012 using HandBrakeWPF.ViewModels;
1113
1214 /// <summary>
@@ -37,12 +39,18 @@ namespace HandBrakeWPF
3739 /// </returns>
3840 protected override object CreateRootModel()
3941 {
40- var binder = (DefaultBinder)Container.GetInstance<IBinder>();
42+ var binder = (DefaultBinder)Container.GetInstance<DefaultBinder>();
4143
4244 binder.EnableBindingConventions();
4345 binder.EnableMessageConventions();
4446
45- return new MainViewModel();
47+ return Container.GetInstance<MainViewModel>();
48+ }
49+
50+
51+ protected override void ConfigurePresentationFramework(PresentationFrameworkModule module)
52+ {
53+ module.UsingWindowManager<WindowManager>();
4654 }
4755 }
4856 }
--- a/win/C#/HandBrakeWPF/HandBrakeWPF.csproj
+++ b/win/C#/HandBrakeWPF/HandBrakeWPF.csproj
@@ -61,12 +61,16 @@
6161 <Reference Include="WindowsBase" />
6262 <Reference Include="PresentationCore" />
6363 <Reference Include="PresentationFramework" />
64+ <Reference Include="WPFToolkit.Extended">
65+ <HintPath>..\libraries\WPFToolkit.Extended.dll</HintPath>
66+ </Reference>
6467 </ItemGroup>
6568 <ItemGroup>
6669 <ApplicationDefinition Include="App.xaml">
6770 <Generator>MSBuild:Compile</Generator>
6871 <SubType>Designer</SubType>
6972 </ApplicationDefinition>
73+ <Compile Include="Services\WindowManager.cs" />
7074 <Compile Include="ViewModels\AboutViewModel.cs" />
7175 <Compile Include="ViewModels\AddPresetViewModel.cs" />
7276 <Compile Include="ViewModels\PreviewViewModel.cs" />
@@ -205,7 +209,6 @@
205209 </ItemGroup>
206210 <ItemGroup>
207211 <Folder Include="Model\" />
208- <Folder Include="Services\" />
209212 </ItemGroup>
210213 <ItemGroup>
211214 <Resource Include="Views\Images\ActivityWindow.png" />
--- /dev/null
+++ b/win/C#/HandBrakeWPF/Services/WindowManager.cs
@@ -0,0 +1,40 @@
1+namespace HandBrakeWPF.Services
2+{
3+ using System;
4+ using System.Windows;
5+
6+ using Caliburn.PresentationFramework.ApplicationModel;
7+
8+ public class WindowManager : DefaultWindowManager, IWindowManager
9+ {
10+
11+ public WindowManager(IViewStrategy viewStrategy, IBinder binder)
12+
13+ : base(viewStrategy, binder)
14+ {
15+ }
16+
17+ //Display a view in a dialog (modal) window
18+ public new bool? ShowDialog(object rootModel, object context, Action<ISubordinate, Action> handleShutdownModel)
19+ {
20+ var window = base.CreateWindow(rootModel, true, context, handleShutdownModel);
21+ window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
22+ window.WindowStyle = WindowStyle.ToolWindow;
23+ window.ResizeMode = ResizeMode.NoResize;
24+ window.Title = ((IPresenter)rootModel).DisplayName;
25+ return window.ShowDialog();
26+ }
27+
28+ //Display a view in a popup (non-modal) window
29+ public new void Show(object rootModel, object context, Action<ISubordinate, Action> handleShutdownModel)
30+ {
31+ var window = base.CreateWindow(rootModel, false, context, handleShutdownModel);
32+ window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
33+ window.Title = ((IPresenter)rootModel).DisplayName;
34+ window.ResizeMode = ResizeMode.NoResize;
35+ window.Show();
36+ }
37+
38+ }
39+
40+}
--- a/win/C#/HandBrakeWPF/ViewModels/AboutViewModel.cs
+++ b/win/C#/HandBrakeWPF/ViewModels/AboutViewModel.cs
@@ -5,10 +5,17 @@
55
66 namespace HandBrakeWPF.ViewModels
77 {
8+ using Microsoft.Practices.ServiceLocation;
9+
810 /// <summary>
911 /// The About View Model
1012 /// </summary>
1113 public class AboutViewModel : ViewModelBase
1214 {
15+ public AboutViewModel(IServiceLocator locator)
16+ : base(locator)
17+ {
18+ }
19+
1320 }
1421 }
--- a/win/C#/HandBrakeWPF/ViewModels/AddPresetViewModel.cs
+++ b/win/C#/HandBrakeWPF/ViewModels/AddPresetViewModel.cs
@@ -5,10 +5,16 @@
55
66 namespace HandBrakeWPF.ViewModels
77 {
8+ using Microsoft.Practices.ServiceLocation;
9+
810 /// <summary>
911 /// The Add Preset View Model
1012 /// </summary>
1113 public class AddPresetViewModel : ViewModelBase
1214 {
15+ public AddPresetViewModel(IServiceLocator locator)
16+ : base(locator)
17+ {
18+ }
1319 }
1420 }
--- a/win/C#/HandBrakeWPF/ViewModels/MainViewModel.cs
+++ b/win/C#/HandBrakeWPF/ViewModels/MainViewModel.cs
@@ -16,6 +16,8 @@ namespace HandBrakeWPF.ViewModels
1616 using HandBrake.ApplicationServices.Services;
1717 using HandBrake.ApplicationServices.Services.Interfaces;
1818
19+ using Microsoft.Practices.ServiceLocation;
20+
1921 /// <summary>
2022 /// HandBrakes Main Window
2123 /// </summary>
@@ -55,10 +57,10 @@ namespace HandBrakeWPF.ViewModels
5557
5658 #endregion
5759
58- /// <summary>
59- /// Initializes a new instance of the <see cref="MainViewModel"/> class.
60- /// </summary>
61- public MainViewModel()
60+ #region Properties
61+
62+ public MainViewModel(IServiceLocator locator)
63+ : base(locator)
6264 {
6365 // Setup Services (TODO - Bring Castle back into the project to wire these up for us)
6466 this.scanService = File.Exists("hb.dll") ? (IScan)new LibScan() : new ScanService();
@@ -79,7 +81,6 @@ namespace HandBrakeWPF.ViewModels
7981 this.queueProcessor.EncodeService.EncodeStatusChanged += this.EncodeStatusChanged;
8082 }
8183
82- #region Properties
8384 /// <summary>
8485 /// Gets or sets TestProperty.
8586 /// </summary>
@@ -185,6 +186,14 @@ namespace HandBrakeWPF.ViewModels
185186 base.Shutdown();
186187 }
187188
189+
190+ #region Menu and Taskbar
191+
192+ public void AboutApplication()
193+ {
194+ this.ShowDialog<AboutViewModel>();
195+ }
196+
188197 /// <summary>
189198 /// Shutdown the Application
190199 /// </summary>
@@ -193,6 +202,9 @@ namespace HandBrakeWPF.ViewModels
193202 Application.Current.Shutdown();
194203 }
195204
205+ #endregion
206+
207+
196208 #region Event Handlers
197209 /// <summary>
198210 /// Handle the Scan Status Changed Event.
--- a/win/C#/HandBrakeWPF/ViewModels/OptionsViewModel.cs
+++ b/win/C#/HandBrakeWPF/ViewModels/OptionsViewModel.cs
@@ -5,10 +5,16 @@
55
66 namespace HandBrakeWPF.ViewModels
77 {
8+ using Microsoft.Practices.ServiceLocation;
9+
810 /// <summary>
911 /// The Options View Model
1012 /// </summary>
1113 public class OptionsViewModel : ViewModelBase
1214 {
15+ public OptionsViewModel(IServiceLocator locator)
16+ : base(locator)
17+ {
18+ }
1319 }
1420 }
--- a/win/C#/HandBrakeWPF/ViewModels/PreviewViewModel.cs
+++ b/win/C#/HandBrakeWPF/ViewModels/PreviewViewModel.cs
@@ -5,10 +5,16 @@
55
66 namespace HandBrakeWPF.ViewModels
77 {
8+ using Microsoft.Practices.ServiceLocation;
9+
810 /// <summary>
911 /// The About View Model
1012 /// </summary>
1113 public class PreviewViewModel : ViewModelBase
1214 {
15+ public PreviewViewModel(IServiceLocator locator)
16+ : base(locator)
17+ {
18+ }
1319 }
1420 }
--- a/win/C#/HandBrakeWPF/ViewModels/QueueViewModel.cs
+++ b/win/C#/HandBrakeWPF/ViewModels/QueueViewModel.cs
@@ -5,10 +5,16 @@
55
66 namespace HandBrakeWPF.ViewModels
77 {
8+ using Microsoft.Practices.ServiceLocation;
9+
810 /// <summary>
911 /// The Preview View Model
1012 /// </summary>
1113 public class QueueViewModel : ViewModelBase
1214 {
15+ public QueueViewModel(IServiceLocator locator)
16+ : base(locator)
17+ {
18+ }
1319 }
1420 }
--- a/win/C#/HandBrakeWPF/ViewModels/ViewModelBase.cs
+++ b/win/C#/HandBrakeWPF/ViewModels/ViewModelBase.cs
@@ -1,12 +1,35 @@
11 namespace HandBrakeWPF.ViewModels
22 {
3- using Caliburn.Core;
43 using Caliburn.PresentationFramework.ApplicationModel;
54
5+ using Microsoft.Practices.ServiceLocation;
6+
67 /// <summary>
78 /// A Base Class for the View Models which contains reusable code.
89 /// </summary>
910 public class ViewModelBase : MultiPresenterManager
1011 {
12+ protected IServiceLocator Locator { get; private set; }
13+
14+ public ViewModelBase(IServiceLocator locator)
15+ {
16+ this.Locator = locator;
17+ }
18+
19+ public void Show<T>() where T : IPresenter
20+ {
21+ this.ShutdownCurrent();
22+ this.Open(Locator.GetInstance<T>());
23+ }
24+
25+ public void ShowDialog<T>() where T : IPresenter
26+ {
27+ Locator.GetInstance<IWindowManager>().ShowDialog(Locator.GetInstance<T>());
28+ }
29+
30+ public void Popup<T>() where T : IPresenter
31+ {
32+ Locator.GetInstance<IWindowManager>().Show(Locator.GetInstance<T>());
33+ }
1134 }
1235 }
--- a/win/C#/HandBrakeWPF/Views/AboutView.xaml
+++ b/win/C#/HandBrakeWPF/Views/AboutView.xaml
@@ -1,7 +1,6 @@
11 <Window x:Class="HandBrakeWPF.Views.AboutView"
22 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4- Title="AboutView" Height="268" Width="511">
3+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:PresentationFramework="clr-namespace:Caliburn.PresentationFramework;assembly=Caliburn.PresentationFramework" Title="AboutView" Height="268" Width="511">
54
65 <StackPanel Orientation="Horizontal">
76 <Image Source="Images/logo64.png" Width="64" Height="64" SnapsToDevicePixels="True" Margin="10,10,10,10" HorizontalAlignment="Left" VerticalAlignment="Top" />
@@ -11,15 +10,16 @@
1110 <Label Content="Copyright 2003-2011 HandBrake Team" />
1211
1312 <Label Content="License:" />
14- <TextBox IsEnabled="False" Width="380" Height="100" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" Margin="10,0,10,10">
13+ <TextBox Width="380" Height="100" IsReadOnly="True" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" Margin="10,0,10,10">
1514 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
1615
1716 This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
1817
1918 You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2019 </TextBox>
21-
22- <Button Content="OK" HorizontalAlignment="Right" Padding="10,2" Margin="0,0,10,10"></Button>
20+
21+ <Button Content="OK" PresentationFramework:Message.Attach="[Event Click] = [Action Close]"
22+ HorizontalAlignment="Right" Padding="10,2" Margin="0,0,10,10" />
2323
2424 </StackPanel>
2525
--- a/win/C#/HandBrakeWPF/Views/Controls/PictureSettingsView.xaml
+++ b/win/C#/HandBrakeWPF/Views/Controls/PictureSettingsView.xaml
@@ -3,9 +3,100 @@
33 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
55 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6- mc:Ignorable="d"
7- d:DesignHeight="300" d:DesignWidth="300">
8- <Grid Background="Beige">
6+ xmlns:Controls="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit.Extended"
7+ >
8+
9+ <StackPanel Orientation="Horizontal" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
10+
11+ <!-- Size Panel-->
12+ <StackPanel Name="SizePanel" Orientation="Vertical" >
13+ <Label Content="Size" FontWeight="Bold" />
14+
15+ <!-- Row 1-->
16+ <StackPanel Orientation="Horizontal" Margin="5,0,5,0">
17+ <Label Content="Source" Grid.Row="0" Grid.Column="0" />
18+ <Label Content="---" Name="sourceResolution" Grid.Row="0" Grid.Column="1" />
19+ </StackPanel>
20+
21+ <!-- Row 2-->
22+ <StackPanel Orientation="Horizontal" Margin="5,0,5,0">
23+ <Label Content="Width:" Grid.Row="1" Grid.Column="0" />
24+ <Controls:NumericUpDown Name="width" Minimum="0" Grid.Row="1" Grid.Column="1" Width="45" />
25+ <Label Content="Height:" Grid.Row="1" Grid.Column="2" />
26+ <Controls:NumericUpDown Name="height" Minimum="0" Grid.Row="1" Grid.Column="3" Width="45" />
27+ <CheckBox Content="Keep Aspect Ratio" VerticalAlignment="Center" Margin="5,0,0,0" />
28+ </StackPanel>
29+
30+ <!-- Row 3-->
31+ <Grid Margin="5,15,5,0">
32+ <Grid.RowDefinitions>
33+ <RowDefinition Height="Auto" />
34+ <RowDefinition Height="Auto" />
35+ <RowDefinition Height="Auto" />
36+ <RowDefinition Height="Auto" />
37+ <RowDefinition Height="Auto" />
38+ <RowDefinition Height="Auto" />
39+ </Grid.RowDefinitions>
40+
41+ <Grid.ColumnDefinitions>
42+ <ColumnDefinition Width="Auto" />
43+ <ColumnDefinition Width="Auto" />
44+ </Grid.ColumnDefinitions>
45+
46+ <Label Content="Anamorphic:" Grid.Row="0" Grid.Column="0" />
47+ <Label Content="Modulus:" Grid.Row="1" Grid.Column="0" />
48+ <Label Content="Display Width:" Grid.Row="2" Grid.Column="0" />
49+ <Label Content="PAR Width:" Grid.Row="3" Grid.Column="0" />
50+ <Label Content="PAR Height:" Grid.Row="4" Grid.Column="0" />
51+ <Label Content="Display Size:" Grid.Row="5" Grid.Column="0" />
52+
53+ <ComboBox Width="110" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Left" Margin="0,0,0,5" />
54+ <ComboBox Width="110" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left" Margin="0,0,0,5" />
55+ <Controls:NumericUpDown Width="45" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left" Margin="0,0,0,5" />
56+ <Controls:NumericUpDown Width="45" Grid.Row="3" Grid.Column="1" HorizontalAlignment="Left" Margin="0,0,0,5" />
57+ <Controls:NumericUpDown Width="45" Grid.Row="4" Grid.Column="1" HorizontalAlignment="Left" Margin="0,0,0,5" />
58+ <Label Content="---" Grid.Row="5" Grid.Column="1" HorizontalAlignment="Left" Margin="0,0,0,5" />
59+ </Grid>
60+ </StackPanel>
61+
62+
63+ <StackPanel Name="CropPanel" Margin="50,0,0,0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
64+ <Label Content="Cropping" FontWeight="Bold" />
65+ <RadioButton Content="Automatic" Margin="10,0,0,0"/>
66+ <RadioButton Content="Custom" Margin="10,0,0,0" />
967
10- </Grid>
68+ <Grid Margin="0,10,0,0">
69+ <Grid.RowDefinitions>
70+ <RowDefinition Height="Auto" />
71+ <RowDefinition Height="Auto" />
72+ <RowDefinition Height="Auto" />
73+ <RowDefinition Height="Auto" />
74+ <RowDefinition Height="Auto" />
75+ </Grid.RowDefinitions>
76+
77+ <Grid.ColumnDefinitions>
78+ <ColumnDefinition Width="Auto" />
79+ <ColumnDefinition Width="Auto" />
80+ <ColumnDefinition Width="Auto" />
81+ <ColumnDefinition Width="Auto" />
82+ <ColumnDefinition Width="Auto" />
83+ </Grid.ColumnDefinitions>
84+
85+ <Label Content="Top" Grid.Row="0" Grid.Column="2" VerticalAlignment="Center" />
86+ <Label Content="Bottom" Grid.Row="4" Grid.Column="2" VerticalAlignment="Center" />
87+ <Label Content="Left" Grid.Row="2" Grid.Column="0" HorizontalAlignment="Center" />
88+ <Label Content="Right" Grid.Row="2" Grid.Column="4" HorizontalAlignment="Center" />
89+
90+ <Controls:NumericUpDown Width="45" Grid.Row="1" Grid.Column="2" HorizontalAlignment="Left" Margin="0,0,0,5" />
91+ <Controls:NumericUpDown Width="45" Grid.Row="3" Grid.Column="2" HorizontalAlignment="Left" Margin="0,0,0,5" />
92+ <Controls:NumericUpDown Width="45" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left" Margin="0,0,0,5" />
93+ <Controls:NumericUpDown Width="45" Grid.Row="2" Grid.Column="3" HorizontalAlignment="Left" Margin="0,0,0,5" />
94+
95+ </Grid>
96+
97+
98+ </StackPanel>
99+
100+
101+ </StackPanel>
11102 </UserControl>
--- a/win/C#/HandBrakeWPF/Views/MainView.xaml
+++ b/win/C#/HandBrakeWPF/Views/MainView.xaml
@@ -18,26 +18,26 @@
1818 </MenuItem>
1919
2020 <MenuItem Header="Tools">
21- <MenuItem Header="Show Queue" />
22- <MenuItem Header="Activity Window" />
21+ <MenuItem Header="Show Queue" PresentationFramework:Message.Attach="[Event Click] = [Action ExitApplication]" />
22+ <MenuItem Header="Activity Window" PresentationFramework:Message.Attach="[Event Click] = [Action ExitApplication]" />
2323 </MenuItem>
2424
2525 <MenuItem Header="Presets">
26- <MenuItem Header="Reset Built-in Presets" />
27- <MenuItem Header="Delete Built-in Presets" />
26+ <MenuItem Header="Reset Built-in Presets" PresentationFramework:Message.Attach="[Event Click] = [Action ExitApplication]" />
27+ <MenuItem Header="Delete Built-in Presets" PresentationFramework:Message.Attach="[Event Click] = [Action ExitApplication]" />
2828 <Separator />
29- <MenuItem Header="Save As New Preset" />
30- <MenuItem Header="Import" />
31- <MenuItem Header="Export" />
32- <MenuItem Header="Set as Default" />
29+ <MenuItem Header="Save As New Preset" PresentationFramework:Message.Attach="[Event Click] = [Action ExitApplication]" />
30+ <MenuItem Header="Import" PresentationFramework:Message.Attach="[Event Click] = [Action ExitApplication]" />
31+ <MenuItem Header="Export" PresentationFramework:Message.Attach="[Event Click] = [Action ExitApplication]" />
32+ <MenuItem Header="Set as Default" PresentationFramework:Message.Attach="[Event Click] = [Action ExitApplication]" />
3333 </MenuItem>
3434
3535 <MenuItem Header="Help">
36- <MenuItem Header="HandBrake User Guide" />
36+ <MenuItem Header="HandBrake User Guide" PresentationFramework:Message.Attach="[Event Click] = [Action ExitApplication]" />
3737 <Separator />
38- <MenuItem Header="Check for Updates" />
38+ <MenuItem Header="Check for Updates" PresentationFramework:Message.Attach="[Event Click] = [Action ExitApplication]" />
3939 <Separator />
40- <MenuItem Header="About..." />
40+ <MenuItem Header="About..." PresentationFramework:Message.Attach="[Event Click] = [Action AboutApplication]" />
4141 </MenuItem>
4242 </Menu>
4343
@@ -144,7 +144,7 @@
144144 <!-- Tab Control -->
145145 <TabControl HorizontalAlignment="Left" VerticalAlignment="Stretch" Width="725" Height="330" Margin="10,10,10,10" Name="tabControl" >
146146 <TabItem Header="Picture" Name="pictureTab">
147- <Views:PictureSettingsView></Views:PictureSettingsView>
147+ <Views:PictureSettingsView x:Name="pictureSettingsView"></Views:PictureSettingsView>
148148 </TabItem>
149149 <TabItem Header="Video Filters" Name="filtersTab">
150150 <Views:FiltersView></Views:FiltersView>