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

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

@ -75,6 +75,10 @@ namespace ICSharpCode.WpfDesign
/// </summary> /// </summary>
public abstract event EventHandler ValueChanged; 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; public abstract event EventHandler ValueOnInstanceChanged;
/// <summary> /// <summary>
@ -104,18 +108,34 @@ namespace ICSharpCode.WpfDesign
/// </summary> /// </summary>
public abstract void Reset(); public abstract void Reset();
/// <summary>
/// Gets the parent design item.
/// </summary>
public abstract DesignItem DesignItem { get; } 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 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 { public string FullName {
get { get {
return DeclaringType.FullName + "." + Name; 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 { public string DependencyFullName {
get { get {
if (DependencyProperty != null) { if (DependencyProperty != null) {

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

@ -10,24 +10,41 @@ using System.Diagnostics;
namespace ICSharpCode.WpfDesign namespace ICSharpCode.WpfDesign
{ {
/// <summary>
/// Contains helper methods for retrieving meta data.
/// </summary>
public static class Metadata public static class Metadata
{ {
/// <summary>
/// Gets the full name of a dependency property (OwnerType.FullName + "." + Name).
/// </summary>
public static string GetFullName(this DependencyProperty p) public static string GetFullName(this DependencyProperty p)
{ {
return p.OwnerType.FullName + "." + p.Name; 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>>(); 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) public static void AddStandardValues(Type type, Type valuesContainer)
{ {
AddStandardValues(type, valuesContainer AddStandardValues(type,
.GetProperties(BindingFlags.Public | BindingFlags.Static) valuesContainer.GetProperties(BindingFlags.Public | BindingFlags.Static)
.Select(p => p.GetValue(null, null))); .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) public static void AddStandardValues<T>(Type type, IEnumerable<T> values)
{ {
List<object> list; List<object> list;
lock (standardValues) { lock (standardValues) {
if (!standardValues.TryGetValue(type, out list)) { if (!standardValues.TryGetValue(type, out list)) {
@ -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) public static IEnumerable GetStandardValues(Type type)
{ {
if (type.IsEnum) { if (type.IsEnum) {
@ -109,27 +129,36 @@ namespace ICSharpCode.WpfDesign
static HashSet<string> hiddenProperties = new HashSet<string>(); static HashSet<string> hiddenProperties = new HashSet<string>();
/// <summary>
/// Hides the specified property (marks it as not browsable).
/// </summary>
public static void HideProperty(DependencyProperty p) public static void HideProperty(DependencyProperty p)
{ {
lock (hiddenProperties) { lock (hiddenProperties) {
hiddenProperties.Add(p.GetFullName()); hiddenProperties.Add(p.GetFullName());
} }
} }
/// <summary>
/// Hides the specified property (marks it as not browsable).
/// </summary>
public static void HideProperty(Type type, string member) public static void HideProperty(Type type, string member)
{ {
lock (hiddenProperties) { lock (hiddenProperties) {
hiddenProperties.Add(type.FullName + "." + member); 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) public static bool IsBrowsable(DesignItemProperty p)
{ {
lock (hiddenProperties) { lock (hiddenProperties) {
if (hiddenProperties.Contains(p.DependencyFullName)) { if (hiddenProperties.Contains(p.DependencyFullName)) {
return false; return false;
} }
} }
return true; return true;
} }
@ -137,57 +166,76 @@ namespace ICSharpCode.WpfDesign
static HashSet<string> popularProperties = new HashSet<string>(); 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) public static void AddPopularProperty(DependencyProperty p)
{ {
lock (popularProperties) { lock (popularProperties) {
popularProperties.Add(p.GetFullName()); popularProperties.Add(p.GetFullName());
} }
} }
/// <summary>
/// Registers a popular property (shown first in the property grid).
/// </summary>
public static void AddPopularProperty(Type type, string member) public static void AddPopularProperty(Type type, string member)
{ {
lock (popularProperties) { lock (popularProperties) {
popularProperties.Add(type.FullName + "." + member); popularProperties.Add(type.FullName + "." + member);
} }
} }
/// <summary>
/// Gets whether the specified property was registered as popular.
/// </summary>
public static bool IsPopularProperty(DesignItemProperty p) public static bool IsPopularProperty(DesignItemProperty p)
{ {
lock (popularProperties) { lock (popularProperties) {
if (popularProperties.Contains(p.DependencyFullName)) { if (popularProperties.Contains(p.DependencyFullName)) {
return true; return true;
} }
} }
return false; return false;
} }
static HashSet<Type> popularControls = new HashSet<Type>(); static HashSet<Type> popularControls = new HashSet<Type>();
/// <summary>
/// Registers a popular control (visible in the default toolbox).
/// </summary>
public static void AddPopularControl(Type t) public static void AddPopularControl(Type t)
{ {
lock (popularControls) { lock (popularControls) {
popularControls.Add(t); popularControls.Add(t);
} }
} }
/// <summary>
/// Gets the list of popular controls.
/// </summary>
public static IEnumerable<Type> GetPopularControls() public static IEnumerable<Type> GetPopularControls()
{ {
lock (popularControls) { lock (popularControls) {
foreach (var t in popularControls) { return popularControls.ToArray();
yield return t; }
}
}
} }
/// <summary>
/// Gets whether the specified control was registered as popular.
/// </summary>
public static bool IsPopularControl(Type t) public static bool IsPopularControl(Type t)
{ {
lock (popularControls) { lock (popularControls) {
return popularControls.Contains(t); 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) public static void AddValueRange(DependencyProperty p, double min, double max)
{ {
lock (ranges) { lock (ranges) {
@ -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) public static NumberRange GetValueRange(DesignItemProperty p)
{ {
NumberRange r; NumberRange r;
@ -208,6 +259,9 @@ namespace ICSharpCode.WpfDesign
static HashSet<Type> placementDisabled = new HashSet<Type>(); 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) public static void DisablePlacement(Type type)
{ {
lock (placementDisabled) { lock (placementDisabled) {
@ -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) public static bool IsPlacementDisabled(Type type)
{ {
lock (placementDisabled) { lock (placementDisabled) {
@ -222,33 +279,50 @@ namespace ICSharpCode.WpfDesign
} }
} }
static Dictionary<Type, Size> defaultSizes = new Dictionary<Type, Size>(); static Dictionary<Type, Size> defaultSizes = new Dictionary<Type, Size>();
public static void AddDefaultSize(Type t, Size s) /// <summary>
{ /// Registers a default size for new controls of the specified type.
lock (defaultSizes) { /// </summary>
defaultSizes[t] = s; public static void AddDefaultSize(Type t, Size s)
} {
} lock (defaultSizes) {
defaultSizes[t] = s;
public static Size GetDefaultSize(Type t) }
{ }
Size s;
lock (defaultSizes) { /// <summary>
while (t != null) { /// Gets the default size for new controls of the specified type,
if (defaultSizes.TryGetValue(t, out s)) { /// or new Size(double.NaN, double.NaN) if no default size was registered.
return s; /// </summary>
} public static Size GetDefaultSize(Type t)
t = t.BaseType; {
} Size s;
} lock (defaultSizes) {
return new Size(double.NaN, double.NaN); 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 class NumberRange
{ {
public double Min; /// <summary>
public double Max; /// 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
/// </summary> /// </summary>
Rect GetPosition(PlacementOperation operation, DesignItem child); Rect GetPosition(PlacementOperation operation, DesignItem child);
/// <summary>
/// Is called before SetPosition is called for the placed items.
/// </summary>
void BeforeSetPosition(PlacementOperation operation); void BeforeSetPosition(PlacementOperation operation);
/// <summary> /// <summary>

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

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

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

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

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

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

Loading…
Cancel
Save