Browse Source

Stylecop fixes.

pull/39/head
Steven Kirk 12 years ago
parent
commit
95d9e6f106
  1. 2
      Perspex.Controls/Border.cs
  2. 2
      Perspex.Controls/ColumnDefinitions.cs
  3. 2
      Perspex.Controls/IContentControl.cs
  4. 2
      Perspex.Controls/Platform/ITopLevelImpl.cs
  5. 3
      Perspex.Controls/Popup.cs
  6. 1
      Perspex.Controls/Presenters/ContentPresenter.cs
  7. 43
      Perspex.Controls/Presenters/TextPresenter.cs
  8. 2
      Perspex.Controls/Primitives/ScrollBar.cs
  9. 2
      Perspex.Controls/RequestBringIntoViewEventArgs.cs
  10. 4
      Perspex.Controls/ScrollViewer.cs
  11. 2
      Perspex.Controls/Shapes/Ellipse.cs
  12. 1
      Perspex.Controls/Shapes/Shape.cs
  13. 2
      Perspex.Controls/TextBlock.cs
  14. 2
      Perspex.Controls/TextWrapping.cs
  15. 22
      Perspex.Controls/Utils/StringUtils.cs
  16. 1
      Perspex.Controls/Window.cs
  17. 2
      Perspex.Diagnostics/ViewModels/TreeNode.cs
  18. 2
      Perspex.Input/PointerPressEventArgs.cs
  19. 4
      Perspex.Interactivity/RoutedEvent.cs
  20. 1
      Perspex.SceneGraph/LogicalTree/LogicalExtensions.cs
  21. 10
      Perspex.SceneGraph/Media/EllipseGeometry.cs
  22. 2
      Perspex.SceneGraph/Media/MatrixTransform.cs
  23. 10
      Perspex.SceneGraph/Media/StreamGeometry.cs
  24. 2
      Perspex.SceneGraph/Media/SweepDirection.cs
  25. 8
      Windows/Perspex.Direct2D1/Media/BrushWrapper.cs
  26. 2
      Windows/Perspex.Direct2D1/Media/FormattedTextImpl.cs
  27. 10
      Windows/Perspex.Direct2D1/Media/StreamGeometryImpl.cs
  28. 1
      Windows/Perspex.Direct2D1/PrimitiveExtensions.cs
  29. 2
      Windows/Perspex.Win32/Interop/UnmanagedMethods.cs
  30. 3
      Windows/Perspex.Win32/PopupImpl.cs
  31. 2
      Windows/Perspex.Win32/WindowImpl.cs

2
Perspex.Controls/Border.cs

@ -51,7 +51,7 @@ namespace Perspex.Controls
Brush background = this.Background; Brush background = this.Background;
Brush borderBrush = this.BorderBrush; Brush borderBrush = this.BorderBrush;
double borderThickness = this.BorderThickness; double borderThickness = this.BorderThickness;
Rect rect = new Rect(this.ActualSize).Deflate(BorderThickness / 2); Rect rect = new Rect(this.ActualSize).Deflate(this.BorderThickness / 2);
if (background != null) if (background != null)
{ {

2
Perspex.Controls/ColumnDefinitions.cs

@ -4,8 +4,6 @@
// </copyright> // </copyright>
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
using Perspex.Collections;
namespace Perspex.Controls namespace Perspex.Controls
{ {
using Perspex.Collections; using Perspex.Collections;

2
Perspex.Controls/IContentControl.cs

@ -1,5 +1,5 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// <copyright file="ContentControl.cs" company="Steven Kirk"> // <copyright file="IContentControl.cs" company="Steven Kirk">
// Copyright 2014 MIT Licence. See licence.md for more information. // Copyright 2014 MIT Licence. See licence.md for more information.
// </copyright> // </copyright>
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------

2
Perspex.Controls/Platform/ITopLevelImpl.cs

@ -1,5 +1,5 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// <copyright file="IWindowImpl.cs" company="Steven Kirk"> // <copyright file="ITopLevelImpl.cs" company="Steven Kirk">
// Copyright 2014 MIT Licence. See licence.md for more information. // Copyright 2014 MIT Licence. See licence.md for more information.
// </copyright> // </copyright>
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------

3
Perspex.Controls/Popup.cs

@ -1,5 +1,5 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// <copyright file="ListBox.cs" company="Steven Kirk"> // <copyright file="Popup.cs" company="Steven Kirk">
// Copyright 2014 MIT Licence. See licence.md for more information. // Copyright 2014 MIT Licence. See licence.md for more information.
// </copyright> // </copyright>
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
@ -47,6 +47,7 @@ namespace Perspex.Controls
} }
}); });
} }
public Control Child public Control Child
{ {
get { return this.GetValue(ChildProperty); } get { return this.GetValue(ChildProperty); }

1
Perspex.Controls/Presenters/ContentPresenter.cs

@ -103,7 +103,6 @@ namespace Perspex.Controls.Presenters
if (content != null) if (content != null)
{ {
if (content is Control) if (content is Control)
{ {
result = (Control)content; result = (Control)content;

43
Perspex.Controls/Presenters/TextPresenter.cs

@ -147,6 +147,20 @@ namespace Perspex.Controls
} }
} }
internal void CaretIndexChanged(int caretIndex)
{
if (this.GetVisualParent() != null)
{
this.caretBlink = true;
this.caretTimer.Stop();
this.caretTimer.Start();
this.InvalidateVisual();
var rect = this.FormattedText.HitTestTextPosition(caretIndex);
this.BringIntoView(rect);
}
}
protected override FormattedText CreateFormattedText() protected override FormattedText CreateFormattedText()
{ {
var result = base.CreateFormattedText(); var result = base.CreateFormattedText();
@ -159,6 +173,7 @@ namespace Perspex.Controls
{ {
result.SetForegroundBrush(Brushes.White, start, length); result.SetForegroundBrush(Brushes.White, start, length);
} }
return result; return result;
} }
@ -197,7 +212,7 @@ namespace Perspex.Controls
case Key.A: case Key.A:
if (modifiers == ModifierKeys.Control) if (modifiers == ModifierKeys.Control)
{ {
SelectAll(); this.SelectAll();
} }
else else
{ {
@ -295,12 +310,6 @@ namespace Perspex.Controls
e.Handled = true; e.Handled = true;
} }
private void SelectAll()
{
this.SelectionStart = 0;
this.SelectionEnd = this.Text.Length;
}
protected override void OnPointerPressed(PointerPressEventArgs e) protected override void OnPointerPressed(PointerPressEventArgs e)
{ {
var point = e.GetPosition(this); var point = e.GetPosition(this);
@ -346,20 +355,6 @@ namespace Perspex.Controls
} }
} }
internal void CaretIndexChanged(int caretIndex)
{
if (this.GetVisualParent() != null)
{
this.caretBlink = true;
this.caretTimer.Stop();
this.caretTimer.Start();
this.InvalidateVisual();
var rect = this.FormattedText.HitTestTextPosition(caretIndex);
this.BringIntoView(rect);
}
}
private void MoveHorizontal(int count, ModifierKeys modifiers) private void MoveHorizontal(int count, ModifierKeys modifiers)
{ {
var text = this.Text ?? string.Empty; var text = this.Text ?? string.Empty;
@ -463,6 +458,12 @@ namespace Perspex.Controls
this.CaretIndex = caretIndex; this.CaretIndex = caretIndex;
} }
private void SelectAll()
{
this.SelectionStart = 0;
this.SelectionEnd = this.Text.Length;
}
private bool DeleteSelection() private bool DeleteSelection()
{ {
var selectionStart = this.SelectionStart; var selectionStart = this.SelectionStart;

2
Perspex.Controls/Primitives/ScrollBar.cs

@ -44,7 +44,7 @@ namespace Perspex.Controls.Primitives
this.GetObservable(ViewportSizeProperty).Select(_ => Unit.Default), this.GetObservable(ViewportSizeProperty).Select(_ => Unit.Default),
this.GetObservable(VisibilityProperty).Select(_ => Unit.Default)) this.GetObservable(VisibilityProperty).Select(_ => Unit.Default))
.Select(_ => this.CalculateIsVisible()); .Select(_ => this.CalculateIsVisible());
this.Bind(IsVisibleProperty, isVisible, BindingPriority.Style); this.Bind(ScrollBar.IsVisibleProperty, isVisible, BindingPriority.Style);
} }
public double Minimum public double Minimum

2
Perspex.Controls/RequestBringIntoViewEventArgs.cs

@ -1,5 +1,5 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// <copyright file="TextPresenter.cs" company="Steven Kirk"> // <copyright file="RequestBringIntoViewEventArgs.cs" company="Steven Kirk">
// Copyright 2013 MIT Licence. See licence.md for more information. // Copyright 2013 MIT Licence. See licence.md for more information.
// </copyright> // </copyright>
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------

4
Perspex.Controls/ScrollViewer.cs

@ -51,8 +51,8 @@ namespace Perspex.Controls
static ScrollViewer() static ScrollViewer()
{ {
AffectsCoercion(ExtentProperty, OffsetProperty); PerspexObject.AffectsCoercion(ExtentProperty, OffsetProperty);
AffectsCoercion(ViewportProperty, OffsetProperty); PerspexObject.AffectsCoercion(ViewportProperty, OffsetProperty);
} }
public ScrollViewer() public ScrollViewer()

2
Perspex.Controls/Shapes/Ellipse.cs

@ -1,5 +1,5 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// <copyright file="Rectangle.cs" company="Steven Kirk"> // <copyright file="Ellipse.cs" company="Steven Kirk">
// Copyright 2014 MIT Licence. See licence.md for more information. // Copyright 2014 MIT Licence. See licence.md for more information.
// </copyright> // </copyright>
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------

1
Perspex.Controls/Shapes/Shape.cs

@ -50,7 +50,6 @@ namespace Perspex.Controls.Shapes
this.renderedGeometry = this.DefiningGeometry.Clone(); this.renderedGeometry = this.DefiningGeometry.Clone();
this.renderedGeometry.Transform = new MatrixTransform(this.transform); this.renderedGeometry.Transform = new MatrixTransform(this.transform);
} }
} }
return this.renderedGeometry; return this.renderedGeometry;

2
Perspex.Controls/TextBlock.cs

@ -124,7 +124,7 @@ namespace Perspex.Controls
this.FontFamily, this.FontFamily,
this.FontSize, this.FontSize,
this.FontStyle); this.FontStyle);
result.Constraint = constraint; result.Constraint = this.constraint;
return result; return result;
} }

2
Perspex.Controls/TextWrapping.cs

@ -1,5 +1,5 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// <copyright file="TextBox.cs" company="Steven Kirk"> // <copyright file="TextWrapping.cs" company="Steven Kirk">
// Copyright 2014 MIT Licence. See licence.md for more information. // Copyright 2014 MIT Licence. See licence.md for more information.
// </copyright> // </copyright>
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------

22
Perspex.Controls/Utils/StringUtils.cs

@ -4,12 +4,19 @@
// </copyright> // </copyright>
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
using System.Globalization;
namespace Perspex.Controls.Utils namespace Perspex.Controls.Utils
{ {
using System.Globalization;
internal static class StringUtils internal static class StringUtils
{ {
private enum CharClass
{
CharClassUnknown,
CharClassWhitespace,
CharClassAlphaNumeric,
}
public static bool IsEol(char c) public static bool IsEol(char c)
{ {
return c == '\r' || c == '\n'; return c == '\r' || c == '\n';
@ -38,8 +45,9 @@ namespace Perspex.Controls.Utils
case UnicodeCategory.CurrencySymbol: case UnicodeCategory.CurrencySymbol:
case UnicodeCategory.MathSymbol: case UnicodeCategory.MathSymbol:
return true; return true;
// TODO: How do you do this in .NET? // TODO: How do you do this in .NET?
//case UnicodeCategory.OtherPunctuation: // case UnicodeCategory.OtherPunctuation:
// // words cannot start with '.', but they can start with '&' or '*' (for example) // // words cannot start with '.', but they can start with '&' or '*' (for example)
// return g_unichar_break_type(buffer->text[index]) == G_UNICODE_BREAK_ALPHABETIC; // return g_unichar_break_type(buffer->text[index]) == G_UNICODE_BREAK_ALPHABETIC;
default: default:
@ -249,13 +257,5 @@ namespace Perspex.Controls.Utils
return cursor; return cursor;
} }
private enum CharClass
{
CharClassUnknown,
CharClassWhitespace,
CharClassAlphaNumeric,
}
} }
} }

1
Perspex.Controls/Window.cs

@ -15,7 +15,6 @@ namespace Perspex.Controls
public static readonly PerspexProperty<string> TitleProperty = public static readonly PerspexProperty<string> TitleProperty =
PerspexProperty.Register<Window, string>("Title", "Window"); PerspexProperty.Register<Window, string>("Title", "Window");
static Window() static Window()
{ {
BackgroundProperty.OverrideDefaultValue(typeof(Window), Brushes.White); BackgroundProperty.OverrideDefaultValue(typeof(Window), Brushes.White);

2
Perspex.Diagnostics/ViewModels/TreeNode.cs

@ -1,5 +1,5 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// <copyright file="LogicalTreeNode.cs" company="Steven Kirk"> // <copyright file="TreeNode.cs" company="Steven Kirk">
// Copyright 2014 MIT Licence. See licence.md for more information. // Copyright 2014 MIT Licence. See licence.md for more information.
// </copyright> // </copyright>
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------

2
Perspex.Input/PointerPressEventArgs.cs

@ -1,5 +1,5 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// <copyright file="PointerEventArgs.cs" company="Steven Kirk"> // <copyright file="PointerPressEventArgs.cs" company="Steven Kirk">
// Copyright 2013 MIT Licence. See licence.md for more information. // Copyright 2013 MIT Licence. See licence.md for more information.
// </copyright> // </copyright>
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------

4
Perspex.Interactivity/RoutedEvent.cs

@ -37,6 +37,8 @@ namespace Perspex.Interactivity
this.RoutingStrategy = routingStrategy; this.RoutingStrategy = routingStrategy;
} }
public event EventHandler<RoutedEventArgs> Raised;
public Type EventArgsType public Type EventArgsType
{ {
get; get;
@ -61,8 +63,6 @@ namespace Perspex.Interactivity
private set; private set;
} }
public event EventHandler<RoutedEventArgs> Raised;
public static RoutedEvent<TEventArgs> Register<TOwner, TEventArgs>( public static RoutedEvent<TEventArgs> Register<TOwner, TEventArgs>(
string name, string name,
RoutingStrategy routingStrategy) RoutingStrategy routingStrategy)

1
Perspex.SceneGraph/LogicalTree/LogicalExtensions.cs

