From fada9f0e0d9ee7ce9bcedbc63b41aa16dff81bc9 Mon Sep 17 00:00:00 2001 From: Ivan Shumilin Date: Wed, 29 Oct 2008 14:34:06 +0000 Subject: [PATCH] remove duplicated projects and reference, update output paths in *.csproj git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3625 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- samples/XamlDesigner/XamlDesigner.csproj | 12 +- .../BackendBindings/Xaml/Xaml/Xaml.csproj | 3 +- .../Project/Configuration/AssemblyInfo.cs | 20 - .../Project/Src/XamlClassReturnType.cs | 42 -- .../Project/Src/XamlCodeCompletionBinding.cs | 99 --- .../Project/Src/XamlCompilationUnit.cs | 126 ---- .../Project/Src/XamlExpressionContext.cs | 63 -- .../Project/Src/XamlExpressionFinder.cs | 74 --- .../XamlBinding/Project/Src/XamlParser.cs | 142 ----- .../XamlBinding/Project/Src/XamlResolver.cs | 336 ---------- .../XamlBinding/Project/XamlBinding.addin | 43 -- .../XamlBinding/Project/XamlBinding.csproj | 94 --- .../Properties/AssemblyInfo.cs | 16 - .../XamlBinding.Tests.csproj | 75 --- .../XamlExpressionFinderTests.cs | 48 -- .../Project/BasicMetadata.cs | 245 -------- .../Project/CallExtension.cs | 109 ---- .../Project/Configuration/AssemblyInfo.cs | 50 -- .../Project/Controls/AdornerLayer.cs | 298 --------- .../Project/Controls/ContainerDragHandle.cs | 32 - .../Project/Controls/ControlStyles.xaml | 416 ------------- .../Project/Controls/DragListener.cs | 111 ---- .../Project/Controls/DropDownButton.cs | 33 - .../Project/Controls/EnterTextBox.cs | 31 - .../Project/Controls/EnumBar.xaml | 7 - .../Project/Controls/EnumBar.xaml.cs | 112 ---- .../Project/Controls/EnumButton.cs | 26 - .../Project/Controls/ErrorBalloon.cs | 23 - .../GrayOutDesignerExceptActiveArea.cs | 121 ---- .../Project/Controls/GridAdorner.cs | 371 ----------- .../Project/Controls/NumericUpDown.cs | 302 --------- .../Project/Controls/NumericUpDown.xaml | 149 ----- .../Project/Controls/PanelMoveAdorner.cs | 34 - .../Project/Controls/ResizeThumb.cs | 89 --- .../Project/Controls/SelectionFrame.cs | 32 - .../Project/Controls/WindowClone.cs | 228 ------- .../Project/Controls/ZoomControl.cs | 200 ------ .../WpfDesign.Designer/Project/Converters.cs | 135 ---- .../WpfDesign.Designer/Project/DesignPanel.cs | 270 -------- .../Project/DesignSurface.xaml | 15 - .../Project/DesignSurface.xaml.cs | 258 -------- .../Project/DragDropExceptionHandler.cs | 24 - .../Project/ExtensionMethods.cs | 86 --- .../Extensions/BorderForInvisibleControl.cs | 31 - .../Extensions/CanvasPlacementSupport.cs | 84 --- .../Extensions/DefaultPlacementBehavior.cs | 96 --- .../Project/Extensions/GridAdornerProvider.cs | 136 ---- .../Extensions/GridPlacementSupport.cs | 292 --------- .../Project/Extensions/Initializers.cs | 52 -- .../Extensions/PanelInstanceFactory.cs | 161 ----- .../Project/Extensions/PanelMove.cs | 27 - .../Extensions/PanelSelectionHandler.cs | 170 ----- .../Extensions/ResizeThumbExtension.cs | 150 ----- .../SelectedElementRectangleExtension.cs | 50 -- .../Extensions/SnaplinePlacementBehavior.cs | 312 ---------- .../Extensions/TabItemClickableExtension.cs | 32 - .../Extensions/TopLeftContainerDragHandle.cs | 44 -- .../Extensions/WindowResizeBehavior.cs | 86 --- .../Project/Images/Class.png | Bin 624 -> 0 bytes .../Project/Images/PanToolCursor.cur | Bin 326 -> 0 bytes .../Project/Images/PanToolCursorMouseDown.cur | Bin 326 -> 0 bytes .../WpfDesign.Designer/Project/Images/Tag.png | Bin 389 -> 0 bytes .../Project/Images/ZoomIn.png | Bin 635 -> 0 bytes .../Project/Images/ZoomOut.png | Bin 647 -> 0 bytes .../WpfDesign.Designer/Project/ModelTools.cs | 139 ----- .../Project/OutlineView/DragListener.cs | 57 -- .../Project/OutlineView/DragTreeView.cs | 326 ---------- .../Project/OutlineView/DragTreeViewItem.cs | 119 ---- .../Project/OutlineView/IconItem.cs | 35 -- .../Project/OutlineView/Outline.xaml | 28 - .../Project/OutlineView/Outline.xaml.cs | 32 - .../Project/OutlineView/OutlineNode.cs | 191 ------ .../Project/OutlineView/OutlineTreeView.cs | 22 - .../Project/OutlineView/OutlineView.xaml | 151 ----- .../PropertyGrid/Editors/BoolEditor.xaml | 7 - .../PropertyGrid/Editors/BoolEditor.xaml.cs | 26 - .../Editors/BrushEditor/BrushEditor.cs | 207 ------- .../Editors/BrushEditor/BrushEditorPopup.xaml | 11 - .../BrushEditor/BrushEditorPopup.xaml.cs | 36 -- .../Editors/BrushEditor/BrushEditorView.xaml | 81 --- .../BrushEditor/BrushEditorView.xaml.cs | 51 -- .../Editors/BrushEditor/BrushTypeEditor.xaml | 13 - .../BrushEditor/BrushTypeEditor.xaml.cs | 36 -- .../Editors/BrushEditor/ColorHelper.cs | 92 --- .../Editors/BrushEditor/ColorPicker.xaml | 233 ------- .../Editors/BrushEditor/ColorPicker.xaml.cs | 184 ------ .../BrushEditor/GradientBrushEditor.xaml | 12 - .../BrushEditor/GradientBrushEditor.xaml.cs | 24 - .../Editors/BrushEditor/GradientSlider.xaml | 109 ---- .../BrushEditor/GradientSlider.xaml.cs | 159 ----- .../Editors/BrushEditor/NormalizedPanel.cs | 68 -- .../Editors/BrushEditor/Picker.cs | 137 ----- .../Editors/BrushEditor/SolidBrushEditor.xaml | 19 - .../BrushEditor/SolidBrushEditor.xaml.cs | 33 - .../PropertyGrid/Editors/EventEditor.xaml | 9 - .../PropertyGrid/Editors/EventEditor.xaml.cs | 71 --- .../PropertyGrid/Editors/NumberEditor.xaml | 9 - .../PropertyGrid/Editors/NumberEditor.xaml.cs | 121 ---- .../PropertyGrid/PropertyContextMenu.xaml | 25 - .../PropertyGrid/PropertyContextMenu.xaml.cs | 51 -- .../Project/PropertyGrid/PropertyGrid.cs | 283 --------- .../PropertyGrid/PropertyGridView.xaml | 356 ----------- .../PropertyGrid/PropertyGridView.xaml.cs | 86 --- .../Project/ServiceRequiredException.cs | 56 -- .../Project/Services/ChooseClass.cs | 99 --- .../Project/Services/ChooseClassDialog.xaml | 70 --- .../Services/ChooseClassDialog.xaml.cs | 112 ---- .../Services/ChooseClassServiceBase.cs | 23 - .../Services/ClickOrDragMouseGesture.cs | 52 -- .../Project/Services/CreateComponentTool.cs | 258 -------- .../Project/Services/DragMoveMouseGesture.cs | 66 -- .../Project/Services/ErrorService.cs | 88 --- .../Project/Services/MouseGestureBase.cs | 112 ---- .../Project/Services/MoveLogic.cs | 140 ----- .../Project/Services/OptionService.cs | 22 - .../Project/Services/PointerTool.cs | 53 -- .../Project/Services/SelectionService.cs | 183 ------ .../Project/Services/ToolService.cs | 66 -- .../Project/Services/UndoService.cs | 316 ---------- .../Project/Services/ViewService.cs | 27 - .../Services/WpfTopLevelWindowService.cs | 44 -- .../Project/Services/XamlErrorService.cs | 31 - .../Project/SharedInstances.cs | 24 - .../Project/WpfDesign.Designer.csproj | 301 --------- .../Project/Xaml/XamlComponentService.cs | 95 --- .../Project/Xaml/XamlDesignContext.cs | 127 ---- .../Project/Xaml/XamlDesignItem.cs | 152 ----- .../Project/Xaml/XamlLoadSettings.cs | 38 -- .../XamlModelCollectionElementsCollection.cs | 241 -------- .../Project/Xaml/XamlModelProperty.cs | 299 --------- .../Xaml/XamlModelPropertyCollection.cs | 39 -- .../Project/themes/generic.xaml | 7 - .../WpfDesign.Designer/Tests/AssemblyInfo.cs | 15 - .../Tests/Designer/ModelTestHelper.cs | 99 --- .../Tests/Designer/ModelTests.cs | 247 -------- .../Tests/Designer/PlacementTests.cs | 50 -- .../Tests/WpfDesign.Tests.csproj | 89 --- .../Tests/XamlDom/ExampleClass.cs | 89 --- .../Tests/XamlDom/ExampleClassContainer.cs | 26 - .../Tests/XamlDom/ExampleService.cs | 44 -- .../Tests/XamlDom/MarkupExtensionTests.cs | 111 ---- .../Tests/XamlDom/SamplesTests.cs | 133 ---- .../Tests/XamlDom/SimpleLoadTests.cs | 292 --------- .../Tests/XamlDom/SystemTypesLoadTest.cs | 35 -- .../Tests/XamlDom/TestHelper.cs | 80 --- .../Tests/XamlDom/WhitespaceTests.cs | 131 ---- .../Tests/XamlDom/XamlTypeFinderTests.cs | 67 -- .../WpfDesign.Designer/Tests/app.config | 15 - .../WpfDesign.Designer.csproj | 14 +- .../WpfDesign.Tests/WpfDesign.Tests.csproj | 10 +- .../WpfDesign.XamlDom/Project/AssemblyInfo.cs | 17 - .../Project/CollectionElementsCollection.cs | 72 --- .../Project/CollectionSupport.cs | 130 ---- .../Project/IXamlErrorSink.cs | 18 - .../Project/MarkupExtensionParser.cs | 323 ---------- .../Project/MarkupExtensionPrinter.cs | 54 -- .../Project/PositionXmlDocument.cs | 141 ----- .../Project/WpfDesign.XamlDom.csproj | 87 --- .../Project/XamlConstants.cs | 35 -- .../WpfDesign.XamlDom/Project/XamlDocument.cs | 184 ------ .../Project/XamlLoadException.cs | 48 -- .../WpfDesign.XamlDom/Project/XamlObject.cs | 395 ------------ .../Project/XamlObjectServiceProvider.cs | 68 -- .../WpfDesign.XamlDom/Project/XamlParser.cs | 579 ------------------ .../Project/XamlParserSettings.cs | 72 --- .../WpfDesign.XamlDom/Project/XamlProperty.cs | 455 -------------- .../Project/XamlPropertyInfo.cs | 339 ---------- .../Project/XamlPropertyValue.cs | 61 -- .../Project/XamlTextValue.cs | 157 ----- .../Project/XamlTypeFinder.cs | 241 -------- .../Project/XamlTypeResolverProvider.cs | 104 ---- .../Project/Adorners/AdornerPanel.cs | 212 ------- .../Project/Adorners/AdornerPlacement.cs | 39 -- .../Project/Adorners/AdornerPlacementSpace.cs | 33 - .../Project/Adorners/AdornerProvider.cs | 167 ----- .../Adorners/AdornerProviderClasses.cs | 50 -- .../Project/Adorners/RelativePlacement.cs | 211 ------- .../WpfDesign/Project/ChangeGroup.cs | 47 -- .../Project/Configuration/AssemblyInfo.cs | 17 - .../WpfDesign/Project/DesignContext.cs | 61 -- .../WpfDesign/WpfDesign/Project/DesignItem.cs | 260 -------- .../WpfDesign/Project/DesignItemProperty.cs | 213 ------- .../Project/DesignPanelHitTestResult.cs | 110 ---- .../WpfDesign/Project/DesignerException.cs | 48 -- .../WpfDesign/WpfDesign/Project/EventArgs.cs | 58 -- .../Project/Extensions/BehaviorExtension.cs | 21 - .../Extensions/CustomInstanceFactory.cs | 68 -- .../Project/Extensions/DefaultExtension.cs | 136 ---- .../Project/Extensions/DefaultInitializer.cs | 23 - .../WpfDesign/Project/Extensions/Extension.cs | 25 - .../Extensions/ExtensionForAttribute.cs | 56 -- .../Project/Extensions/ExtensionManager.cs | 261 -------- .../Project/Extensions/ExtensionServer.cs | 83 --- .../Extensions/ExtensionServerAttribute.cs | 42 -- .../Extensions/LogicalExtensionServers.cs | 75 --- .../Extensions/SelectionExtensionServer.cs | 145 ----- .../WpfDesign/WpfDesign/Project/HashSet.cs | 202 ------ .../WpfDesign/WpfDesign/Project/Metadata.cs | 328 ---------- .../WpfDesign/Project/MouseInteraction.cs | 29 - .../WpfDesign/Project/PlacementAlignment.cs | 107 ---- .../WpfDesign/Project/PlacementBehavior.cs | 78 --- .../WpfDesign/Project/PlacementInformation.cs | 60 -- .../WpfDesign/Project/PlacementOperation.cs | 293 --------- .../WpfDesign/Project/PlacementType.cs | 67 -- .../Project/PropertyGrid/Category.cs | 83 --- .../Project/PropertyGrid/EditorManager.cs | 75 --- .../PropertyGrid/Editors/ComboBoxEditor.xaml | 10 - .../Editors/ComboBoxEditor.xaml.cs | 38 -- .../PropertyGrid/Editors/TextBoxEditor.xaml | 9 - .../Editors/TextBoxEditor.xaml.cs | 38 -- .../PropertyGrid/PropertyEditorAttribute.cs | 50 -- .../Project/PropertyGrid/PropertyNode.cs | 310 ---------- .../SortedObservableCollection.cs | 60 -- .../PropertyGrid/TypeEditorAttribute.cs | 39 -- .../Project/PropertyGrid/TypeHelper.cs | 64 -- .../WpfDesign/Project/ServiceContainer.cs | 168 ----- .../WpfDesign/WpfDesign/Project/Services.cs | 220 ------- .../WpfDesign/WpfDesign/Project/Tools.cs | 132 ---- .../WpfDesign/Project/WpfDesign.csproj | 125 ---- .../WpfDesign/WpfDesign/WpfDesign.csproj | 14 +- 220 files changed, 13 insertions(+), 23687 deletions(-) delete mode 100644 src/AddIns/BackendBindings/XamlBinding/Project/Configuration/AssemblyInfo.cs delete mode 100644 src/AddIns/BackendBindings/XamlBinding/Project/Src/XamlClassReturnType.cs delete mode 100644 src/AddIns/BackendBindings/XamlBinding/Project/Src/XamlCodeCompletionBinding.cs delete mode 100644 src/AddIns/BackendBindings/XamlBinding/Project/Src/XamlCompilationUnit.cs delete mode 100644 src/AddIns/BackendBindings/XamlBinding/Project/Src/XamlExpressionContext.cs delete mode 100644 src/AddIns/BackendBindings/XamlBinding/Project/Src/XamlExpressionFinder.cs delete mode 100644 src/AddIns/BackendBindings/XamlBinding/Project/Src/XamlParser.cs delete mode 100644 src/AddIns/BackendBindings/XamlBinding/Project/Src/XamlResolver.cs delete mode 100644 src/AddIns/BackendBindings/XamlBinding/Project/XamlBinding.addin delete mode 100644 src/AddIns/BackendBindings/XamlBinding/Project/XamlBinding.csproj delete mode 100644 src/AddIns/BackendBindings/XamlBinding/XamlBinding.Tests/Properties/AssemblyInfo.cs delete mode 100644 src/AddIns/BackendBindings/XamlBinding/XamlBinding.Tests/XamlBinding.Tests.csproj delete mode 100644 src/AddIns/BackendBindings/XamlBinding/XamlBinding.Tests/XamlExpressionFinderTests.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/BasicMetadata.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/CallExtension.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Configuration/AssemblyInfo.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/AdornerLayer.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ContainerDragHandle.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ControlStyles.xaml delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/DragListener.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/DropDownButton.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/EnterTextBox.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/EnumBar.xaml delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/EnumBar.xaml.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/EnumButton.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ErrorBalloon.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/GrayOutDesignerExceptActiveArea.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/GridAdorner.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/NumericUpDown.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/NumericUpDown.xaml delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/PanelMoveAdorner.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ResizeThumb.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/SelectionFrame.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/WindowClone.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ZoomControl.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Converters.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignPanel.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignSurface.xaml delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignSurface.xaml.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DragDropExceptionHandler.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/ExtensionMethods.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/BorderForInvisibleControl.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/CanvasPlacementSupport.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/DefaultPlacementBehavior.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/GridAdornerProvider.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/GridPlacementSupport.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/Initializers.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/PanelInstanceFactory.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/PanelMove.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/PanelSelectionHandler.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/ResizeThumbExtension.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/SelectedElementRectangleExtension.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/SnaplinePlacementBehavior.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/TabItemClickableExtension.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/TopLeftContainerDragHandle.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/WindowResizeBehavior.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/Class.png delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/PanToolCursor.cur delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/PanToolCursorMouseDown.cur delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/Tag.png delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/ZoomIn.png delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/ZoomOut.png delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/ModelTools.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/DragListener.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/DragTreeView.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/DragTreeViewItem.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/IconItem.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/Outline.xaml delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/Outline.xaml.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/OutlineNode.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/OutlineTreeView.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/OutlineView.xaml delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BoolEditor.xaml delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BoolEditor.xaml.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BrushEditor/BrushEditor.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BrushEditor/BrushEditorPopup.xaml delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BrushEditor/BrushEditorPopup.xaml.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BrushEditor/BrushEditorView.xaml delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BrushEditor/BrushEditorView.xaml.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BrushEditor/BrushTypeEditor.xaml delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BrushEditor/BrushTypeEditor.xaml.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BrushEditor/ColorHelper.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BrushEditor/ColorPicker.xaml delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BrushEditor/ColorPicker.xaml.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BrushEditor/GradientBrushEditor.xaml delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BrushEditor/GradientBrushEditor.xaml.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BrushEditor/GradientSlider.xaml delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BrushEditor/GradientSlider.xaml.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BrushEditor/NormalizedPanel.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BrushEditor/Picker.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BrushEditor/SolidBrushEditor.xaml delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BrushEditor/SolidBrushEditor.xaml.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/EventEditor.xaml delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/EventEditor.xaml.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/NumberEditor.xaml delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/NumberEditor.xaml.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/PropertyContextMenu.xaml delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/PropertyContextMenu.xaml.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/PropertyGrid.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/PropertyGridView.xaml delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/PropertyGridView.xaml.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/ServiceRequiredException.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Services/ChooseClass.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Services/ChooseClassDialog.xaml delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Services/ChooseClassDialog.xaml.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Services/ChooseClassServiceBase.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Services/ClickOrDragMouseGesture.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Services/CreateComponentTool.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Services/DragMoveMouseGesture.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Services/ErrorService.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Services/MouseGestureBase.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Services/MoveLogic.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Services/OptionService.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Services/PointerTool.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Services/SelectionService.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Services/ToolService.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Services/UndoService.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Services/ViewService.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Services/WpfTopLevelWindowService.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Services/XamlErrorService.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/SharedInstances.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/WpfDesign.Designer.csproj delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Xaml/XamlComponentService.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Xaml/XamlDesignContext.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Xaml/XamlDesignItem.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Xaml/XamlLoadSettings.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Xaml/XamlModelCollectionElementsCollection.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Xaml/XamlModelProperty.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Xaml/XamlModelPropertyCollection.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/themes/generic.xaml delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/AssemblyInfo.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/Designer/ModelTestHelper.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/Designer/ModelTests.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/Designer/PlacementTests.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/WpfDesign.Tests.csproj delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/XamlDom/ExampleClass.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/XamlDom/ExampleClassContainer.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/XamlDom/ExampleService.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/XamlDom/MarkupExtensionTests.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/XamlDom/SamplesTests.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/XamlDom/SimpleLoadTests.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/XamlDom/SystemTypesLoadTest.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/XamlDom/TestHelper.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/XamlDom/WhitespaceTests.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/XamlDom/XamlTypeFinderTests.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/app.config delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/AssemblyInfo.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/CollectionElementsCollection.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/CollectionSupport.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/IXamlErrorSink.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/MarkupExtensionParser.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/MarkupExtensionPrinter.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/PositionXmlDocument.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/WpfDesign.XamlDom.csproj delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlConstants.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlDocument.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlLoadException.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlObject.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlObjectServiceProvider.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlParser.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlParserSettings.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlProperty.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlPropertyInfo.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlPropertyValue.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlTextValue.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlTypeFinder.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlTypeResolverProvider.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/Adorners/AdornerPanel.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/Adorners/AdornerPlacement.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/Adorners/AdornerPlacementSpace.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/Adorners/AdornerProvider.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/Adorners/AdornerProviderClasses.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/Adorners/RelativePlacement.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/ChangeGroup.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/Configuration/AssemblyInfo.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/DesignContext.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/DesignItem.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/DesignItemProperty.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/DesignPanelHitTestResult.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/DesignerException.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/EventArgs.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/Extensions/BehaviorExtension.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/Extensions/CustomInstanceFactory.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/Extensions/DefaultExtension.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/Extensions/DefaultInitializer.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/Extensions/Extension.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/Extensions/ExtensionForAttribute.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/Extensions/ExtensionManager.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/Extensions/ExtensionServer.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/Extensions/ExtensionServerAttribute.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/Extensions/LogicalExtensionServers.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/Extensions/SelectionExtensionServer.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/HashSet.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/Metadata.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/MouseInteraction.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementAlignment.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementBehavior.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementInformation.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementOperation.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementType.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyGrid/Category.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyGrid/EditorManager.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyGrid/Editors/ComboBoxEditor.xaml delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyGrid/Editors/ComboBoxEditor.xaml.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyGrid/Editors/TextBoxEditor.xaml delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyGrid/Editors/TextBoxEditor.xaml.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyGrid/PropertyEditorAttribute.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyGrid/PropertyNode.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyGrid/SortedObservableCollection.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyGrid/TypeEditorAttribute.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyGrid/TypeHelper.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/ServiceContainer.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/Services.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/Tools.cs delete mode 100644 src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/WpfDesign.csproj diff --git a/samples/XamlDesigner/XamlDesigner.csproj b/samples/XamlDesigner/XamlDesigner.csproj index 61839e3fc6..4a796b9cfe 100644 --- a/samples/XamlDesigner/XamlDesigner.csproj +++ b/samples/XamlDesigner/XamlDesigner.csproj @@ -41,14 +41,6 @@ False ..\..\bin\ICSharpCode.TextEditor.dll - - False - ..\..\AddIns\AddIns\DisplayBindings\WpfDesign\ICSharpCode.WpfDesign.dll - - - False - ..\..\AddIns\AddIns\DisplayBindings\WpfDesign\ICSharpCode.WpfDesign.Designer.dll - 3.5 @@ -185,6 +177,10 @@ {78CC29AC-CC79-4355-B1F2-97936DF198AC} WpfDesign.Designer + + {66A378A1-E9F4-4AD5-8946-D0EC06C2902F} + WpfDesign + - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/AddIns/BackendBindings/XamlBinding/Project/XamlBinding.csproj b/src/AddIns/BackendBindings/XamlBinding/Project/XamlBinding.csproj deleted file mode 100644 index b5f618f0b0..0000000000 --- a/src/AddIns/BackendBindings/XamlBinding/Project/XamlBinding.csproj +++ /dev/null @@ -1,94 +0,0 @@ - - - {7C96B65D-28A5-4F28-A35B-8D83CE831EE8} - Debug - AnyCPU - Library - XamlBinding - XamlBinding - ..\..\..\..\..\AddIns\AddIns\BackendBindings\XamlBinding - False - False - 4 - false - C:\Users\Daniel\AppData\Roaming\ICSharpCode/SharpDevelop3.0\Settings.SourceAnalysis - v3.5 - - - true - Full - True - DEBUG;TRACE - False - - - False - None - False - TRACE - - - False - Auto - 4194304 - AnyCPU - 4096 - - - - - - 3.5 - - - - - - - - - Always - - - Configuration\GlobalAssemblyInfo.cs - - - - - - - - - - - {2D18BE89-D210-49EB-A9DD-2246FBB3DF6D} - ICSharpCode.TextEditor - False - - - {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195} - NRefactory - False - - - {2748AD25-9C63-4E12-877B-4DCE96FBED54} - ICSharpCode.SharpDevelop - False - - - {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} - ICSharpCode.Core - False - - - {924EE450-603D-49C1-A8E5-4AFAA31CE6F3} - ICSharpCode.SharpDevelop.Dom - False - - - {6B717BD1-CD5E-498C-A42E-9E6A4584DC48} - XmlEditor - False - - - \ No newline at end of file diff --git a/src/AddIns/BackendBindings/XamlBinding/XamlBinding.Tests/Properties/AssemblyInfo.cs b/src/AddIns/BackendBindings/XamlBinding/XamlBinding.Tests/Properties/AssemblyInfo.cs deleted file mode 100644 index 75eeecb3bb..0000000000 --- a/src/AddIns/BackendBindings/XamlBinding/XamlBinding.Tests/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,16 +0,0 @@ -#region Using directives - -using System; -using System.Reflection; -using System.Runtime.InteropServices; - -#endregion - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("XamlBinding.Tests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] diff --git a/src/AddIns/BackendBindings/XamlBinding/XamlBinding.Tests/XamlBinding.Tests.csproj b/src/AddIns/BackendBindings/XamlBinding/XamlBinding.Tests/XamlBinding.Tests.csproj deleted file mode 100644 index cdf9a59770..0000000000 --- a/src/AddIns/BackendBindings/XamlBinding/XamlBinding.Tests/XamlBinding.Tests.csproj +++ /dev/null @@ -1,75 +0,0 @@ - - - {F390DA70-1FE1-4715-81A0-389AB010C130} - Debug - AnyCPU - Library - XamlBinding.Tests - XamlBinding.Tests - v3.5 - Properties - C:\Users\Daniel\AppData\Roaming\ICSharpCode/SharpDevelop3.0\Settings.SourceAnalysis - ..\..\..\..\..\bin\UnitTests\ - False - False - 4 - false - - - true - Full - False - True - DEBUG;TRACE - - - False - None - True - False - TRACE - - - False - Auto - 4194304 - AnyCPU - 4096 - - - - - ..\..\..\..\Tools\NUnit\nunit.framework.dll - False - - - - 3.5 - - - - 3.5 - - - - - Properties\GlobalAssemblyInfo.cs - - - - - - - {924EE450-603D-49C1-A8E5-4AFAA31CE6F3} - ICSharpCode.SharpDevelop.Dom - - - {6B717BD1-CD5E-498C-A42E-9E6A4584DC48} - XmlEditor - - - {7C96B65D-28A5-4F28-A35B-8D83CE831EE8} - XamlBinding - - - \ No newline at end of file diff --git a/src/AddIns/BackendBindings/XamlBinding/XamlBinding.Tests/XamlExpressionFinderTests.cs b/src/AddIns/BackendBindings/XamlBinding/XamlBinding.Tests/XamlExpressionFinderTests.cs deleted file mode 100644 index f48f483f53..0000000000 --- a/src/AddIns/BackendBindings/XamlBinding/XamlBinding.Tests/XamlExpressionFinderTests.cs +++ /dev/null @@ -1,48 +0,0 @@ -// -// -// -// -// $Revision$ -// - - -using ICSharpCode.SharpDevelop.Dom; -using System; -using NUnit.Framework; -using NUnit.Framework.SyntaxHelpers; - -namespace XamlBinding.Tests -{ - [TestFixture] - public class XamlExpressionFinderTests - { - XamlExpressionContext GetXamlContext(string text) - { - return (XamlExpressionContext)GetContext(text); - } - - ExpressionContext GetContext(string text) - { - return XamlExpressionFinder.Instance.FindExpression(text, text.Length).Context; - } - - [Test] - public void FindContextAfterElementName() - { - XamlExpressionContext c = GetXamlContext(" Grid", c.ElementPath.ToString()); - Assert.IsNull(c.AttributeName); - Assert.IsFalse(c.InAttributeValue); - } - - [Test] - public void FindContextAtElementStart() - { - XamlExpressionContext c = GetXamlContext("<"); - Assert.AreEqual(0, c.ElementPath.Elements.Count); - Assert.IsNull(c.AttributeName); - Assert.IsFalse(c.InAttributeValue); - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/BasicMetadata.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/BasicMetadata.cs deleted file mode 100644 index 18eb7ff0c6..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/BasicMetadata.cs +++ /dev/null @@ -1,245 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows.Media; -using System.Windows; -using System.Windows.Input; -using System.Windows.Documents; -using System.Windows.Controls; -using System.Windows.Controls.Primitives; -using System.Windows.Media.Imaging; -using System.Windows.Media.Media3D; -using System.Windows.Shapes; -using System.Windows.Media.Animation; -using System.Windows.Data; -using System.Windows.Automation; -using System.Windows.Media.Effects; -using System.Windows.Navigation; - -namespace ICSharpCode.WpfDesign.Designer -{ - public static class BasicMetadata - { - static bool registered; - - public static void Register() - { - if (registered) return; - registered = true; - - Metadata.AddStandardValues(typeof(Brush), typeof(Brushes)); - Metadata.AddStandardValues(typeof(Color), typeof(Colors)); - Metadata.AddStandardValues(typeof(FontStretch), typeof(FontStretches)); - Metadata.AddStandardValues(typeof(FontWeight), typeof(FontWeights)); - Metadata.AddStandardValues(typeof(FontStyle), typeof(FontStyles)); - Metadata.AddStandardValues(typeof(Cursor), typeof(Cursors)); - Metadata.AddStandardValues(typeof(PixelFormat), typeof(PixelFormats)); - Metadata.AddStandardValues(typeof(TextDecorationCollection), typeof(TextDecorations)); - Metadata.AddStandardValues(typeof(FontFamily), Fonts.SystemFontFamilies); - - Metadata.AddStandardValues(typeof(ICommand), typeof(ApplicationCommands)); - Metadata.AddStandardValues(typeof(ICommand), typeof(EditingCommands)); - Metadata.AddStandardValues(typeof(ICommand), typeof(NavigationCommands)); - Metadata.AddStandardValues(typeof(ICommand), typeof(ComponentCommands)); - Metadata.AddStandardValues(typeof(ICommand), typeof(MediaCommands)); - - Metadata.AddPopularProperty(Line.Y2Property); - Metadata.AddPopularProperty(NavigationWindow.ShowsNavigationUIProperty); - Metadata.AddPopularProperty(FlowDocumentScrollViewer.DocumentProperty); - Metadata.AddPopularProperty(GridViewRowPresenterBase.ColumnsProperty); - Metadata.AddPopularProperty(ListView.ViewProperty); - Metadata.AddPopularProperty(DocumentPageView.PageNumberProperty); - Metadata.AddPopularProperty(Popup.PlacementProperty); - Metadata.AddPopularProperty(Popup.PopupAnimationProperty); - Metadata.AddPopularProperty(ScrollBar.ViewportSizeProperty); - Metadata.AddPopularProperty(UniformGrid.RowsProperty); - Metadata.AddPopularProperty(TabControl.TabStripPlacementProperty); - Metadata.AddPopularProperty(Line.X1Property); - Metadata.AddPopularProperty(Line.Y1Property); - Metadata.AddPopularProperty(Line.X2Property); - Metadata.AddPopularProperty(Polygon.PointsProperty); - Metadata.AddPopularProperty(Polyline.PointsProperty); - Metadata.AddPopularProperty(Path.DataProperty); - Metadata.AddPopularProperty(HeaderedContentControl.HeaderProperty); - Metadata.AddPopularProperty(MediaElement.UnloadedBehaviorProperty); - Metadata.AddPopularProperty(Shape.FillProperty); - Metadata.AddPopularProperty(Page.TitleProperty); - Metadata.AddPopularProperty(ItemsControl.ItemsSourceProperty); - Metadata.AddPopularProperty(Image.SourceProperty); - Metadata.AddPopularProperty(TextBlock.TextProperty); - Metadata.AddPopularProperty(DockPanel.LastChildFillProperty); - Metadata.AddPopularProperty(Expander.IsExpandedProperty); - Metadata.AddPopularProperty(Shape.StrokeProperty); - Metadata.AddPopularProperty(RangeBase.ValueProperty); - Metadata.AddPopularProperty(ItemsControl.ItemContainerStyleProperty); - Metadata.AddPopularProperty(ToggleButton.IsCheckedProperty); - Metadata.AddPopularProperty(Window.TitleProperty); - Metadata.AddPopularProperty(Viewport3DVisual.CameraProperty); - Metadata.AddPopularProperty(Frame.SourceProperty); - Metadata.AddPopularProperty(Rectangle.RadiusXProperty); - Metadata.AddPopularProperty(Rectangle.RadiusYProperty); - Metadata.AddPopularProperty(FrameworkElement.HeightProperty); - Metadata.AddPopularProperty(FrameworkElement.WidthProperty); - Metadata.AddPopularProperty(UniformGrid.ColumnsProperty); - Metadata.AddPopularProperty(RangeBase.MinimumProperty); - Metadata.AddPopularProperty(RangeBase.MaximumProperty); - Metadata.AddPopularProperty(ScrollBar.OrientationProperty); - Metadata.AddPopularProperty(ContentControl.ContentProperty); - Metadata.AddPopularProperty(Popup.IsOpenProperty); - Metadata.AddPopularProperty(TextElement.FontSizeProperty); - Metadata.AddPopularProperty(FrameworkElement.NameProperty); - Metadata.AddPopularProperty(Popup.HorizontalOffsetProperty); - Metadata.AddPopularProperty(Popup.VerticalOffsetProperty); - Metadata.AddPopularProperty(Window.WindowStyleProperty); - Metadata.AddPopularProperty(Shape.StrokeThicknessProperty); - Metadata.AddPopularProperty(TextElement.ForegroundProperty); - Metadata.AddPopularProperty(FrameworkElement.VerticalAlignmentProperty); - Metadata.AddPopularProperty(Button.IsDefaultProperty); - Metadata.AddPopularProperty(UIElement.RenderTransformOriginProperty); - Metadata.AddPopularProperty(TextElement.FontFamilyProperty); - Metadata.AddPopularProperty(FrameworkElement.HorizontalAlignmentProperty); - Metadata.AddPopularProperty(ToolBar.BandProperty); - Metadata.AddPopularProperty(ToolBar.BandIndexProperty); - Metadata.AddPopularProperty(ItemsControl.ItemTemplateProperty); - Metadata.AddPopularProperty(TextBlock.TextWrappingProperty); - Metadata.AddPopularProperty(FrameworkElement.MarginProperty); - Metadata.AddPopularProperty(RangeBase.LargeChangeProperty); - Metadata.AddPopularProperty(RangeBase.SmallChangeProperty); - Metadata.AddPopularProperty(Panel.BackgroundProperty); - Metadata.AddPopularProperty(Shape.StrokeMiterLimitProperty); - Metadata.AddPopularProperty(TextElement.FontWeightProperty); - Metadata.AddPopularProperty(StackPanel.OrientationProperty); - Metadata.AddPopularProperty(ListBox.SelectionModeProperty); - Metadata.AddPopularProperty(FrameworkElement.StyleProperty); - Metadata.AddPopularProperty(TextBox.TextProperty); - Metadata.AddPopularProperty(Window.SizeToContentProperty); - Metadata.AddPopularProperty(Window.ResizeModeProperty); - Metadata.AddPopularProperty(TextBlock.TextTrimmingProperty); - Metadata.AddPopularProperty(Window.ShowInTaskbarProperty); - Metadata.AddPopularProperty(Window.IconProperty); - Metadata.AddPopularProperty(UIElement.RenderTransformProperty); - Metadata.AddPopularProperty(Button.IsCancelProperty); - Metadata.AddPopularProperty(Border.BorderBrushProperty); - Metadata.AddPopularProperty(Block.TextAlignmentProperty); - Metadata.AddPopularProperty(Border.CornerRadiusProperty); - Metadata.AddPopularProperty(Border.BorderThicknessProperty); - Metadata.AddPopularProperty(TreeViewItem.IsSelectedProperty); - Metadata.AddPopularProperty(Border.PaddingProperty); - Metadata.AddPopularProperty(Shape.StretchProperty); - - Metadata.AddPopularProperty(typeof(Binding), "Path"); - Metadata.AddPopularProperty(typeof(Binding), "Source"); - Metadata.AddPopularProperty(typeof(Binding), "Mode"); - Metadata.AddPopularProperty(typeof(Binding), "RelativeSource"); - Metadata.AddPopularProperty(typeof(Binding), "ElementName"); - Metadata.AddPopularProperty(typeof(Binding), "Converter"); - Metadata.AddPopularProperty(typeof(Binding), "XPath"); - - Metadata.AddValueRange(Block.LineHeightProperty, double.Epsilon, double.MaxValue); - Metadata.AddValueRange(Canvas.BottomProperty, double.MinValue, double.MaxValue); - Metadata.AddValueRange(Canvas.LeftProperty, double.MinValue, double.MaxValue); - Metadata.AddValueRange(Canvas.TopProperty, double.MinValue, double.MaxValue); - Metadata.AddValueRange(Canvas.RightProperty, double.MinValue, double.MaxValue); - Metadata.AddValueRange(ColumnDefinition.MaxWidthProperty, 0, double.PositiveInfinity); - Metadata.AddValueRange(DocumentViewer.MaxPagesAcrossProperty, double.Epsilon, double.MaxValue); - Metadata.AddValueRange(Figure.HorizontalOffsetProperty, double.MinValue, double.MaxValue); - Metadata.AddValueRange(Figure.VerticalOffsetProperty, double.MinValue, double.MaxValue); - Metadata.AddValueRange(FlowDocument.MaxPageWidthProperty, 0, double.PositiveInfinity); - Metadata.AddValueRange(FlowDocument.MaxPageHeightProperty, 0, double.PositiveInfinity); - Metadata.AddValueRange(FlowDocumentPageViewer.ZoomProperty, double.Epsilon, double.MaxValue); - Metadata.AddValueRange(FlowDocumentPageViewer.ZoomIncrementProperty, double.Epsilon, double.MaxValue); - Metadata.AddValueRange(FlowDocumentPageViewer.MinZoomProperty, double.Epsilon, double.MaxValue); - Metadata.AddValueRange(FlowDocumentPageViewer.MaxZoomProperty, double.Epsilon, double.MaxValue); - Metadata.AddValueRange(FrameworkElement.MaxHeightProperty, 0, double.PositiveInfinity); - Metadata.AddValueRange(FrameworkElement.MaxWidthProperty, 0, double.PositiveInfinity); - Metadata.AddValueRange(Grid.ColumnSpanProperty, double.Epsilon, double.MaxValue); - Metadata.AddValueRange(Grid.RowSpanProperty, double.Epsilon, double.MaxValue); - Metadata.AddValueRange(GridSplitter.KeyboardIncrementProperty, double.Epsilon, double.MaxValue); - Metadata.AddValueRange(GridSplitter.DragIncrementProperty, double.Epsilon, double.MaxValue); - Metadata.AddValueRange(InkCanvas.BottomProperty, double.MinValue, double.MaxValue); - Metadata.AddValueRange(InkCanvas.TopProperty, double.MinValue, double.MaxValue); - Metadata.AddValueRange(InkCanvas.RightProperty, double.MinValue, double.MaxValue); - Metadata.AddValueRange(InkCanvas.LeftProperty, double.MinValue, double.MaxValue); - Metadata.AddValueRange(Line.Y2Property, double.MinValue, double.MaxValue); - Metadata.AddValueRange(Line.X1Property, double.MinValue, double.MaxValue); - Metadata.AddValueRange(Line.Y1Property, double.MinValue, double.MaxValue); - Metadata.AddValueRange(Line.X2Property, double.MinValue, double.MaxValue); - Metadata.AddValueRange(List.MarkerOffsetProperty, double.MinValue, double.MaxValue); - Metadata.AddValueRange(List.StartIndexProperty, double.Epsilon, double.MaxValue); - Metadata.AddValueRange(Paragraph.TextIndentProperty, double.MinValue, double.MaxValue); - Metadata.AddValueRange(RangeBase.ValueProperty, double.MinValue, double.MaxValue); - Metadata.AddValueRange(RangeBase.MaximumProperty, double.MinValue, double.MaxValue); - Metadata.AddValueRange(RangeBase.MinimumProperty, double.MinValue, double.MaxValue); - Metadata.AddValueRange(RepeatButton.IntervalProperty, double.Epsilon, double.MaxValue); - Metadata.AddValueRange(RowDefinition.MaxHeightProperty, 0, double.PositiveInfinity); - Metadata.AddValueRange(Selector.SelectedIndexProperty, double.MinValue, double.MaxValue); - Metadata.AddValueRange(Slider.TickFrequencyProperty, double.MinValue, double.MaxValue); - Metadata.AddValueRange(Slider.SelectionStartProperty, double.MinValue, double.MaxValue); - Metadata.AddValueRange(Slider.SelectionEndProperty, double.MinValue, double.MaxValue); - Metadata.AddValueRange(TableCell.RowSpanProperty, double.Epsilon, double.MaxValue); - Metadata.AddValueRange(TableCell.ColumnSpanProperty, double.Epsilon, double.MaxValue); - Metadata.AddValueRange(TextBox.MinLinesProperty, double.Epsilon, double.MaxValue); - Metadata.AddValueRange(TextBox.MaxLinesProperty, double.Epsilon, double.MaxValue); - Metadata.AddValueRange(TextBoxBase.UndoLimitProperty, double.MinValue, double.MaxValue); - Metadata.AddValueRange(TextElement.FontSizeProperty, double.Epsilon, double.MaxValue); - Metadata.AddValueRange(Timeline.SpeedRatioProperty, double.Epsilon, double.MaxValue); - Metadata.AddValueRange(Timeline.DecelerationRatioProperty, 0, 1); - Metadata.AddValueRange(Timeline.AccelerationRatioProperty, 0, 1); - Metadata.AddValueRange(Track.ViewportSizeProperty, 0, double.PositiveInfinity); - Metadata.AddValueRange(UIElement.OpacityProperty, 0, 1); - - Metadata.HideProperty(typeof(UIElement), "RenderSize"); - Metadata.HideProperty(FrameworkElement.NameProperty); - Metadata.HideProperty(typeof(FrameworkElement), "Resources"); - Metadata.HideProperty(typeof(Window), "Owner"); - - //Metadata.DisablePlacement(typeof(Button)); - - Metadata.AddPopularControl(typeof(Button)); - Metadata.AddPopularControl(typeof(CheckBox)); - Metadata.AddPopularControl(typeof(ComboBox)); - Metadata.AddPopularControl(typeof(Label)); - Metadata.AddPopularControl(typeof(TextBox)); - Metadata.AddPopularControl(typeof(RadioButton)); - Metadata.AddPopularControl(typeof(Canvas)); - Metadata.AddPopularControl(typeof(Grid)); - Metadata.AddPopularControl(typeof(Border)); - Metadata.AddPopularControl(typeof(DockPanel)); - Metadata.AddPopularControl(typeof(Expander)); - Metadata.AddPopularControl(typeof(GroupBox)); - Metadata.AddPopularControl(typeof(Image)); - Metadata.AddPopularControl(typeof(InkCanvas)); - Metadata.AddPopularControl(typeof(ListBox)); - Metadata.AddPopularControl(typeof(ListView)); - Metadata.AddPopularControl(typeof(Menu)); - Metadata.AddPopularControl(typeof(PasswordBox)); - Metadata.AddPopularControl(typeof(ProgressBar)); - Metadata.AddPopularControl(typeof(RichTextBox)); - Metadata.AddPopularControl(typeof(ScrollViewer)); - Metadata.AddPopularControl(typeof(Slider)); - Metadata.AddPopularControl(typeof(StackPanel)); - Metadata.AddPopularControl(typeof(TabControl)); - Metadata.AddPopularControl(typeof(ToolBar)); - Metadata.AddPopularControl(typeof(TreeView)); - Metadata.AddPopularControl(typeof(Viewbox)); - Metadata.AddPopularControl(typeof(Viewport3D)); - Metadata.AddPopularControl(typeof(WrapPanel)); - - Metadata.AddDefaultSize(typeof(UIElement), new Size(120, 100)); - Metadata.AddDefaultSize(typeof(ContentControl), new Size(double.NaN, double.NaN)); - Metadata.AddDefaultSize(typeof(Button), new Size(75, 23)); - - var s1 = new Size(120, double.NaN); - Metadata.AddDefaultSize(typeof(Slider), s1); - Metadata.AddDefaultSize(typeof(TextBox), s1); - Metadata.AddDefaultSize(typeof(PasswordBox), s1); - Metadata.AddDefaultSize(typeof(ComboBox), s1); - Metadata.AddDefaultSize(typeof(ProgressBar), s1); - - var s2 = new Size(120, 20); - Metadata.AddDefaultSize(typeof(ToolBar), s2); - Metadata.AddDefaultSize(typeof(Menu), s2); - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/CallExtension.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/CallExtension.cs deleted file mode 100644 index 593be1fa1d..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/CallExtension.cs +++ /dev/null @@ -1,109 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows.Markup; -using System.Windows; -using System.Windows.Data; -using System.Windows.Input; -using System.Reflection; - -namespace ICSharpCode.WpfDesign.Designer -{ - public class CallExtension : MarkupExtension - { - public CallExtension(string methodName) - { - this.methodName = methodName; - } - - string methodName; - - public override object ProvideValue(IServiceProvider sp) - { - var t = (IProvideValueTarget)sp.GetService(typeof(IProvideValueTarget)); - return new CallCommand(t.TargetObject as FrameworkElement, methodName); - } - } - - public class CallCommand : DependencyObject, ICommand - { - public CallCommand(FrameworkElement element, string methodName) - { - this.element = element; - this.methodName = methodName; - element.DataContextChanged += target_DataContextChanged; - - BindingOperations.SetBinding(this, CanCallProperty, new Binding("DataContext.Can" + methodName) { - Source = element - }); - - GetMethod(); - } - - FrameworkElement element; - string methodName; - MethodInfo method; - - public static readonly DependencyProperty CanCallProperty = - DependencyProperty.Register("CanCall", typeof(bool), typeof(CallCommand), - new PropertyMetadata(true)); - - public bool CanCall { - get { return (bool)GetValue(CanCallProperty); } - set { SetValue(CanCallProperty, value); } - } - - public object DataContext { - get { return element.DataContext; } - } - - protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e) - { - base.OnPropertyChanged(e); - - if (e.Property == CanCallProperty) { - RaiseCanExecuteChanged(); - } - } - - void GetMethod() - { - if (DataContext == null) { - method = null; - } - else { - method = DataContext.GetType().GetMethod(methodName, Type.EmptyTypes); - } - } - - void target_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) - { - GetMethod(); - RaiseCanExecuteChanged(); - } - - void RaiseCanExecuteChanged() - { - if (CanExecuteChanged != null) { - CanExecuteChanged(this, EventArgs.Empty); - } - } - - #region ICommand Members - - public event EventHandler CanExecuteChanged; - - public bool CanExecute(object parameter) - { - return method != null && CanCall; - } - - public void Execute(object parameter) - { - method.Invoke(DataContext, null); - } - - #endregion - } -} \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Configuration/AssemblyInfo.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Configuration/AssemblyInfo.cs deleted file mode 100644 index ac57010a8d..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Configuration/AssemblyInfo.cs +++ /dev/null @@ -1,50 +0,0 @@ -#region Using directives - -using System; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Resources; -using System.Globalization; -using System.Windows; -using System.Runtime.InteropServices; -using ICSharpCode.WpfDesign.Extensions; -using System.Windows.Markup; - -#endregion - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("WpfDesign.Designer")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: CLSCompliant(true)] - -//In order to begin building localizable applications, set -//CultureYouAreCodingWith in your .csproj file -//inside a . For example, if you are using US english -//in your source files, set the to en-US. Then uncomment -//the NeutralResourceLanguage attribute below. Update the "en-US" in -//the line below to match the UICulture setting in the project file. - -//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] - - -[assembly: ThemeInfo( - ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located - //(used if a resource is not found in the page, - // or application resource dictionaries) - ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located - //(used if a resource is not found in the page, - // app, or any theme specific resource dictionaries) -)] - -[assembly: XmlnsPrefix("http://sharpdevelop.net", "sd")] - -[assembly: XmlnsDefinition("http://sharpdevelop.net", "ICSharpCode.WpfDesign.Designer")] -[assembly: XmlnsDefinition("http://sharpdevelop.net", "ICSharpCode.WpfDesign.Designer.Controls")] -[assembly: XmlnsDefinition("http://sharpdevelop.net", "ICSharpCode.WpfDesign.Designer.PropertyGrid")] -[assembly: XmlnsDefinition("http://sharpdevelop.net", "ICSharpCode.WpfDesign.Designer.PropertyGrid.Editors")] - diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/AdornerLayer.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/AdornerLayer.cs deleted file mode 100644 index eee966f0e9..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/AdornerLayer.cs +++ /dev/null @@ -1,298 +0,0 @@ -// -// -// -// -// $Revision$ -// - -//#define DEBUG_ADORNERLAYER - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Media; - -using ICSharpCode.WpfDesign.Adorners; - -namespace ICSharpCode.WpfDesign.Designer.Controls -{ - /// - /// A control that displays adorner panels. - /// - sealed class AdornerLayer : Panel - { - #region AdornerPanelCollection - internal sealed class AdornerPanelCollection : ICollection - { - readonly AdornerLayer _layer; - - public AdornerPanelCollection(AdornerLayer layer) - { - this._layer = layer; - } - - public int Count { - get { return _layer.Children.Count; } - } - - public bool IsReadOnly { - get { return false; } - } - - public void Add(AdornerPanel item) - { - if (item == null) - throw new ArgumentNullException("item"); - - _layer.AddAdorner(item); - } - - public void Clear() - { - _layer.ClearAdorners(); - } - - public bool Contains(AdornerPanel item) - { - if (item == null) - throw new ArgumentNullException("item"); - - return VisualTreeHelper.GetParent(item) == _layer; - } - - public void CopyTo(AdornerPanel[] array, int arrayIndex) - { - foreach (AdornerPanel panel in this) - array[arrayIndex++] = panel; - } - - public bool Remove(AdornerPanel item) - { - if (item == null) - throw new ArgumentNullException("item"); - - return _layer.RemoveAdorner(item); - } - - public IEnumerator GetEnumerator() - { - foreach (AdornerPanel panel in _layer.Children) { - yield return panel; - } - } - - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() - { - return this.GetEnumerator(); - } - } - #endregion - - AdornerPanelCollection _adorners; - readonly UIElement _designPanel; - - #if DEBUG_ADORNERLAYER - int _totalAdornerCount; - #endif - - - internal AdornerLayer(UIElement designPanel) - { - this._designPanel = designPanel; - - this.LayoutUpdated += OnLayoutUpdated; - - _adorners = new AdornerPanelCollection(this); - } - - void OnLayoutUpdated(object sender, EventArgs e) - { - UpdateAllAdorners(false); - #if DEBUG_ADORNERLAYER - Debug.WriteLine("Adorner LayoutUpdated. AdornedElements=" + _dict.Count + - ", visible adorners=" + VisualChildrenCount + ", total adorners=" + (_totalAdornerCount)); - #endif - } - - protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo) - { - base.OnRenderSizeChanged(sizeInfo); - UpdateAllAdorners(true); - } - - internal AdornerPanelCollection Adorners { - get { - return _adorners; - } - } - - sealed class AdornerInfo - { - internal readonly List adorners = new List(); - internal bool isVisible; - internal Rect position; - } - - // adorned element => AdornerInfo - Dictionary _dict = new Dictionary(); - - void ClearAdorners() - { - if (_dict.Count == 0) - return; // already empty - - this.Children.Clear(); - _dict = new Dictionary(); - - #if DEBUG_ADORNERLAYER - _totalAdornerCount = 0; - Debug.WriteLine("AdornerLayer cleared."); - #endif - } - - AdornerInfo GetOrCreateAdornerInfo(UIElement adornedElement) - { - AdornerInfo info; - if (!_dict.TryGetValue(adornedElement, out info)) { - info = _dict[adornedElement] = new AdornerInfo(); - info.isVisible = adornedElement.IsDescendantOf(_designPanel); - } - return info; - } - - AdornerInfo GetExistingAdornerInfo(UIElement adornedElement) - { - AdornerInfo info; - _dict.TryGetValue(adornedElement, out info); - return info; - } - - void AddAdorner(AdornerPanel adornerPanel) - { - if (adornerPanel.AdornedElement == null) - throw new DesignerException("adornerPanel.AdornedElement must be set"); - - AdornerInfo info = GetOrCreateAdornerInfo(adornerPanel.AdornedElement); - info.adorners.Add(adornerPanel); - - if (info.isVisible) { - AddAdornerToChildren(adornerPanel); - } - - #if DEBUG_ADORNERLAYER - Debug.WriteLine("Adorner added. AdornedElements=" + _dict.Count + - ", visible adorners=" + VisualChildrenCount + ", total adorners=" + (++_totalAdornerCount)); - #endif - } - - void AddAdornerToChildren(AdornerPanel adornerPanel) - { - UIElementCollection children = this.Children; - int i = 0; - for (i = 0; i < children.Count; i++) { - AdornerPanel p = (AdornerPanel)children[i]; - if (p.Order.CompareTo(adornerPanel.Order) > 0) { - break; - } - } - children.Insert(i, adornerPanel); - } - - protected override Size MeasureOverride(Size availableSize) - { - Size infiniteSize = new Size(double.PositiveInfinity, double.PositiveInfinity); - foreach (AdornerPanel adorner in this.Children) { - adorner.Measure(infiniteSize); - } - return new Size(0, 0); - } - - protected override Size ArrangeOverride(Size finalSize) - { - foreach (AdornerPanel adorner in this.Children) { - adorner.Arrange(new Rect(new Point(0, 0), adorner.DesiredSize)); - if (adorner.AdornedElement.IsDescendantOf(_designPanel)) { - adorner.RenderTransform = (Transform)adorner.AdornedElement.TransformToAncestor(_designPanel); - } - } - return finalSize; - } - - bool RemoveAdorner(AdornerPanel adornerPanel) - { - if (adornerPanel.AdornedElement == null) - return false; - - AdornerInfo info = GetExistingAdornerInfo(adornerPanel.AdornedElement); - if (info == null) - return false; - - if (info.adorners.Remove(adornerPanel)) { - if (info.isVisible) { - this.Children.Remove(adornerPanel); - } - - if (info.adorners.Count == 0) { - _dict.Remove(adornerPanel.AdornedElement); - } - - #if DEBUG_ADORNERLAYER - Debug.WriteLine("Adorner removed. AdornedElements=" + _dict.Count + - ", visible adorners=" + VisualChildrenCount + ", total adorners=" + (--_totalAdornerCount)); - #endif - - return true; - } else { - return false; - } - } - - public void UpdateAdornersForElement(UIElement element, bool forceInvalidate) - { - AdornerInfo info = GetExistingAdornerInfo(element); - if (info != null) { - UpdateAdornersForElement(element, info, forceInvalidate); - } - } - - Rect GetPositionCache(UIElement element) - { - Transform t = (Transform)element.TransformToAncestor(_designPanel); - return new Rect(new Point(t.Value.OffsetX, t.Value.OffsetY), element.RenderSize); - } - - void UpdateAdornersForElement(UIElement element, AdornerInfo info, bool forceInvalidate) - { - if (element.IsDescendantOf(_designPanel)) { - if (!info.isVisible) { - info.isVisible = true; - // make adorners visible: - info.adorners.ForEach(AddAdornerToChildren); - } - Rect c = GetPositionCache(element); - if (forceInvalidate || !info.position.Equals(c)) { - info.position = c; - foreach (AdornerPanel p in info.adorners) { - p.InvalidateMeasure(); - } - this.InvalidateArrange(); - } - } else { - if (info.isVisible) { - info.isVisible = false; - // make adorners invisible: - info.adorners.ForEach(this.Children.Remove); - } - } - } - - void UpdateAllAdorners(bool forceInvalidate) - { - foreach (KeyValuePair pair in _dict) { - UpdateAdornersForElement(pair.Key, pair.Value, forceInvalidate); - } - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ContainerDragHandle.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ContainerDragHandle.cs deleted file mode 100644 index fda4b92743..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ContainerDragHandle.cs +++ /dev/null @@ -1,32 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Windows.Controls; -using System.Windows; -using System.Windows.Media; -using System.Windows.Shapes; -using System.Windows.Controls.Primitives; -using ICSharpCode.WpfDesign.Adorners; -using ICSharpCode.WpfDesign.Extensions; - -namespace ICSharpCode.WpfDesign.Designer.Controls -{ - /// - /// A thumb where the look can depend on the IsPrimarySelection property. - /// Used by UIElementSelectionRectangle. - /// - public class ContainerDragHandle : Control - { - static ContainerDragHandle() - { - //This OverrideMetadata call tells the system that this element wants to provide a style that is different than its base class. - //This style is defined in themes\generic.xaml - DefaultStyleKeyProperty.OverrideMetadata(typeof(ContainerDragHandle), new FrameworkPropertyMetadata(typeof(ContainerDragHandle))); - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ControlStyles.xaml b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ControlStyles.xaml deleted file mode 100644 index c38dff1ff7..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ControlStyles.xaml +++ /dev/null @@ -1,416 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/DragListener.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/DragListener.cs deleted file mode 100644 index 1785779481..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/DragListener.cs +++ /dev/null @@ -1,111 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows; -using System.Windows.Input; -using System.Diagnostics; - -namespace ICSharpCode.WpfDesign.Designer.Controls -{ - public delegate void DragHandler(DragListener drag); - - public class DragListener - { - static DragListener() - { - InputManager.Current.PostProcessInput += new ProcessInputEventHandler(PostProcessInput); - } - - public DragListener(IInputElement target) - { - Target = target; - - Target.PreviewMouseLeftButtonDown += Target_MouseDown; - Target.PreviewMouseMove += Target_MouseMove; - Target.PreviewMouseLeftButtonUp += Target_MouseUp; - } - - static DragListener CurrentListener; - - static void PostProcessInput(object sender, ProcessInputEventArgs e) - { - if (CurrentListener != null) { - var a = e.StagingItem.Input as KeyEventArgs; - if (a != null && a.Key == Key.Escape) { - Mouse.Capture(null); - CurrentListener.IsDown = false; - CurrentListener.IsCanceled = true; - CurrentListener.Complete(); - } - } - } - - void Target_MouseDown(object sender, MouseButtonEventArgs e) - { - StartPoint = Mouse.GetPosition(null); - CurrentPoint = StartPoint; - DeltaDelta = new Vector(); - IsDown = true; - IsCanceled = false; - } - - void Target_MouseMove(object sender, MouseEventArgs e) - { - if (IsDown) { - DeltaDelta = e.GetPosition(null) - CurrentPoint; - CurrentPoint += DeltaDelta; - - if (!IsActive) { - if (Math.Abs(Delta.X) >= SystemParameters.MinimumHorizontalDragDistance || - Math.Abs(Delta.Y) >= SystemParameters.MinimumVerticalDragDistance) { - IsActive = true; - CurrentListener = this; - - if (Started != null) { - Started(this); - } - } - } - - if (IsActive && Changed != null) { - Changed(this); - } - } - } - - void Target_MouseUp(object sender, MouseButtonEventArgs e) - { - IsDown = false; - if (IsActive) { - Complete(); - } - } - - void Complete() - { - IsActive = false; - CurrentListener = null; - - if (Completed != null) { - Completed(this); - } - } - - public event DragHandler Started; - public event DragHandler Changed; - public event DragHandler Completed; - - public IInputElement Target { get; private set; } - public Point StartPoint { get; private set; } - public Point CurrentPoint { get; private set; } - public Vector DeltaDelta { get; private set; } - public bool IsActive { get; private set; } - public bool IsDown { get; private set; } - public bool IsCanceled { get; private set; } - - public Vector Delta { - get { return CurrentPoint - StartPoint; } - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/DropDownButton.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/DropDownButton.cs deleted file mode 100644 index ea5e4a8182..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/DropDownButton.cs +++ /dev/null @@ -1,33 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Windows.Controls; -using System.Windows.Media; -using System.Windows.Shapes; - -namespace ICSharpCode.WpfDesign.Designer.Controls -{ - /// - /// A button with a drop-down arrow. - /// - public class DropDownButton : Button - { - static readonly Geometry triangle = (Geometry)new GeometryConverter().ConvertFromInvariantString("M0,0 L1,0 0.5,1 z"); - - public DropDownButton() - { - Content = new Path { - Fill = Brushes.Black, - Data = triangle, - Width = 7, - Height = 3.5, - Stretch = Stretch.Fill - }; - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/EnterTextBox.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/EnterTextBox.cs deleted file mode 100644 index a88814f70c..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/EnterTextBox.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows.Controls; -using System.Windows.Input; -using System.Windows.Data; -using System.Windows; - -namespace ICSharpCode.WpfDesign.Designer.Controls -{ - public class EnterTextBox : TextBox - { - protected override void OnKeyDown(KeyEventArgs e) - { - if (e.Key == Key.Enter) { - var b = BindingOperations.GetBindingExpressionBase(this, TextProperty); - if (b != null) { - b.UpdateSource(); - } - SelectAll(); - } - else if (e.Key == Key.Escape) { - var b = BindingOperations.GetBindingExpressionBase(this, TextProperty); - if (b != null) { - b.UpdateTarget(); - } - } - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/EnumBar.xaml b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/EnumBar.xaml deleted file mode 100644 index 531721005a..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/EnumBar.xaml +++ /dev/null @@ -1,7 +0,0 @@ - - - diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/EnumBar.xaml.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/EnumBar.xaml.cs deleted file mode 100644 index 8d75cd3c24..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/EnumBar.xaml.cs +++ /dev/null @@ -1,112 +0,0 @@ -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; - -namespace ICSharpCode.WpfDesign.Designer.Controls -{ - public partial class EnumBar - { - public EnumBar() - { - InitializeComponent(); - } - - Type currentEnumType; - - public static readonly DependencyProperty ValueProperty = - DependencyProperty.Register("Value", typeof(object), typeof(EnumBar), - new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)); - - public object Value { - get { return (object)GetValue(ValueProperty); } - set { SetValue(ValueProperty, value); } - } - - public static readonly DependencyProperty ContainerProperty = - DependencyProperty.Register("Container", typeof(Panel), typeof(EnumBar)); - - public Panel Container { - get { return (Panel)GetValue(ContainerProperty); } - set { SetValue(ContainerProperty, value); } - } - - public static readonly DependencyProperty ButtonStyleProperty = - DependencyProperty.Register("ButtonStyle", typeof(Style), typeof(EnumBar)); - - public Style ButtonStyle { - get { return (Style)GetValue(ButtonStyleProperty); } - set { SetValue(ButtonStyleProperty, value); } - } - - protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e) - { - base.OnPropertyChanged(e); - - if (e.Property == ValueProperty) { - - var type = e.NewValue.GetType(); - - if (currentEnumType != type) { - currentEnumType = type; - uxPanel.Children.Clear(); - foreach (var v in Enum.GetValues(type)) { - var b = new EnumButton(); - b.Value = v; - b.Content = Enum.GetName(type, v); - b.SetBinding(StyleProperty, new Binding("ButtonStyle") { Source = this }); - b.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(button_PreviewMouseLeftButtonDown); - uxPanel.Children.Add(b); - } - } - - UpdateButtons(); - UpdateContainer(); - - } else if (e.Property == ContainerProperty) { - UpdateContainer(); - } - } - - void UpdateButtons() - { - foreach (EnumButton c in uxPanel.Children) { - if (c.Value.Equals(Value)) { - c.IsChecked = true; - } - else { - c.IsChecked = false; - } - } - } - - void UpdateContainer() - { - if (Container != null) { - for (int i = 0; i < uxPanel.Children.Count; i++) { - var c = uxPanel.Children[i] as EnumButton; - if (c.IsChecked.Value) - Container.Children[i].Visibility = Visibility.Visible; - else - Container.Children[i].Visibility = Visibility.Collapsed; - } - } - } - - void button_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) - { - Value = (sender as EnumButton).Value; - e.Handled = true; - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/EnumButton.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/EnumButton.cs deleted file mode 100644 index 1cb487ce90..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/EnumButton.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows.Controls.Primitives; -using System.Windows; - -namespace ICSharpCode.WpfDesign.Designer.Controls -{ - public class EnumButton : ToggleButton - { - static EnumButton() - { - DefaultStyleKeyProperty.OverrideMetadata(typeof(EnumButton), - new FrameworkPropertyMetadata(typeof(EnumButton))); - } - - public static readonly DependencyProperty ValueProperty = - DependencyProperty.Register("Value", typeof(object), typeof(EnumButton)); - - public object Value { - get { return (object)GetValue(ValueProperty); } - set { SetValue(ValueProperty, value); } - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ErrorBalloon.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ErrorBalloon.cs deleted file mode 100644 index 6df66934cd..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ErrorBalloon.cs +++ /dev/null @@ -1,23 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Windows; - -namespace ICSharpCode.WpfDesign.Designer.Controls -{ - /// - /// An ErrorBalloon window. - /// - public class ErrorBalloon : Window - { - static ErrorBalloon() - { - DefaultStyleKeyProperty.OverrideMetadata(typeof(ErrorBalloon), new FrameworkPropertyMetadata(typeof(ErrorBalloon))); - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/GrayOutDesignerExceptActiveArea.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/GrayOutDesignerExceptActiveArea.cs deleted file mode 100644 index 700ab946dc..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/GrayOutDesignerExceptActiveArea.cs +++ /dev/null @@ -1,121 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Diagnostics; -using System.Windows; -using System.Windows.Media; -using System.Windows.Threading; -using System.Windows.Media.Animation; -using ICSharpCode.WpfDesign.Adorners; -using ICSharpCode.WpfDesign.Designer.Services; - -namespace ICSharpCode.WpfDesign.Designer.Controls -{ - /// - /// Gray out everything except a specific area. - /// - sealed class GrayOutDesignerExceptActiveArea : FrameworkElement - { - Geometry designSurfaceRectangle; - Geometry activeAreaGeometry; - Geometry combinedGeometry; - Brush grayOutBrush; - AdornerPanel adornerPanel; - IDesignPanel designPanel; - const double MaxOpacity = 0.3; - - public GrayOutDesignerExceptActiveArea() - { - this.GrayOutBrush = new SolidColorBrush(SystemColors.GrayTextColor); - this.GrayOutBrush.Opacity = MaxOpacity; - this.IsHitTestVisible = false; - } - - public Brush GrayOutBrush { - get { return grayOutBrush; } - set { grayOutBrush = value; } - } - - public Geometry ActiveAreaGeometry { - get { return activeAreaGeometry; } - set { - activeAreaGeometry = value; - combinedGeometry = new CombinedGeometry(GeometryCombineMode.Exclude, designSurfaceRectangle, activeAreaGeometry); - } - } - - protected override void OnRender(DrawingContext drawingContext) - { - drawingContext.DrawGeometry(grayOutBrush, null, combinedGeometry); - } - - Rect currentAnimateActiveAreaRectToTarget; - - internal void AnimateActiveAreaRectTo(Rect newRect) - { - if (newRect.Equals(currentAnimateActiveAreaRectToTarget)) - return; - activeAreaGeometry.BeginAnimation( - RectangleGeometry.RectProperty, - new RectAnimation(newRect, new Duration(new TimeSpan(0,0,0,0,100))), - HandoffBehavior.SnapshotAndReplace); - currentAnimateActiveAreaRectToTarget = newRect; - } - - internal static void Start(ref GrayOutDesignerExceptActiveArea grayOut, ServiceContainer services, UIElement activeContainer) - { - Debug.Assert(activeContainer != null); - Start(ref grayOut, services, activeContainer, new Rect(activeContainer.RenderSize)); - } - - internal static void Start(ref GrayOutDesignerExceptActiveArea grayOut, ServiceContainer services, UIElement activeContainer, Rect activeRectInActiveContainer) - { - Debug.Assert(services != null); - Debug.Assert(activeContainer != null); - DesignPanel designPanel = services.GetService() as DesignPanel; - OptionService optionService = services.GetService(); - if (designPanel != null && grayOut == null && optionService != null && optionService.GrayOutDesignSurfaceExceptParentContainerWhenDragging) { - grayOut = new GrayOutDesignerExceptActiveArea(); - grayOut.designSurfaceRectangle = new RectangleGeometry( - new Rect(new Point(0, 0), designPanel.RenderSize)); - grayOut.designPanel = designPanel; - grayOut.adornerPanel = new AdornerPanel(); - grayOut.adornerPanel.Order = AdornerOrder.BehindForeground; - grayOut.adornerPanel.SetAdornedElement(designPanel.Context.RootItem.View, null); - grayOut.adornerPanel.Children.Add(grayOut); - grayOut.ActiveAreaGeometry = new RectangleGeometry(activeRectInActiveContainer, 0, 0, (Transform)activeContainer.TransformToVisual(grayOut.adornerPanel.AdornedElement)); - Animate(grayOut.GrayOutBrush, Brush.OpacityProperty, 0, MaxOpacity); - designPanel.Adorners.Add(grayOut.adornerPanel); - } - } - - static readonly TimeSpan animationTime = new TimeSpan(2000000); - - static void Animate(Animatable element, DependencyProperty property, double from, double to) - { - element.BeginAnimation(property, new DoubleAnimation(from, to, new Duration(animationTime), FillBehavior.Stop)); - } - - internal static void Stop(ref GrayOutDesignerExceptActiveArea grayOut) - { - if (grayOut != null) { - Animate(grayOut.GrayOutBrush, Brush.OpacityProperty, MaxOpacity, 0); - IDesignPanel designPanel = grayOut.designPanel; - AdornerPanel adornerPanelToRemove = grayOut.adornerPanel; - DispatcherTimer timer = new DispatcherTimer(); - timer.Interval = animationTime; - timer.Tick += delegate { - timer.Stop(); - designPanel.Adorners.Remove(adornerPanelToRemove); - }; - timer.Start(); - grayOut = null; - } - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/GridAdorner.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/GridAdorner.cs deleted file mode 100644 index 44cc1678cb..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/GridAdorner.cs +++ /dev/null @@ -1,371 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Diagnostics; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Input; -using System.Windows.Media; - -using ICSharpCode.WpfDesign.Adorners; - -namespace ICSharpCode.WpfDesign.Designer.Controls -{ - /// - /// Adorner that displays the blue bar next to grids that can be used to create new rows/column. - /// - public class GridRailAdorner : Control - { - static GridRailAdorner() - { - DefaultStyleKeyProperty.OverrideMetadata(typeof(GridRailAdorner), new FrameworkPropertyMetadata(typeof(GridRailAdorner))); - } - - readonly DesignItem gridItem; - readonly Grid grid; - readonly AdornerPanel adornerPanel; - readonly GridSplitterAdorner previewAdorner; - readonly Orientation orientation; - - public const double RailSize = 10; - public const double RailDistance = 6; - public const double SplitterWidth = 10; - - public GridRailAdorner(DesignItem gridItem, AdornerPanel adornerPanel, Orientation orientation) - { - Debug.Assert(gridItem != null); - Debug.Assert(adornerPanel != null); - - this.gridItem = gridItem; - this.grid = (Grid)gridItem.Component; - this.adornerPanel = adornerPanel; - this.orientation = orientation; - - if (orientation == Orientation.Horizontal) { - this.Height = RailSize; - previewAdorner = new GridColumnSplitterAdorner(gridItem, null, null); - } else { // vertical - this.Width = RailSize; - previewAdorner = new GridRowSplitterAdorner(gridItem, null, null); - } - previewAdorner.IsPreview = true; - previewAdorner.IsHitTestVisible = false; - } - - #region Handle mouse events to add a new row/column - protected override void OnMouseEnter(MouseEventArgs e) - { - base.OnMouseEnter(e); - adornerPanel.Children.Add(previewAdorner); - } - - protected override void OnMouseMove(MouseEventArgs e) - { - base.OnMouseMove(e); - RelativePlacement rp = new RelativePlacement(); - if (orientation == Orientation.Vertical) { - rp.XOffset = -(RailSize + RailDistance); - rp.WidthOffset = RailSize + RailDistance; - rp.WidthRelativeToContentWidth = 1; - rp.HeightOffset = SplitterWidth; - rp.YOffset = e.GetPosition(this).Y - SplitterWidth / 2; - } else { - rp.YOffset = -(RailSize + RailDistance); - rp.HeightOffset = RailSize + RailDistance; - rp.HeightRelativeToContentHeight = 1; - rp.WidthOffset = SplitterWidth; - rp.XOffset = e.GetPosition(this).X - SplitterWidth / 2; - } - AdornerPanel.SetPlacement(previewAdorner, rp); - } - - protected override void OnMouseLeave(MouseEventArgs e) - { - base.OnMouseLeave(e); - adornerPanel.Children.Remove(previewAdorner); - } - - protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) - { - base.OnMouseLeftButtonDown(e); - e.Handled = true; - Focus(); - adornerPanel.Children.Remove(previewAdorner); - if (orientation == Orientation.Vertical) { - using (ChangeGroup changeGroup = gridItem.OpenGroup("Split grid row")) { - DesignItemProperty rowCollection = gridItem.Properties["RowDefinitions"]; - if (rowCollection.CollectionElements.Count == 0) { - DesignItem firstRow = gridItem.Services.Component.RegisterComponentForDesigner(new RowDefinition()); - rowCollection.CollectionElements.Add(firstRow); - grid.UpdateLayout(); // let WPF assign firstRow.ActualHeight - } - double insertionPosition = e.GetPosition(this).Y; - for (int i = 0; i < grid.RowDefinitions.Count; i++) { - RowDefinition row = grid.RowDefinitions[i]; - if (row.Offset > insertionPosition) continue; - if (row.Offset + row.ActualHeight < insertionPosition) continue; - - // split row - GridLength oldLength = (GridLength)row.GetValue(RowDefinition.HeightProperty); - GridLength newLength1, newLength2; - SplitLength(oldLength, insertionPosition - row.Offset, row.ActualHeight, out newLength1, out newLength2); - DesignItem newRowDefinition = gridItem.Services.Component.RegisterComponentForDesigner(new RowDefinition()); - rowCollection.CollectionElements.Insert(i + 1, newRowDefinition); - rowCollection.CollectionElements[i].Properties[RowDefinition.HeightProperty].SetValue(newLength1); - newRowDefinition.Properties[RowDefinition.HeightProperty].SetValue(newLength2); - - FixIndicesAfterSplit(i, Grid.RowProperty, Grid.RowSpanProperty); - changeGroup.Commit(); - gridItem.Services.Selection.SetSelectedComponents(new DesignItem[] { newRowDefinition }, SelectionTypes.Auto); - break; - } - } - } else { - using (ChangeGroup changeGroup = gridItem.OpenGroup("Split grid column")) { - DesignItemProperty columnCollection = gridItem.Properties["ColumnDefinitions"]; - if (columnCollection.CollectionElements.Count == 0) { - DesignItem firstColumn = gridItem.Services.Component.RegisterComponentForDesigner(new ColumnDefinition()); - columnCollection.CollectionElements.Add(firstColumn); - grid.UpdateLayout(); // let WPF assign firstColumn.ActualWidth - } - double insertionPosition = e.GetPosition(this).X; - for (int i = 0; i < grid.ColumnDefinitions.Count; i++) { - ColumnDefinition column = grid.ColumnDefinitions[i]; - if (column.Offset > insertionPosition) continue; - if (column.Offset + column.ActualWidth < insertionPosition) continue; - - // split column - GridLength oldLength = (GridLength)column.GetValue(ColumnDefinition.WidthProperty); - GridLength newLength1, newLength2; - SplitLength(oldLength, insertionPosition - column.Offset, column.ActualWidth, out newLength1, out newLength2); - DesignItem newColumnDefinition = gridItem.Services.Component.RegisterComponentForDesigner(new ColumnDefinition()); - columnCollection.CollectionElements.Insert(i + 1, newColumnDefinition); - columnCollection.CollectionElements[i].Properties[ColumnDefinition.WidthProperty].SetValue(newLength1); - newColumnDefinition.Properties[ColumnDefinition.WidthProperty].SetValue(newLength2); - FixIndicesAfterSplit(i, Grid.ColumnProperty, Grid.ColumnSpanProperty); - changeGroup.Commit(); - gridItem.Services.Selection.SetSelectedComponents(new DesignItem[] { newColumnDefinition }, SelectionTypes.Auto); - break; - } - } - } - } - - void FixIndicesAfterSplit(int splitIndex, DependencyProperty idxProperty, DependencyProperty spanProperty) - { - // increment ColSpan of all controls in the split column, increment Column of all controls in later columns: - foreach (DesignItem child in gridItem.Properties["Children"].CollectionElements) { - int start = (int)child.Properties.GetAttachedProperty(idxProperty).ValueOnInstance; - int span = (int)child.Properties.GetAttachedProperty(spanProperty).ValueOnInstance; - if (start <= splitIndex && splitIndex < start + span) { - child.Properties.GetAttachedProperty(spanProperty).SetValue(span + 1); - } else if (start > splitIndex) { - child.Properties.GetAttachedProperty(idxProperty).SetValue(start + 1); - } - } - } - - void SplitLength(GridLength oldLength, double insertionPosition, double oldActualValue, - out GridLength newLength1, out GridLength newLength2) - { - if (oldLength.IsAuto) { - oldLength = new GridLength(oldActualValue); - } - double percentage = insertionPosition / oldActualValue; - newLength1 = new GridLength(oldLength.Value * percentage, oldLength.GridUnitType); - newLength2 = new GridLength(oldLength.Value - newLength1.Value, oldLength.GridUnitType); - } - #endregion - } - - public abstract class GridSplitterAdorner : Control - { - public static readonly DependencyProperty IsPreviewProperty - = DependencyProperty.Register("IsPreview", typeof(bool), typeof(GridSplitterAdorner), new PropertyMetadata(SharedInstances.BoxedFalse)); - - protected readonly Grid grid; - protected readonly DesignItem gridItem; - protected readonly DesignItem firstRow, secondRow; // can also be columns - - internal GridSplitterAdorner(DesignItem gridItem, DesignItem firstRow, DesignItem secondRow) - { - Debug.Assert(gridItem != null); - this.grid = (Grid)gridItem.Component; - this.gridItem = gridItem; - this.firstRow = firstRow; - this.secondRow = secondRow; - } - - public bool IsPreview { - get { return (bool)GetValue(IsPreviewProperty); } - set { SetValue(IsPreviewProperty, SharedInstances.Box(value)); } - } - - ChangeGroup activeChangeGroup; - double mouseStartPos; - bool mouseIsDown; - - protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) - { - e.Handled = true; - if (CaptureMouse()) { - Focus(); - gridItem.Services.Selection.SetSelectedComponents(new DesignItem[] { secondRow }, SelectionTypes.Auto); - mouseStartPos = GetCoordinate(e.GetPosition(grid)); - mouseIsDown = true; - } - } - - protected override void OnMouseMove(MouseEventArgs e) - { - if (mouseIsDown) { - double mousePos = GetCoordinate(e.GetPosition(grid)); - if (activeChangeGroup == null) { - if (Math.Abs(mousePos - mouseStartPos) - >= GetCoordinate(new Point(SystemParameters.MinimumHorizontalDragDistance, SystemParameters.MinimumVerticalDragDistance))) { - activeChangeGroup = gridItem.OpenGroup("Change grid row/column size"); - RememberOriginalSize(); - } - } - if (activeChangeGroup != null) { - ChangeSize(mousePos - mouseStartPos); - } - } - } - - protected GridLength original1, original2; - protected double originalPixelSize1, originalPixelSize2; - - protected abstract double GetCoordinate(Point point); - protected abstract void RememberOriginalSize(); - protected abstract DependencyProperty RowColumnSizeProperty { get; } - - void ChangeSize(double delta) - { - // delta = difference in pixels - - if (delta < -originalPixelSize1) delta = -originalPixelSize1; - if (delta > originalPixelSize2) delta = originalPixelSize2; - - // replace Auto lengths with absolute lengths if necessary - if (original1.IsAuto) original1 = new GridLength(originalPixelSize1); - if (original2.IsAuto) original2 = new GridLength(originalPixelSize2); - - GridLength new1; - if (original1.IsStar && originalPixelSize1 > 0) - new1 = new GridLength(original1.Value * (originalPixelSize1 + delta) / originalPixelSize1, GridUnitType.Star); - else - new1 = new GridLength(originalPixelSize1 + delta); - GridLength new2; - if (original2.IsStar && originalPixelSize2 > 0) - new2 = new GridLength(original2.Value * (originalPixelSize2 - delta) / originalPixelSize2, GridUnitType.Star); - else - new2 = new GridLength(originalPixelSize2 - delta); - firstRow.Properties[RowColumnSizeProperty].SetValue(new1); - secondRow.Properties[RowColumnSizeProperty].SetValue(new2); - ((UIElement)VisualTreeHelper.GetParent(this)).InvalidateArrange(); - } - - protected override void OnMouseUp(MouseButtonEventArgs e) - { - if (activeChangeGroup != null) { - activeChangeGroup.Commit(); - activeChangeGroup = null; - } - Stop(); - } - - protected override void OnLostMouseCapture(MouseEventArgs e) - { - Stop(); - } - - protected override void OnKeyDown(KeyEventArgs e) - { - if (e.Key == Key.Escape) { - e.Handled = true; - Stop(); - } - } - - protected void Stop() - { - ReleaseMouseCapture(); - mouseIsDown = false; - if (activeChangeGroup != null) { - activeChangeGroup.Abort(); - activeChangeGroup = null; - } - } - } - - public class GridRowSplitterAdorner : GridSplitterAdorner - { - static GridRowSplitterAdorner() - { - DefaultStyleKeyProperty.OverrideMetadata(typeof(GridRowSplitterAdorner), new FrameworkPropertyMetadata(typeof(GridRowSplitterAdorner))); - CursorProperty.OverrideMetadata(typeof(GridRowSplitterAdorner), new FrameworkPropertyMetadata(Cursors.SizeNS)); - } - - - internal GridRowSplitterAdorner(DesignItem gridItem, DesignItem firstRow, DesignItem secondRow) : base(gridItem, firstRow, secondRow) - { - } - - protected override double GetCoordinate(Point point) - { - return point.Y; - } - - protected override void RememberOriginalSize() - { - RowDefinition r1 = (RowDefinition)firstRow.Component; - RowDefinition r2 = (RowDefinition)secondRow.Component; - original1 = (GridLength)r1.GetValue(RowDefinition.HeightProperty); - original2 = (GridLength)r2.GetValue(RowDefinition.HeightProperty); - originalPixelSize1 = r1.ActualHeight; - originalPixelSize2 = r2.ActualHeight; - } - - protected override DependencyProperty RowColumnSizeProperty { - get { return RowDefinition.HeightProperty; } - } - } - - public sealed class GridColumnSplitterAdorner : GridSplitterAdorner - { - static GridColumnSplitterAdorner() - { - DefaultStyleKeyProperty.OverrideMetadata(typeof(GridColumnSplitterAdorner), new FrameworkPropertyMetadata(typeof(GridColumnSplitterAdorner))); - CursorProperty.OverrideMetadata(typeof(GridColumnSplitterAdorner), new FrameworkPropertyMetadata(Cursors.SizeWE)); - } - - internal GridColumnSplitterAdorner(DesignItem gridItem, DesignItem firstRow, DesignItem secondRow) : base(gridItem, firstRow, secondRow) - { - } - - protected override double GetCoordinate(Point point) - { - return point.X; - } - - protected override void RememberOriginalSize() - { - ColumnDefinition r1 = (ColumnDefinition)firstRow.Component; - ColumnDefinition r2 = (ColumnDefinition)secondRow.Component; - original1 = (GridLength)r1.GetValue(ColumnDefinition.WidthProperty); - original2 = (GridLength)r2.GetValue(ColumnDefinition.WidthProperty); - originalPixelSize1 = r1.ActualWidth; - originalPixelSize2 = r2.ActualWidth; - } - - protected override DependencyProperty RowColumnSizeProperty { - get { return ColumnDefinition.WidthProperty; } - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/NumericUpDown.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/NumericUpDown.cs deleted file mode 100644 index a600f250f4..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/NumericUpDown.cs +++ /dev/null @@ -1,302 +0,0 @@ -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); } - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/NumericUpDown.xaml b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/NumericUpDown.xaml deleted file mode 100644 index 224930ac98..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/NumericUpDown.xaml +++ /dev/null @@ -1,149 +0,0 @@ - - - - - #DADFEA - #E6EBEF - #B6BDD3 - #7F9DB9 - Black - #B6BDD3 - - - - - - - - diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/PanelMoveAdorner.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/PanelMoveAdorner.cs deleted file mode 100644 index 234a9b5ac0..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/PanelMoveAdorner.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows.Controls; -using System.Windows; -using System.Windows.Input; -using ICSharpCode.WpfDesign.Designer.Services; - -namespace ICSharpCode.WpfDesign.Designer.Controls -{ - public class PanelMoveAdorner : Control - { - static PanelMoveAdorner() - { - DefaultStyleKeyProperty.OverrideMetadata(typeof(PanelMoveAdorner), - new FrameworkPropertyMetadata(typeof(PanelMoveAdorner))); - } - - public PanelMoveAdorner(DesignItem item) - { - this.item = item; - } - - DesignItem item; - - protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) - { - e.Handled = true; - item.Services.Selection.SetSelectedComponents(new DesignItem [] { item }, SelectionTypes.Auto); - new DragMoveMouseGesture(item, false).Start(item.Services.DesignPanel, e); - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ResizeThumb.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ResizeThumb.cs deleted file mode 100644 index 1066e153c5..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ResizeThumb.cs +++ /dev/null @@ -1,89 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Windows; -using System.Windows.Input; -using System.Windows.Controls; -using System.Windows.Controls.Primitives; -using ICSharpCode.WpfDesign.Adorners; -using ICSharpCode.WpfDesign.Extensions; - -namespace ICSharpCode.WpfDesign.Designer.Controls -{ - /// - /// A thumb where the look can depend on the IsPrimarySelection property. - /// - public class ResizeThumb : Thumb - { - /// - /// Dependency property for . - /// - public static readonly DependencyProperty IsPrimarySelectionProperty - = DependencyProperty.Register("IsPrimarySelection", typeof(bool), typeof(ResizeThumb)); - - /// - /// Dependency property for . - /// - public static readonly DependencyProperty ResizeThumbVisibleProperty - = DependencyProperty.Register("ResizeThumbVisible", typeof(bool), typeof(ResizeThumb), new FrameworkPropertyMetadata(true)); - - internal PlacementAlignment Alignment; - - static ResizeThumb() - { - //This OverrideMetadata call tells the system that this element wants to provide a style that is different than its base class. - //This style is defined in themes\generic.xaml - DefaultStyleKeyProperty.OverrideMetadata(typeof(ResizeThumb), new FrameworkPropertyMetadata(typeof(ResizeThumb))); - } - - /// - /// Gets/Sets if the resize thumb is attached to the primary selection. - /// - public bool IsPrimarySelection { - get { return (bool)GetValue(IsPrimarySelectionProperty); } - set { SetValue(IsPrimarySelectionProperty, value); } - } - - /// - /// Gets/Sets if the resize thumb is visible. - /// - public bool ResizeThumbVisible { - get { return (bool)GetValue(ResizeThumbVisibleProperty); } - set { SetValue(ResizeThumbVisibleProperty, value); } - } - } - - /// - /// Resize thumb that automatically disappears if the adornered element is too small. - /// - sealed class ResizeThumbImpl : ResizeThumb - { - bool checkWidth, checkHeight; - - internal ResizeThumbImpl(bool checkWidth, bool checkHeight) - { - Debug.Assert((checkWidth && checkHeight) == false); - this.checkWidth = checkWidth; - this.checkHeight = checkHeight; - } - - protected override Size ArrangeOverride(Size arrangeBounds) - { - AdornerPanel parent = this.Parent as AdornerPanel; - if (parent != null && parent.AdornedElement != null) { - if (checkWidth) - this.ResizeThumbVisible = parent.AdornedElement.RenderSize.Width > 14; - else if (checkHeight) - this.ResizeThumbVisible = parent.AdornedElement.RenderSize.Height > 14; - } - return base.ArrangeOverride(arrangeBounds); - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/SelectionFrame.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/SelectionFrame.cs deleted file mode 100644 index b3e1f4159d..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/SelectionFrame.cs +++ /dev/null @@ -1,32 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.ComponentModel; -using System.Diagnostics; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Input; -using System.Windows.Media; - -using ICSharpCode.WpfDesign.Extensions; - -namespace ICSharpCode.WpfDesign.Designer.Controls -{ - /// - /// The rectangle shown during a rubber-band selecting operation. - /// - public class SelectionFrame : Control - { - static SelectionFrame() - { - //This OverrideMetadata call tells the system that this element wants to provide a style that is different than its base class. - //This style is defined in themes\generic.xaml - DefaultStyleKeyProperty.OverrideMetadata(typeof(SelectionFrame), new FrameworkPropertyMetadata(typeof(SelectionFrame))); - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/WindowClone.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/WindowClone.cs deleted file mode 100644 index 13d6b52c4f..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/WindowClone.cs +++ /dev/null @@ -1,228 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.ComponentModel; -using System.Diagnostics; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Input; -using System.Windows.Media; - -using ICSharpCode.WpfDesign.Extensions; - -namespace ICSharpCode.WpfDesign.Designer.Controls -{ - /// - /// A custom control that imitates the properties of , but is not a top-level control. - /// - public class WindowClone : ContentControl - { - static WindowClone() - { - //This OverrideMetadata call tells the system that this element wants to provide a style that is different than its base class. - //This style is defined in themes\generic.xaml - DefaultStyleKeyProperty.OverrideMetadata(typeof(WindowClone), new FrameworkPropertyMetadata(typeof(WindowClone))); - - Control.IsTabStopProperty.OverrideMetadata(typeof(WindowClone), new FrameworkPropertyMetadata(SharedInstances.BoxedFalse)); - KeyboardNavigation.DirectionalNavigationProperty.OverrideMetadata(typeof(WindowClone), new FrameworkPropertyMetadata(KeyboardNavigationMode.Cycle)); - KeyboardNavigation.TabNavigationProperty.OverrideMetadata(typeof(WindowClone), new FrameworkPropertyMetadata(KeyboardNavigationMode.Cycle)); - KeyboardNavigation.ControlTabNavigationProperty.OverrideMetadata(typeof(WindowClone), new FrameworkPropertyMetadata(KeyboardNavigationMode.Cycle)); - FocusManager.IsFocusScopeProperty.OverrideMetadata(typeof(WindowClone), new FrameworkPropertyMetadata(SharedInstances.BoxedTrue)); - } - - /// - /// This property has no effect. (for compatibility with only). - /// - public bool AllowsTransparency { - get { return (bool)GetValue(Window.AllowsTransparencyProperty); } - set { SetValue(Window.AllowsTransparencyProperty, SharedInstances.Box(value)); } - } - - /// - /// This property has no effect. (for compatibility with only). - /// - [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), TypeConverter(typeof(DialogResultConverter))] - public bool? DialogResult { - get { - return null; - } - set { } - } - - /// - /// Specifies the icon to use. - /// - public ImageSource Icon { - get { return (ImageSource)GetValue(Window.IconProperty); } - set { SetValue(Window.IconProperty, value); } - } - - /// - /// This property has no effect. (for compatibility with only). - /// - [TypeConverter(typeof(LengthConverter))] - public double Left { - get { return (double)GetValue(Window.LeftProperty); } - set { SetValue(Window.LeftProperty, value); } - } - - Window owner; - - /// - /// This property has no effect. (for compatibility with only). - /// - public Window Owner { - get { return owner; } - set { owner = value; } - } - - /// - /// Gets or sets the resize mode. - /// - public ResizeMode ResizeMode { - get { return (ResizeMode)GetValue(Window.ResizeModeProperty); } - set { SetValue(Window.ResizeModeProperty, value); } - } - - public static readonly DependencyProperty ShowActivatedProperty = - DependencyProperty.Register("ShowActivated", typeof(bool), typeof(WindowClone)); - - public bool ShowActivated { - get { return (bool)GetValue(ShowActivatedProperty); } - set { SetValue(ShowActivatedProperty, value); } - } - - /// - /// This property has no effect. (for compatibility with only). - /// - public bool ShowInTaskbar { - get { return (bool)GetValue(Window.ShowInTaskbarProperty); } - set { SetValue(Window.ShowInTaskbarProperty, SharedInstances.Box(value)); } - } - - /// - /// Gets or sets a value that specifies whether a window will automatically size itself to fit the size of its content. - /// - public SizeToContent SizeToContent { - get { return (SizeToContent)GetValue(Window.SizeToContentProperty); } - set { SetValue(Window.SizeToContentProperty, value); } - } - - /// - /// The title to display in the Window's title bar. - /// - public string Title { - get { return (string)GetValue(Window.TitleProperty); } - set { SetValue(Window.TitleProperty, value); } - } - - /// - /// This property has no effect. (for compatibility with only). - /// - [TypeConverter(typeof(LengthConverter))] - public double Top { - get { return (double)GetValue(Window.TopProperty); } - set { SetValue(Window.TopProperty, value); } - } - - /// - /// This property has no effect. (for compatibility with only). - /// - public bool Topmost { - get { return (bool)GetValue(Window.TopmostProperty); } - set { SetValue(Window.TopmostProperty, SharedInstances.Box(value)); } - } - - WindowStartupLocation windowStartupLocation; - - /// - /// This property has no effect. (for compatibility with only). - /// - public WindowStartupLocation WindowStartupLocation { - get { return windowStartupLocation; } - set { windowStartupLocation = value; } - } - - /// - /// This property has no effect. (for compatibility with only). - /// - public WindowState WindowState { - get { return (WindowState) GetValue(Window.WindowStateProperty); } - set { SetValue(Window.WindowStateProperty, value); } - } - - /// - /// This property has no effect. (for compatibility with only). - /// - public WindowStyle WindowStyle { - get { return (WindowStyle)GetValue(Window.WindowStyleProperty); } - set { SetValue(Window.WindowStyleProperty, value); } - } - - #pragma warning disable 0067 - // disable "event is never used" warning - - /// - /// This event is never raised. (for compatibility with only). - /// - public event EventHandler Activated; - - /// - /// This event is never raised. (for compatibility with only). - /// - public event EventHandler Closed; - - /// - /// This event is never raised. (for compatibility with only). - /// - public event EventHandler Closing; - - /// - /// This event is never raised. (for compatibility with only). - /// - public event EventHandler ContentRendered; - - /// - /// This event is never raised. (for compatibility with only). - /// - public event EventHandler Deactivated; - - /// - /// This event is never raised. (for compatibility with only). - /// - public event EventHandler LocationChanged; - - /// - /// This event is never raised. (for compatibility with only). - /// - public event EventHandler SourceInitialized; - - /// - /// This event is never raised. (for compatibility with only). - /// - public event EventHandler StateChanged; - #pragma warning restore - } - - /// - /// A for - /// (and derived classes, unless they specify their own ). - /// - [ExtensionFor(typeof(Window))] - public class WindowCloneExtension : CustomInstanceFactory - { - /// - /// Used to create instances of . - /// - public override object CreateInstance(Type type, params object[] arguments) - { - Debug.Assert(arguments.Length == 0); - return new WindowClone(); - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ZoomControl.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ZoomControl.cs deleted file mode 100644 index 659c6e3738..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ZoomControl.cs +++ /dev/null @@ -1,200 +0,0 @@ -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.Reflection; -using System.Resources; - -namespace ICSharpCode.WpfDesign.Designer.Controls -{ - public class ZoomControl : ContentControl - { - static ZoomControl() - { - DefaultStyleKeyProperty.OverrideMetadata(typeof(ZoomControl), - new FrameworkPropertyMetadata(typeof(ZoomControl))); - - PanToolCursor = new Cursor(GetStream("Images/PanToolCursor.cur")); - PanToolCursorMouseDown = new Cursor(GetStream("Images/PanToolCursorMouseDown.cur")); - } - - static Stream GetStream(string path) - { - var a = Assembly.GetExecutingAssembly(); - var m = new ResourceManager(a.GetName().Name + ".g", a); - var s = m.GetStream(path.ToLower()); - return s; - } - - static Cursor PanToolCursor; - static Cursor PanToolCursorMouseDown; - public static double ZoomFactor = 1.1; - public static double Minimum = 0.1; - public static double Maximum = 10; - - double startHorizontalOffset; - double startVericalOffset; - - internal ScrollViewer ScrollViewer; - Border container; - ScaleTransform transform; - Point startPoint; - bool isMouseDown; - 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 = (Border)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) - { - if (!pan && e.Key == Key.Space) - { - Cursor = PanToolCursor; - pan = true; - } - } - - protected override void OnKeyUp(KeyEventArgs e) - { - if (e.Key == Key.Space) - { - ClearValue(CursorProperty); - pan = false; - } - } - - protected override void OnPreviewMouseDown(MouseButtonEventArgs e) - { - if (pan) - { - Cursor = PanToolCursorMouseDown; - Mouse.Capture(this); // will call move - isMouseDown = true; - startPoint = e.GetPosition(this); - PanStart(); - } - } - - protected override void OnPreviewMouseMove(MouseEventArgs e) - { - if (isMouseDown && pan) - { - var endPoint = e.GetPosition(this); - PanContinue(endPoint - startPoint); - } - } - - protected override void OnPreviewMouseUp(MouseButtonEventArgs e) - { - if (isMouseDown) - { - Cursor = PanToolCursor; - isMouseDown = false; - Mouse.Capture(null); - } - } - - protected override void OnMouseEnter(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; - } - - public void Reset() - { - Zoom = 1; - ScrollViewer.ScrollToHorizontalOffset(0); - ScrollViewer.ScrollToVerticalOffset(0); - } - - void PanStart() - { - startHorizontalOffset = ScrollViewer.HorizontalOffset; - startVericalOffset = ScrollViewer.VerticalOffset; - } - - void PanContinue(Vector delta) - { - ScrollViewer.ScrollToHorizontalOffset(startHorizontalOffset - delta.X); - ScrollViewer.ScrollToVerticalOffset(startVericalOffset - delta.Y); - } - - 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); - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Converters.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Converters.cs deleted file mode 100644 index d43fae8d29..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Converters.cs +++ /dev/null @@ -1,135 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows.Data; -using System.Globalization; -using System.Windows; -using System.Collections; - -namespace ICSharpCode.WpfDesign.Designer.Converters -{ - public class IntFromEnumConverter : IValueConverter - { - public static IntFromEnumConverter Instance = new IntFromEnumConverter(); - - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - return (int)value; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - return Enum.ToObject(targetType, (int)value); - } - } - - public class HiddenWhenFalse : IValueConverter - { - public static HiddenWhenFalse Instance = new HiddenWhenFalse(); - - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - return (bool)value ? Visibility.Visible : Visibility.Hidden; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } - } - - public class CollapsedWhenFalse : IValueConverter - { - public static CollapsedWhenFalse Instance = new CollapsedWhenFalse(); - - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - return (bool)value ? Visibility.Visible : Visibility.Collapsed; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } - } - - public class LevelConverter : IValueConverter - { - public static LevelConverter Instance = new LevelConverter(); - - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - return new Thickness(2 + 14 * (int)value, 0, 0, 0); - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } - } - - public class CollapsedWhenZero : IValueConverter - { - public static CollapsedWhenZero Instance = new CollapsedWhenZero(); - - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - if (value == null || (int)value == 0) { - return Visibility.Collapsed; - } - return Visibility.Visible; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } - } - - public class FalseWhenNull : IValueConverter - { - public static FalseWhenNull Instance = new FalseWhenNull(); - - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - return value != null; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } - } - - public class BoldWhenTrue : IValueConverter - { - public static BoldWhenTrue Instance = new BoldWhenTrue(); - - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - return (bool)value ? FontWeights.Bold : FontWeights.Normal; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } - } - - // Boxed int throw exception without converter (wpf bug?) - public class DummyConverter : IValueConverter - { - public static DummyConverter Instance = new DummyConverter(); - - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - return value; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - return value; - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignPanel.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignPanel.cs deleted file mode 100644 index ded6791a92..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignPanel.cs +++ /dev/null @@ -1,270 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Diagnostics; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Threading; - -using ICSharpCode.WpfDesign.Adorners; -using ICSharpCode.WpfDesign.Designer.Controls; - -namespace ICSharpCode.WpfDesign.Designer -{ - sealed class DesignPanel : Decorator, IDesignPanel - { - #region Hit Testing - /// - /// this element is always hit (unless HitTestVisible is set to false) - /// - sealed class EatAllHitTestRequests : UIElement - { - protected override GeometryHitTestResult HitTestCore(GeometryHitTestParameters hitTestParameters) - { - return new GeometryHitTestResult(this, IntersectionDetail.FullyContains); - } - - protected override HitTestResult HitTestCore(PointHitTestParameters hitTestParameters) - { - return new PointHitTestResult(this, hitTestParameters.HitPoint); - } - } - - static void RunHitTest(Visual reference, Point point, HitTestFilterCallback filterCallback, HitTestResultCallback resultCallback) - { - VisualTreeHelper.HitTest(reference, filterCallback, resultCallback, - new PointHitTestParameters(point)); - } - - static HitTestFilterBehavior FilterHitTestInvisibleElements(DependencyObject potentialHitTestTarget) - { - UIElement element = potentialHitTestTarget as UIElement; - if (element != null) { - if (!(element.IsHitTestVisible && element.Visibility == Visibility.Visible)) { - return HitTestFilterBehavior.ContinueSkipSelfAndChildren; - } - } - return HitTestFilterBehavior.Continue; - } - - /// - /// Performs a custom hit testing lookup for the specified mouse event args. - /// - public DesignPanelHitTestResult HitTest(Point mousePosition, bool testAdorners, bool testDesignSurface) - { - DesignPanelHitTestResult result = DesignPanelHitTestResult.NoHit; - HitTest(mousePosition, testAdorners, testDesignSurface, - delegate(DesignPanelHitTestResult r) { - result = r; - return false; - }); - return result; - } - - /// - /// Performs a hit test on the design surface, raising for each match. - /// Hit testing continues while the callback returns true. - /// - public void HitTest(Point mousePosition, bool testAdorners, bool testDesignSurface, Predicate callback) - { - if (mousePosition.X < 0 || mousePosition.Y < 0 || mousePosition.X > this.RenderSize.Width || mousePosition.Y > this.RenderSize.Height) { - return; - } - // First try hit-testing on the adorner layer. - - bool continueHitTest = true; - - if (testAdorners) { - RunHitTest( - _adornerLayer, mousePosition, FilterHitTestInvisibleElements, - delegate(HitTestResult result) { - if (result != null && result.VisualHit != null && result.VisualHit is Visual) { - DesignPanelHitTestResult customResult = new DesignPanelHitTestResult((Visual)result.VisualHit); - DependencyObject obj = result.VisualHit; - while (obj != null && obj != _adornerLayer) { - AdornerPanel adorner = obj as AdornerPanel; - if (adorner != null) { - customResult.AdornerHit = adorner; - } - obj = VisualTreeHelper.GetParent(obj); - } - continueHitTest = callback(customResult); - return continueHitTest ? HitTestResultBehavior.Continue : HitTestResultBehavior.Stop; - } else { - return HitTestResultBehavior.Continue; - } - }); - } - - if (continueHitTest && testDesignSurface) { - RunHitTest( - this.Child, mousePosition, delegate { return HitTestFilterBehavior.Continue; }, - delegate(HitTestResult result) { - if (result != null && result.VisualHit != null && result.VisualHit is Visual) { - DesignPanelHitTestResult customResult = new DesignPanelHitTestResult((Visual)result.VisualHit); - - ViewService viewService = _context.Services.View; - DependencyObject obj = result.VisualHit; - while (obj != null) { - if ((customResult.ModelHit = viewService.GetModel(obj)) != null) - break; - obj = VisualTreeHelper.GetParent(obj); - } - if (customResult.ModelHit == null) { - customResult.ModelHit = _context.RootItem; - } - continueHitTest = callback(customResult); - return continueHitTest ? HitTestResultBehavior.Continue : HitTestResultBehavior.Stop; - } else { - return HitTestResultBehavior.Continue; - } - } - ); - } - } - #endregion - - #region Fields + Constructor - DesignContext _context; - readonly EatAllHitTestRequests _eatAllHitTestRequests; - readonly AdornerLayer _adornerLayer; - - public DesignPanel() - { - this.Focusable = true; - this.VerticalAlignment = VerticalAlignment.Top; - this.HorizontalAlignment = HorizontalAlignment.Left; - this.AllowDrop = true; - DesignerProperties.SetIsInDesignMode(this, true); - - _eatAllHitTestRequests = new EatAllHitTestRequests(); - _eatAllHitTestRequests.MouseDown += delegate { - // ensure the design panel has focus while the user is interacting with it - this.Focus(); - }; - _eatAllHitTestRequests.AllowDrop = true; - _adornerLayer = new AdornerLayer(this); - } - #endregion - - #region Properties - - /// - /// Gets/Sets the design context. - /// - public DesignContext Context { - get { return _context; } - set { _context = value; } - } - - public ICollection Adorners { - get { - return _adornerLayer.Adorners; - } - } - - /// - /// Gets/Sets if the design content is visible for hit-testing purposes. - /// - public bool IsContentHitTestVisible { - get { return !_eatAllHitTestRequests.IsHitTestVisible; } - set { _eatAllHitTestRequests.IsHitTestVisible = !value; } - } - - /// - /// Gets/Sets if the adorner layer is visible for hit-testing purposes. - /// - public bool IsAdornerLayerHitTestVisible { - get { return _adornerLayer.IsHitTestVisible; } - set { _adornerLayer.IsHitTestVisible = value; } - } - - #endregion - - #region Visual Child Management - public override UIElement Child { - get { return base.Child; } - set { - if (base.Child == value) - return; - if (value == null) { - // Child is being set from some value to null - - // remove _adornerLayer and _eatAllHitTestRequests - RemoveVisualChild(_adornerLayer); - RemoveVisualChild(_eatAllHitTestRequests); - } else if (base.Child == null) { - // Child is being set from null to some value - AddVisualChild(_adornerLayer); - AddVisualChild(_eatAllHitTestRequests); - } - base.Child = value; - } - } - - protected override Visual GetVisualChild(int index) - { - if (base.Child != null) { - if (index == 0) - return base.Child; - else if (index == 1) - return _eatAllHitTestRequests; - else if (index == 2) - return _adornerLayer; - } - return base.GetVisualChild(index); - } - - protected override int VisualChildrenCount { - get { - if (base.Child != null) - return 3; - else - return base.VisualChildrenCount; - } - } - - protected override Size MeasureOverride(Size constraint) - { - Size result = base.MeasureOverride(constraint); - if (this.Child != null) { - _adornerLayer.Measure(constraint); - _eatAllHitTestRequests.Measure(constraint); - } - return result; - } - - protected override Size ArrangeOverride(Size arrangeSize) - { - Size result = base.ArrangeOverride(arrangeSize); - if (this.Child != null) { - Rect r = new Rect(new Point(0, 0), arrangeSize); - _adornerLayer.Arrange(r); - _eatAllHitTestRequests.Arrange(r); - } - return result; - } - #endregion - - protected override void OnQueryCursor(QueryCursorEventArgs e) - { - base.OnQueryCursor(e); - if (_context != null) { - Cursor cursor = _context.Services.Tool.CurrentTool.Cursor; - if (cursor != null) { - e.Cursor = cursor; - e.Handled = true; - } - } - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignSurface.xaml b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignSurface.xaml deleted file mode 100644 index 0fe0ad99df..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignSurface.xaml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignSurface.xaml.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignSurface.xaml.cs deleted file mode 100644 index 4f09e107aa..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignSurface.xaml.cs +++ /dev/null @@ -1,258 +0,0 @@ -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.Xml; -using ICSharpCode.WpfDesign.Designer.Xaml; -using ICSharpCode.WpfDesign.Designer.Services; -using System.Diagnostics; -using ICSharpCode.WpfDesign.XamlDom; -using System.Threading; -using System.Globalization; - -namespace ICSharpCode.WpfDesign.Designer -{ - /// - /// Surface hosting the WPF designer. - /// - public partial class DesignSurface - { - static DesignSurface() - { - //TODO: this is for converters (see PropertyGrid) - Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; - } - - public DesignSurface() - { - InitializeComponent(); - - this.AddCommandHandler(ApplicationCommands.Undo, Undo, CanUndo); - this.AddCommandHandler(ApplicationCommands.Redo, Redo, CanRedo); - this.AddCommandHandler(ApplicationCommands.Copy, Copy, HasSelection); - this.AddCommandHandler(ApplicationCommands.Cut, Cut, HasSelection); - this.AddCommandHandler(ApplicationCommands.Delete, Delete, CanDelete); - this.AddCommandHandler(ApplicationCommands.Paste, Paste, CanPaste); - this.AddCommandHandler(ApplicationCommands.SelectAll, SelectAll, CanSelectAll); - } - - protected override void OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e) - { - if (e.OriginalSource == uxZoom.ScrollViewer) { - UnselectAll(); - } - } - - DesignContext _designContext; - - /// - /// Gets the active design context. - /// - public DesignContext DesignContext { - get { return _designContext; } - } - - /// - /// Initializes the designer content from the specified XmlReader. - /// - public void LoadDesigner(XmlReader xamlReader, XamlLoadSettings loadSettings) - { - UnloadDesigner(); - loadSettings = loadSettings ?? new XamlLoadSettings(); - loadSettings.CustomServiceRegisterFunctions.Add( - context => context.Services.AddService(typeof(IDesignPanel), _designPanel)); - InitializeDesigner(new XamlDesignContext(xamlReader, loadSettings)); - } - - /// - /// Saves the designer content into the specified XmlWriter. - /// - public void SaveDesigner(XmlWriter writer) - { - _designContext.Save(writer); - } - - void InitializeDesigner(DesignContext context) - { - _designContext = context; - _designPanel.Context = context; - - if (context.RootItem != null) { - _sceneContainer.Child = context.RootItem.View; - } - - context.Services.RunWhenAvailable( - undoService => undoService.UndoStackChanged += delegate { - CommandManager.InvalidateRequerySuggested(); - } - ); - context.Services.Selection.SelectionChanged += delegate { - CommandManager.InvalidateRequerySuggested(); - }; - } - - /// - /// Unloads the designer content. - /// - public void UnloadDesigner() - { - if (_designContext != null) { - foreach (object o in _designContext.Services.AllServices) { - IDisposable d = o as IDisposable; - if (d != null) d.Dispose(); - } - } - _designContext = null; - _designPanel.Context = null; - _sceneContainer.Child = null; - _designPanel.Adorners.Clear(); - } - - #region Commands - - public bool CanUndo() - { - UndoService undoService = GetService(); - return undoService != null && undoService.CanUndo; - } - - public void Undo() - { - UndoService undoService = GetService(); - IUndoAction action = undoService.UndoActions.First(); - Debug.WriteLine("Undo " + action.Title); - undoService.Undo(); - _designContext.Services.Selection.SetSelectedComponents(GetLiveElements(action.AffectedElements)); - } - - public bool CanRedo() - { - UndoService undoService = GetService(); - return undoService != null && undoService.CanRedo; - } - - public void Redo() - { - UndoService undoService = GetService(); - IUndoAction action = undoService.RedoActions.First(); - Debug.WriteLine("Redo " + action.Title); - undoService.Redo(); - _designContext.Services.Selection.SetSelectedComponents(GetLiveElements(action.AffectedElements)); - } - - public bool HasSelection() - { - return false; - } - - public void Copy() - { - } - - public void Cut() - { - } - - public bool CanDelete() - { - if (_designContext != null) { - return ModelTools.CanDeleteComponents(_designContext.Services.Selection.SelectedItems); - } - return false; - } - - public void Delete() - { - if (_designContext != null) { - ModelTools.DeleteComponents(_designContext.Services.Selection.SelectedItems); - } - } - - public bool CanPaste() - { - return false; - } - - public void Paste() - { - } - - public bool CanSelectAll() - { - return DesignContext != null; - } - - //TODO: Do not select layout root - public void SelectAll() - { - var items = Descendants(DesignContext.RootItem).Where(item => ModelTools.CanSelectComponent(item)).ToArray(); - DesignContext.Services.Selection.SetSelectedComponents(items); - } - - public void UnselectAll() - { - DesignContext.Services.Selection.SetSelectedComponents(null); - } - - //TODO: Share with Outline / PlacementBehavior - public static IEnumerable DescendantsAndSelf(DesignItem item) - { - yield return item; - foreach (var child in Descendants(item)) { - yield return child; - } - } - - public static IEnumerable Descendants(DesignItem item) - { - if (item.ContentPropertyName != null) { - var content = item.ContentProperty; - if (content.IsCollection) { - foreach (var child in content.CollectionElements) { - foreach (var child2 in DescendantsAndSelf(child)) { - yield return child2; - } - } - } else { - if (content.Value != null) { - foreach (var child2 in DescendantsAndSelf(content.Value)) { - yield return child2; - } - } - } - } - } - - // Filters an element list, dropping all elements that are not part of the xaml document - // (e.g. because they were deleted). - static List GetLiveElements(ICollection items) - { - List result = new List(items.Count); - foreach (DesignItem item in items) { - if (ModelTools.IsInDocument(item) && ModelTools.CanSelectComponent(item)) { - result.Add(item); - } - } - return result; - } - - T GetService() where T : class - { - if (_designContext != null) - return _designContext.Services.GetService(); - else - return null; - } - - #endregion - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DragDropExceptionHandler.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DragDropExceptionHandler.cs deleted file mode 100644 index 3ef7df9d65..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DragDropExceptionHandler.cs +++ /dev/null @@ -1,24 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; - -namespace ICSharpCode.WpfDesign.Designer -{ - /// - /// When the designer is hosted in a Windows.Forms application, exceptions in - /// drag'n'drop handlers are silently ignored. - /// Applications hosting the designer should specify a delegate to their own exception handling - /// method. The default is Environment.FailFast. - /// - public static class DragDropExceptionHandler - { - public static Action HandleException = delegate(Exception ex) { - Environment.FailFast(ex.ToString()); - }; - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/ExtensionMethods.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/ExtensionMethods.cs deleted file mode 100644 index e9e7c819a5..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/ExtensionMethods.cs +++ /dev/null @@ -1,86 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Reflection; -using System.Collections; -using System.Windows; -using System.Windows.Media; -using System.Windows.Input; - -namespace ICSharpCode.WpfDesign.Designer -{ - public static class ExtensionMethods - { - public static double Coerce(this double d, double min, double max) - { - return Math.Max(Math.Min(d, max), min); - } - - public static void AddRange(this ICollection col, IEnumerable items) - { - foreach (var item in items) { - col.Add(item); - } - } - - public static object GetDataContext(this RoutedEventArgs e) - { - var f = e.OriginalSource as FrameworkElement; - if (f != null) { - return f.DataContext; - } - return null; - } - - public static T FindAncestor(this DependencyObject d, string name) where T : class - { - while (true) { - if (d == null) return null; - if (d is T && d is FrameworkElement && (d as FrameworkElement).Name == name) return d as T; - d = VisualTreeHelper.GetParent(d); - } - } - - public static T FindAncestor(this DependencyObject d) where T : class - { - while (true) { - if (d == null) return null; - if (d is T) return d as T; - d = VisualTreeHelper.GetParent(d); - } - } - - public static T FindChild(this DependencyObject d) where T : class - { - if (d is T) return d as T; - int n = VisualTreeHelper.GetChildrenCount(d); - for (int i = 0; i < n; i++) { - var child = VisualTreeHelper.GetChild(d, i); - var result = FindChild(child); - if (result != null) return result; - } - return null; - } - - public static void AddCommandHandler(this UIElement element, ICommand command, Action execute) - { - AddCommandHandler(element, command, execute, null); - } - - public static void AddCommandHandler(this UIElement element, ICommand command, Action execute, Func canExecute) - { - var cb = new CommandBinding(command); - if (canExecute != null) { - cb.CanExecute += delegate(object sender, CanExecuteRoutedEventArgs e) { - e.CanExecute = canExecute(); - e.Handled = true; - }; - } - cb.Executed += delegate(object sender, ExecutedRoutedEventArgs e) { - execute(); - }; - element.CommandBindings.Add(cb); - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/BorderForInvisibleControl.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/BorderForInvisibleControl.cs deleted file mode 100644 index 95e048c4ac..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/BorderForInvisibleControl.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using ICSharpCode.WpfDesign.Adorners; -using ICSharpCode.WpfDesign.Extensions; -using System.Windows.Controls; -using System.Windows; -using ICSharpCode.WpfDesign.Designer.Controls; -using System.Windows.Media; - -namespace ICSharpCode.WpfDesign.Designer.Extensions -{ - [ExtensionFor(typeof(Panel))] - public class BorderForInvisibleControl : PermanentAdornerProvider - { - protected override void OnInitialized() - { - base.OnInitialized(); - - var adornerPanel = new AdornerPanel(); - var border = new Border(); - border.BorderThickness = new Thickness(1); - border.BorderBrush = Brushes.WhiteSmoke; - border.IsHitTestVisible = false; - AdornerPanel.SetPlacement(border, AdornerPlacement.FillContent); - adornerPanel.Children.Add(border); - Adorners.Add(adornerPanel); - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/CanvasPlacementSupport.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/CanvasPlacementSupport.cs deleted file mode 100644 index 4f504a9108..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/CanvasPlacementSupport.cs +++ /dev/null @@ -1,84 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Collections.Generic; -using System.Windows; -using System.Windows.Controls; - -using ICSharpCode.WpfDesign.Designer.Controls; -using ICSharpCode.WpfDesign.Extensions; - -namespace ICSharpCode.WpfDesign.Designer.Extensions -{ - /// - /// Provides behavior for . - /// - [ExtensionFor(typeof(Canvas), OverrideExtension=typeof(DefaultPlacementBehavior))] - public sealed class CanvasPlacementSupport : SnaplinePlacementBehavior - { - static double GetLeft(UIElement element) - { - double v = (double)element.GetValue(Canvas.LeftProperty); - if (double.IsNaN(v)) - return 0; - else - return v; - } - - static double GetTop(UIElement element) - { - double v = (double)element.GetValue(Canvas.TopProperty); - if (double.IsNaN(v)) - return 0; - else - return v; - } - - //TODO: Is default way ok? - //public override Rect GetPosition(PlacementOperation operation, DesignItem childItem) - //{ - // UIElement child = childItem.View; - // return new Rect(GetLeft(child), GetTop(child), ModelTools.GetWidth(child), ModelTools.GetHeight(child)); - //} - - public override void SetPosition(PlacementInformation info) - { - base.SetPosition(info); - info.Item.Properties[FrameworkElement.MarginProperty].Reset(); - - UIElement child = info.Item.View; - Rect newPosition = info.Bounds; - - if (newPosition.Left != GetLeft(child)) { - info.Item.Properties.GetAttachedProperty(Canvas.LeftProperty).SetValue(newPosition.Left); - } - if (newPosition.Top != GetTop(child)) { - info.Item.Properties.GetAttachedProperty(Canvas.TopProperty).SetValue(newPosition.Top); - } - } - - public override void LeaveContainer(PlacementOperation operation) - { - base.LeaveContainer(operation); - foreach (PlacementInformation info in operation.PlacedItems) { - info.Item.Properties.GetAttachedProperty(Canvas.LeftProperty).Reset(); - info.Item.Properties.GetAttachedProperty(Canvas.TopProperty).Reset(); - } - } - - public override void EnterContainer(PlacementOperation operation) - { - base.EnterContainer(operation); - foreach (PlacementInformation info in operation.PlacedItems) { - info.Item.Properties[FrameworkElement.HorizontalAlignmentProperty].Reset(); - info.Item.Properties[FrameworkElement.VerticalAlignmentProperty].Reset(); - info.Item.Properties[FrameworkElement.MarginProperty].Reset(); - } - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/DefaultPlacementBehavior.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/DefaultPlacementBehavior.cs deleted file mode 100644 index 90edbbaac9..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/DefaultPlacementBehavior.cs +++ /dev/null @@ -1,96 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using ICSharpCode.WpfDesign.Extensions; -using System.Windows.Controls; -using System.Windows; -using ICSharpCode.WpfDesign.Designer.Controls; -using System.Diagnostics; -using ICSharpCode.WpfDesign.XamlDom; -using System.Windows.Media; - -namespace ICSharpCode.WpfDesign.Designer.Extensions -{ - [ExtensionFor(typeof(UIElement))] - public class DefaultPlacementBehavior : BehaviorExtension, IPlacementBehavior - { - protected override void OnInitialized() - { - base.OnInitialized(); - if (ExtendedItem.ContentProperty == null || - Metadata.IsPlacementDisabled(ExtendedItem.ComponentType)) - return; - ExtendedItem.AddBehavior(typeof(IPlacementBehavior), this); - } - - public virtual bool CanPlace(ICollection childItems, PlacementType type, PlacementAlignment position) - { - return true; - } - - public virtual void BeginPlacement(PlacementOperation operation) - { - } - - public virtual void EndPlacement(PlacementOperation operation) - { - } - - public virtual Rect GetPosition(PlacementOperation operation, DesignItem item) - { - var p = item.View.TranslatePoint(new Point(), operation.CurrentContainer.View); - return new Rect(p, item.View.RenderSize); - } - - public virtual void BeforeSetPosition(PlacementOperation operation) - { - } - - public virtual void SetPosition(PlacementInformation info) - { - ModelTools.Resize(info.Item, info.Bounds.Width, info.Bounds.Height); - } - - public virtual bool CanLeaveContainer(PlacementOperation operation) - { - return true; - } - - public virtual void LeaveContainer(PlacementOperation operation) - { - if (ExtendedItem.ContentProperty.IsCollection) { - foreach (var info in operation.PlacedItems) { - ExtendedItem.ContentProperty.CollectionElements.Remove(info.Item); - } - } else { - ExtendedItem.ContentProperty.Reset(); - } - } - - public virtual bool CanEnterContainer(PlacementOperation operation) - { - if (ExtendedItem.ContentProperty.IsCollection && - CollectionSupport.CanCollectionAdd(ExtendedItem.ContentProperty.ReturnType, - operation.PlacedItems.Select(p => p.Item.Component))) - return true; - return !ExtendedItem.ContentProperty.IsSet; - } - - public virtual void EnterContainer(PlacementOperation operation) - { - if (ExtendedItem.ContentProperty.IsCollection) { - foreach (var info in operation.PlacedItems) { - ExtendedItem.ContentProperty.CollectionElements.Add(info.Item); - } - } else { - ExtendedItem.ContentProperty.SetValue(operation.PlacedItems[0].Item); - } - if (operation.Type == PlacementType.AddItem) { - foreach (var info in operation.PlacedItems) { - SetPosition(info); - } - } - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/GridAdornerProvider.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/GridAdornerProvider.cs deleted file mode 100644 index 5425d321d6..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/GridAdornerProvider.cs +++ /dev/null @@ -1,136 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Collections.Generic; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Threading; - -using ICSharpCode.WpfDesign.Adorners; -using ICSharpCode.WpfDesign.Designer.Controls; -using ICSharpCode.WpfDesign.Extensions; - -namespace ICSharpCode.WpfDesign.Designer.Extensions -{ - /// - /// Allows arranging the rows/column on a grid. - /// - [ExtensionFor(typeof(Grid))] - [ExtensionServer(typeof(LogicalOrExtensionServer))] - public class GridAdornerProvider : AdornerProvider - { - sealed class RowSplitterPlacement : AdornerPlacement - { - readonly RowDefinition row; - public RowSplitterPlacement(RowDefinition row) { this.row = row; } - - public override void Arrange(AdornerPanel panel, UIElement adorner, Size adornedElementSize) - { - adorner.Arrange(new Rect(-(GridRailAdorner.RailSize + GridRailAdorner.RailDistance), - row.Offset - GridRailAdorner.SplitterWidth / 2, - GridRailAdorner.RailSize + GridRailAdorner.RailDistance + adornedElementSize.Width, - GridRailAdorner.SplitterWidth)); - } - } - - sealed class ColumnSplitterPlacement : AdornerPlacement - { - readonly ColumnDefinition column; - public ColumnSplitterPlacement(ColumnDefinition column) { this.column = column; } - - public override void Arrange(AdornerPanel panel, UIElement adorner, Size adornedElementSize) - { - adorner.Arrange(new Rect(column.Offset - GridRailAdorner.SplitterWidth / 2, - -(GridRailAdorner.RailSize + GridRailAdorner.RailDistance), - GridRailAdorner.SplitterWidth, - GridRailAdorner.RailSize + GridRailAdorner.RailDistance + adornedElementSize.Height)); - } - } - - AdornerPanel adornerPanel = new AdornerPanel(); - GridRailAdorner topBar, leftBar; - - protected override void OnInitialized() - { - leftBar = new GridRailAdorner(this.ExtendedItem, adornerPanel, Orientation.Vertical); - topBar = new GridRailAdorner(this.ExtendedItem, adornerPanel, Orientation.Horizontal); - - RelativePlacement rp = new RelativePlacement(HorizontalAlignment.Left, VerticalAlignment.Stretch); - rp.XOffset -= GridRailAdorner.RailDistance; - AdornerPanel.SetPlacement(leftBar, rp); - rp = new RelativePlacement(HorizontalAlignment.Stretch, VerticalAlignment.Top); - rp.YOffset -= GridRailAdorner.RailDistance; - AdornerPanel.SetPlacement(topBar, rp); - - adornerPanel.Children.Add(leftBar); - adornerPanel.Children.Add(topBar); - this.Adorners.Add(adornerPanel); - - CreateSplitter(); - this.ExtendedItem.PropertyChanged += OnPropertyChanged; - - base.OnInitialized(); - } - - protected override void OnRemove() - { - this.ExtendedItem.PropertyChanged -= OnPropertyChanged; - base.OnRemove(); - } - - void OnPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) - { - if (e.PropertyName == "RowDefinitions" || e.PropertyName == "ColumnDefinitions") { - CreateSplitter(); - } - } - - readonly List splitterList = new List(); - /// - /// flag used to ensure that the asynchronus splitter creation is only enqueued once - /// - bool requireSplitterRecreation; - - void CreateSplitter() - { - if (requireSplitterRecreation) return; - requireSplitterRecreation = true; - - // splitter creation is delayed to prevent unnecessary splitter re-creation when multiple - // changes to the collection are done. - // It also ensures that the Offset property of new rows/columns is initialized when the splitter - // is added. - Dispatcher.CurrentDispatcher.BeginInvoke( - DispatcherPriority.Loaded, // Loaded = after layout, but before input - (Action)delegate { - requireSplitterRecreation = false; - foreach (GridSplitterAdorner splitter in splitterList) { - adornerPanel.Children.Remove(splitter); - } - splitterList.Clear(); - Grid grid = (Grid)this.ExtendedItem.Component; - IList col = this.ExtendedItem.Properties["RowDefinitions"].CollectionElements; - for (int i = 1; i < grid.RowDefinitions.Count; i++) { - RowDefinition row = grid.RowDefinitions[i]; - GridRowSplitterAdorner splitter = new GridRowSplitterAdorner(this.ExtendedItem, col[i-1], col[i]); - AdornerPanel.SetPlacement(splitter, new RowSplitterPlacement(row)); - adornerPanel.Children.Add(splitter); - splitterList.Add(splitter); - } - col = this.ExtendedItem.Properties["ColumnDefinitions"].CollectionElements; - for (int i = 1; i < grid.ColumnDefinitions.Count; i++) { - ColumnDefinition column = grid.ColumnDefinitions[i]; - GridColumnSplitterAdorner splitter = new GridColumnSplitterAdorner(this.ExtendedItem, col[i-1], col[i]); - AdornerPanel.SetPlacement(splitter, new ColumnSplitterPlacement(column)); - adornerPanel.Children.Add(splitter); - splitterList.Add(splitter); - } - }); - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/GridPlacementSupport.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/GridPlacementSupport.cs deleted file mode 100644 index cd51501f95..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/GridPlacementSupport.cs +++ /dev/null @@ -1,292 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Collections.Generic; -using System.Windows; -using System.Diagnostics; -using System.Windows.Controls; -using System.Windows.Media; - -using ICSharpCode.WpfDesign.Adorners; -using ICSharpCode.WpfDesign.Extensions; -using ICSharpCode.WpfDesign.Designer.Controls; - -namespace ICSharpCode.WpfDesign.Designer.Extensions -{ - /// - /// Provides behavior for . - /// - [ExtensionFor(typeof(Grid), OverrideExtension=typeof(DefaultPlacementBehavior))] - public sealed class GridPlacementSupport : SnaplinePlacementBehavior - { - Grid grid; - - protected override void OnInitialized() - { - base.OnInitialized(); - grid = (Grid)this.ExtendedItem.Component; - } - - //TODO: Is default way ok? - //public override Rect GetPosition(PlacementOperation operation, DesignItem child) - //{ - // FrameworkElement obj = child.Component as FrameworkElement; - // if (obj == null) return new Rect(); - - // Thickness margin = obj.Margin; - - // double left, width, right; - // switch (obj.HorizontalAlignment) { - // case HorizontalAlignment.Stretch: - // left = GetColumnOffset(Grid.GetColumn(obj)) + margin.Left; - // right = GetColumnOffset(Grid.GetColumn(obj) + Grid.GetColumnSpan(obj)) - margin.Right; - // width = right - left; - // break; - // case HorizontalAlignment.Left: - // left = GetColumnOffset(Grid.GetColumn(obj)) + margin.Left; - // width = ModelTools.GetWidth(obj); - // right = left + width; - // break; - // case HorizontalAlignment.Right: - // right = GetColumnOffset(Grid.GetColumn(obj) + Grid.GetColumnSpan(obj)) - margin.Right; - // width = ModelTools.GetWidth(obj); - // left = right - width; - // break; - // case HorizontalAlignment.Center: - // throw new NotImplementedException(); - // default: - // throw new NotSupportedException(); - // } - - // double top, height, bottom; - // switch (obj.VerticalAlignment) { - // case VerticalAlignment.Stretch: - // top = GetRowOffset(Grid.GetRow(obj)) + margin.Top; - // bottom = GetRowOffset(Grid.GetRow(obj) + Grid.GetRowSpan(obj)) - margin.Bottom; - // height = bottom - top; - // break; - // case VerticalAlignment.Top: - // top = GetRowOffset(Grid.GetRow(obj)) + margin.Top; - // height = ModelTools.GetHeight(obj); - // bottom = top + height; - // break; - // case VerticalAlignment.Bottom: - // bottom = GetRowOffset(Grid.GetRow(obj) + Grid.GetRowSpan(obj)) - margin.Bottom; - // height = ModelTools.GetHeight(obj); - // top = bottom - height; - // break; - // case VerticalAlignment.Center: - // throw new NotImplementedException(); - // default: - // throw new NotSupportedException(); - // } - // return new Rect(left, top, Math.Max(0, width), Math.Max(0, height)); - //} - - double GetColumnOffset(int index) - { - // when the grid has no columns, we still need to return 0 for index=0 and grid.Width for index=1 - if (index == 0) - return 0; - else if (index < grid.ColumnDefinitions.Count) - return grid.ColumnDefinitions[index].Offset; - else - return grid.ActualWidth; - } - - double GetRowOffset(int index) - { - if (index == 0) - return 0; - else if (index < grid.RowDefinitions.Count) - return grid.RowDefinitions[index].Offset; - else - return grid.ActualHeight; - } - - const double epsilon = 0.00000001; - - int GetColumnIndex(double x) - { - if (grid.ColumnDefinitions.Count == 0) - return 0; - for (int i = 1; i < grid.ColumnDefinitions.Count; i++) { - if (x < grid.ColumnDefinitions[i].Offset - epsilon) - return i - 1; - } - return grid.ColumnDefinitions.Count - 1; - } - - int GetRowIndex(double y) - { - if (grid.RowDefinitions.Count == 0) - return 0; - for (int i = 1; i < grid.RowDefinitions.Count; i++) { - if (y < grid.RowDefinitions[i].Offset - epsilon) - return i - 1; - } - return grid.RowDefinitions.Count - 1; - } - - int GetEndColumnIndex(double x) - { - if (grid.ColumnDefinitions.Count == 0) - return 0; - for (int i = 1; i < grid.ColumnDefinitions.Count; i++) { - if (x <= grid.ColumnDefinitions[i].Offset + epsilon) - return i - 1; - } - return grid.ColumnDefinitions.Count - 1; - } - - int GetEndRowIndex(double y) - { - if (grid.RowDefinitions.Count == 0) - return 0; - for (int i = 1; i < grid.RowDefinitions.Count; i++) { - if (y <= grid.RowDefinitions[i].Offset + epsilon) - return i - 1; - } - return grid.RowDefinitions.Count - 1; - } - - static void SetColumn(DesignItem item, int column, int columnSpan) - { - Debug.Assert(item != null && column >= 0 && columnSpan > 0); - item.Properties.GetAttachedProperty(Grid.ColumnProperty).SetValue(column); - if (columnSpan == 1) { - item.Properties.GetAttachedProperty(Grid.ColumnSpanProperty).Reset(); - } else { - item.Properties.GetAttachedProperty(Grid.ColumnSpanProperty).SetValue(columnSpan); - } - } - - static void SetRow(DesignItem item, int row, int rowSpan) - { - Debug.Assert(item != null && row >= 0 && rowSpan > 0); - item.Properties.GetAttachedProperty(Grid.RowProperty).SetValue(row); - if (rowSpan == 1) { - item.Properties.GetAttachedProperty(Grid.RowSpanProperty).Reset(); - } else { - item.Properties.GetAttachedProperty(Grid.RowSpanProperty).SetValue(rowSpan); - } - } - - static HorizontalAlignment SuggestHorizontalAlignment(Rect itemBounds, Rect availableSpaceRect) - { - if (itemBounds.Right < (availableSpaceRect.Left + availableSpaceRect.Right) / 2) { - return HorizontalAlignment.Left; - } else if (itemBounds.Left > (availableSpaceRect.Left + availableSpaceRect.Right) / 2) { - return HorizontalAlignment.Right; - } else { - return HorizontalAlignment.Stretch; - } - } - - static VerticalAlignment SuggestVerticalAlignment(Rect itemBounds, Rect availableSpaceRect) - { - if (itemBounds.Bottom < (availableSpaceRect.Top + availableSpaceRect.Bottom) / 2) { - return VerticalAlignment.Top; - } else if (itemBounds.Top > (availableSpaceRect.Top + availableSpaceRect.Bottom) / 2) { - return VerticalAlignment.Bottom; - } else { - return VerticalAlignment.Stretch; - } - } - - GrayOutDesignerExceptActiveArea grayOut; - - public override void EndPlacement(PlacementOperation operation) - { - GrayOutDesignerExceptActiveArea.Stop(ref grayOut); - base.EndPlacement(operation); - } - - public override void SetPosition(PlacementInformation info) - { - base.SetPosition(info); - if (info.Operation.Type == PlacementType.AddItem) { - SetColumn(info.Item, GetColumnIndex(info.Bounds.Left), 1); - SetRow(info.Item, GetRowIndex(info.Bounds.Top), 1); - } else { - int leftColumnIndex = GetColumnIndex(info.Bounds.Left); - int rightColumnIndex = GetEndColumnIndex(info.Bounds.Right); - if (rightColumnIndex < leftColumnIndex) rightColumnIndex = leftColumnIndex; - SetColumn(info.Item, leftColumnIndex, rightColumnIndex - leftColumnIndex + 1); - int topRowIndex = GetRowIndex(info.Bounds.Top); - int bottomRowIndex = GetEndRowIndex(info.Bounds.Bottom); - if (bottomRowIndex < topRowIndex) bottomRowIndex = topRowIndex; - SetRow(info.Item, topRowIndex, bottomRowIndex - topRowIndex + 1); - - Rect availableSpaceRect = new Rect( - new Point(GetColumnOffset(leftColumnIndex), GetRowOffset(topRowIndex)), - new Point(GetColumnOffset(rightColumnIndex + 1), GetRowOffset(bottomRowIndex + 1)) - ); - if (grayOut != null) { - grayOut.AnimateActiveAreaRectTo(availableSpaceRect); - } else { - GrayOutDesignerExceptActiveArea.Start(ref grayOut, this.Services, this.ExtendedItem.View, availableSpaceRect); - } - - HorizontalAlignment ha = (HorizontalAlignment)info.Item.Properties[FrameworkElement.HorizontalAlignmentProperty].ValueOnInstance; - VerticalAlignment va = (VerticalAlignment)info.Item.Properties[FrameworkElement.VerticalAlignmentProperty].ValueOnInstance; - ha = SuggestHorizontalAlignment(info.Bounds, availableSpaceRect); - va = SuggestVerticalAlignment(info.Bounds, availableSpaceRect); - - info.Item.Properties[FrameworkElement.HorizontalAlignmentProperty].SetValue(ha); - info.Item.Properties[FrameworkElement.VerticalAlignmentProperty].SetValue(va); - - Thickness margin = new Thickness(0, 0, 0, 0); - if (ha == HorizontalAlignment.Left || ha == HorizontalAlignment.Stretch) - margin.Left = info.Bounds.Left - GetColumnOffset(leftColumnIndex); - if (va == VerticalAlignment.Top || va == VerticalAlignment.Stretch) - margin.Top = info.Bounds.Top - GetRowOffset(topRowIndex); - if (ha == HorizontalAlignment.Right || ha == HorizontalAlignment.Stretch) - margin.Right = GetColumnOffset(rightColumnIndex + 1) - info.Bounds.Right; - if (va == VerticalAlignment.Bottom || va == VerticalAlignment.Stretch) - margin.Bottom = GetRowOffset(bottomRowIndex + 1) - info.Bounds.Bottom; - info.Item.Properties[FrameworkElement.MarginProperty].SetValue(margin); - - if (ha == HorizontalAlignment.Stretch) - info.Item.Properties[FrameworkElement.WidthProperty].Reset(); - else - info.Item.Properties[FrameworkElement.WidthProperty].SetValue(info.Bounds.Width); - if (va == VerticalAlignment.Stretch) - info.Item.Properties[FrameworkElement.HeightProperty].Reset(); - else - info.Item.Properties[FrameworkElement.HeightProperty].SetValue(info.Bounds.Height); - } - } - - public override void LeaveContainer(PlacementOperation operation) - { - base.LeaveContainer(operation); - foreach (PlacementInformation info in operation.PlacedItems) { - if (info.Item.ComponentType == typeof(ColumnDefinition)) { - // TODO: combine the width of the deleted column with the previous column - this.ExtendedItem.Properties["ColumnDefinitions"].CollectionElements.Remove(info.Item); - } else if (info.Item.ComponentType == typeof(RowDefinition)) { - this.ExtendedItem.Properties["RowDefinitions"].CollectionElements.Remove(info.Item); - } else { - info.Item.Properties.GetAttachedProperty(Grid.RowProperty).Reset(); - info.Item.Properties.GetAttachedProperty(Grid.ColumnProperty).Reset(); - info.Item.Properties.GetAttachedProperty(Grid.RowSpanProperty).Reset(); - info.Item.Properties.GetAttachedProperty(Grid.ColumnSpanProperty).Reset(); - - HorizontalAlignment ha = (HorizontalAlignment)info.Item.Properties[FrameworkElement.HorizontalAlignmentProperty].ValueOnInstance; - VerticalAlignment va = (VerticalAlignment)info.Item.Properties[FrameworkElement.VerticalAlignmentProperty].ValueOnInstance; - - if (ha == HorizontalAlignment.Stretch) - info.Item.Properties[FrameworkElement.WidthProperty].SetValue(info.Bounds.Width); - if (va == VerticalAlignment.Stretch) - info.Item.Properties[FrameworkElement.HeightProperty].SetValue(info.Bounds.Height); - } - } - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/Initializers.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/Initializers.cs deleted file mode 100644 index 4df3dd8482..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/Initializers.cs +++ /dev/null @@ -1,52 +0,0 @@ -// -// -// -// -// $Revision: 2667$ -// - -using System; -using System.Windows.Controls; -using ICSharpCode.WpfDesign.Extensions; -using System.Windows; -using System.Windows.Shapes; -using System.Windows.Media; - -namespace ICSharpCode.WpfDesign.Designer.Extensions.Initializers -{ - [ExtensionFor(typeof(ContentControl))] - public class ContentControlInitializer : DefaultInitializer - { - public override void InitializeDefaults(DesignItem item) - { - DesignItemProperty contentProperty = item.Properties["Content"]; - if (contentProperty.ValueOnInstance == null) { - contentProperty.SetValue(item.ComponentType.Name); - } - } - } - - [ExtensionFor(typeof(HeaderedContentControl))] - public class HeaderedContentControlInitializer : DefaultInitializer - { - public override void InitializeDefaults(DesignItem item) - { - DesignItemProperty headerProperty = item.Properties["Header"]; - if (headerProperty.ValueOnInstance == null) { - headerProperty.SetValue(item.ComponentType.Name); - } - } - } - - [ExtensionFor(typeof(Shape))] - public class ShapeInitializer : DefaultInitializer - { - public override void InitializeDefaults(DesignItem item) - { - DesignItemProperty fillProperty = item.Properties["Fill"]; - if (fillProperty.ValueOnInstance == null) { - fillProperty.SetValue(Brushes.YellowGreen); - } - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/PanelInstanceFactory.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/PanelInstanceFactory.cs deleted file mode 100644 index 7ab77750f3..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/PanelInstanceFactory.cs +++ /dev/null @@ -1,161 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.ComponentModel; -using System.Linq; -using System.Windows.Media; -using System.Windows.Controls; -using ICSharpCode.WpfDesign.Extensions; - -namespace ICSharpCode.WpfDesign.Designer.Extensions -{ - /// - /// Instance factory used to create Panel instances. - /// Sets the panels Brush to a transparent brush, and modifies the panel's type descriptor so that - /// the property value is reported as null when the transparent brush is used, and - /// setting the Brush to null actually restores the transparent brush. - /// - [ExtensionFor(typeof(Panel))] - public sealed class PanelInstanceFactory : CustomInstanceFactory - { - Brush _transparentBrush = new SolidColorBrush(Colors.Transparent); - - /// - /// Creates an instance of the specified type, passing the specified arguments to its constructor. - /// - public override object CreateInstance(Type type, params object[] arguments) - { - object instance = base.CreateInstance(type, arguments); - Panel panel = instance as Panel; - if (panel != null) { - if (panel.Background == null) { - panel.Background = _transparentBrush; - } - TypeDescriptionProvider provider = new DummyValueInsteadOfNullTypeDescriptionProvider( - TypeDescriptor.GetProvider(panel), "Background", _transparentBrush); - TypeDescriptor.AddProvider(provider, panel); - } - return instance; - } - } - - sealed class DummyValueInsteadOfNullTypeDescriptionProvider : TypeDescriptionProvider - { - // By using a TypeDescriptionProvider, we can intercept all access to the property that is - // using a PropertyDescriptor. WpfDesign.XamlDom uses a PropertyDescriptor for accessing - // properties (except for attached properties), so even DesignItemProperty/XamlProperty.ValueOnInstance - // will report null when the actual value is the dummy value. - - readonly string _propertyName; - readonly object _dummyValue; - - public DummyValueInsteadOfNullTypeDescriptionProvider(TypeDescriptionProvider existingProvider, - string propertyName, object dummyValue) - : base(existingProvider) - { - this._propertyName = propertyName; - this._dummyValue = dummyValue; - } - - public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance) - { - return new ShadowTypeDescriptor(this, base.GetTypeDescriptor(objectType, instance)); - } - - sealed class ShadowTypeDescriptor : CustomTypeDescriptor - { - readonly DummyValueInsteadOfNullTypeDescriptionProvider _parent; - - public ShadowTypeDescriptor(DummyValueInsteadOfNullTypeDescriptionProvider parent, - ICustomTypeDescriptor existingDescriptor) - : base(existingDescriptor) - { - this._parent = parent; - } - - public override PropertyDescriptorCollection GetProperties() - { - return Filter(base.GetProperties()); - } - - public override PropertyDescriptorCollection GetProperties(Attribute[] attributes) - { - return Filter(base.GetProperties(attributes)); - } - - PropertyDescriptorCollection Filter(PropertyDescriptorCollection properties) - { - PropertyDescriptor property = properties[_parent._propertyName]; - if (property != null) { - if ((properties as System.Collections.IDictionary).IsReadOnly) { - properties = new PropertyDescriptorCollection(properties.Cast().ToArray()); - } - properties.Remove(property); - properties.Add(new ShadowPropertyDescriptor(_parent, property)); - } - return properties; - } - } - - sealed class ShadowPropertyDescriptor : PropertyDescriptor - { - readonly DummyValueInsteadOfNullTypeDescriptionProvider _parent; - readonly PropertyDescriptor _baseDescriptor; - - public ShadowPropertyDescriptor(DummyValueInsteadOfNullTypeDescriptionProvider parent, - PropertyDescriptor existingDescriptor) - : base(existingDescriptor) - { - this._parent = parent; - this._baseDescriptor = existingDescriptor; - } - - public override Type ComponentType { - get { return _baseDescriptor.ComponentType; } - } - - public override bool IsReadOnly { - get { return _baseDescriptor.IsReadOnly; } - } - - public override Type PropertyType { - get { return _baseDescriptor.PropertyType; } - } - - public override bool CanResetValue(object component) - { - return _baseDescriptor.CanResetValue(component); - } - - public override object GetValue(object component) - { - object value = _baseDescriptor.GetValue(component); - if (value == _parent._dummyValue) - return null; - else - return value; - } - - public override void ResetValue(object component) - { - _baseDescriptor.SetValue(component, _parent._dummyValue); - } - - public override void SetValue(object component, object value) - { - _baseDescriptor.SetValue(component, value ?? _parent._dummyValue); - } - - public override bool ShouldSerializeValue(object component) - { - return _baseDescriptor.ShouldSerializeValue(component) - && _baseDescriptor.GetValue(component) != _parent._dummyValue; - } - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/PanelMove.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/PanelMove.cs deleted file mode 100644 index 72f40633b2..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/PanelMove.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using ICSharpCode.WpfDesign.Adorners; -using ICSharpCode.WpfDesign.Extensions; -using System.Windows.Controls; -using System.Windows; -using ICSharpCode.WpfDesign.Designer.Controls; - -namespace ICSharpCode.WpfDesign.Designer.Extensions -{ - [ExtensionFor(typeof(Panel))] - public class PanelMove : PermanentAdornerProvider - { - protected override void OnInitialized() - { - base.OnInitialized(); - - var adornerPanel = new AdornerPanel(); - var adorner = new PanelMoveAdorner(ExtendedItem); - AdornerPanel.SetPlacement(adorner, AdornerPlacement.FillContent); - adornerPanel.Children.Add(adorner); - Adorners.Add(adornerPanel); - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/PanelSelectionHandler.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/PanelSelectionHandler.cs deleted file mode 100644 index c20ea5c055..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/PanelSelectionHandler.cs +++ /dev/null @@ -1,170 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Input; -using System.Windows.Media; - -using ICSharpCode.WpfDesign.Adorners; -using ICSharpCode.WpfDesign.Designer.Controls; -using ICSharpCode.WpfDesign.Designer.Services; -using ICSharpCode.WpfDesign.Extensions; - -namespace ICSharpCode.WpfDesign.Designer.Extensions -{ - /// - /// Handles selection multiple controls inside a Panel. - /// - [ExtensionFor(typeof(Panel))] - public class PanelSelectionHandler : BehaviorExtension, IHandlePointerToolMouseDown - { - protected override void OnInitialized() - { - base.OnInitialized(); - this.ExtendedItem.AddBehavior(typeof(IHandlePointerToolMouseDown), this); - } - - public void HandleSelectionMouseDown(IDesignPanel designPanel, MouseButtonEventArgs e, DesignPanelHitTestResult result) - { - if (e.ChangedButton == MouseButton.Left && MouseGestureBase.IsOnlyButtonPressed(e, MouseButton.Left)) { - e.Handled = true; - new RangeSelectionGesture(result.ModelHit).Start(designPanel, e); - } - } - } - - sealed class RangeSelectionGesture : ClickOrDragMouseGesture - { - DesignItem container; - AdornerPanel adornerPanel; - SelectionFrame selectionFrame; - - GrayOutDesignerExceptActiveArea grayOut; - - public RangeSelectionGesture(DesignItem container) - { - this.container = container; - this.positionRelativeTo = container.View; - } - - protected override void OnDragStarted(MouseEventArgs e) - { - adornerPanel = new AdornerPanel(); - adornerPanel.SetAdornedElement(container.View, container); - - selectionFrame = new SelectionFrame(); - adornerPanel.Children.Add(selectionFrame); - - designPanel.Adorners.Add(adornerPanel); - - GrayOutDesignerExceptActiveArea.Start(ref grayOut, services, container.View); - } - - protected override void OnMouseMove(object sender, MouseEventArgs e) - { - base.OnMouseMove(sender, e); - if (hasDragStarted) { - SetPlacement(e.GetPosition(positionRelativeTo)); - } - } - - protected override void OnMouseUp(object sender, MouseButtonEventArgs e) - { - if (hasDragStarted == false) { - services.Selection.SetSelectedComponents(new DesignItem [] { container }, SelectionTypes.Auto); - } else { - Point endPoint = e.GetPosition(positionRelativeTo); - Rect frameRect = new Rect( - Math.Min(startPoint.X, endPoint.X), - Math.Min(startPoint.Y, endPoint.Y), - Math.Abs(startPoint.X - endPoint.X), - Math.Abs(startPoint.Y - endPoint.Y) - ); - - ICollection items = GetChildDesignItemsInContainer(container, new RectangleGeometry(frameRect)); - if (items.Count == 0) { - items.Add(container); - } - services.Selection.SetSelectedComponents(items, SelectionTypes.Auto); - } - Stop(); - } - - static ICollection GetChildDesignItemsInContainer( - DesignItem container, Geometry geometry) - { - HashSet resultItems = new HashSet(); - ViewService viewService = container.Services.View; - - HitTestFilterCallback filterCallback = delegate(DependencyObject potentialHitTestTarget) { - FrameworkElement element = potentialHitTestTarget as FrameworkElement; - if (element != null) { - // ensure we are able to select elements with width/height=0 - if (element.ActualWidth == 0 || element.ActualHeight == 0) { - DependencyObject tmp = element; - DesignItem model = null; - while (tmp != null) { - model = viewService.GetModel(tmp); - if (model != null) break; - tmp = VisualTreeHelper.GetParent(tmp); - } - if (model != container) { - resultItems.Add(model); - return HitTestFilterBehavior.ContinueSkipChildren; - } - } - } - return HitTestFilterBehavior.Continue; - }; - - HitTestResultCallback resultCallback = delegate(HitTestResult result) { - if (((GeometryHitTestResult) result).IntersectionDetail == IntersectionDetail.FullyInside) { - // find the model for the visual contained in the selection area - DependencyObject tmp = result.VisualHit; - DesignItem model = null; - while (tmp != null) { - model = viewService.GetModel(tmp); - if (model != null) break; - tmp = VisualTreeHelper.GetParent(tmp); - } - if (model != container) { - resultItems.Add(model); - } - } - return HitTestResultBehavior.Continue; - }; - - VisualTreeHelper.HitTest(container.View, filterCallback, resultCallback, new GeometryHitTestParameters(geometry)); - return resultItems; - } - - void SetPlacement(Point endPoint) - { - RelativePlacement p = new RelativePlacement(); - p.XOffset = Math.Min(startPoint.X, endPoint.X); - p.YOffset = Math.Min(startPoint.Y, endPoint.Y); - p.WidthOffset = Math.Max(startPoint.X, endPoint.X) - p.XOffset; - p.HeightOffset = Math.Max(startPoint.Y, endPoint.Y) - p.YOffset; - AdornerPanel.SetPlacement(selectionFrame, p); - } - - protected override void OnStopped() - { - if (adornerPanel != null) { - designPanel.Adorners.Remove(adornerPanel); - adornerPanel = null; - } - GrayOutDesignerExceptActiveArea.Stop(ref grayOut); - selectionFrame = null; - base.OnStopped(); - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/ResizeThumbExtension.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/ResizeThumbExtension.cs deleted file mode 100644 index b8ab9989a4..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/ResizeThumbExtension.cs +++ /dev/null @@ -1,150 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Diagnostics; -using System.Windows; -using System.Windows.Controls.Primitives; -using System.Windows.Input; - -using ICSharpCode.WpfDesign.Adorners; -using ICSharpCode.WpfDesign.Designer.Controls; -using ICSharpCode.WpfDesign.Extensions; -using System.Collections.Generic; - -namespace ICSharpCode.WpfDesign.Designer.Extensions -{ - /// - /// The resize thumb around a component. - /// - [ExtensionFor(typeof(FrameworkElement))] - public sealed class ResizeThumbExtension : PrimarySelectionAdornerProvider - { - readonly AdornerPanel adornerPanel; - readonly ResizeThumb[] resizeThumbs; - /// An array containing this.ExtendedItem as only element - readonly DesignItem[] extendedItemArray = new DesignItem[1]; - IPlacementBehavior resizeBehavior; - PlacementOperation operation; - ChangeGroup changeGroup; - - public ResizeThumbExtension() - { - adornerPanel = new AdornerPanel(); - adornerPanel.Order = AdornerOrder.Foreground; - this.Adorners.Add(adornerPanel); - - resizeThumbs = new ResizeThumb[] { - CreateThumb(PlacementAlignment.TopLeft, Cursors.SizeNWSE), - CreateThumb(PlacementAlignment.Top, Cursors.SizeNS), - CreateThumb(PlacementAlignment.TopRight, Cursors.SizeNESW), - CreateThumb(PlacementAlignment.Left, Cursors.SizeWE), - CreateThumb(PlacementAlignment.Right, Cursors.SizeWE), - CreateThumb(PlacementAlignment.BottomLeft, Cursors.SizeNESW), - CreateThumb(PlacementAlignment.Bottom, Cursors.SizeNS), - CreateThumb(PlacementAlignment.BottomRight, Cursors.SizeNWSE) - }; - } - - ResizeThumb CreateThumb(PlacementAlignment alignment, Cursor cursor) - { - ResizeThumb resizeThumb = new ResizeThumbImpl( cursor == Cursors.SizeNS, cursor == Cursors.SizeWE ); - resizeThumb.Cursor = cursor; - resizeThumb.Alignment = alignment; - AdornerPanel.SetPlacement(resizeThumb, new RelativePlacement(alignment.Horizontal, alignment.Vertical)); - adornerPanel.Children.Add(resizeThumb); - - DragListener drag = new DragListener(resizeThumb); - drag.Started += new DragHandler(drag_Started); - drag.Changed += new DragHandler(drag_Changed); - drag.Completed += new DragHandler(drag_Completed); - return resizeThumb; - } - - Size oldSize; - - void drag_Started(DragListener drag) - { - oldSize = new Size(ModelTools.GetWidth(ExtendedItem.View), ModelTools.GetHeight(ExtendedItem.View)); - if (resizeBehavior != null) - operation = PlacementOperation.Start(extendedItemArray, PlacementType.Resize); - else { - changeGroup = this.ExtendedItem.Context.OpenGroup("Resize", extendedItemArray); - } - } - - void drag_Changed(DragListener drag) - { - double dx = 0; - double dy = 0; - var alignment = (drag.Target as ResizeThumb).Alignment; - - if (alignment.Horizontal == HorizontalAlignment.Left) dx = -drag.Delta.X; - if (alignment.Horizontal == HorizontalAlignment.Right) dx = drag.Delta.X; - if (alignment.Vertical == VerticalAlignment.Top) dy = -drag.Delta.Y; - if (alignment.Vertical == VerticalAlignment.Bottom) dy = drag.Delta.Y; - - var newWidth = Math.Max(0, oldSize.Width + dx); - var newHeight = Math.Max(0, oldSize.Height + dy); - - ModelTools.Resize(ExtendedItem, newWidth, newHeight); - - if (operation != null) { - var info = operation.PlacedItems[0]; - var result = info.OriginalBounds; - - if (alignment.Horizontal == HorizontalAlignment.Left) - result.X = Math.Min(result.Right, result.X - dx); - if (alignment.Vertical == VerticalAlignment.Top) - result.Y = Math.Min(result.Bottom, result.Y - dy); - result.Width = newWidth; - result.Height = newHeight; - - info.Bounds = result; - info.ResizeThumbAlignment = alignment; - operation.CurrentContainerBehavior.BeforeSetPosition(operation); - operation.CurrentContainerBehavior.SetPosition(info); - } - } - - void drag_Completed(DragListener drag) - { - if (operation != null) { - if (drag.IsCanceled) operation.Abort(); - else operation.Commit(); - operation = null; - } else { - if (drag.IsCanceled) changeGroup.Abort(); - else changeGroup.Commit(); - changeGroup = null; - } - } - - protected override void OnInitialized() - { - base.OnInitialized(); - extendedItemArray[0] = this.ExtendedItem; - this.Services.Selection.PrimarySelectionChanged += OnPrimarySelectionChanged; - resizeBehavior = PlacementOperation.GetPlacementBehavior(extendedItemArray); - OnPrimarySelectionChanged(null, null); - } - - protected override void OnRemove() - { - this.Services.Selection.PrimarySelectionChanged -= OnPrimarySelectionChanged; - base.OnRemove(); - } - - void OnPrimarySelectionChanged(object sender, EventArgs e) - { - bool isPrimarySelection = this.Services.Selection.PrimarySelection == this.ExtendedItem; - foreach (ResizeThumb g in adornerPanel.Children) { - g.IsPrimarySelection = isPrimarySelection; - } - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/SelectedElementRectangleExtension.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/SelectedElementRectangleExtension.cs deleted file mode 100644 index 2086561aa3..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/SelectedElementRectangleExtension.cs +++ /dev/null @@ -1,50 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Windows; -using System.Windows.Media; -using System.Windows.Shapes; - -using ICSharpCode.WpfDesign.Adorners; -using ICSharpCode.WpfDesign.Extensions; - -namespace ICSharpCode.WpfDesign.Designer.Extensions -{ - /// - /// Draws a dotted line around selected UIElements. - /// - [ExtensionFor(typeof(UIElement))] - public sealed class SelectedElementRectangleExtension : SelectionAdornerProvider - { - /// - /// Creates a new SelectedElementRectangleExtension instance. - /// - public SelectedElementRectangleExtension() - { - Rectangle selectionRect = new Rectangle(); - selectionRect.SnapsToDevicePixels = true; - selectionRect.Stroke = Brushes.White; - selectionRect.IsHitTestVisible = false; - - Rectangle dottedRect = new Rectangle(); - dottedRect.SnapsToDevicePixels = true; - dottedRect.Stroke = Brushes.Black; - dottedRect.StrokeDashCap = PenLineCap.Square; - dottedRect.StrokeDashArray = new DoubleCollection(new double[] { 0, 2 }); - dottedRect.IsHitTestVisible = false; - - RelativePlacement placement = new RelativePlacement(HorizontalAlignment.Stretch, VerticalAlignment.Stretch); - placement.XOffset = -1; - placement.YOffset = -1; - placement.WidthOffset = 2; - placement.HeightOffset = 2; - - this.AddAdorners(placement, selectionRect, dottedRect); - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/SnaplinePlacementBehavior.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/SnaplinePlacementBehavior.cs deleted file mode 100644 index c09fcd5697..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/SnaplinePlacementBehavior.cs +++ /dev/null @@ -1,312 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows; -using ICSharpCode.WpfDesign.Extensions; -using System.ComponentModel; -using ICSharpCode.WpfDesign.Adorners; -using System.Windows.Controls; -using System.Windows.Media; -using System.Windows.Shapes; -using System.Windows.Automation.Peers; -using System.Windows.Controls.Primitives; -using System.Diagnostics; -using System.Windows.Input; - -namespace ICSharpCode.WpfDesign.Designer.Extensions -{ - public class SnaplinePlacementBehavior : DefaultPlacementBehavior - { - AdornerPanel adornerPanel; - Canvas surface; - List horizontalMap; - List verticalMap; - double? baseline; - - public static double Accuracy = 5; - public static double Margin = 8; - - public override void BeginPlacement(PlacementOperation operation) - { - base.BeginPlacement(operation); - CreateSurface(operation); - } - - public override void EndPlacement(PlacementOperation operation) - { - base.EndPlacement(operation); - DeleteSurface(); - } - - public override void EnterContainer(PlacementOperation operation) - { - base.EnterContainer(operation); - CreateSurface(operation); - } - - public override void LeaveContainer(PlacementOperation operation) - { - base.LeaveContainer(operation); - DeleteSurface(); - } - - public override void BeforeSetPosition(PlacementOperation operation) - { - base.BeforeSetPosition(operation); - if (surface == null) return; - - surface.Children.Clear(); - if (Keyboard.IsKeyDown(Key.LeftCtrl)) return; - - Rect bounds = Rect.Empty; - foreach (var item in operation.PlacedItems) { - bounds.Union(item.Bounds); - } - - var horizontalInput = new List(); - var verticalInput = new List(); - var info = operation.PlacedItems[0]; - - if (operation.Type == PlacementType.Resize) { - AddLines(bounds, 0, false, horizontalInput, verticalInput, info.ResizeThumbAlignment); - } else { - AddLines(bounds, 0, false, horizontalInput, verticalInput, null); - if (baseline.HasValue) { - var textOffset = bounds.Top + baseline.Value; - horizontalInput.Add(new Snapline() { Group = 1, Offset = textOffset, Start = bounds.Left, End = bounds.Right }); - } - } - - // debug - //foreach (var t in horizontalMap.Concat(horizontalInput)) { - // surface.Children.Add(new Line() { X1 = t.Start, X2 = t.End, Y1 = t.Offset, Y2 = t.Offset, Stroke = Brushes.Black }); - //} - //foreach (var t in verticalMap.Concat(verticalInput)) { - // surface.Children.Add(new Line() { X1 = t.Offset, X2 = t.Offset, Y1 = t.Start , Y2 = t.End, Stroke = Brushes.Black }); - //} - //return; - - List drawLines; - double delta; - - if (Snap(horizontalInput, horizontalMap, Accuracy, out drawLines, out delta)) { - - if (operation.Type == PlacementType.Resize) { - if (info.ResizeThumbAlignment.Vertical == VerticalAlignment.Top) { - bounds.Y += delta; - bounds.Height = Math.Max(0, bounds.Height - delta); - } else { - bounds.Height = Math.Max(0, bounds.Height + delta); - } - info.Bounds = bounds; - } else { - foreach (var item in operation.PlacedItems) { - var r = item.Bounds; - r.Y += delta; - item.Bounds = r; - } - } - - foreach (var d in drawLines) { - DrawLine(d.Start, d.Offset, d.End, d.Offset); - } - } - - if (Snap(verticalInput, verticalMap, Accuracy, out drawLines, out delta)) { - - if (operation.Type == PlacementType.Resize) { - if (info.ResizeThumbAlignment.Horizontal == HorizontalAlignment.Left) { - bounds.X += delta; - bounds.Width = Math.Max(0, bounds.Width - delta); - } else { - bounds.Width = Math.Max(0, bounds.Width + delta); - } - info.Bounds = bounds; - } else { - foreach (var item in operation.PlacedItems) { - var r = item.Bounds; - r.X += delta; - item.Bounds = r; - } - } - - foreach (var d in drawLines) { - DrawLine(d.Offset, d.Start, d.Offset, d.End); - } - } - } - - void CreateSurface(PlacementOperation operation) - { - if (ExtendedItem.Services.GetService() != null) { - - surface = new Canvas(); - adornerPanel = new AdornerPanel(); - adornerPanel.SetAdornedElement(ExtendedItem.View, ExtendedItem); - AdornerPanel.SetPlacement(surface, AdornerPlacement.FillContent); - adornerPanel.Children.Add(surface); - ExtendedItem.Services.DesignPanel.Adorners.Add(adornerPanel); - - BuildMaps(operation); - - if (operation.Type != PlacementType.Resize && operation.PlacedItems.Count == 1) { - baseline = GetBaseline(operation.PlacedItems[0].Item.View); - } - } - } - - void BuildMaps(PlacementOperation operation) - { - horizontalMap = new List(); - verticalMap = new List(); - - var containerRect = new Rect(0, 0, ModelTools.GetWidth(ExtendedItem.View), ModelTools.GetHeight(ExtendedItem.View)); - AddLines(containerRect, -Margin, false); - - foreach (var item in ExtendedItem.ContentProperty.CollectionElements - .Except(operation.PlacedItems.Select(f => f.Item))) - { - var bounds = GetPosition(operation, item); - - AddLines(bounds, 0, false); - AddLines(bounds, Margin, true); - AddBaseline(item, bounds, horizontalMap); - } - } - - void AddLines(Rect r, double inflate, bool requireOverlap) - { - AddLines(r, inflate, requireOverlap, horizontalMap, verticalMap, null); - } - - void AddLines(Rect r, double inflate, bool requireOverlap, List h, List v, PlacementAlignment? filter) - { - Rect r2 = r; - r2.Inflate(inflate, inflate); - - if (filter == null || filter.Value.Vertical == VerticalAlignment.Top) - h.Add(new Snapline() { RequireOverlap = requireOverlap, Offset = r2.Top - 1, Start = r.Left, End = r.Right }); - if (filter == null || filter.Value.Vertical == VerticalAlignment.Bottom) - h.Add(new Snapline() { RequireOverlap = requireOverlap, Offset = r2.Bottom, Start = r.Left, End = r.Right }); - if (filter == null || filter.Value.Horizontal == HorizontalAlignment.Left) - v.Add(new Snapline() { RequireOverlap = requireOverlap, Offset = r2.Left - 1, Start = r.Top, End = r.Bottom }); - if (filter == null || filter.Value.Horizontal == HorizontalAlignment.Right) - v.Add(new Snapline() { RequireOverlap = requireOverlap, Offset = r2.Right, Start = r.Top, End = r.Bottom }); - } - - void AddBaseline(DesignItem item, Rect bounds, List list) - { - var baseline = GetBaseline(item.View); - if (baseline.HasValue) { - var textOffset = item.View.TranslatePoint(new Point(0, baseline.Value), ExtendedItem.View).Y; - list.Add(new Snapline() { Group = 1, Offset = textOffset, Start = bounds.Left, End = bounds.Right }); - } - } - - void DeleteSurface() - { - if (surface != null) { - ExtendedItem.Services.DesignPanel.Adorners.Remove(adornerPanel); - adornerPanel = null; - surface = null; - horizontalMap = null; - verticalMap = null; - } - } - - void DrawLine(double x1, double y1, double x2, double y2) - { - var line1 = new Line() { - X1 = x1, - Y1 = y1, - X2 = x2, - Y2 = y2, - StrokeThickness = 1, - Stroke = Brushes.White - }; - surface.Children.Add(line1); - - var line2 = new Line() { - X1 = x1, - Y1 = y1, - X2 = x2, - Y2 = y2, - StrokeThickness = 1, - Stroke = Brushes.Orange, - StrokeDashArray = new DoubleCollection(new double[] { 5, 2 }), - StrokeDashOffset = x1 + y1 // fix dashes - }; - surface.Children.Add(line2); - } - - //TODO: GlyphRun must be used - static double? GetBaseline(UIElement element) { - var textBox = element.FindChild(); - if (textBox != null) { - var r = textBox.GetRectFromCharacterIndex(0).Bottom; - return textBox.TranslatePoint(new Point(0, r), element).Y; - } - var textBlock = element.FindChild(); - if (textBlock != null) - return textBlock.TranslatePoint(new Point(0, textBlock.ActualHeight), element).Y; - - return null; - } - - static bool Snap(List input, List map, double accuracy, - out List drawLines, out double delta) - { - delta = double.MaxValue; - drawLines = null; - - foreach (var inputLine in input) { - foreach (var mapLine in map) { - if (Math.Abs(mapLine.Offset - inputLine.Offset) <= accuracy) { - if (!inputLine.RequireOverlap && !mapLine.RequireOverlap || - Math.Max(inputLine.Start, mapLine.Start) < Math.Min(inputLine.End, mapLine.End)) - { - if (mapLine.Group == inputLine.Group) - delta = mapLine.Offset - inputLine.Offset; - } - } - } - } - - if (delta == double.MaxValue) return false; - var offsetDict = new Dictionary(); - - foreach (var inputLine in input) { - inputLine.Offset += delta; - foreach (var mapLine in map) { - if (inputLine.Offset == mapLine.Offset) { - var offset = mapLine.Offset; - Snapline drawLine; - if (!offsetDict.TryGetValue(offset, out drawLine)) { - drawLine = new Snapline(); - drawLine.Start = double.MaxValue; - drawLine.End = double.MinValue; - offsetDict[offset] = drawLine; - } - drawLine.Offset = offset; - drawLine.Start = Math.Min(drawLine.Start, Math.Min(inputLine.Start, mapLine.Start)); - drawLine.End = Math.Max(drawLine.End, Math.Max(inputLine.End, mapLine.End)); - } - } - } - - drawLines = offsetDict.Values.ToList(); - return true; - } - - [DebuggerDisplay("Snapline: {Offset}")] - class Snapline - { - public double Offset; - public double Start; - public double End; - public bool RequireOverlap; - public int Group; - } - } -} \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/TabItemClickableExtension.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/TabItemClickableExtension.cs deleted file mode 100644 index 61f5da55d0..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/TabItemClickableExtension.cs +++ /dev/null @@ -1,32 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Windows.Controls; -using ICSharpCode.WpfDesign.Extensions; - -namespace ICSharpCode.WpfDesign.Designer.Extensions -{ - /// - /// Makes TabItems clickable. - /// - [ExtensionFor(typeof(TabItem))] - [ExtensionServer(typeof(PrimarySelectionExtensionServer))] - public sealed class TabItemClickableExtension : DefaultExtension - { - /// - protected override void OnInitialized() - { - // When tab item becomes primary selection, make it the active tab page in its parent tab control. - TabItem tabItem = (TabItem)this.ExtendedItem.Component; - TabControl tabControl = tabItem.Parent as TabControl; - if (tabControl != null) { - tabControl.SelectedItem = tabItem; - } - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/TopLeftContainerDragHandle.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/TopLeftContainerDragHandle.cs deleted file mode 100644 index b779f1bc73..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/TopLeftContainerDragHandle.cs +++ /dev/null @@ -1,44 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Windows.Controls; -using System.Windows; -using System.Windows.Media; -using System.Windows.Shapes; -using ICSharpCode.WpfDesign.Adorners; -using ICSharpCode.WpfDesign.Extensions; -using ICSharpCode.WpfDesign.Designer.Controls; - -namespace ICSharpCode.WpfDesign.Designer.Extensions -{ - /* - /// - /// The drag handle displayed for panels. - /// - [ExtensionServer(typeof(PrimarySelectionExtensionServer))] - [ExtensionFor(typeof(Panel), OverrideExtension = typeof(TopLeftResizeThumb))] - public class TopLeftContainerDragHandle : AdornerProvider - { - /// - public TopLeftContainerDragHandle() - { - ContainerDragHandle rect = new ContainerDragHandle(); - - rect.PreviewMouseDown += delegate { - Services.Selection.SetSelectedComponents(new DesignItem[] { this.ExtendedItem }, SelectionTypes.Auto); - }; - - RelativePlacement p = new RelativePlacement(HorizontalAlignment.Left, VerticalAlignment.Top); - p.XOffset = -1; - p.YOffset = -1; - - AddAdorner(p, AdornerOrder.Background, rect); - } - } - */ -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/WindowResizeBehavior.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/WindowResizeBehavior.cs deleted file mode 100644 index d6e6a7eb0a..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/WindowResizeBehavior.cs +++ /dev/null @@ -1,86 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Collections.Generic; -using System.Windows; -using ICSharpCode.WpfDesign.Extensions; - -namespace ICSharpCode.WpfDesign.Designer.Extensions -{ - /// - /// Supports resizing a Window. - /// - [ExtensionFor(typeof(Window))] - public class WindowResizeBehavior : BehaviorExtension, IRootPlacementBehavior - { - protected override void OnInitialized() - { - base.OnInitialized(); - this.ExtendedItem.AddBehavior(typeof(IRootPlacementBehavior), this); - } - - public bool CanPlace(ICollection children, PlacementType type, PlacementAlignment position) - { - return type == PlacementType.Resize && - (position == PlacementAlignment.Right - || position == PlacementAlignment.BottomRight - || position == PlacementAlignment.Bottom); - } - - - public void BeginPlacement(PlacementOperation operation) - { - } - - public void EndPlacement(PlacementOperation operation) - { - } - - public Rect GetPosition(PlacementOperation operation, DesignItem childItem) - { - UIElement child = childItem.View; - return new Rect(0, 0, ModelTools.GetWidth(child), ModelTools.GetHeight(child)); - } - - public void BeforeSetPosition(PlacementOperation operation) - { - } - - public void SetPosition(PlacementInformation info) - { - UIElement element = info.Item.View; - Rect newPosition = info.Bounds; - if (newPosition.Right != ModelTools.GetWidth(element)) { - info.Item.Properties[FrameworkElement.WidthProperty].SetValue(newPosition.Right); - } - if (newPosition.Bottom != ModelTools.GetHeight(element)) { - info.Item.Properties[FrameworkElement.HeightProperty].SetValue(newPosition.Bottom); - } - } - - public bool CanLeaveContainer(PlacementOperation operation) - { - return false; - } - - public void LeaveContainer(PlacementOperation operation) - { - throw new NotSupportedException(); - } - - public bool CanEnterContainer(PlacementOperation operation) - { - return false; - } - - public void EnterContainer(PlacementOperation operation) - { - throw new NotSupportedException(); - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/Class.png b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/Class.png deleted file mode 100644 index f8e82b5568b0529aaa1c413f61ddc92cc218e0ef..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 624 zcmV-$0+0QPP)Px#1ZP1_K>z@;j|==^1poj5AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBUy32;bRa{vGma{vGma{-JZxd#9M0oh4JK~y+Tjg#LiLtz-lpU!fu zG(T1(SCZUt=a%wsxN~8~m~F)-tEJ|!Oq(3rp=~v1AvJf(Jy%?qA{P`X7euruKT==k zeWzn5#x71h@6-GJJWt>6dk6p(f9va=+R@ni>ueBbvpx9uAf!@lWkYm8Hrs{wcf!jH zA)hCNLe{b%9I&<3jn`Mg^E2W8o^X9lI6EVFJmy~^+Z`#rPpaCEw>QGm6XEujaB)dE zJ|?)`X7u%mFqurTVh?t@RPIo^N#YPvloqV4wBY83aDGn6<(OE6&1S=p-45^g801I< z>2w;K%~3AS(-lr>4U%XpxGl@An4Ye|;UQa_i7WNV^5P<|mD))ze$>P#w1KcNjHt!^ z9ak{e2$#!@fdS*%$z+lP7Azhl8m6?#n_zX=GQ#_Y82kH;Vu!;)nblQ&8zz+NyqKx7 z>pcUY*es{hNq)bdGMS9Q$T`a}tP#zNug6vr5C{ZFk|atc5*(naD!WQ2VvAz9)Rh@ z*%0a#ZG)pD2-;*}aOh_W|NVs(;dxX9gAkmf|EEw2Cir}YR6YUovy{(>b~_ya0000< KMNUMnLSTZaq7B;s diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/PanToolCursor.cur b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/PanToolCursor.cur deleted file mode 100644 index 6d10c848cdc8d0d7a52bd81ee2f5e8b47d1ef9a2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 326 zcmaLSu?@m75QX92iBKx!4vC7Clx#q@VT6=;1V%v=)EOlO1EfMJP>y#vqV%1wvZ(il?Nc7Gzh@zp nrv7_+LpkQg%uO=ZW`hf6NpSkcO~%!*QD1jo(QLVvXRG@KcZz>G diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/PanToolCursorMouseDown.cur b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/PanToolCursorMouseDown.cur deleted file mode 100644 index 5f3c236bac7fdaf45d323e9e800e4f0ccedae28c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 326 zcmaLSF%E+;429u8Ffdiw$_Qh}-T;oqkvebyj=~W#AqG_UnWzgwar8NnEjbBP1o|GL z);quxc!^4k60|&~Gv`!ka~@`v52aiuaE-(rIvI|v{i-f;gU753Kcz{xJ-wkEdt>I3 XthL!9Q^*#5Vf|ArsdvQkyi4~7fDwUA diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/Tag.png b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/Tag.png deleted file mode 100644 index b7686f106b0931ea8140d4fbf72eb7413053f7d2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 389 zcmV;00eb$4P) z7zJ2Ez_8~bKiNTJ(D{JhbKcWq5v!hmfEg0E`Sl0y#m|p{BaHYsTodXqMkH2FaCfdig(a=HrhF zNmtlV)TkHVj0m0o^n2E-7ymu_9^8|Uy99RuP)^!=>Z5xgxuBVkz60e@T>vvlG3APo zZNr^osf(ZfcWt=~4+F1BkM3oxc>W(GCl`GYdl0)+jEP)BDiIJYLps>`r!OuoocSclke}BKDu)TAH znXtUbl%TS`#n3xZaDb1bH%n`OjiY>(tyN!UW`CJdWrDoJ&QocIO<{pNQg2gehj@*w zLRWP@Tt%2>h$)z%hu-h`QGyO-tqUP z%IAWn%s*6erITc&yv@w$^w;k8+VA(p;_|cA?485oa+I~s>h!YI<$#{Gy5I7_;q$@a z^0L_Nqs!-qt&Qvgz$*-O5|(Cl0q z$xeX!Bn0#2_tpLH-Oi%-^c3-)M)iU*o5=IwbpZl8%28z%I6(ja0HjGoK~#8NWysT# z15pqF(2i|;?Hk*+Z7z-fN0REyLu$_B0g$tqT$Yj}28x8Iat$g~z5tL=q;a}EsdPpv z!>}seKbEA?Y;{gC)Z^KFLF#r#UyCsudC8v7AHdLs!jUM6#S=+AhQXN4DfDw{CO zmeqRm`1Jhp8U$oJ`TY9+`ThH^QFC^FaoN7Q?sahvZh-N2JV2Y<-Atx%BDiIJYLy~WUbjH0>0&y}FDu)N4dT6acN zalFIMqp-c%+~Yh_ZUXRO<{pkXoq->tU_0H zI!|y{YmQ1xM>|n)0001ge*jNUPft%xPEJei_WRoH_QBrpsn6_vqQL6(_Hlui-tzX& z>h!YI<)zB!f~L$rRC0EZrKG&g%;@yj?)KX6_tNV0#p3d_)$E@7RZcp0!U< zO}gLm!Qu14;qtrQ@UqzLqs!-qth<~a`uz0!{C!L{v;Y7AEp$>& zQvgx~PUV`z+3Z{z$^E{7(D(Wzp7TqB)!ojb_w*F;M)fh9$n)WK?*Rfj%28iBbHM-r z0HjGoK~#8NWysTV1OX5Lz&YBsZQHhu*!K4)si}L|+J0;Rs)E5}(FHU(5{ks{yO%7R z1BlDxN1x+~WJ4mwkjc0E>zmuVhesub>gwzJClCyUBQA{C>)ZHWDxJYl=kkSOsa&bn zG#FZ4tKI4L`h%e!!(g1w=8NTOy_o -// -// -// -// $Revision$ -// - -using System; -using System.Collections.Generic; -using System.Windows; -using System.Linq; - -namespace ICSharpCode.WpfDesign.Designer -{ - /// - /// Static helper methods for working with the designer DOM. - /// - public static class ModelTools - { - /// - /// Compares the positions of a and b in the model file. - /// - public static int ComparePositionInModelFile(DesignItem a, DesignItem b) - { - // first remember all parent properties of a - HashSet aProps = new HashSet(); - DesignItem tmp = a; - while (tmp != null) { - aProps.Add(tmp.ParentProperty); - tmp = tmp.Parent; - } - - // now walk up b's parent tree until a matching property is found - tmp = b; - while (tmp != null) { - DesignItemProperty prop = tmp.ParentProperty; - if (aProps.Contains(prop)) { - if (prop.IsCollection) { - return prop.CollectionElements.IndexOf(a).CompareTo(prop.CollectionElements.IndexOf(b)); - } else { - return 0; - } - } - } - return 0; - } - - /// - /// Gets if the specified design item is in the document it belongs to. - /// - /// True for live objects, false for deleted objects. - public static bool IsInDocument(DesignItem item) - { - DesignItem rootItem = item.Context.RootItem; - while (item != null) { - if (item == rootItem) return true; - item = item.Parent; - } - return false; - } - - /// - /// Gets if the specified components can be deleted. - /// - public static bool CanDeleteComponents(ICollection items) - { - IPlacementBehavior b = PlacementOperation.GetPlacementBehavior(items); - return b != null - && b.CanPlace(items, PlacementType.Delete, PlacementAlignment.Center); - } - - public static bool CanSelectComponent(DesignItem item) - { - return item.View != null; - } - - /// - /// Deletes the specified components from their parent containers. - /// If the deleted components are currently selected, they are deselected before they are deleted. - /// - public static void DeleteComponents(ICollection items) - { - DesignItem parent = items.First().Parent; - PlacementOperation operation = PlacementOperation.Start(items, PlacementType.Delete); - try { - ISelectionService selectionService = items.First().Services.Selection; - selectionService.SetSelectedComponents(items, SelectionTypes.Remove); - // if the selection is empty after deleting some components, select the parent of the deleted component - if (selectionService.SelectionCount == 0 && !items.Contains(parent)) { - selectionService.SetSelectedComponents(new DesignItem[] { parent }); - } - operation.DeleteItemsAndCommit(); - } catch { - operation.Abort(); - throw; - } - } - - internal static Size GetDefaultSize(DesignItem createdItem) - { - var s = Metadata.GetDefaultSize(createdItem.ComponentType); - if (double.IsNaN(s.Width)) { - s.Width = GetWidth(createdItem.View); - } - if (double.IsNaN(s.Height)) { - s.Height = GetHeight(createdItem.View); - } - return s; - } - - internal static double GetWidth(UIElement element) - { - double v = (double)element.GetValue(FrameworkElement.WidthProperty); - if (double.IsNaN(v)) - return element.RenderSize.Width; - else - return v; - } - - internal static double GetHeight(UIElement element) - { - double v = (double)element.GetValue(FrameworkElement.HeightProperty); - if (double.IsNaN(v)) - return element.RenderSize.Height; - else - return v; - } - - public static void Resize(DesignItem item, double newWidth, double newHeight) - { - if (newWidth != GetWidth(item.View)) { - item.Properties.GetProperty(FrameworkElement.WidthProperty).SetValue(newWidth); - } - if (newHeight != GetHeight(item.View)) { - item.Properties.GetProperty(FrameworkElement.HeightProperty).SetValue(newHeight); - } - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/DragListener.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/DragListener.cs deleted file mode 100644 index 883b675c32..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/DragListener.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows; -using System.Windows.Input; - -namespace ICSharpCode.WpfDesign.Designer.OutlineView -{ - public class DragListener - { - public DragListener(FrameworkElement target) - { - this.target = target; - target.AddHandler(Mouse.MouseDownEvent, new MouseButtonEventHandler(MouseButtonDown), true); - target.PreviewMouseMove += MouseMove; - target.PreviewMouseLeftButtonUp += MouseLeftButtonUp; - } - - public event MouseButtonEventHandler DragStarted; - - FrameworkElement target; - Point startPoint; - bool ready; - MouseButtonEventArgs args; - - void MouseButtonDown(object sender, MouseButtonEventArgs e) - { - if (e.ChangedButton == MouseButton.Left && Mouse.Captured == null) { - ready = true; - startPoint = e.GetPosition(target); - args = e; - target.CaptureMouse(); - } - } - - void MouseMove(object sender, MouseEventArgs e) - { - if (ready) { - var currentPoint = e.GetPosition(target); - if (Math.Abs(currentPoint.X - startPoint.X) >= SystemParameters.MinimumHorizontalDragDistance || - Math.Abs(currentPoint.Y - startPoint.Y) >= SystemParameters.MinimumVerticalDragDistance) { - ready = false; - if (DragStarted != null) { - DragStarted(this, args); - } - } - } - } - - void MouseLeftButtonUp(object sender, MouseButtonEventArgs e) - { - ready = false; - target.ReleaseMouseCapture(); - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/DragTreeView.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/DragTreeView.cs deleted file mode 100644 index c2dfff4f73..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/DragTreeView.cs +++ /dev/null @@ -1,326 +0,0 @@ -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.Collections.Specialized; -using System.Collections; - -namespace ICSharpCode.WpfDesign.Designer.OutlineView -{ - // limitations: - // - Do not use ItemsSource (use Root) - // - Do not use Items (use Root) - public class DragTreeView : TreeView - { - static DragTreeView() - { - DefaultStyleKeyProperty.OverrideMetadata(typeof(DragTreeView), - new FrameworkPropertyMetadata(typeof(DragTreeView))); - } - - public DragTreeView() - { - AllowDrop = true; - new DragListener(this).DragStarted += new MouseButtonEventHandler(DragTreeView_DragStarted); - } - - DragTreeViewItem dropTarget; - DragTreeViewItem treeItem; - DragTreeViewItem dropAfter; - int part; - bool dropInside; - bool dropCopy; - bool canDrop; - - Border insertLine; - - public static readonly DependencyProperty RootProperty = - DependencyProperty.Register("Root", typeof(object), typeof(DragTreeView)); - - public object Root { - get { return (object)GetValue(RootProperty); } - set { SetValue(RootProperty, value); } - } - - //public object[] SelectedItems - //{ - // get { return Selection.Select(item => item.DataContext).ToArray(); } - //} - - protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e) - { - base.OnPropertyChanged(e); - if (e.Property == RootProperty) { - ItemsSource = new[] { Root }; - } - } - - void DragTreeView_DragStarted(object sender, MouseButtonEventArgs e) - { - DragDrop.DoDragDrop(this, this, DragDropEffects.All); - } - - public override void OnApplyTemplate() - { - base.OnApplyTemplate(); - insertLine = (Border)Template.FindName("PART_InsertLine", this); - } - - protected override DependencyObject GetContainerForItemOverride() - { - return new DragTreeViewItem(); - } - - protected override bool IsItemItsOwnContainerOverride(object item) - { - return item is DragTreeViewItem; - } - - protected override void OnDragEnter(DragEventArgs e) - { - ProcessDrag(e); - } - - protected override void OnDragOver(DragEventArgs e) - { - ProcessDrag(e); - } - - protected override void OnDrop(DragEventArgs e) - { - ProcessDrop(e); - } - - protected override void OnDragLeave(DragEventArgs e) - { - HideDropMarker(); - } - - void PrepareDropInfo(DragEventArgs e) - { - dropTarget = null; - dropAfter = null; - treeItem = (e.OriginalSource as DependencyObject).FindAncestor(); - - if (treeItem != null) { - var parent = ItemsControl.ItemsControlFromItemContainer(treeItem) as DragTreeViewItem; - ContentPresenter header = treeItem.HeaderPresenter; - Point p = e.GetPosition(header); - part = (int)(p.Y / (header.ActualHeight / 3)); - dropCopy = Keyboard.IsKeyDown(Key.LeftCtrl); - dropInside = false; - - if (part == 1 || parent == null) { - dropTarget = treeItem; - dropInside = true; - if (treeItem.Items.Count > 0) { - dropAfter = treeItem.ItemContainerGenerator.ContainerFromIndex(treeItem.Items.Count - 1) as DragTreeViewItem; - } - } - else if (part == 0) { - dropTarget = parent; - var index = dropTarget.ItemContainerGenerator.IndexFromContainer(treeItem); - if (index > 0) { - dropAfter = dropTarget.ItemContainerGenerator.ContainerFromIndex(index - 1) as DragTreeViewItem; - } - } - else { - dropTarget = parent; - dropAfter = treeItem; - } - } - } - - void ProcessDrag(DragEventArgs e) - { - e.Effects = DragDropEffects.None; - e.Handled = true; - canDrop = false; - - if (e.Data.GetData(GetType()) != this) return; - - HideDropMarker(); - PrepareDropInfo(e); - - if (dropTarget != null && CanInsertInternal()) { - canDrop = true; - e.Effects = dropCopy ? DragDropEffects.Copy : DragDropEffects.Move; - DrawDropMarker(); - } - } - - void ProcessDrop(DragEventArgs e) - { - HideDropMarker(); - - if (canDrop) { - InsertInternal(); - } - } - - void DrawDropMarker() - { - if (dropInside) { - dropTarget.IsDragHover = true; - } - else { - var header = treeItem.HeaderPresenter; - var p = header.TransformToVisual(this).Transform( - new Point(0, part == 0 ? 0 : header.ActualHeight)); - - insertLine.Visibility = Visibility.Visible; - insertLine.Margin = new Thickness(p.X, p.Y, 0, 0); - } - } - - void HideDropMarker() - { - insertLine.Visibility = Visibility.Collapsed; - if (dropTarget != null) { - dropTarget.IsDragHover = false; - } - } - - internal HashSet Selection = new HashSet(); - DragTreeViewItem upSelection; - - internal void ItemMouseDown(DragTreeViewItem item) - { - upSelection = null; - bool control = Keyboard.IsKeyDown(Key.LeftCtrl); - - if (Selection.Contains(item)) { - if (control) { - Unselect(item); - } - else { - upSelection = item; - } - } - else { - if (control) { - Select(item); - } - else { - SelectOnly(item); - } - } - } - - internal void ItemMouseUp(DragTreeViewItem item) - { - if (upSelection == item) { - SelectOnly(item); - } - upSelection = null; - } - - internal void ItemAttached(DragTreeViewItem item) - { - if (item.IsSelected) Selection.Add(item); - } - - internal void ItemDetached(DragTreeViewItem item) - { - if (item.IsSelected) Selection.Remove(item); - } - - internal void ItemIsSelectedChanged(DragTreeViewItem item) - { - if (item.IsSelected) { - Selection.Add(item); - } - else { - Selection.Remove(item); - } - } - - void Select(DragTreeViewItem item) - { - Selection.Add(item); - item.IsSelected = true; - OnSelectionChanged(); - } - - void Unselect(DragTreeViewItem item) - { - Selection.Remove(item); - item.IsSelected = false; - OnSelectionChanged(); - } - - void SelectOnly(DragTreeViewItem item) - { - ClearSelection(); - Select(item); - OnSelectionChanged(); - } - - void ClearSelection() - { - foreach (var treeItem in Selection.ToArray()) { - treeItem.IsSelected = false; - } - Selection.Clear(); - OnSelectionChanged(); - } - - void OnSelectionChanged() - { - } - - bool CanInsertInternal() - { - if (!dropCopy) { - var item = dropTarget; - while (true) { - if (Selection.Contains(item)) return false; - item = ItemsControl.ItemsControlFromItemContainer(item) as DragTreeViewItem; - if (item == null) break; - } - - if (Selection.Contains(dropAfter)) return false; - } - - return CanInsert(dropTarget, Selection.ToArray(), dropAfter, dropCopy); - } - - void InsertInternal() - { - var selection = Selection.ToArray(); - - if (!dropCopy) { - foreach (var item in Selection.ToArray()) { - var parent = ItemsControl.ItemsControlFromItemContainer(item) as DragTreeViewItem; - //TODO - if (parent != null) { - Remove(parent, item); - } - } - } - Insert(dropTarget, selection, dropAfter, dropCopy); - } - - protected virtual bool CanInsert(DragTreeViewItem target, DragTreeViewItem[] items, DragTreeViewItem after, bool copy) - { - return true; - } - - protected virtual void Insert(DragTreeViewItem target, DragTreeViewItem[] items, DragTreeViewItem after, bool copy) - { - } - - protected virtual void Remove(DragTreeViewItem target, DragTreeViewItem item) - { - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/DragTreeViewItem.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/DragTreeViewItem.cs deleted file mode 100644 index 22394de453..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/DragTreeViewItem.cs +++ /dev/null @@ -1,119 +0,0 @@ -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; - -namespace ICSharpCode.WpfDesign.Designer.OutlineView -{ - public class DragTreeViewItem : TreeViewItem - { - static DragTreeViewItem() - { - DefaultStyleKeyProperty.OverrideMetadata(typeof(DragTreeViewItem), - new FrameworkPropertyMetadata(typeof(DragTreeViewItem))); - } - - public DragTreeViewItem() - { - Loaded += new RoutedEventHandler(DragTreeViewItem_Loaded); - Unloaded += new RoutedEventHandler(DragTreeViewItem_Unloaded); - } - - void DragTreeViewItem_Loaded(object sender, RoutedEventArgs e) - { - ParentTree = this.FindAncestor(); - if (ParentTree != null) { - ParentTree.ItemAttached(this); - } - } - - void DragTreeViewItem_Unloaded(object sender, RoutedEventArgs e) - { - if (ParentTree != null) { - ParentTree.ItemDetached(this); - } - ParentTree = null; - } - - public new static readonly DependencyProperty IsSelectedProperty = - Selector.IsSelectedProperty.AddOwner(typeof(DragTreeViewItem)); - - public new bool IsSelected { - get { return (bool)GetValue(IsSelectedProperty); } - set { SetValue(IsSelectedProperty, value); } - } - - public static readonly DependencyProperty IsDragHoverProperty = - DependencyProperty.Register("IsDragHover", typeof(bool), typeof(DragTreeViewItem)); - - public bool IsDragHover { - get { return (bool)GetValue(IsDragHoverProperty); } - set { SetValue(IsDragHoverProperty, value); } - } - - internal ContentPresenter HeaderPresenter { - get { return (ContentPresenter)Template.FindName("PART_Header", this); } - } - - public static readonly DependencyProperty LevelProperty = - DependencyProperty.Register("Level", typeof(int), typeof(DragTreeViewItem)); - - public int Level { - get { return (int)GetValue(LevelProperty); } - set { SetValue(LevelProperty, value); } - } - - public DragTreeView ParentTree { get; private set; } - - protected override void OnVisualParentChanged(DependencyObject oldParent) - { - base.OnVisualParentChanged(oldParent); - - var parentItem = ItemsControl.ItemsControlFromItemContainer(this) as DragTreeViewItem; - if (parentItem != null) Level = parentItem.Level + 1; - } - - protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e) - { - base.OnPropertyChanged(e); - if (e.Property == IsSelectedProperty) { - if (ParentTree != null) { - ParentTree.ItemIsSelectedChanged(this); - } - } - } - - protected override DependencyObject GetContainerForItemOverride() - { - return new DragTreeViewItem(); - } - - protected override bool IsItemItsOwnContainerOverride(object item) - { - return item is DragTreeViewItem; - } - - protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) - { - base.OnMouseLeftButtonDown(e); - if (e.Source is ToggleButton || e.Source is ItemsPresenter) return; - ParentTree.ItemMouseDown(this); - } - - protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e) - { - base.OnMouseLeftButtonUp(e); - ParentTree.ItemMouseUp(this); - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/IconItem.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/IconItem.cs deleted file mode 100644 index f6eead04e3..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/IconItem.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows.Controls; -using System.Windows; -using System.Windows.Media; - -namespace ICSharpCode.WpfDesign.Designer.OutlineView -{ - public class IconItem : Control - { - static IconItem() - { - DefaultStyleKeyProperty.OverrideMetadata(typeof(IconItem), - new FrameworkPropertyMetadata(typeof(IconItem))); - } - - public static readonly DependencyProperty IconProperty = - DependencyProperty.Register("Icon", typeof(ImageSource), typeof(IconItem)); - - public ImageSource Icon { - get { return (ImageSource)GetValue(IconProperty); } - set { SetValue(IconProperty, value); } - } - - public static readonly DependencyProperty TextProperty = - DependencyProperty.Register("Text", typeof(string), typeof(IconItem)); - - public string Text { - get { return (string)GetValue(TextProperty); } - set { SetValue(TextProperty, value); } - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/Outline.xaml b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/Outline.xaml deleted file mode 100644 index 5ae7dc3f5a..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/Outline.xaml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/Outline.xaml.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/Outline.xaml.cs deleted file mode 100644 index 64bd561c71..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/Outline.xaml.cs +++ /dev/null @@ -1,32 +0,0 @@ -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; - -namespace ICSharpCode.WpfDesign.Designer.OutlineView -{ - public partial class Outline - { - public Outline() - { - InitializeComponent(); - } - - public static readonly DependencyProperty RootProperty = - DependencyProperty.Register("Root", typeof(OutlineNode), typeof(Outline)); - - public OutlineNode Root { - get { return (OutlineNode)GetValue(RootProperty); } - set { SetValue(RootProperty, value); } - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/OutlineNode.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/OutlineNode.cs deleted file mode 100644 index fc079f7b38..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/OutlineNode.cs +++ /dev/null @@ -1,191 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.ComponentModel; -using ICSharpCode.WpfDesign; -using System.Collections.ObjectModel; -using System.Collections; -using ICSharpCode.WpfDesign.Designer; -using ICSharpCode.WpfDesign.XamlDom; - -namespace ICSharpCode.WpfDesign.Designer.OutlineView -{ - public class OutlineNode : INotifyPropertyChanged - { - public static OutlineNode Create(DesignItem designItem) - { - OutlineNode node; - if (!outlineNodes.TryGetValue(designItem, out node)) { - node = new OutlineNode(designItem); - outlineNodes[designItem] = node; - } - return node; - } - - //TODO: Reset with DesignContext - static Dictionary outlineNodes = new Dictionary(); - - OutlineNode(DesignItem designItem) - { - DesignItem = designItem; - UpdateChildren(); - - //TODO - DesignItem.NameChanged += new EventHandler(DesignItem_NameChanged); - DesignItem.PropertyChanged += new PropertyChangedEventHandler(DesignItem_PropertyChanged); - SelectionService.SelectionChanged += new EventHandler(Selection_SelectionChanged); - } - - public DesignItem DesignItem { get; private set; } - - public ISelectionService SelectionService { - get { return DesignItem.Services.Selection; } - } - - bool isExpanded = true; - - public bool IsExpanded { - get { - return isExpanded; - } - set { - isExpanded = value; - RaisePropertyChanged("IsExpanded"); - } - } - - bool isSelected; - - public bool IsSelected { - get { - return isSelected; - } - set { - if (isSelected != value) { - isSelected = value; - SelectionService.SetSelectedComponents(new[] { DesignItem }, - value ? SelectionTypes.Add : SelectionTypes.Remove); - RaisePropertyChanged("IsSelected"); - } - } - } - - ObservableCollection children = new ObservableCollection(); - - public ObservableCollection Children { - get { return children; } - } - - public string Name { - get { - if (string.IsNullOrEmpty(DesignItem.Name)) { - return DesignItem.ComponentType.Name; - } - return DesignItem.ComponentType.Name + " (" + DesignItem.Name + ")"; - } - } - - void Selection_SelectionChanged(object sender, DesignItemCollectionEventArgs e) - { - IsSelected = DesignItem.Services.Selection.IsComponentSelected(DesignItem); - } - - void DesignItem_NameChanged(object sender, EventArgs e) - { - RaisePropertyChanged("Name"); - } - - void DesignItem_PropertyChanged(object sender, PropertyChangedEventArgs e) - { - if (e.PropertyName == DesignItem.ContentPropertyName) { - UpdateChildren(); - } - } - - void UpdateChildren() - { - Children.Clear(); - - if (DesignItem.ContentPropertyName != null) { - var content = DesignItem.ContentProperty; - if (content.IsCollection) { - UpdateChildrenCore(content.CollectionElements); - } - else { - if (content.Value != null) { - UpdateChildrenCore(new[] { content.Value }); - } - } - } - } - - void UpdateChildrenCore(IEnumerable items) - { - foreach (var item in items) { - if (ModelTools.CanSelectComponent(item)) { - var node = OutlineNode.Create(item); - Children.Add(node); - } - } - } - - // TODO: Outline and IPlacementBehavior must use the same logic (put it inside DesignItem) - public bool CanInsert(IEnumerable nodes, OutlineNode after, bool copy) - { - if (DesignItem.ContentPropertyName == null) return false; - - if (DesignItem.ContentProperty.IsCollection) { - foreach (var node in nodes) { - if (!CollectionSupport.CanCollectionAdd(DesignItem.ContentProperty.ReturnType, - node.DesignItem.ComponentType)) { - return false; - } - } - return true; - } - else { - return after == null && nodes.Count() == 1 && - DesignItem.ContentProperty.DeclaringType.IsAssignableFrom( - nodes.First().DesignItem.ComponentType); - } - } - - public void Insert(IEnumerable nodes, OutlineNode after, bool copy) - { - if (copy) { - nodes = nodes.Select(n => OutlineNode.Create(n.DesignItem.Clone())); - } - else { - foreach (var node in nodes) { - node.DesignItem.Remove(); - } - } - - var index = after == null ? 0 : Children.IndexOf(after) + 1; - - var content = DesignItem.ContentProperty; - if (content.IsCollection) { - foreach (var node in nodes) { - content.CollectionElements.Insert(index++, node.DesignItem); - } - } - else { - content.SetValue(nodes.First().DesignItem); - } - } - - #region INotifyPropertyChanged Members - - public event PropertyChangedEventHandler PropertyChanged; - - void RaisePropertyChanged(string name) - { - if (PropertyChanged != null) { - PropertyChanged(this, new PropertyChangedEventArgs(name)); - } - } - - #endregion - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/OutlineTreeView.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/OutlineTreeView.cs deleted file mode 100644 index 05c46fba3c..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/OutlineTreeView.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace ICSharpCode.WpfDesign.Designer.OutlineView -{ - public class OutlineTreeView : DragTreeView - { - protected override bool CanInsert(DragTreeViewItem target, DragTreeViewItem[] items, DragTreeViewItem after, bool copy) - { - return (target.DataContext as OutlineNode).CanInsert(items.Select(t => t.DataContext as OutlineNode), - after == null ? null : after.DataContext as OutlineNode, copy); - } - - protected override void Insert(DragTreeViewItem target, DragTreeViewItem[] items, DragTreeViewItem after, bool copy) - { - (target.DataContext as OutlineNode).Insert(items.Select(t => t.DataContext as OutlineNode), - after == null ? null : after.DataContext as OutlineNode, copy); - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/OutlineView.xaml b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/OutlineView.xaml deleted file mode 100644 index 8dd10c9a17..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/OutlineView.xaml +++ /dev/null @@ -1,151 +0,0 @@ - - - - - - - - #FFC73C - - - - - - \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BoolEditor.xaml b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BoolEditor.xaml deleted file mode 100644 index f088519992..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BoolEditor.xaml +++ /dev/null @@ -1,7 +0,0 @@ - - diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BoolEditor.xaml.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BoolEditor.xaml.cs deleted file mode 100644 index adf8b4a177..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BoolEditor.xaml.cs +++ /dev/null @@ -1,26 +0,0 @@ -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 ICSharpCode.WpfDesign.PropertyGrid; - -namespace ICSharpCode.WpfDesign.Designer.PropertyGrid.Editors -{ - [TypeEditor(typeof(bool))] - public partial class BoolEditor - { - public BoolEditor() - { - InitializeComponent(); - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BrushEditor/BrushEditor.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BrushEditor/BrushEditor.cs deleted file mode 100644 index 87ef6655d9..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BrushEditor/BrushEditor.cs +++ /dev/null @@ -1,207 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.ComponentModel; -using ICSharpCode.WpfDesign.PropertyGrid; -using System.Windows.Media; -using System.Reflection; -using System.Windows; - -namespace ICSharpCode.WpfDesign.Designer.PropertyGrid.Editors.BrushEditor -{ - public class BrushEditor : INotifyPropertyChanged - { - public BrushEditor() - { - GradientStopCollection stops = new GradientStopCollection(); - stops.Add(new GradientStop(Colors.Black, 0)); - stops.Add(new GradientStop(Colors.White, 1)); - - linearGradientBrush = new LinearGradientBrush(stops); - linearGradientBrush.EndPoint = new Point(1, 0); - radialGradientBrush = new RadialGradientBrush(stops); - } - - public static BrushItem[] SystemBrushes = typeof(SystemColors) - .GetProperties(BindingFlags.Static | BindingFlags.Public) - .Where(p => p.PropertyType == typeof(SolidColorBrush)) - .Select(p => new BrushItem() { Name = p.Name, Brush = (Brush)p.GetValue(null, null) }) - .ToArray(); - - public static BrushItem[] SystemColors = typeof(SystemColors) - .GetProperties(BindingFlags.Static | BindingFlags.Public) - .Where(p => p.PropertyType == typeof(Color)) - .Select(p => new BrushItem() - { - Name = p.Name, - Brush = new SolidColorBrush((Color)p.GetValue(null, null)) - }) - .ToArray(); - - SolidColorBrush solidColorBrush = new SolidColorBrush(Colors.White); - LinearGradientBrush linearGradientBrush; - RadialGradientBrush radialGradientBrush; - - PropertyNode property; - - public PropertyNode Property { - get { - return property; - } - set { - property = value; - if (property != null) { - var f = property.Value as Freezable; - if (f != null && f.IsFrozen) property.Value = f.Clone(); - } - DetermineCurrentKind(); - RaisePropertyChanged("Property"); - RaisePropertyChanged("Brush"); - } - } - - public Brush Brush { - get { - if (property != null) { - return property.Value as Brush; - } - return null; - } - set { - if (property != null && property.Value != value) { - property.Value = value; - DetermineCurrentKind(); - RaisePropertyChanged("Brush"); - } - } - } - - void DetermineCurrentKind() - { - if (Brush == null) { - CurrentKind = BrushEditorKind.None; - } - else if (Brush is SolidColorBrush) { - solidColorBrush = Brush as SolidColorBrush; - CurrentKind = BrushEditorKind.Solid; - } - else if (Brush is LinearGradientBrush) { - linearGradientBrush = Brush as LinearGradientBrush; - radialGradientBrush.GradientStops = linearGradientBrush.GradientStops; - CurrentKind = BrushEditorKind.Linear; - } - else if (Brush is RadialGradientBrush) { - radialGradientBrush = Brush as RadialGradientBrush; - linearGradientBrush.GradientStops = linearGradientBrush.GradientStops; - CurrentKind = BrushEditorKind.Radial; - } - } - - BrushEditorKind currentKind; - - public BrushEditorKind CurrentKind { - get { - return currentKind; - } - set { - currentKind = value; - RaisePropertyChanged("CurrentKind"); - - switch (CurrentKind) { - case BrushEditorKind.None: - Brush = null; - break; - - case BrushEditorKind.Solid: - Brush = solidColorBrush; - break; - - case BrushEditorKind.Linear: - Brush = linearGradientBrush; - break; - - case BrushEditorKind.Radial: - Brush = radialGradientBrush; - break; - - case BrushEditorKind.List: - Brush = solidColorBrush; - break; - } - } - } - - public double GradientAngle { - get { - var x = linearGradientBrush.EndPoint.X - linearGradientBrush.StartPoint.X; - var y = linearGradientBrush.EndPoint.Y - linearGradientBrush.StartPoint.Y; - return Vector.AngleBetween(new Vector(1, 0), new Vector(x, -y)); - } - set { - var d = value * Math.PI / 180; - var p = new Point(Math.Cos(d), -Math.Sin(d)); - var k = 1 / Math.Max(Math.Abs(p.X), Math.Abs(p.Y)); - p.X *= k; - p.Y *= k; - var p2 = new Point(-p.X, -p.Y); - linearGradientBrush.StartPoint = new Point((p2.X + 1) / 2, (p2.Y + 1) / 2); - linearGradientBrush.EndPoint = new Point((p.X + 1) / 2, (p.Y + 1) / 2); - RaisePropertyChanged("GradientAngle"); - } - } - - public IEnumerable AvailableColors { - get { return SystemColors; } - } - - public IEnumerable AvailableBrushes { - get { return SystemBrushes; } - } - - public void MakeGradientHorizontal() - { - GradientAngle = 0; - } - - public void MakeGradientVertical() - { - GradientAngle = -90; - } - - public void Commit() - { - if (Brush != null) { - Property.Value = Brush.Clone(); - } - } - - #region INotifyPropertyChanged Members - - public event PropertyChangedEventHandler PropertyChanged; - - void RaisePropertyChanged(string name) - { - if (PropertyChanged != null) { - PropertyChanged(this, new PropertyChangedEventArgs(name)); - } - } - - #endregion - } - - public enum BrushEditorKind - { - None, - Solid, - Linear, - Radial, - List - } - - public class BrushItem - { - public string Name { get; set; } - public Brush Brush { get; set; } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BrushEditor/BrushEditorPopup.xaml b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BrushEditor/BrushEditorPopup.xaml deleted file mode 100644 index de8144b584..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BrushEditor/BrushEditorPopup.xaml +++ /dev/null @@ -1,11 +0,0 @@ - - - diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BrushEditor/BrushEditorPopup.xaml.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BrushEditor/BrushEditorPopup.xaml.cs deleted file mode 100644 index d9568035b8..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BrushEditor/BrushEditorPopup.xaml.cs +++ /dev/null @@ -1,36 +0,0 @@ -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.Diagnostics; - -namespace ICSharpCode.WpfDesign.Designer.PropertyGrid.Editors.BrushEditor -{ - public partial class BrushEditorPopup - { - public BrushEditorPopup() - { - InitializeComponent(); - } - - protected override void OnClosed(EventArgs e) - { - base.OnClosed(e); - BrushEditorView.BrushEditor.Commit(); - } - - protected override void OnKeyDown(KeyEventArgs e) - { - if (e.Key == Key.Escape) IsOpen = false; - } - } -} diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BrushEditor/BrushEditorView.xaml b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BrushEditor/BrushEditorView.xaml deleted file mode 100644 index 8286f1060a..0000000000 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BrushEditor/BrushEditorView.xaml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - -