Browse Source

XML comments for WpfDesign.

Fixed NullReferenceException in MemberLookupHelper.SignatureComparer if a parameter has no return type (can happen when there are syntax errors).

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3582 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 17 years ago
parent
commit
a0d768dfff
  1. 5
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Xaml/XamlDesignItem.cs
  2. 17
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/DesignItem.cs
  3. 22
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/DesignItemProperty.cs
  4. 200
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/Metadata.cs
  5. 3
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementBehavior.cs
  6. 6
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyGrid/Category.cs
  7. 6
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyGrid/PropertyNode.cs
  8. 4
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/MemberLookupHelper.cs

5
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Xaml/XamlDesignItem.cs

@ -143,5 +143,10 @@ namespace ICSharpCode.WpfDesign.Designer.Xaml @@ -143,5 +143,10 @@ namespace ICSharpCode.WpfDesign.Designer.Xaml
return XamlObject.ContentPropertyName;
}
}
public override DesignItem Clone()
{
throw new NotImplementedException();
}
}
}

17
src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/DesignItem.cs

@ -222,8 +222,14 @@ namespace ICSharpCode.WpfDesign @@ -222,8 +222,14 @@ namespace ICSharpCode.WpfDesign
}
}
/// <summary>
/// Gets the name of the content property (the property that contains the logical children)
/// </summary>
public abstract string ContentPropertyName { get; }
/// <summary>
/// Gets the content property (the property that contains the logical children)
/// </summary>
public DesignItemProperty ContentProperty {
get {
if (ContentPropertyName == null) return null;
@ -231,6 +237,9 @@ namespace ICSharpCode.WpfDesign @@ -231,6 +237,9 @@ namespace ICSharpCode.WpfDesign
}
}
/// <summary>
/// Removes this design item from its parent property/collection.
/// </summary>
public void Remove()
{
if (ParentProperty != null) {
@ -243,9 +252,9 @@ namespace ICSharpCode.WpfDesign @@ -243,9 +252,9 @@ namespace ICSharpCode.WpfDesign
}
}
public DesignItem Clone()
{
throw new NotImplementedException();
}
/// <summary>
/// Creates a copy of this design item.
/// </summary>
public abstract DesignItem Clone();
}
}

22
src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/DesignItemProperty.cs