@ -35,7 +35,6 @@ namespace Perspex.LogicalTree
} }
} }
public static IEnumerable<ILogical> GetLogicalChildren(this ILogical logical) public static IEnumerable<ILogical> GetLogicalChildren(this ILogical logical)
{ {
return logical.LogicalChildren; return logical.LogicalChildren;

10
Perspex.SceneGraph/Media/EllipseGeometry.cs

@ -19,20 +19,20 @@ namespace Perspex.Media
using (IStreamGeometryContextImpl ctx = impl.Open()) using (IStreamGeometryContextImpl ctx = impl.Open())
{ {
double ControlPointRatio = (Math.Sqrt(2) - 1) * 4 / 3; double controlPointRatio = (Math.Sqrt(2) - 1) * 4 / 3;
var center = rect.Center; var center = rect.Center;
var radius = new Vector(rect.Width / 2, rect.Height / 2); var radius = new Vector(rect.Width / 2, rect.Height / 2);
var x0 = center.X - radius.X; var x0 = center.X - radius.X;
var x1 = center.X - radius.X * ControlPointRatio; var x1 = center.X - (radius.X * controlPointRatio);
var x2 = center.X; var x2 = center.X;
var x3 = center.X + radius.X * ControlPointRatio; var x3 = center.X + (radius.X * controlPointRatio);
var x4 = center.X + radius.X; var x4 = center.X + radius.X;
var y0 = center.Y - radius.Y; var y0 = center.Y - radius.Y;
var y1 = center.Y - radius.Y * ControlPointRatio; var y1 = center.Y - (radius.Y * controlPointRatio);
var y2 = center.Y; var y2 = center.Y;
var y3 = center.Y + radius.Y * ControlPointRatio; var y3 = center.Y + (radius.Y * controlPointRatio);
var y4 = center.Y + radius.Y; var y4 = center.Y + radius.Y;
ctx.BeginFigure(new Point(x2, y0), true); ctx.BeginFigure(new Point(x2, y0), true);

2
Perspex.SceneGraph/Media/MatrixTransform.cs

@ -1,5 +1,5 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// <copyright file="RotateTransform.cs" company="Steven Kirk"> // <copyright file="MatrixTransform.cs" company="Steven Kirk">
// Copyright 2013 MIT Licence. See licence.md for more information. // Copyright 2013 MIT Licence. See licence.md for more information.
// </copyright> // </copyright>
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------

10
Perspex.SceneGraph/Media/StreamGeometry.cs

@ -35,6 +35,11 @@ namespace Perspex.Media
} }
} }
private StreamGeometry(IGeometryImpl impl)
{
this.PlatformImpl = impl;
}
public override Geometry Clone() public override Geometry Clone()
{ {
return new StreamGeometry(((IStreamGeometryImpl)this.PlatformImpl).Clone()); return new StreamGeometry(((IStreamGeometryImpl)this.PlatformImpl).Clone());
@ -44,10 +49,5 @@ namespace Perspex.Media
{ {
return new StreamGeometryContext(((IStreamGeometryImpl)this.PlatformImpl).Open()); return new StreamGeometryContext(((IStreamGeometryImpl)this.PlatformImpl).Open());
} }
private StreamGeometry(IGeometryImpl impl)
{
this.PlatformImpl = impl;
}
} }
} }

2
Perspex.SceneGraph/Media/SweepDirection.cs

@ -1,5 +1,5 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// <copyright file="StreamGeometryContextImpl.cs" company="Steven Kirk"> // <copyright file="SweepDirection.cs" company="Steven Kirk">
// Copyright 2013 MIT Licence. See licence.md for more information. // Copyright 2013 MIT Licence. See licence.md for more information.
// </copyright> // </copyright>
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------

8
Windows/Perspex.Direct2D1/Media/BrushWrapper.cs

@ -1,4 +1,10 @@
namespace Perspex.Direct2D1.Media // -----------------------------------------------------------------------
// <copyright file="BrushWrapper.cs" company="Steven Kirk">
// Copyright 2014 MIT Licence. See licence.md for more information.
// </copyright>
// -----------------------------------------------------------------------
namespace Perspex.Direct2D1.Media
{ {
using Perspex.Media; using Perspex.Media;
using SharpDX; using SharpDX;

2
Windows/Perspex.Direct2D1/Media/FormattedTextImpl.cs

@ -1,5 +1,5 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// <copyright file="TextService.cs" company="Steven Kirk"> // <copyright file="FormattedTextImpl.cs" company="Steven Kirk">
// Copyright 2014 MIT Licence. See licence.md for more information. // Copyright 2014 MIT Licence. See licence.md for more information.
// </copyright> // </copyright>
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------

10
Windows/Perspex.Direct2D1/Media/StreamGeometryImpl.cs

@ -24,6 +24,11 @@ namespace Perspex.Direct2D1.Media
this.path = new PathGeometry(factory); this.path = new PathGeometry(factory);
} }
protected StreamGeometryImpl(PathGeometry geometry)
{
this.path = geometry;
}
public override Rect Bounds public override Rect Bounds
{ {
get { return this.path.GetBounds().ToPerspex(); } get { return this.path.GetBounds().ToPerspex(); }
@ -48,10 +53,5 @@ namespace Perspex.Direct2D1.Media
{ {
return new StreamGeometryContextImpl(this.path.Open()); return new StreamGeometryContextImpl(this.path.Open());
} }
protected StreamGeometryImpl(PathGeometry geometry)
{
this.path = geometry;
}
} }
} }

