Browse Source

Move NumericUpDown and ZoomScrollViewer to SharpDevelop.Widgets.

Remove WPF designer's copy of NumericUpDown and ZoomControl and use SD.Widgets instead.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5659 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
Daniel Grunwald 15 years ago
parent
commit
58fb57ce24
  1. 4
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/themes/generic.xaml
  2. 74
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ControlStyles.xaml
  3. 309
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/NumericUpDown.cs
  4. 149
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/NumericUpDown.xaml
  5. 188
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ZoomControl.cs
  6. 2
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignSurface.xaml
  7. 2
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignSurface.xaml.cs
  8. 3
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BrushEditor/BrushEditorView.xaml
  9. 447
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BrushEditor/ColorPicker.xaml
  10. 6
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/NumberEditor.xaml
  11. 12
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/WpfDesign.Designer.csproj
  12. 3
      src/AddIns/Misc/StartPage/Project/StartPage.csproj
  13. 14
      src/AddIns/Misc/UsageDataCollector/UsageDataCollector.AddIn/StartPageMessage.xaml
  14. 5
      src/AddIns/Misc/UsageDataCollector/UsageDataCollector.AddIn/UsageDataCollector.AddIn.csproj
  15. 3
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/IDEOptions/ProjectAndSolutionOptions.xaml
  16. 21
      src/Main/ICSharpCode.Core.Presentation/ICSharpCode.Core.Presentation.csproj
  17. 39
      src/Main/ICSharpCode.Core.Presentation/themes/generic.xaml
  18. 2
      src/Main/ICSharpCode.SharpDevelop.Widgets/Project/CollapsiblePanel.cs
  19. 10
      src/Main/ICSharpCode.SharpDevelop.Widgets/Project/Configuration/AssemblyInfo.cs
  20. 2
      src/Main/ICSharpCode.SharpDevelop.Widgets/Project/DragListener.cs
  21. 34
      src/Main/ICSharpCode.SharpDevelop.Widgets/Project/ICSharpCode.SharpDevelop.Widgets.csproj
  22. 0
      src/Main/ICSharpCode.SharpDevelop.Widgets/Project/Images/ZoomIn.png
  23. 0
      src/Main/ICSharpCode.SharpDevelop.Widgets/Project/Images/ZoomOut.png
  24. 2
      src/Main/ICSharpCode.SharpDevelop.Widgets/Project/NumericUpDown.cs
  25. 2
      src/Main/ICSharpCode.SharpDevelop.Widgets/Project/NumericUpDown.xaml
  26. 2
      src/Main/ICSharpCode.SharpDevelop.Widgets/Project/ZoomButtons.cs
  27. 33
      src/Main/ICSharpCode.SharpDevelop.Widgets/Project/ZoomScrollViewer.cs
  28. 4
      src/Main/ICSharpCode.SharpDevelop.Widgets/Project/ZoomScrollViewer.xaml
  29. 43
      src/Main/ICSharpCode.SharpDevelop.Widgets/Project/themes/generic.xaml

4
src/AddIns/DisplayBindings/AvalonEdit.AddIn/themes/generic.xaml

@ -1,14 +1,14 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ICSharpCode.AvalonEdit.AddIn" xmlns:local="clr-namespace:ICSharpCode.AvalonEdit.AddIn"
xmlns:core="http://icsharpcode.net/sharpdevelop/core" xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets"
> >
<Style TargetType="{x:Type local:SharpDevelopTextEditor}"> <Style TargetType="{x:Type local:SharpDevelopTextEditor}">
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" /> <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" />
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="{x:Type local:SharpDevelopTextEditor}"> <ControlTemplate TargetType="{x:Type local:SharpDevelopTextEditor}">
<core:ZoomScrollViewer <widgets:ZoomScrollViewer
Focusable="False" Focusable="False"
Name="PART_ScrollViewer" Name="PART_ScrollViewer"
MouseWheelZoom="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Options.MouseWheelZoom}" MouseWheelZoom="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Options.MouseWheelZoom}"

74
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ControlStyles.xaml

@ -5,80 +5,6 @@
This file contains the default styles used by the Controls in ICSharpCode.WpfDesign.Designer.Controls This file contains the default styles used by the Controls in ICSharpCode.WpfDesign.Designer.Controls
--> -->
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="NumericUpDown.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style x:Key="ZoomButtonStyle"
TargetType="RepeatButton">
<Setter Property="Delay"
Value="0" />
<Setter Property="Focusable"
Value="False" />
<Setter Property="Opacity"
Value="0.5" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RepeatButton">
<ContentPresenter Margin="5"/>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver"
Value="True">
<Setter Property="Opacity"
Value="1" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type Controls:ZoomControl}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Controls:ZoomControl}">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<Grid>
<ScrollViewer x:Name="scrollViewer"
HorizontalScrollBarVisibility="Visible"
VerticalScrollBarVisibility="Visible">
<ContentPresenter x:Name="container" />
</ScrollViewer>
<StackPanel Orientation="Vertical"
HorizontalAlignment="Left"
VerticalAlignment="Bottom"
Margin="3 0 0 20"
Background="#3000">
<RepeatButton x:Name="uxPlus"
Style="{StaticResource ZoomButtonStyle}">
<Image Source="../Images/ZoomIn.png"
Stretch="None"/>
</RepeatButton>
<RepeatButton x:Name="uxMinus"
Style="{StaticResource ZoomButtonStyle}">
<Image Source="../Images/ZoomOut.png"
Stretch="None" />
</RepeatButton>
<RepeatButton x:Name="uxReset"
Style="{StaticResource ZoomButtonStyle}">
<Border Background="#5000"
Width="16"
Height="16">
<TextBlock Foreground="White"
HorizontalAlignment="Center"
VerticalAlignment="Center">1</TextBlock>
</Border>
</RepeatButton>
</StackPanel>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type Controls:PanelMoveAdorner}"> <Style TargetType="{x:Type Controls:PanelMoveAdorner}">
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>

309
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/NumericUpDown.cs

@ -1,309 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <author name="Ivan Shumilin"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Controls.Primitives;
using System.Globalization;
using System.Diagnostics;
namespace ICSharpCode.WpfDesign.Designer.Controls
{
public class NumericUpDown : Control
{
static NumericUpDown()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(NumericUpDown),
new FrameworkPropertyMetadata(typeof(NumericUpDown)));
}
TextBox textBox;
DragRepeatButton upButton;
DragRepeatButton downButton;
public static readonly DependencyProperty DecimalPlacesProperty =
DependencyProperty.Register("DecimalPlaces", typeof(int), typeof(NumericUpDown));
public int DecimalPlaces {
get { return (int)GetValue(DecimalPlacesProperty); }
set { SetValue(DecimalPlacesProperty, value); }
}
public static readonly DependencyProperty MinimumProperty =
DependencyProperty.Register("Minimum", typeof(double), typeof(NumericUpDown));
public double Minimum {
get { return (double)GetValue(MinimumProperty); }
set { SetValue(MinimumProperty, value); }
}
public static readonly DependencyProperty MaximumProperty =
DependencyProperty.Register("Maximum", typeof(double), typeof(NumericUpDown),
new FrameworkPropertyMetadata(100.0));
public double Maximum {
get { return (double)GetValue(MaximumProperty); }
set { SetValue(MaximumProperty, value); }
}
public static readonly DependencyProperty ValueProperty =
DependencyProperty.Register("Value", typeof(double), typeof(NumericUpDown),
new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
public double Value {
get { return (double)GetValue(ValueProperty); }
set { SetValue(ValueProperty, value); }
}
public static readonly DependencyProperty SmallChangeProperty =
DependencyProperty.Register("SmallChange", typeof(double), typeof(NumericUpDown),
new FrameworkPropertyMetadata(1.0));
public double SmallChange {
get { return (double)GetValue(SmallChangeProperty); }
set { SetValue(SmallChangeProperty, value); }
}
public static readonly DependencyProperty LargeChangeProperty =
DependencyProperty.Register("LargeChange", typeof(double), typeof(NumericUpDown),
new FrameworkPropertyMetadata(10.0));
public double LargeChange {
get { return (double)GetValue(LargeChangeProperty); }
set { SetValue(LargeChangeProperty, value); }
}
bool IsDragging {
get {
return upButton.IsDragging;
}
set {
upButton.IsDragging = value; downButton.IsDragging = value;
}
}
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
upButton = (DragRepeatButton)Template.FindName("PART_UpButton", this);
downButton = (DragRepeatButton)Template.FindName("PART_DownButton", this);
textBox = (TextBox)Template.FindName("PART_TextBox", this);
upButton.Click += new RoutedEventHandler(upButton_Click);
downButton.Click += new RoutedEventHandler(downButton_Click);
var upDrag = new DragListener(upButton);
var downDrag = new DragListener(downButton);
upDrag.Started += drag_Started;
upDrag.Changed += drag_Changed;
upDrag.Completed += drag_Completed;
downDrag.Started += drag_Started;
downDrag.Changed += drag_Changed;
downDrag.Completed += drag_Completed;
Print();
}
void drag_Started(DragListener drag)
{
OnDragStarted();
}
void drag_Changed(DragListener drag)
{
IsDragging = true;
MoveValue(-drag.DeltaDelta.Y * SmallChange);
}
void drag_Completed(DragListener drag)
{
IsDragging = false;
OnDragCompleted();
}
void downButton_Click(object sender, RoutedEventArgs e)
{
if (!IsDragging) SmallDown();
}
void upButton_Click(object sender, RoutedEventArgs e)
{
if (!IsDragging) SmallUp();
}
protected virtual void OnDragStarted()
{
}
protected virtual void OnDragCompleted()
{
}
public void SmallUp()
{
MoveValue(SmallChange);
}
public void SmallDown()
{
MoveValue(-SmallChange);
}
public void LargeUp()
{
MoveValue(LargeChange);
}
public void LargeDown()
{
MoveValue(-LargeChange);
}
void MoveValue(double delta)
{
double result;
if (double.IsNaN(Value) || double.IsInfinity(Value)) {
SetValue(delta);
}
else if (double.TryParse(textBox.Text, out result)) {
SetValue(result + delta);
}
else {
SetValue(Value + delta);
}
}
void Print()
{
if (textBox != null) {
textBox.Text = Value.ToString("F" + DecimalPlaces);
textBox.CaretIndex = int.MaxValue;
}
}
//wpf bug?: Value = -1 updates bindings without coercing, workaround
//update: not derived from RangeBase - no problem
void SetValue(double newValue)
{
newValue = CoerceValue(newValue);
if (Value != newValue) {
Value = newValue;
}
}
double CoerceValue(double newValue)
{
return Math.Max(Minimum, Math.Min(newValue, Maximum));
}
protected override void OnPreviewKeyDown(KeyEventArgs e)
{
base.OnPreviewKeyDown(e);
if (e.Key == Key.Enter) {
double result;
if (double.TryParse(textBox.Text, out result)) {
SetValue(result);
}
else {
Print();
}
textBox.SelectAll();
e.Handled = true;
}
else if (e.Key == Key.Up) {
SmallUp();
e.Handled = true;
}
else if (e.Key == Key.Down) {
SmallDown();
e.Handled = true;
}
else if (e.Key == Key.PageUp) {
LargeUp();
e.Handled = true;
}
else if (e.Key == Key.PageDown) {
LargeDown();
e.Handled = true;
}
//else if (e.Key == Key.Home) {
// Maximize();
// e.Handled = true;
//}
//else if (e.Key == Key.End) {
// Minimize();
// e.Handled = true;
//}
}
//protected override void OnMouseWheel(MouseWheelEventArgs e)
//{
// if (e.Delta > 0)
// {
// if (Keyboard.IsKeyDown(Key.LeftShift))
// {
// LargeUp();
// }
// else
// {
// SmallUp();
// }
// }
// else
// {
// if (Keyboard.IsKeyDown(Key.LeftShift))
// {
// LargeDown();
// }
// else
// {
// SmallDown();
// }
// }
// e.Handled = true;
//}
protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
{
base.OnPropertyChanged(e);
if (e.Property == ValueProperty) {
Value = CoerceValue((double)e.NewValue);
Print();
}
else if (e.Property == SmallChangeProperty &&
ReadLocalValue(LargeChangeProperty) == DependencyProperty.UnsetValue) {
LargeChange = SmallChange * 10;
}
}
}
public class DragRepeatButton : RepeatButton
{
public static readonly DependencyProperty IsDraggingProperty =
DependencyProperty.Register("IsDragging", typeof(bool), typeof(DragRepeatButton));
public bool IsDragging {
get { return (bool)GetValue(IsDraggingProperty); }
set { SetValue(IsDraggingProperty, value); }
}
}
}

149
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/NumericUpDown.xaml

@ -1,149 +0,0 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Controls="clr-namespace:ICSharpCode.WpfDesign.Designer.Controls"
xmlns:BrushEditor="clr-namespace:ICSharpCode.WpfDesign.Designer.PropertyGrid.Editors.BrushEditor">
<!--<Brush x:Key="ButtonNormal">#C3D3FD</Brush>
<Brush x:Key="ButtonHover">#D7ECFC</Brush>
<Brush x:Key="ButtonPressed">#92AAF0</Brush>
<Brush x:Key="BorderBrush">#FF7F9DB9</Brush>
<Brush x:Key="ArrowBrush">#4D6185</Brush>
<Brush x:Key="ArrowsBorderBrush">#B4C8F6</Brush>-->
<Brush x:Key="ButtonNormal">#DADFEA</Brush>
<Brush x:Key="ButtonHover">#E6EBEF</Brush>
<Brush x:Key="ButtonPressed">#B6BDD3</Brush>
<Brush x:Key="BorderBrush">#7F9DB9</Brush>
<Brush x:Key="ArrowBrush">Black</Brush>
<Brush x:Key="ArrowsBorderBrush">#B6BDD3</Brush>
<Style x:Key="UpButton"
TargetType="RepeatButton">
<Setter Property="Focusable"
Value="False" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Controls:DragRepeatButton}">
<Border x:Name="bg"
Background="{StaticResource ButtonNormal}"
CornerRadius="2 2 0 0">
<Path Fill="{StaticResource ArrowBrush}"
Data="M 0 3 L 3.5 0 L 7 3"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver"
Value="True">
<Setter TargetName="bg"
Property="Background"
Value="{StaticResource ButtonHover}" />
</Trigger>
<Trigger Property="IsMouseCaptured"
Value="True">
<Setter TargetName="bg"
Property="Background"
Value="{StaticResource ButtonPressed}" />
</Trigger>
<Trigger Property="IsDragging"
Value="True">
<Setter TargetName="bg"
Property="Background"
Value="{StaticResource ButtonPressed}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="DownButton"
TargetType="RepeatButton">
<Setter Property="Focusable"
Value="False" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Controls:DragRepeatButton}">
<Border x:Name="bg"
Background="{StaticResource ButtonNormal}"
CornerRadius="0 0 2 2">
<Path Fill="{StaticResource ArrowBrush}"
Data="M 0 0 L 3.5 3 L 7 0"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver"
Value="True">
<Setter TargetName="bg"
Property="Background"
Value="{StaticResource ButtonHover}" />
</Trigger>
<Trigger Property="IsMouseCaptured"
Value="True">
<Setter TargetName="bg"
Property="Background"
Value="{StaticResource ButtonPressed}" />
</Trigger>
<Trigger Property="IsDragging"
Value="True">
<Setter TargetName="bg"
Property="Background"
Value="{StaticResource ButtonPressed}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type Controls:NumericUpDown}">
<Setter Property="Background"
Value="White" />
<Setter Property="BorderThickness"
Value="1" />
<Setter Property="BorderBrush"
Value="{StaticResource BorderBrush}" />
<Setter Property="Focusable"
Value="False" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Controls:NumericUpDown}">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Padding="1">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="15" />
</Grid.ColumnDefinitions>
<TextBox x:Name="PART_TextBox"
BorderThickness="0"
Background="{x:Null}"
Foreground="{TemplateBinding Foreground}"
Grid.RowSpan="2" />
<Controls:DragRepeatButton x:Name="PART_UpButton"
Style="{StaticResource UpButton}"
Grid.Column="1" />
<Controls:DragRepeatButton x:Name="PART_DownButton"
Style="{StaticResource DownButton}"
Grid.Column="1"
Grid.Row="1" />
<Border Grid.Column="1"
Grid.RowSpan="2"
BorderBrush="{StaticResource ArrowsBorderBrush}"
BorderThickness="1"
CornerRadius="2" />
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

188
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ZoomControl.cs

@ -6,202 +6,122 @@
// </file> // </file>
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Controls.Primitives;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
using System.Resources; using System.Resources;
using System.Windows;
using System.Windows.Input;
using ICSharpCode.SharpDevelop.Widgets;
namespace ICSharpCode.WpfDesign.Designer.Controls namespace ICSharpCode.WpfDesign.Designer.Controls
{ {
public class ZoomControl : ContentControl public class ZoomControl : ZoomScrollViewer
{ {
static ZoomControl() static ZoomControl()
{ {
DefaultStyleKeyProperty.OverrideMetadata(typeof(ZoomControl), PanToolCursor = GetCursor("Images/PanToolCursor.cur");
new FrameworkPropertyMetadata(typeof(ZoomControl))); PanToolCursorMouseDown = GetCursor("Images/PanToolCursorMouseDown.cur");
PanToolCursor = new Cursor(GetStream("Images/PanToolCursor.cur"));
PanToolCursorMouseDown = new Cursor(GetStream("Images/PanToolCursorMouseDown.cur"));
} }
static Stream GetStream(string path) static Cursor GetCursor(string path)
{ {
var a = Assembly.GetExecutingAssembly(); var a = Assembly.GetExecutingAssembly();
var m = new ResourceManager(a.GetName().Name + ".g", a); var m = new ResourceManager(a.GetName().Name + ".g", a);
var s = m.GetStream(path.ToLower()); using (Stream s = m.GetStream(path.ToLowerInvariant())) {
return s; return new Cursor(s);
}
} }
static Cursor PanToolCursor; static Cursor PanToolCursor;
static Cursor PanToolCursorMouseDown; static Cursor PanToolCursorMouseDown;
public const double ZoomFactor = 1.1;
public const double Minimum = 0.1;
public const double Maximum = 10;
double startHorizontalOffset; double startHorizontalOffset;
double startVericalOffset; double startVericalOffset;
internal ScrollViewer ScrollViewer;
FrameworkElement container;
ScaleTransform transform;
Point startPoint; Point startPoint;
bool isMouseDown; bool isMouseDown;
bool pan; bool pan;
public static readonly DependencyProperty ZoomProperty =
DependencyProperty.Register("Zoom", typeof(double), typeof(ZoomControl),
new PropertyMetadata(1.0, null, CoerceZoom));
public double Zoom
{
get { return (double)GetValue(ZoomProperty); }
set { SetValue(ZoomProperty, value); }
}
static object CoerceZoom(DependencyObject d, object baseValue)
{
var zoom = (double)baseValue;
return Math.Max(Minimum, Math.Min(Maximum, zoom));
}
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
ScrollViewer = (ScrollViewer)Template.FindName("scrollViewer", this);
container = (FrameworkElement)Template.FindName("container", this);
transform = new ScaleTransform();
container.LayoutTransform = transform;
var uxPlus = (ButtonBase)Template.FindName("uxPlus", this);
var uxMinus = (ButtonBase)Template.FindName("uxMinus", this);
var uxReset = (ButtonBase)Template.FindName("uxReset", this);
uxPlus.Click += delegate { ZoomIn(); };
uxMinus.Click += delegate { ZoomOut(); };
uxReset.Click += delegate { Reset(); };
}
protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
{
base.OnPropertyChanged(e);
if (e.Property == ZoomProperty)
{
transform.ScaleX = Zoom;
transform.ScaleY = Zoom;
CenterViewport((double)e.OldValue);
}
}
protected override void OnKeyDown(KeyEventArgs e) protected override void OnKeyDown(KeyEventArgs e)
{ {
if (!pan && e.Key == Key.Space) if (!pan && e.Key == Key.Space) {
{
Cursor = PanToolCursor;
pan = true; pan = true;
Mouse.UpdateCursor();
} }
base.OnKeyDown(e);
} }
protected override void OnKeyUp(KeyEventArgs e) protected override void OnKeyUp(KeyEventArgs e)
{ {
if (e.Key == Key.Space) if (e.Key == Key.Space) {
{
ClearValue(CursorProperty);
pan = false; pan = false;
Mouse.UpdateCursor();
} }
base.OnKeyUp(e);
} }
protected override void OnPreviewMouseDown(MouseButtonEventArgs e) protected override void OnPreviewMouseDown(MouseButtonEventArgs e)
{ {
if (pan) if (pan && !e.Handled) {
{ if (Mouse.Capture(this)) {
Cursor = PanToolCursorMouseDown; isMouseDown = true;
Mouse.Capture(this); // will call move e.Handled = true;
isMouseDown = true; startPoint = e.GetPosition(this);
startPoint = e.GetPosition(this); PanStart();
PanStart(); Mouse.UpdateCursor();
}
} }
base.OnPreviewMouseDown(e);
} }
protected override void OnPreviewMouseMove(MouseEventArgs e) protected override void OnPreviewMouseMove(MouseEventArgs e)
{ {
if (isMouseDown && pan) if (isMouseDown) {
{
var endPoint = e.GetPosition(this); var endPoint = e.GetPosition(this);
PanContinue(endPoint - startPoint); PanContinue(endPoint - startPoint);
} }
base.OnPreviewMouseMove(e);
} }
protected override void OnPreviewMouseUp(MouseButtonEventArgs e) protected override void OnPreviewMouseUp(MouseButtonEventArgs e)
{ {
if (isMouseDown) if (isMouseDown) {
{
Cursor = PanToolCursor;
isMouseDown = false; isMouseDown = false;
Mouse.Capture(null); ReleaseMouseCapture();
Mouse.UpdateCursor();
} }
base.OnPreviewMouseUp(e);
} }
protected override void OnMouseEnter(MouseEventArgs e) protected override void OnLostMouseCapture(MouseEventArgs e)
{
Focus();
}
public void Fit()
{
Zoom = Math.Min(
ScrollViewer.ActualWidth / container.ActualWidth,
ScrollViewer.ActualHeight / container.ActualHeight);
}
public void ZoomIn()
{
Zoom *= ZoomFactor;
}
public void ZoomOut()
{ {
Zoom /= ZoomFactor; if (isMouseDown) {
isMouseDown = false;
ReleaseMouseCapture();
Mouse.UpdateCursor();
}
base.OnLostMouseCapture(e);
} }
public void Reset() protected override void OnQueryCursor(QueryCursorEventArgs e)
{ {
Zoom = 1; base.OnQueryCursor(e);
ScrollViewer.ScrollToHorizontalOffset(0); if (!e.Handled && (pan || isMouseDown)) {
ScrollViewer.ScrollToVerticalOffset(0); e.Handled = true;
e.Cursor = isMouseDown ? PanToolCursorMouseDown : PanToolCursor;
}
} }
void PanStart() void PanStart()
{ {
startHorizontalOffset = ScrollViewer.HorizontalOffset; startHorizontalOffset = this.HorizontalOffset;
startVericalOffset = ScrollViewer.VerticalOffset; startVericalOffset = this.VerticalOffset;
} }
void PanContinue(Vector delta) void PanContinue(Vector delta)
{ {
ScrollViewer.ScrollToHorizontalOffset(startHorizontalOffset - delta.X); this.ScrollToHorizontalOffset(startHorizontalOffset - delta.X / this.CurrentZoom);
ScrollViewer.ScrollToVerticalOffset(startVericalOffset - delta.Y); this.ScrollToVerticalOffset(startVericalOffset - delta.Y / this.CurrentZoom);
}
void CenterViewport(double oldZoom)
{
var k = Zoom / oldZoom;
var add = (k * ScrollViewer.ViewportWidth - ScrollViewer.ViewportWidth) / 2;
ScrollViewer.ScrollToHorizontalOffset(k * ScrollViewer.HorizontalOffset + add);
add = (k * ScrollViewer.ViewportHeight - ScrollViewer.ViewportHeight) / 2;
ScrollViewer.ScrollToVerticalOffset(k * ScrollViewer.VerticalOffset + add);
} }
} }
} }

2
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignSurface.xaml

@ -5,7 +5,7 @@
xmlns:Controls="clr-namespace:ICSharpCode.WpfDesign.Designer.Controls" xmlns:Controls="clr-namespace:ICSharpCode.WpfDesign.Designer.Controls"
DataContext="{x:Null}" DataContext="{x:Null}"
Background="#888"> Background="#888">
<Controls:ZoomControl x:Name="uxZoom"> <Controls:ZoomControl x:Name="uxZoom" AlwaysShowZoomButtons="True" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible">
<Default:DesignPanel x:Name="_designPanel"> <Default:DesignPanel x:Name="_designPanel">
<!-- Reset some inherited properties to the WPF defaults to avoid values from SharpDevelop applying to designed forms. --> <!-- Reset some inherited properties to the WPF defaults to avoid values from SharpDevelop applying to designed forms. -->
<Border x:Name="_sceneContainer" AllowDrop="False" UseLayoutRounding="False" TextOptions.TextFormattingMode="Ideal" /> <Border x:Name="_sceneContainer" AllowDrop="False" UseLayoutRounding="False" TextOptions.TextFormattingMode="Ideal" />

2
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignSurface.xaml.cs

@ -63,7 +63,7 @@ namespace ICSharpCode.WpfDesign.Designer
protected override void OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e) protected override void OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e)
{ {
if (e.OriginalSource == uxZoom.ScrollViewer) { if (e.OriginalSource == uxZoom) {
UnselectAll(); UnselectAll();
} }
} }

3
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BrushEditor/BrushEditorView.xaml

@ -6,6 +6,7 @@
xmlns:BrushEditor="clr-namespace:ICSharpCode.WpfDesign.Designer.PropertyGrid.Editors.BrushEditor" xmlns:BrushEditor="clr-namespace:ICSharpCode.WpfDesign.Designer.PropertyGrid.Editors.BrushEditor"
xmlns:Converters="clr-namespace:ICSharpCode.WpfDesign.Designer.Converters" xmlns:Converters="clr-namespace:ICSharpCode.WpfDesign.Designer.Converters"
xmlns:PropertyGrid="clr-namespace:ICSharpCode.WpfDesign.Designer.PropertyGrid" xmlns:PropertyGrid="clr-namespace:ICSharpCode.WpfDesign.Designer.PropertyGrid"
xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets"
Width="395"> Width="395">
<UserControl.Resources> <UserControl.Resources>
@ -51,7 +52,7 @@
Margin="5"> Margin="5">
<TextBlock Text="Angle" <TextBlock Text="Angle"
VerticalAlignment="Center" /> VerticalAlignment="Center" />
<Controls:NumericUpDown Value="{Binding GradientAngle}" <widgets:NumericUpDown Value="{Binding GradientAngle}"
Minimum="-360" Minimum="-360"
Maximum="360" Maximum="360"
Margin="5 0 0 0" Margin="5 0 0 0"

447
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BrushEditor/ColorPicker.xaml

@ -3,231 +3,232 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Controls="clr-namespace:ICSharpCode.WpfDesign.Designer.Controls" xmlns:Controls="clr-namespace:ICSharpCode.WpfDesign.Designer.Controls"
xmlns:BrushEditor="clr-namespace:ICSharpCode.WpfDesign.Designer.PropertyGrid.Editors.BrushEditor" xmlns:BrushEditor="clr-namespace:ICSharpCode.WpfDesign.Designer.PropertyGrid.Editors.BrushEditor"
xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets"
x:Name="this" x:Name="this"
Padding="5" Padding="5"
Width="373"> Width="373">
<UserControl.Resources> <UserControl.Resources>
<DrawingBrush x:Key="ChessBrush" <DrawingBrush x:Key="ChessBrush"
TileMode="Tile" TileMode="Tile"
ViewportUnits="Absolute" ViewportUnits="Absolute"
Viewport="0 0 9 9"> Viewport="0 0 9 9">
<DrawingBrush.Drawing> <DrawingBrush.Drawing>
<DrawingGroup> <DrawingGroup>
<GeometryDrawing Brush="White"> <GeometryDrawing Brush="White">
<GeometryDrawing.Geometry> <GeometryDrawing.Geometry>
<RectangleGeometry Rect="0 0 2 2" /> <RectangleGeometry Rect="0 0 2 2" />
</GeometryDrawing.Geometry> </GeometryDrawing.Geometry>
</GeometryDrawing> </GeometryDrawing>
<GeometryDrawing Brush="Gray"> <GeometryDrawing Brush="Gray">
<GeometryDrawing.Geometry> <GeometryDrawing.Geometry>
<GeometryGroup> <GeometryGroup>
<RectangleGeometry Rect="0 0 1 1" /> <RectangleGeometry Rect="0 0 1 1" />
<RectangleGeometry Rect="1 1 1 1" /> <RectangleGeometry Rect="1 1 1 1" />
</GeometryGroup> </GeometryGroup>
</GeometryDrawing.Geometry> </GeometryDrawing.Geometry>
</GeometryDrawing> </GeometryDrawing>
</DrawingGroup> </DrawingGroup>
</DrawingBrush.Drawing> </DrawingBrush.Drawing>
</DrawingBrush> </DrawingBrush>
</UserControl.Resources> </UserControl.Resources>
<DockPanel> <DockPanel>
<StackPanel VerticalAlignment="Top" <StackPanel VerticalAlignment="Top"
DockPanel.Dock="Right" DockPanel.Dock="Right"
Margin="10 0 0 0"> Margin="10 0 0 0">
<Border Background="{StaticResource ChessBrush}" <Border Background="{StaticResource ChessBrush}"
HorizontalAlignment="Right" HorizontalAlignment="Right"
BorderBrush="Black" BorderBrush="Black"
BorderThickness="1" BorderThickness="1"
Height="50" Height="50"
Width="70"> Width="70">
<Rectangle> <Rectangle>
<Rectangle.Fill> <Rectangle.Fill>
<SolidColorBrush Color="{Binding Color, ElementName=this}" /> <SolidColorBrush Color="{Binding Color, ElementName=this}" />
</Rectangle.Fill> </Rectangle.Fill>
</Rectangle> </Rectangle>
</Border> </Border>
<DockPanel Margin="0 3 0 0"> <DockPanel Margin="0 3 0 0">
<BrushEditor:HexTextBox Text="{Binding Hex, ElementName=this, UpdateSourceTrigger=PropertyChanged}" <BrushEditor:HexTextBox Text="{Binding Hex, ElementName=this, UpdateSourceTrigger=PropertyChanged}"
Width="70" Width="70"
Margin="5 0 0 0" Margin="5 0 0 0"
DockPanel.Dock="Right" /> DockPanel.Dock="Right" />
<TextBlock Text="#" <TextBlock Text="#"
VerticalAlignment="Center" VerticalAlignment="Center"
HorizontalAlignment="Right" /> HorizontalAlignment="Right" />
</DockPanel> </DockPanel>
<DockPanel Margin="0 3 0 0"> <DockPanel Margin="0 3 0 0">
<Controls:NumericUpDown Value="{Binding H, ElementName=this}" <widgets:NumericUpDown Value="{Binding H, ElementName=this}"
Maximum="360" Maximum="360"
Width="70" Width="70"
Margin="5 0 0 0" Margin="5 0 0 0"
DockPanel.Dock="Right" /> DockPanel.Dock="Right" />
<TextBlock Text="H" <TextBlock Text="H"
VerticalAlignment="Center" VerticalAlignment="Center"
HorizontalAlignment="Right" /> HorizontalAlignment="Right" />
</DockPanel> </DockPanel>
<DockPanel Margin="0 3 0 0"> <DockPanel Margin="0 3 0 0">
<Controls:NumericUpDown Value="{Binding S, ElementName=this}" <widgets:NumericUpDown Value="{Binding S, ElementName=this}"
Width="70" Width="70"
Margin="5 0 0 0" Margin="5 0 0 0"
DockPanel.Dock="Right" /> DockPanel.Dock="Right" />
<TextBlock Text="S" <TextBlock Text="S"
VerticalAlignment="Center" VerticalAlignment="Center"
HorizontalAlignment="Right" /> HorizontalAlignment="Right" />
</DockPanel> </DockPanel>
<DockPanel Margin="0 3 0 0"> <DockPanel Margin="0 3 0 0">
<Controls:NumericUpDown Value="{Binding V, ElementName=this}" <widgets:NumericUpDown Value="{Binding V, ElementName=this}"
Width="70" Width="70"
Margin="5 0 0 0" Margin="5 0 0 0"
DockPanel.Dock="Right" /> DockPanel.Dock="Right" />
<TextBlock Text="V" <TextBlock Text="V"
VerticalAlignment="Center" VerticalAlignment="Center"
HorizontalAlignment="Right" /> HorizontalAlignment="Right" />
</DockPanel> </DockPanel>
<DockPanel Margin="0 3 0 0"> <DockPanel Margin="0 3 0 0">
<Controls:NumericUpDown Value="{Binding R, ElementName=this}" <widgets:NumericUpDown Value="{Binding R, ElementName=this}"
Maximum="255" Maximum="255"
Width="70" Width="70"
Margin="5 0 0 0" Margin="5 0 0 0"
DockPanel.Dock="Right" /> DockPanel.Dock="Right" />
<TextBlock Text="R" <TextBlock Text="R"
VerticalAlignment="Center" VerticalAlignment="Center"
HorizontalAlignment="Right" /> HorizontalAlignment="Right" />
</DockPanel> </DockPanel>
<DockPanel Margin="0 3 0 0"> <DockPanel Margin="0 3 0 0">
<Controls:NumericUpDown Value="{Binding G, ElementName=this}" <widgets:NumericUpDown Value="{Binding G, ElementName=this}"
Maximum="255" Maximum="255"
Width="70" Width="70"
Margin="5 0 0 0" Margin="5 0 0 0"
DockPanel.Dock="Right" /> DockPanel.Dock="Right" />
<TextBlock Text="G" <TextBlock Text="G"
VerticalAlignment="Center" VerticalAlignment="Center"
HorizontalAlignment="Right" /> HorizontalAlignment="Right" />
</DockPanel> </DockPanel>
<DockPanel Margin="0 3 0 0"> <DockPanel Margin="0 3 0 0">
<Controls:NumericUpDown Value="{Binding B, ElementName=this}" <widgets:NumericUpDown Value="{Binding B, ElementName=this}"
Maximum="255" Maximum="255"
Width="70" Width="70"
Margin="5 0 0 0" Margin="5 0 0 0"
DockPanel.Dock="Right" /> DockPanel.Dock="Right" />
<TextBlock Text="B" <TextBlock Text="B"
VerticalAlignment="Center" VerticalAlignment="Center"
HorizontalAlignment="Right" /> HorizontalAlignment="Right" />
</DockPanel> </DockPanel>
<DockPanel Margin="0 3 0 0"> <DockPanel Margin="0 3 0 0">
<Controls:NumericUpDown Value="{Binding A, ElementName=this}" <widgets:NumericUpDown Value="{Binding A, ElementName=this}"
Maximum="255" Maximum="255"
Width="70" Width="70"
Margin="5 0 0 0" Margin="5 0 0 0"
DockPanel.Dock="Right" /> DockPanel.Dock="Right" />
<TextBlock Text="A" <TextBlock Text="A"
VerticalAlignment="Center" VerticalAlignment="Center"
HorizontalAlignment="Right" /> HorizontalAlignment="Right" />
</DockPanel> </DockPanel>
</StackPanel> </StackPanel>
<Border Margin="10 0 0 0" <Border Margin="10 0 0 0"
DockPanel.Dock="Right"> DockPanel.Dock="Right">
<BrushEditor:Picker Orientation="Vertical" <BrushEditor:Picker Orientation="Vertical"
Value="{Binding H, ElementName=this}" Value="{Binding H, ElementName=this}"
Minimum="360" Minimum="360"
Maximum="0" Maximum="0"
Marker="{Binding ElementName=arrows}" Marker="{Binding ElementName=arrows}"
Width="20"> Width="20">
<Border Margin="0 -1"> <Border Margin="0 -1">
<Border.Background> <Border.Background>
<LinearGradientBrush EndPoint="0 1"> <LinearGradientBrush EndPoint="0 1">
<GradientStop Offset="0" <GradientStop Offset="0"
Color="#F00" /> Color="#F00" />
<GradientStop Offset="0.16" <GradientStop Offset="0.16"
Color="#F0F" /> Color="#F0F" />
<GradientStop Offset="0.33" <GradientStop Offset="0.33"
Color="#00F" /> Color="#00F" />
<GradientStop Offset="0.5" <GradientStop Offset="0.5"
Color="#0FF" /> Color="#0FF" />
<GradientStop Offset="0.76" <GradientStop Offset="0.76"
Color="#0F0" /> Color="#0F0" />
<GradientStop Offset="0.85" <GradientStop Offset="0.85"
Color="#FF0" /> Color="#FF0" />
<GradientStop Offset="1" <GradientStop Offset="1"
Color="#F00" /> Color="#F00" />
</LinearGradientBrush> </LinearGradientBrush>
</Border.Background> </Border.Background>
</Border> </Border>
<Grid x:Name="arrows" <Grid x:Name="arrows"
IsHitTestVisible="False" IsHitTestVisible="False"
VerticalAlignment="Top" VerticalAlignment="Top"
Margin="-5"> Margin="-5">
<Path HorizontalAlignment="Left" <Path HorizontalAlignment="Left"
Data="M 0 0 L 5 5 L 0 10 Z" Data="M 0 0 L 5 5 L 0 10 Z"
Fill="Black" /> Fill="Black" />
<Path HorizontalAlignment="Right" <Path HorizontalAlignment="Right"
Data="M 0 0 L -5 5 L 0 10 Z" Data="M 0 0 L -5 5 L 0 10 Z"
Fill="Black" /> Fill="Black" />
</Grid> </Grid>
</BrushEditor:Picker> </BrushEditor:Picker>
</Border> </Border>
<Border BorderBrush="Black" <Border BorderBrush="Black"
BorderThickness="1"> BorderThickness="1">
<BrushEditor:Picker Value="{Binding S, ElementName=this}" <BrushEditor:Picker Value="{Binding S, ElementName=this}"
Marker="{Binding ElementName=point}" Marker="{Binding ElementName=point}"
ClipToBounds="True"> ClipToBounds="True">
<BrushEditor:Picker Orientation="Vertical" <BrushEditor:Picker Orientation="Vertical"
Value="{Binding V, ElementName=this}" Value="{Binding V, ElementName=this}"
Minimum="100" Minimum="100"
Maximum="0" Maximum="0"
Marker="{Binding ElementName=point}"> Marker="{Binding ElementName=point}">
<Rectangle> <Rectangle>
<Rectangle.Fill> <Rectangle.Fill>
<LinearGradientBrush EndPoint="1 0"> <LinearGradientBrush EndPoint="1 0">
<GradientStop Offset="0" <GradientStop Offset="0"
Color="White" /> Color="White" />
<GradientStop Offset="1" <GradientStop Offset="1"
Color="{Binding HueColor, ElementName=this}" /> Color="{Binding HueColor, ElementName=this}" />
</LinearGradientBrush> </LinearGradientBrush>
</Rectangle.Fill> </Rectangle.Fill>
</Rectangle> </Rectangle>
<Rectangle> <Rectangle>
<Rectangle.Fill> <Rectangle.Fill>
<LinearGradientBrush EndPoint="0 1"> <LinearGradientBrush EndPoint="0 1">
<GradientStop Offset="0" <GradientStop Offset="0"
Color="#0000" /> Color="#0000" />
<GradientStop Offset="1" <GradientStop Offset="1"
Color="#F000" /> Color="#F000" />
</LinearGradientBrush> </LinearGradientBrush>
</Rectangle.Fill> </Rectangle.Fill>
</Rectangle> </Rectangle>
<Grid x:Name="point" <Grid x:Name="point"
VerticalAlignment="Top" VerticalAlignment="Top"
HorizontalAlignment="Left" HorizontalAlignment="Left"
Width="12" Width="12"
Height="12" Height="12"
Margin="-6 -6 0 0"> Margin="-6 -6 0 0">
<Ellipse Stroke="Black" <Ellipse Stroke="Black"
IsHitTestVisible="False" /> IsHitTestVisible="False" />
<Ellipse Stroke="White" <Ellipse Stroke="White"
Margin="1" Margin="1"
IsHitTestVisible="False" /> IsHitTestVisible="False" />
</Grid> </Grid>
</BrushEditor:Picker> </BrushEditor:Picker>
</BrushEditor:Picker> </BrushEditor:Picker>
</Border> </Border>
</DockPanel> </DockPanel>
</UserControl> </UserControl>

6
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/NumberEditor.xaml

@ -1,9 +1,9 @@
<Controls:NumericUpDown x:Class="ICSharpCode.WpfDesign.Designer.PropertyGrid.Editors.NumberEditor" <widgets:NumericUpDown x:Class="ICSharpCode.WpfDesign.Designer.PropertyGrid.Editors.NumberEditor"
xmlns="http://schemas.microsoft.com/netfx/2007/xaml/presentation" xmlns="http://schemas.microsoft.com/netfx/2007/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Controls="clr-namespace:ICSharpCode.WpfDesign.Designer.Controls" xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets"
xmlns:Converters="clr-namespace:ICSharpCode.WpfDesign.Designer.Converters" xmlns:Converters="clr-namespace:ICSharpCode.WpfDesign.Designer.Converters"
BorderThickness="0" BorderThickness="0"
Background="{x:Null}" Background="{x:Null}"
Value="{Binding Value, Converter={x:Static Converters:DummyConverter.Instance}}"> Value="{Binding Value, Converter={x:Static Converters:DummyConverter.Instance}}">
</Controls:NumericUpDown> </widgets:NumericUpDown>

12
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/WpfDesign.Designer.csproj

@ -92,9 +92,6 @@
<DependentUpon>GridUnitSelector.xaml</DependentUpon> <DependentUpon>GridUnitSelector.xaml</DependentUpon>
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="Controls\NumericUpDown.cs">
<DependentUpon>NumericUpDown.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\PanelMoveAdorner.cs" /> <Compile Include="Controls\PanelMoveAdorner.cs" />
<Compile Include="Controls\SelectionFrame.cs" /> <Compile Include="Controls\SelectionFrame.cs" />
<Compile Include="Controls\ErrorBalloon.cs" /> <Compile Include="Controls\ErrorBalloon.cs" />
@ -217,6 +214,11 @@
<Resource Include="Images\Tag.png" /> <Resource Include="Images\Tag.png" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\..\..\Main\ICSharpCode.SharpDevelop.Widgets\Project\ICSharpCode.SharpDevelop.Widgets.csproj">
<Project>{8035765F-D51F-4A0C-A746-2FD100E19419}</Project>
<Name>ICSharpCode.SharpDevelop.Widgets</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\WpfDesign.XamlDom\Project\WpfDesign.XamlDom.csproj"> <ProjectReference Include="..\..\WpfDesign.XamlDom\Project\WpfDesign.XamlDom.csproj">
<Project>{88DA149F-21B2-48AB-82C4-28FB6BDFD783}</Project> <Project>{88DA149F-21B2-48AB-82C4-28FB6BDFD783}</Project>
<Name>WpfDesign.XamlDom</Name> <Name>WpfDesign.XamlDom</Name>
@ -233,10 +235,6 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
<Page Include="Controls\GridUnitSelector.xaml" /> <Page Include="Controls\GridUnitSelector.xaml" />
<Page Include="Controls\NumericUpDown.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Controls\ControlStyles.xaml" /> <Page Include="Controls\ControlStyles.xaml" />
<Page Include="DesignSurface.xaml"> <Page Include="DesignSurface.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>

3
src/AddIns/Misc/StartPage/Project/StartPage.csproj

@ -1,4 +1,5 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>

14
src/AddIns/Misc/UsageDataCollector/UsageDataCollector.AddIn/StartPageMessage.xaml

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<UserControl <UserControl
x:Class="ICSharpCode.UsageDataCollector.StartPageMessage" 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:local="clr-namespace:ICSharpCode.UsageDataCollector"> x:Class="ICSharpCode.UsageDataCollector.StartPageMessage" 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:local="clr-namespace:ICSharpCode.UsageDataCollector" xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets">
<StackPanel> <StackPanel>
<core:CollapsiblePanel <widgets:CollapsiblePanel
Name="mainPanel"> Name="mainPanel">
<StackPanel> <StackPanel>
<TextBlock <TextBlock
@ -26,17 +26,17 @@
Click="SaveButton_Click" Click="SaveButton_Click"
Content="{core:Localize Dialog.Options.IDEOptions.LoadSaveOptions.SaveLabel}"/> Content="{core:Localize Dialog.Options.IDEOptions.LoadSaveOptions.SaveLabel}"/>
</StackPanel> </StackPanel>
</core:CollapsiblePanel> </widgets:CollapsiblePanel>
<core:CollapsiblePanel <widgets:CollapsiblePanel
Name="acceptedMessage" Name="acceptedMessage"
IsCollapsed="True"> IsCollapsed="True">
<TextBlock TextWrapping="Wrap" Text="{core:Localize AddIns.UsageDataCollector.AcceptConfirmation}"/> <TextBlock TextWrapping="Wrap" Text="{core:Localize AddIns.UsageDataCollector.AcceptConfirmation}"/>
</core:CollapsiblePanel> </widgets:CollapsiblePanel>
<core:CollapsiblePanel <widgets:CollapsiblePanel
Name="declinedMessage" Name="declinedMessage"
IsCollapsed="True"> IsCollapsed="True">
<TextBlock TextWrapping="Wrap" Text="{core:Localize AddIns.UsageDataCollector.DeclineConfirmation}"/> <TextBlock TextWrapping="Wrap" Text="{core:Localize AddIns.UsageDataCollector.DeclineConfirmation}"/>
</core:CollapsiblePanel> </widgets:CollapsiblePanel>
<TextBlock <TextBlock
HorizontalAlignment="Left"> HorizontalAlignment="Left">
<Hyperlink <Hyperlink

5
src/AddIns/Misc/UsageDataCollector/UsageDataCollector.AddIn/UsageDataCollector.AddIn.csproj

@ -92,6 +92,11 @@
<Name>ICSharpCode.Core.Presentation</Name> <Name>ICSharpCode.Core.Presentation</Name>
<Private>False</Private> <Private>False</Private>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\..\..\Main\ICSharpCode.SharpDevelop.Widgets\Project\ICSharpCode.SharpDevelop.Widgets.csproj">
<Project>{8035765F-D51F-4A0C-A746-2FD100E19419}</Project>
<Name>ICSharpCode.SharpDevelop.Widgets</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\UsageDataCollector\UsageDataCollector.csproj"> <ProjectReference Include="..\UsageDataCollector\UsageDataCollector.csproj">
<Project>{6B1CFE35-DA17-4DEB-9C6E-227E5E251DA0}</Project> <Project>{6B1CFE35-DA17-4DEB-9C6E-227E5E251DA0}</Project>
<Name>UsageDataCollector</Name> <Name>UsageDataCollector</Name>

3
src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/IDEOptions/ProjectAndSolutionOptions.xaml

@ -1,6 +1,7 @@
<gui:OptionPanel x:Class="ICSharpCode.SharpDevelop.Gui.OptionPanels.ProjectAndSolutionOptions" <gui:OptionPanel x:Class="ICSharpCode.SharpDevelop.Gui.OptionPanels.ProjectAndSolutionOptions"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:core="http://icsharpcode.net/sharpdevelop/core" xmlns:core="http://icsharpcode.net/sharpdevelop/core"
xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets"
xmlns:sd="clr-namespace:ICSharpCode.SharpDevelop" xmlns:sd="clr-namespace:ICSharpCode.SharpDevelop"
xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui" xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui"
xmlns:project="clr-namespace:ICSharpCode.SharpDevelop.Project" xmlns:project="clr-namespace:ICSharpCode.SharpDevelop.Project"
@ -27,7 +28,7 @@
<Label <Label
Content="{core:Localize Dialog.Options.IDEOptions.ProjectAndSolutionOptions.ParallelBuild}" Content="{core:Localize Dialog.Options.IDEOptions.ProjectAndSolutionOptions.ParallelBuild}"
Target="{Binding ElementName=parallelBuildCount}" /> Target="{Binding ElementName=parallelBuildCount}" />
<core:NumericUpDown Minimum="1" Maximum="16" Name="parallelBuildCount" Width="45" /> <widgets:NumericUpDown Minimum="1" Maximum="16" Name="parallelBuildCount" Width="45" />
</StackPanel> </StackPanel>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<Label <Label

21
src/Main/ICSharpCode.Core.Presentation/ICSharpCode.Core.Presentation.csproj

@ -69,14 +69,9 @@
<Compile Include="..\GlobalAssemblyInfo.cs"> <Compile Include="..\GlobalAssemblyInfo.cs">
<Link>Properties\GlobalAssemblyInfo.cs</Link> <Link>Properties\GlobalAssemblyInfo.cs</Link>
</Compile> </Compile>
<Compile Include="DragListener.cs" />
<Compile Include="GlobalStyles.cs" /> <Compile Include="GlobalStyles.cs" />
<Compile Include="NumericUpDown.cs">
<DependentUpon>NumericUpDown.xaml</DependentUpon>
</Compile>
<Compile Include="RestrictDesiredSize.cs" /> <Compile Include="RestrictDesiredSize.cs" />
<Compile Include="SortableGridViewColumn.cs" /> <Compile Include="SortableGridViewColumn.cs" />
<Compile Include="CollapsiblePanel.cs" />
<Compile Include="ConditionalSeparator.cs" /> <Compile Include="ConditionalSeparator.cs" />
<Compile Include="DropDownButton.cs" /> <Compile Include="DropDownButton.cs" />
<Compile Include="ExtensionMethods.cs" /> <Compile Include="ExtensionMethods.cs" />
@ -103,30 +98,14 @@
<Compile Include="ToolBar\ToolBarService.cs" /> <Compile Include="ToolBar\ToolBarService.cs" />
<Compile Include="ToolBar\ToolBarSplitButton.cs" /> <Compile Include="ToolBar\ToolBarSplitButton.cs" />
<CodeAnalysisDictionary Include="Properties\CodeAnalysisDictionary.xml" /> <CodeAnalysisDictionary Include="Properties\CodeAnalysisDictionary.xml" />
<Compile Include="ZoomButtons.cs">
<DependentUpon>ZoomScrollViewer.xaml</DependentUpon>
</Compile>
<Compile Include="ZoomScrollViewer.cs">
<DependentUpon>ZoomScrollViewer.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Page Include="ZoomScrollViewer.xaml" />
<ProjectReference Include="..\Core\Project\ICSharpCode.Core.csproj"> <ProjectReference Include="..\Core\Project\ICSharpCode.Core.csproj">
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project> <Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project>
<Name>ICSharpCode.Core</Name> <Name>ICSharpCode.Core</Name>
<Private>False</Private> <Private>False</Private>
</ProjectReference> </ProjectReference>
<Page Include="NumericUpDown.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="themes\Aero.NormalColor.xaml" /> <Page Include="themes\Aero.NormalColor.xaml" />
<Page Include="themes\generic.xaml" /> <Page Include="themes\generic.xaml" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Resource Include="Images\ZoomIn.png" />
<Resource Include="Images\ZoomOut.png" />
</ItemGroup>
</Project> </Project>