@ -75,6 +75,10 @@ namespace ICSharpCode.WpfDesign @@ -75,6 +75,10 @@ namespace ICSharpCode.WpfDesign
/// </summary>
public abstract event EventHandler ValueChanged;
/// <summary>
/// Is raised when the <see cref="ValueOnInstance"/> property changes.
/// This event is not raised when the value is changed without going through the designer infrastructure.
/// </summary>
public abstract event EventHandler ValueOnInstanceChanged;
/// <summary>
@ -104,18 +108,34 @@ namespace ICSharpCode.WpfDesign @@ -104,18 +108,34 @@ namespace ICSharpCode.WpfDesign
/// </summary>
public abstract void Reset();
/// <summary>
/// Gets the parent design item.
/// </summary>
public abstract DesignItem DesignItem { get; }
/// <summary>
/// Gets the dependency property, or null if this property does not represent a dependency property.
/// </summary>
public abstract DependencyProperty DependencyProperty { get; }
public abstract bool IsAdvanced { get; }
/// <summary>
/// Gets if this property is considered "advanced" and should be hidden by default in a property grid.
/// </summary>
public virtual bool IsAdvanced { get { return false; } }
/// <summary>
/// Gets the full name of the property (DeclaringType.FullName + "." + Name).
/// </summary>
public string FullName {
get {
return DeclaringType.FullName + "." + Name;
}
}
/// <summary>
/// Gets the full name of the dependency property. Returns the normal FullName if the property
/// isn't a dependency property.
/// </summary>
public string DependencyFullName {
get {
if (DependencyProperty != null) {

200
src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/Metadata.cs

@ -10,24 +10,41 @@ using System.Diagnostics; @@ -10,24 +10,41 @@ using System.Diagnostics;
namespace ICSharpCode.WpfDesign
{
/// <summary>
/// Contains helper methods for retrieving meta data.
/// </summary>
public static class Metadata
{
/// <summary>
/// Gets the full name of a dependency property (OwnerType.FullName + "." + Name).
/// </summary>
public static string GetFullName(this DependencyProperty p)
{
return p.OwnerType.FullName + "." + p.Name;
}
// TODO: do we really want to store these values in a static dictionary?
// Why not per-design context (as a service?)
static Dictionary<Type, List<object>> standardValues = new Dictionary<Type, List<object>>();
/// <summary>
/// Registers a set of standard values for a <paramref name="type"/> by using the
/// public static properties of the type <paramref name="valuesContainer"/>.
/// </summary>
/// <example>Metadata.AddStandardValues(typeof(Brush), typeof(Brushes));</example>
public static void AddStandardValues(Type type, Type valuesContainer)
{
AddStandardValues(type, valuesContainer
.GetProperties(BindingFlags.Public | BindingFlags.Static)
.Select(p => p.GetValue(null, null)));
AddStandardValues(type,
valuesContainer.GetProperties(BindingFlags.Public | BindingFlags.Static)
.Select(p => p.GetValue(null, null)));
}
/// <summary>
/// Registers a set of standard <paramref name="values"/> for a <paramref name="type"/>.
/// </summary>
/// <remarks>You can call this method multiple times to add additional standard values.</remarks>
public static void AddStandardValues<T>(Type type, IEnumerable<T> values)
{
{
List<object> list;
lock (standardValues) {
if (!standardValues.TryGetValue(type, out list)) {
@ -40,6 +57,9 @@ namespace ICSharpCode.WpfDesign @@ -40,6 +57,9 @@ namespace ICSharpCode.WpfDesign
}
}
/// <summary>
/// Retrieves the standard values for the specified <paramref name="type"/>.
/// </summary>
public static IEnumerable GetStandardValues(Type type)
{
if (type.IsEnum) {
@ -109,27 +129,36 @@ namespace ICSharpCode.WpfDesign @@ -109,27 +129,36 @@ namespace ICSharpCode.WpfDesign
static HashSet<string> hiddenProperties = new HashSet<string>();
/// <summary>
/// Hides the specified property (marks it as not browsable).
/// </summary>
public static void HideProperty(DependencyProperty p)
{
lock (hiddenProperties) {
hiddenProperties.Add(p.GetFullName());
}
lock (hiddenProperties) {
hiddenProperties.Add(p.GetFullName());
}
}
/// <summary>
/// Hides the specified property (marks it as not browsable).
/// </summary>
public static void HideProperty(Type type, string member)
{
lock (hiddenProperties) {
hiddenProperties.Add(type.FullName + "." + member);
}
lock (hiddenProperties) {
hiddenProperties.Add(type.FullName + "." + member);
}
}
/// <summary>
/// Gets whether the specified property is browsable (should be visible in property grids).
/// </summary>
public static bool IsBrowsable(DesignItemProperty p)
{
lock (hiddenProperties) {
if (hiddenProperties.Contains(p.DependencyFullName)) {
return false;
}
}
lock (hiddenProperties) {
if (hiddenProperties.Contains(p.DependencyFullName)) {
return false;
}
}
return true;
}
@ -137,57 +166,76 @@ namespace ICSharpCode.WpfDesign @@ -137,57 +166,76 @@ namespace ICSharpCode.WpfDesign
static HashSet<string> popularProperties = new HashSet<string>();
/// <summary>
/// Registers a popular property (shown first in the property grid).
/// </summary>
public static void AddPopularProperty(DependencyProperty p)
{
lock (popularProperties) {
popularProperties.Add(p.GetFullName());
}
lock (popularProperties) {
popularProperties.Add(p.GetFullName());
}
}
/// <summary>
/// Registers a popular property (shown first in the property grid).
/// </summary>
public static void AddPopularProperty(Type type, string member)
{
lock (popularProperties) {
popularProperties.Add(type.FullName + "." + member);
}
lock (popularProperties) {
popularProperties.Add(type.FullName + "." + member);
}
}
/// <summary>
/// Gets whether the specified property was registered as popular.
/// </summary>
public static bool IsPopularProperty(DesignItemProperty p)
{
lock (popularProperties) {
if (popularProperties.Contains(p.DependencyFullName)) {
return true;
}
}
return false;
lock (popularProperties) {
if (popularProperties.Contains(p.DependencyFullName)) {
return true;
}
}
return false;
}
static HashSet<Type> popularControls = new HashSet<Type>();
/// <summary>
/// Registers a popular control (visible in the default toolbox).
/// </summary>
public static void AddPopularControl(Type t)
{
lock (popularControls) {
popularControls.Add(t);
}
lock (popularControls) {
popularControls.Add(t);
}
}
/// <summary>
/// Gets the list of popular controls.
/// </summary>
public static IEnumerable<Type> GetPopularControls()
{
lock (popularControls) {
foreach (var t in popularControls) {
yield return t;
}
}
lock (popularControls) {
return popularControls.ToArray();
}
}
/// <summary>
/// Gets whether the specified control was registered as popular.
/// </summary>
public static bool IsPopularControl(Type t)
{
lock (popularControls) {
return popularControls.Contains(t);
}
lock (popularControls) {
return popularControls.Contains(t);
}
}
static Dictionary<string, NumberRange> ranges = new Dictionary<string, NumberRange>();
static Dictionary<string, NumberRange> ranges = new Dictionary<string, NumberRange>();
/// <summary>
/// Registers the value range for the property.
/// </summary>
public static void AddValueRange(DependencyProperty p, double min, double max)
{
lock (ranges) {
@ -195,6 +243,9 @@ namespace ICSharpCode.WpfDesign @@ -195,6 +243,9 @@ namespace ICSharpCode.WpfDesign
}
}
/// <summary>
/// Gets the registered value range for the property, or null if no range was registered.
/// </summary>
public static NumberRange GetValueRange(DesignItemProperty p)
{
NumberRange r;
@ -208,6 +259,9 @@ namespace ICSharpCode.WpfDesign @@ -208,6 +259,9 @@ namespace ICSharpCode.WpfDesign
static HashSet<Type> placementDisabled = new HashSet<Type>();
/// <summary>
/// Disables the default placement behaviour (setting the ContentProperty) for the type.
/// </summary>
public static void DisablePlacement(Type type)
{
lock (placementDisabled) {
@ -215,6 +269,9 @@ namespace ICSharpCode.WpfDesign @@ -215,6 +269,9 @@ namespace ICSharpCode.WpfDesign
}
}
/// <summary>
/// Gets whether thr default placement behaviour (setting the ContentProperty) was disabled for the type.
/// </summary>
public static bool IsPlacementDisabled(Type type)
{
lock (placementDisabled) {
@ -222,33 +279,50 @@ namespace ICSharpCode.WpfDesign @@ -222,33 +279,50 @@ namespace ICSharpCode.WpfDesign
}
}
static Dictionary<Type, Size> defaultSizes = new Dictionary<Type, Size>();
public static void AddDefaultSize(Type t, Size s)
{
lock (defaultSizes) {
defaultSizes[t] = s;
}
}
public static Size GetDefaultSize(Type t)
{
Size s;
lock (defaultSizes) {
while (t != null) {
if (defaultSizes.TryGetValue(t, out s)) {
return s;
}
t = t.BaseType;
}
}
return new Size(double.NaN, double.NaN);
}
static Dictionary<Type, Size> defaultSizes = new Dictionary<Type, Size>();
/// <summary>
/// Registers a default size for new controls of the specified type.
/// </summary>
public static void AddDefaultSize(Type t, Size s)
{
lock (defaultSizes) {
defaultSizes[t] = s;
}
}
/// <summary>
/// Gets the default size for new controls of the specified type,
/// or new Size(double.NaN, double.NaN) if no default size was registered.
/// </summary>
public static Size GetDefaultSize(Type t)
{
Size s;
lock (defaultSizes) {
while (t != null) {
if (defaultSizes.TryGetValue(t, out s)) {
return s;
}
t = t.BaseType;
}
}
return new Size(double.NaN, double.NaN);
}
}
/// <summary>
/// Represets the minimum and maximum valid value for a double property.
/// </summary>
public class NumberRange
{
public double Min;
public double Max;
/// <summary>
/// Gets/Sets the minimum value.
/// </summary>
public double Min { get; set; }
/// <summary>
/// Gets/Sets the maximum value.
/// </summary>
public double Max { get; set; }
}
}

3
src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementBehavior.cs

@ -37,6 +37,9 @@ namespace ICSharpCode.WpfDesign @@ -37,6 +37,9 @@ namespace ICSharpCode.WpfDesign
/// </summary>
Rect GetPosition(PlacementOperation operation, DesignItem child);
/// <summary>
/// Is called before SetPosition is called for the placed items.
/// </summary>
void BeforeSetPosition(PlacementOperation operation);
/// <summary>

6
src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyGrid/Category.cs

@ -8,8 +8,14 @@ using ICSharpCode.WpfDesign.PropertyGrid; @@ -8,8 +8,14 @@ using ICSharpCode.WpfDesign.PropertyGrid;
namespace ICSharpCode.WpfDesign.PropertyGrid
{
/// <summary>
/// View-Model class for a property grid category.
/// </summary>
public class Category : INotifyPropertyChanged
{
// don't warn on missing XML comments in View-Model
#pragma warning disable 1591
public Category(string name)
{
Name = name;

6
src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyGrid/PropertyNode.cs

@ -12,8 +12,14 @@ using System.Windows.Markup; @@ -12,8 +12,14 @@ using System.Windows.Markup;
namespace ICSharpCode.WpfDesign.PropertyGrid
{
/// <summary>
/// View-Model class for the property grid.
/// </summary>
public class PropertyNode : INotifyPropertyChanged
{
// don't warn on missing XML comments in View-Model
#pragma warning disable 1591
static object Unset = new object();
public DesignItemProperty[] Properties { get; private set; }

4
src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/MemberLookupHelper.cs

@ -93,7 +93,9 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -93,7 +93,9 @@ namespace ICSharpCode.SharpDevelop.Dom
hashCode *= 1000000579;
if (p.IsOut || p.IsRef)
hashCode += 1;
hashCode += p.ReturnType.GetHashCode();
if (p.ReturnType != null) {
hashCode += p.ReturnType.GetHashCode();
}
}
}
cachedHashes[obj] = hashCode;

Loading…
Cancel
Save