1
Windows/Perspex.Direct2D1/PrimitiveExtensions.cs

@ -110,6 +110,5 @@ namespace Perspex.Direct2D1
(float)rect.Width, (float)rect.Width,
(float)rect.Height); (float)rect.Height);
} }
} }
} }

2
Windows/Perspex.Win32/Interop/UnmanagedMethods.cs

@ -484,7 +484,7 @@ namespace Perspex.Win32.Interop
} }
[DllImport("user32.dll", SetLastError = true)] [DllImport("user32.dll", SetLastError = true)]
public static extern Boolean AdjustWindowRectEx(ref RECT lpRect, uint dwStyle, bool bMenu, uint dwExStyle); public static extern bool AdjustWindowRectEx(ref RECT lpRect, uint dwStyle, bool bMenu, uint dwExStyle);
[DllImport("user32.dll")] [DllImport("user32.dll")]
public static extern IntPtr BeginPaint(IntPtr hwnd, out PAINTSTRUCT lpPaint); public static extern IntPtr BeginPaint(IntPtr hwnd, out PAINTSTRUCT lpPaint);

3
Windows/Perspex.Win32/PopupImpl.cs

@ -1,5 +1,5 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// <copyright file="WindowImpl.cs" company="Steven Kirk"> // <copyright file="PopupImpl.cs" company="Steven Kirk">
// Copyright 2014 MIT Licence. See licence.md for more information. // Copyright 2014 MIT Licence. See licence.md for more information.
// </copyright> // </copyright>
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
@ -24,7 +24,6 @@ namespace Perspex.Win32
UnmanagedMethods.SetWindowPosFlags.SWP_NOSIZE | UnmanagedMethods.SetWindowPosFlags.SWP_NOACTIVATE); UnmanagedMethods.SetWindowPosFlags.SWP_NOSIZE | UnmanagedMethods.SetWindowPosFlags.SWP_NOACTIVATE);
} }
public override void Show() public override void Show()
{ {
UnmanagedMethods.ShowWindow(this.Handle.Handle, UnmanagedMethods.ShowWindowCommand.ShowNoActivate); UnmanagedMethods.ShowWindow(this.Handle.Handle, UnmanagedMethods.ShowWindowCommand.ShowNoActivate);

2
Windows/Perspex.Win32/WindowImpl.cs

@ -277,6 +277,7 @@ namespace Perspex.Win32
UnmanagedMethods.EndPaint(this.hwnd, ref ps); UnmanagedMethods.EndPaint(this.hwnd, ref ps);
} }
} }
return IntPtr.Zero; return IntPtr.Zero;
case UnmanagedMethods.WindowsMessage.WM_SIZE: case UnmanagedMethods.WindowsMessage.WM_SIZE:
@ -298,7 +299,6 @@ namespace Perspex.Win32
return UnmanagedMethods.DefWindowProc(hWnd, msg, wParam, lParam); return UnmanagedMethods.DefWindowProc(hWnd, msg, wParam, lParam);
} }
private void CreateWindow() private void CreateWindow()
{ {
// Ensure that the delegate doesn't get garbage collected by storing it as a field. // Ensure that the delegate doesn't get garbage collected by storing it as a field.

Loading…
Cancel
Save