39
src/Main/ICSharpCode.Core.Presentation/themes/generic.xaml

@ -2,11 +2,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ICSharpCode.Core.Presentation" xmlns:local="clr-namespace:ICSharpCode.Core.Presentation"
> >
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/ICSharpCode.Core.Presentation;component/NumericUpDown.xaml" />
<ResourceDictionary Source="/ICSharpCode.Core.Presentation;component/ZoomScrollViewer.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style TargetType="{x:Type Window}" x:Key="{x:Static local:GlobalStyles.WindowStyleKey}"> <Style TargetType="{x:Type Window}" x:Key="{x:Static local:GlobalStyles.WindowStyleKey}">
<Setter Property="UseLayoutRounding" Value="True" /> <Setter Property="UseLayoutRounding" Value="True" />
<Setter Property="TextOptions.TextFormattingMode" Value="Display" /> <Setter Property="TextOptions.TextFormattingMode" Value="Display" />
@ -173,40 +168,6 @@
</Setter> </Setter>
</Style> </Style>
<!-- Template for CollapsiblePanel -->
<Style TargetType="{x:Type local:CollapsiblePanel}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:CollapsiblePanel">
<ControlTemplate.Resources>
<local:CollapsiblePanelProgressToVisibilityConverter x:Key="visibilityConverter"/>
</ControlTemplate.Resources>
<Border
BorderThickness="{TemplateBinding Border.BorderThickness}"
BorderBrush="{TemplateBinding Border.BorderBrush}"
Background="{TemplateBinding Panel.Background}"
SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}"
Name="PART_Border"
Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=AnimationProgress, Converter={StaticResource visibilityConverter}}"
>
<Border.LayoutTransform>
<ScaleTransform ScaleX="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=AnimationProgressX}"
ScaleY="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=AnimationProgressY}"/>
</Border.LayoutTransform>
<ContentPresenter
Margin="{TemplateBinding Control.Padding}"
Content="{TemplateBinding ContentControl.Content}"
ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}"
HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Template for RadioButtonGroup --> <!-- Template for RadioButtonGroup -->
<!-- Necessary because Selector does not have a template by default. --> <!-- Necessary because Selector does not have a template by default. -->
<Style TargetType="{x:Type local:RadioButtonGroup}"> <Style TargetType="{x:Type local:RadioButtonGroup}">

2
src/Main/ICSharpCode.Core.Presentation/CollapsiblePanel.cs → src/Main/ICSharpCode.SharpDevelop.Widgets/Project/CollapsiblePanel.cs

