Browse Source

Code fixes in Line/Polyline Extensions

pull/630/head
jkuehner 11 years ago
parent
commit
6ca3555dc7
  1. 26
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/LineExtensionBase.cs
  2. 39
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/LineHandlerExtension.cs
  3. 39
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/PolyLineHandlerExtension.cs
  4. 11
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/ResizeThumbExtension.cs

26
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/LineExtensionBase.cs

@ -1,11 +1,21 @@ @@ -1,11 +1,21 @@
/*
* Created by SharpDevelop.
* User: trubra
* Date: 2014-12-22
* Time: 11:00
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System;
using ICSharpCode.WpfDesign.Designer.Controls;
using ICSharpCode.WpfDesign.Designer.Extensions;

39
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/LineHandlerExtension.cs

@ -1,11 +1,21 @@ @@ -1,11 +1,21 @@
/*
* Created by SharpDevelop.
* User: trubra
* Date: 2014-12-22
* Time: 10:34
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System;
using ICSharpCode.WpfDesign.Extensions;
using ICSharpCode.WpfDesign;
@ -21,12 +31,13 @@ using System; @@ -21,12 +31,13 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using ICSharpCode.WpfDesign.Designer.UIExtensions;
namespace ICSharpCode.WpfDesign.Designer.Extensions
{
/// <summary>
/// Description of LineHandlerExtension.
/// </summary>
[ExtensionFor(typeof(Line), OverrideExtensions = new Type[] { typeof(ResizeThumbExtension), typeof(SelectedElementRectangleExtension), typeof(CanvasPositionExtension), typeof(QuickOperationMenuExtension), typeof(RotateThumbExtension), typeof(RenderTransformOriginExtension), typeof(InPlaceEditorExtension) })]
[ExtensionFor(typeof(Line), OverrideExtensions = new Type[] { typeof(ResizeThumbExtension), typeof(SelectedElementRectangleExtension), typeof(CanvasPositionExtension), typeof(QuickOperationMenuExtension), typeof(RotateThumbExtension), typeof(RenderTransformOriginExtension), typeof(InPlaceEditorExtension), typeof(SkewThumbExtension) })]
internal class LineHandlerExtension : LineExtensionBase
{
//
@ -101,15 +112,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -101,15 +112,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
CurrentTop = (double)al.GetValue(Canvas.TopProperty);
var designPanel = ExtendedItem.Services.DesignPanel as DesignPanel;
if (designPanel != null)
{
var p = VisualTreeHelper.GetParent(designPanel);
while (p != null && !(p is ZoomControl))
{
p = VisualTreeHelper.GetParent(p);
}
zoom = p as ZoomControl;
}
zoom = designPanel.TryFindParent<ZoomControl>();
if (resizeBehavior != null)
operation = PlacementOperation.Start(extendedItemArray, PlacementType.Resize);

39
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/PolyLineHandlerExtension.cs

@ -1,11 +1,21 @@ @@ -1,11 +1,21 @@
/*
* Created by SharpDevelop.
* User: trubra
* Date: 2014-12-22
* Time: 10:34
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System;
using ICSharpCode.WpfDesign.Extensions;
using ICSharpCode.WpfDesign;
@ -21,13 +31,14 @@ using System; @@ -21,13 +31,14 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using ICSharpCode.WpfDesign.Designer.UIExtensions;
namespace ICSharpCode.WpfDesign.Designer.Extensions
{
/// <summary>
/// Description of PolyLineHandlerExtension.
/// </summary>
[ExtensionFor(typeof(Polyline), OverrideExtensions = new Type[] { typeof(ResizeThumbExtension), typeof(SelectedElementRectangleExtension), typeof(CanvasPositionExtension), typeof(QuickOperationMenuExtension), typeof(RotateThumbExtension), typeof(RenderTransformOriginExtension), typeof(InPlaceEditorExtension), typeof(SizeDisplayExtension) })]
[ExtensionFor(typeof(Polyline), OverrideExtensions = new Type[] { typeof(ResizeThumbExtension), typeof(SelectedElementRectangleExtension), typeof(CanvasPositionExtension), typeof(QuickOperationMenuExtension), typeof(RotateThumbExtension), typeof(RenderTransformOriginExtension), typeof(InPlaceEditorExtension), typeof(SizeDisplayExtension), typeof(SkewThumbExtension) })]
internal class PolyLineHandlerExtension : LineExtensionBase, IKeyDown, IKeyUp
{
private readonly Dictionary<int, Bounds> _selectedThumbs = new Dictionary<int, Bounds>();
@ -134,15 +145,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -134,15 +145,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
void SetOperation()
{
var designPanel = ExtendedItem.Services.DesignPanel as DesignPanel;
if (designPanel != null)
{
var p = VisualTreeHelper.GetParent(designPanel);
while (p != null && !(p is ZoomControl))
{
p = VisualTreeHelper.GetParent(p);
}
_zoom = p as ZoomControl;
}
_zoom = designPanel.TryFindParent<ZoomControl>();
if (resizeBehavior != null)
operation = PlacementOperation.Start(extendedItemArray, PlacementType.Resize);

11
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/ResizeThumbExtension.cs

@ -26,6 +26,7 @@ using ICSharpCode.WpfDesign.Adorners; @@ -26,6 +26,7 @@ using ICSharpCode.WpfDesign.Adorners;
using ICSharpCode.WpfDesign.Designer.Controls;
using ICSharpCode.WpfDesign.Extensions;
using System.Collections.Generic;
using ICSharpCode.WpfDesign.Designer.UIExtensions;
namespace ICSharpCode.WpfDesign.Designer.Extensions
{
@ -124,15 +125,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -124,15 +125,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
void drag_Started(DragListener drag)
{
var designPanel = ExtendedItem.Services.DesignPanel as DesignPanel;
if (designPanel != null)
{
var p = VisualTreeHelper.GetParent(designPanel);
while (p != null && !(p is ZoomControl))
{
p = VisualTreeHelper.GetParent(p);
}
zoom = p as ZoomControl;
}
zoom = designPanel.TryFindParent<ZoomControl>();
/* Abort editing Text if it was editing, because it interferes with the undo stack. */
foreach(var extension in this.ExtendedItem.Extensions){

Loading…
Cancel
Save