@ -13,7 +13,7 @@ using System.Windows.Input;
using System.Windows.Media.Animation; using System.Windows.Media.Animation;
using System.Windows.Threading; using System.Windows.Threading;
namespace ICSharpCode.Core.Presentation namespace ICSharpCode.SharpDevelop.Widgets
{ {
/// <summary> /// <summary>
/// Allows animated collapsing of the content of this panel. /// Allows animated collapsing of the content of this panel.

10
src/Main/ICSharpCode.SharpDevelop.Widgets/Project/Configuration/AssemblyInfo.cs

@ -8,6 +8,8 @@
using System; using System;
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Windows;
using System.Windows.Markup;
[assembly: CLSCompliant(true)] [assembly: CLSCompliant(true)]
[assembly: StringFreezing()] [assembly: StringFreezing()]
@ -17,3 +19,11 @@ using System.Runtime.CompilerServices;
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
[assembly: ThemeInfo(
ResourceDictionaryLocation.SourceAssembly, //where theme specific resource dictionaries are located
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
)]
[assembly: XmlnsPrefix("http://icsharpcode.net/sharpdevelop/widgets", "widgets")]
[assembly: XmlnsDefinition("http://icsharpcode.net/sharpdevelop/widgets", "ICSharpCode.SharpDevelop.Widgets")]

2
src/Main/ICSharpCode.Core.Presentation/DragListener.cs → src/Main/ICSharpCode.SharpDevelop.Widgets/Project/DragListener.cs

@ -13,7 +13,7 @@ using System.Windows;
using System.Windows.Input; using System.Windows.Input;
using System.Diagnostics; using System.Diagnostics;
namespace ICSharpCode.Core.Presentation namespace ICSharpCode.SharpDevelop.Widgets
{ {
public delegate void DragHandler(DragListener drag); public delegate void DragHandler(DragListener drag);

34
src/Main/ICSharpCode.SharpDevelop.Widgets/Project/ICSharpCode.SharpDevelop.Widgets.csproj

@ -40,16 +40,30 @@
<FileAlignment>4096</FileAlignment> <FileAlignment>4096</FileAlignment>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="PresentationCore">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
<Reference Include="PresentationFramework">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Forms" />
<Reference Include="WindowsBase">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="..\..\GlobalAssemblyInfo.cs"> <Compile Include="..\..\GlobalAssemblyInfo.cs">
<Link>Configuration\GlobalAssemblyInfo.cs</Link> <Link>Configuration\GlobalAssemblyInfo.cs</Link>
</Compile> </Compile>
<Compile Include="CollapsiblePanel.cs" />
<Compile Include="Configuration\AssemblyInfo.cs" /> <Compile Include="Configuration\AssemblyInfo.cs" />
<Compile Include="DragListener.cs" />
<Compile Include="ListViewSorting\AbstractListViewParseableColumnComparer.cs" /> <Compile Include="ListViewSorting\AbstractListViewParseableColumnComparer.cs" />
<Compile Include="ListViewSorting\AbstractListViewSubItemComparer.cs" /> <Compile Include="ListViewSorting\AbstractListViewSubItemComparer.cs" />
<Compile Include="ListViewSorting\ListViewIntegerParseColumnComparer.cs" /> <Compile Include="ListViewSorting\ListViewIntegerParseColumnComparer.cs" />
@ -58,6 +72,9 @@
<Compile Include="ListViewSorting\IListViewItemComparer.cs" /> <Compile Include="ListViewSorting\IListViewItemComparer.cs" />
<Compile Include="ListViewSorting\ListViewItemSorter.cs" /> <Compile Include="ListViewSorting\ListViewItemSorter.cs" />
<Compile Include="MouseWheelHandler.cs" /> <Compile Include="MouseWheelHandler.cs" />
<Compile Include="NumericUpDown.cs">
<DependentUpon>NumericUpDown.xaml</DependentUpon>
</Compile>
<Compile Include="Resources\BitmapResources.cs" /> <Compile Include="Resources\BitmapResources.cs" />
<Compile Include="SideBar\SideBar.cs"> <Compile Include="SideBar\SideBar.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
@ -68,10 +85,27 @@
<Compile Include="DesignTimeSupport\DropDownEditorListBox.cs"> <Compile Include="DesignTimeSupport\DropDownEditorListBox.cs">
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>
<Compile Include="ZoomButtons.cs">
<DependentUpon>ZoomScrollViewer.xaml</DependentUpon>
</Compile>
<Compile Include="ZoomScrollViewer.cs">
<DependentUpon>ZoomScrollViewer.xaml</DependentUpon>
</Compile>
<EmbeddedResource Include="Resources\Icons.16x16.SortAscending.png" /> <EmbeddedResource Include="Resources\Icons.16x16.SortAscending.png" />
<EmbeddedResource Include="Resources\Icons.16x16.SortDescending.png" /> <EmbeddedResource Include="Resources\Icons.16x16.SortDescending.png" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Page Include="NumericUpDown.xaml" />
<Page Include="themes\generic.xaml" />
<Page Include="ZoomScrollViewer.xaml" />
</ItemGroup>
<ItemGroup>
<Folder Include="Images" />
<Folder Include="themes" />
</ItemGroup>
<ItemGroup>
<Resource Include="Images\ZoomIn.png" />
<Resource Include="Images\ZoomOut.png" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project> </Project>

0
src/Main/ICSharpCode.Core.Presentation/Images/ZoomIn.png → src/Main/ICSharpCode.SharpDevelop.Widgets/Project/Images/ZoomIn.png

Before

Width:  |  Height:  |  Size: 635 B

After

Width:  |  Height:  |  Size: 635 B

0
src/Main/ICSharpCode.Core.Presentation/Images/ZoomOut.png → src/Main/ICSharpCode.SharpDevelop.Widgets/Project/Images/ZoomOut.png

Before

Width:  |  Height:  |  Size: 647 B

After

Width:  |  Height:  |  Size: 647 B

2
src/Main/ICSharpCode.Core.Presentation/NumericUpDown.cs → src/Main/ICSharpCode.SharpDevelop.Widgets/Project/NumericUpDown.cs

@ -22,7 +22,7 @@ using System.Windows.Controls.Primitives;
using System.Globalization; using System.Globalization;
using System.Diagnostics; using System.Diagnostics;
namespace ICSharpCode.Core.Presentation namespace ICSharpCode.SharpDevelop.Widgets
{ {
public class NumericUpDown : Control public class NumericUpDown : Control
{ {

2
src/Main/ICSharpCode.Core.Presentation/NumericUpDown.xaml → src/Main/ICSharpCode.SharpDevelop.Widgets/Project/NumericUpDown.xaml

@ -1,6 +1,6 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Controls="clr-namespace:ICSharpCode.Core.Presentation"> xmlns:Controls="clr-namespace:ICSharpCode.SharpDevelop.Widgets">
<Brush x:Key="ButtonNormal">#DADFEA</Brush> <Brush x:Key="ButtonNormal">#DADFEA</Brush>
<Brush x:Key="ButtonHover">#E6EBEF</Brush> <Brush x:Key="ButtonHover">#E6EBEF</Brush>

2
src/Main/ICSharpCode.Core.Presentation/ZoomButtons.cs → src/Main/ICSharpCode.SharpDevelop.Widgets/Project/ZoomButtons.cs

@ -16,7 +16,7 @@ using System.Windows.Documents;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media; using System.Windows.Media;
namespace ICSharpCode.Core.Presentation namespace ICSharpCode.SharpDevelop.Widgets
{ {
public class ZoomButtons : RangeBase public class ZoomButtons : RangeBase
{ {

33
src/Main/ICSharpCode.Core.Presentation/ZoomScrollViewer.cs → src/Main/ICSharpCode.SharpDevelop.Widgets/Project/ZoomScrollViewer.cs

@ -16,7 +16,7 @@ using System.Windows.Documents;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media; using System.Windows.Media;
namespace ICSharpCode.Core.Presentation namespace ICSharpCode.SharpDevelop.Widgets
{ {
public class ZoomScrollViewer : ScrollViewer public class ZoomScrollViewer : ScrollViewer
{ {
@ -28,7 +28,7 @@ namespace ICSharpCode.Core.Presentation
public static readonly DependencyProperty CurrentZoomProperty = public static readonly DependencyProperty CurrentZoomProperty =
DependencyProperty.Register("CurrentZoom", typeof(double), typeof(ZoomScrollViewer), DependencyProperty.Register("CurrentZoom", typeof(double), typeof(ZoomScrollViewer),
new FrameworkPropertyMetadata(1.0, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, null, CoerceZoom)); new FrameworkPropertyMetadata(1.0, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, CalculateZoomButtonCollapsed, CoerceZoom));
public double CurrentZoom { public double CurrentZoom {
get { return (double)GetValue(CurrentZoomProperty); } get { return (double)GetValue(CurrentZoomProperty); }
@ -69,6 +69,33 @@ namespace ICSharpCode.Core.Presentation
set { SetValue(MouseWheelZoomProperty, value); } set { SetValue(MouseWheelZoomProperty, value); }
} }
public static readonly DependencyProperty AlwaysShowZoomButtonsProperty =
DependencyProperty.Register("AlwaysShowZoomButtons", typeof(bool), typeof(ZoomScrollViewer),
new FrameworkPropertyMetadata(false, CalculateZoomButtonCollapsed));
public bool AlwaysShowZoomButtons {
get { return (bool)GetValue(AlwaysShowZoomButtonsProperty); }
set { SetValue(AlwaysShowZoomButtonsProperty, value); }
}
static readonly DependencyPropertyKey ComputedZoomButtonCollapsedPropertyKey =
DependencyProperty.RegisterReadOnly("ComputedZoomButtonCollapsed", typeof(bool), typeof(ZoomScrollViewer),
new FrameworkPropertyMetadata(true));
public static readonly DependencyProperty ComputedZoomButtonCollapsedProperty = ComputedZoomButtonCollapsedPropertyKey.DependencyProperty;
public bool ComputedZoomButtonCollapsed {
get { return (bool)GetValue(ComputedZoomButtonCollapsedProperty); }
private set { SetValue(ComputedZoomButtonCollapsedPropertyKey, value); }
}
static void CalculateZoomButtonCollapsed(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
ZoomScrollViewer z = d as ZoomScrollViewer;
if (z != null)
z.ComputedZoomButtonCollapsed = (z.AlwaysShowZoomButtons == false) && (z.CurrentZoom == 1.0);
}
protected override void OnMouseWheel(MouseWheelEventArgs e) protected override void OnMouseWheel(MouseWheelEventArgs e)
{ {
if (!e.Handled && Keyboard.Modifiers == ModifierKeys.Control && MouseWheelZoom) { if (!e.Handled && Keyboard.Modifiers == ModifierKeys.Control && MouseWheelZoom) {
@ -138,6 +165,8 @@ namespace ICSharpCode.Core.Presentation
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{ {
if (parameter is bool && (bool)parameter)
return true;
return ((double)value) == 1.0; return ((double)value) == 1.0;
} }

4
src/Main/ICSharpCode.Core.Presentation/ZoomScrollViewer.xaml → src/Main/ICSharpCode.SharpDevelop.Widgets/Project/ZoomScrollViewer.xaml

@ -1,6 +1,6 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Controls="clr-namespace:ICSharpCode.Core.Presentation"> xmlns:Controls="clr-namespace:ICSharpCode.SharpDevelop.Widgets">
<Style TargetType="{x:Type Controls:ZoomScrollViewer}"> <Style TargetType="{x:Type Controls:ZoomScrollViewer}">
<Setter Property="Template"> <Setter Property="Template">
@ -16,7 +16,7 @@
<RowDefinition Height="*" /> <RowDefinition Height="*" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Controls:SelfCollapsingPanel Grid.Column="0" Grid.Row="1" CollapseOrientation="Horizontal" CanCollapse="{Binding Path=CurrentZoom, Mode=OneWay, RelativeSource={RelativeSource Mode=TemplatedParent}, Converter={x:Static Controls:IsNormalZoomConverter.Instance}}"> <Controls:SelfCollapsingPanel Grid.Column="0" Grid.Row="1" CollapseOrientation="Horizontal" CanCollapse="{Binding Path=ComputedZoomButtonCollapsed, Mode=OneWay, RelativeSource={RelativeSource Mode=TemplatedParent}}">
<Controls:ZoomButtons x:Name="zoomButtons" Value="{Binding Path=CurrentZoom, RelativeSource={RelativeSource Mode=TemplatedParent}}" Minimum="{TemplateBinding MinimumZoom}" Maximum="{TemplateBinding MaximumZoom}" /> <Controls:ZoomButtons x:Name="zoomButtons" Value="{Binding Path=CurrentZoom, RelativeSource={RelativeSource Mode=TemplatedParent}}" Minimum="{TemplateBinding MinimumZoom}" Maximum="{TemplateBinding MaximumZoom}" />
</Controls:SelfCollapsingPanel> </Controls:SelfCollapsingPanel>
<Rectangle Grid.Column="2" Grid.Row="1" Fill="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" /> <Rectangle Grid.Column="2" Grid.Row="1" Fill="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />

43
src/Main/ICSharpCode.SharpDevelop.Widgets/Project/themes/generic.xaml

@ -0,0 +1,43 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ICSharpCode.SharpDevelop.Widgets"
>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/ICSharpCode.SharpDevelop.Widgets;component/NumericUpDown.xaml" />
<ResourceDictionary Source="/ICSharpCode.SharpDevelop.Widgets;component/ZoomScrollViewer.xaml" />
</ResourceDictionary.MergedDictionaries>
<!-- Template for CollapsiblePanel -->
<Style TargetType="{x:Type local:CollapsiblePanel}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:CollapsiblePanel">
<ControlTemplate.Resources>
<local:CollapsiblePanelProgressToVisibilityConverter x:Key="visibilityConverter"/>
</ControlTemplate.Resources>
<Border
BorderThickness="{TemplateBinding Border.BorderThickness}"
BorderBrush="{TemplateBinding Border.BorderBrush}"
Background="{TemplateBinding Panel.Background}"
SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}"
Name="PART_Border"
Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=AnimationProgress, Converter={StaticResource visibilityConverter}}"
>
<Border.LayoutTransform>
<ScaleTransform ScaleX="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=AnimationProgressX}"
ScaleY="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=AnimationProgressY}"/>
</Border.LayoutTransform>
<ContentPresenter
Margin="{TemplateBinding Control.Padding}"
Content="{TemplateBinding ContentControl.Content}"
ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}"
HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
Loading…
Cancel
Save