Example #1
0
 public bool HasGlyphElements(IsSupportedGlyphHandler handler)
 {
     foreach (IGlyph glyph in _Glyphs)
     {
         if (handler(glyph))
         {
             return(true);
         }
     }
     return(false);
 }
Example #2
0
 public IGlyph FindInnerMostChildContainingBound(IGlyph glyph, System.Drawing.Rectangle bound, IsSupportedGlyphHandler isSupported, IGlyph excludeGlyph)
 {
     foreach (IGlyph child in glyph.Children)
     {
         if (!isSupported(child))
         {
             continue;
         }
         if (child == excludeGlyph)
         {
             continue;
         }
         if (child.Bounds.Contains(bound))
         {
             return(FindInnerMostChildContainingBound(child, bound, isSupported));
         }
     }
     return(glyph);
 }
Example #3
0
        public void ReparentGlyphs(IGlyph selectedGlyph, IEnumerable glyphs, IsSupportedGlyphHandler isSupported)
        {
            selectedGlyph.Parent = null;
            foreach (IGlyph glyph in glyphs)
            {
                if (!isSupported(glyph))
                {
                    continue;
                }

                if (glyph.Parent != null)
                {
                    if (!glyph.Parent.Bounds.Contains(glyph.Bounds))
                    {
                        glyph.Parent = null;
                    }
                }
                if (glyph != selectedGlyph)
                {
                    if (glyph.Bounds.Contains(selectedGlyph.Bounds))
                    {
                        if (selectedGlyph.Parent == null)
                        {
                            selectedGlyph.Parent = glyph;
                        }
                        else if (selectedGlyph.Parent.Bounds.Contains(glyph.Bounds))
                        {
                            selectedGlyph.Parent = glyph;
                        }
                    }
                    else if (glyph.Parent == null && selectedGlyph.Bounds.Contains(glyph.Bounds))
                    {
                        glyph.Parent = selectedGlyph;
                    }
                }
            }

            bool changed = true;

            while (changed)
            {
                changed = false;
                foreach (IGlyph glyph in glyphs)
                {
                    if (!isSupported(glyph))
                    {
                        continue;
                    }

                    if (glyph.Parent != null)
                    {
                        if (glyph.Parent.Bounds.Contains(glyph.Bounds))
                        {
                            foreach (IGlyph child in glyph.Parent.Children)
                            {
                                if (!(glyph is IStateGlyph))
                                {
                                    continue;
                                }

                                if (child != glyph)
                                {
                                    if (child.Bounds.Contains(glyph.Bounds))
                                    {
                                        glyph.Parent = child;
                                        changed      = true;
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Example #4
0
 public IGlyph FindInnerMostChildContainingBound(IGlyph glyph, System.Drawing.Rectangle bound, IsSupportedGlyphHandler isSupported)
 {
     return(FindInnerMostChildContainingBound(glyph, bound, isSupported, null));
 }
		public bool HasGlyphElements (IsSupportedGlyphHandler handler)
		{
			foreach (IGlyph glyph in _Glyphs)
			{
				if (handler (glyph))
				{
					return true;
				}
			}
			return false;
		}
		public void ReparentGlyphs (IGlyph selectedGlyph, IEnumerable glyphs, IsSupportedGlyphHandler isSupported)
		{
			selectedGlyph.Parent = null;
			foreach (IGlyph glyph in glyphs)
			{
				if (!isSupported (glyph))
				{
					continue;
				}

				if (glyph.Parent != null)
				{
					if (!glyph.Parent.Bounds.Contains (glyph.Bounds))
					{
						glyph.Parent = null;
					} 
				}
				if (glyph != selectedGlyph)
				{
					if (glyph.Bounds.Contains (selectedGlyph.Bounds))
					{
						if (selectedGlyph.Parent == null)
						{
							selectedGlyph.Parent = glyph;
						} 
						else if (selectedGlyph.Parent.Bounds.Contains (glyph.Bounds))
						{
							selectedGlyph.Parent = glyph;
						}
					} 
					else if (glyph.Parent == null && selectedGlyph.Bounds.Contains (glyph.Bounds))
					{
						glyph.Parent = selectedGlyph;
					}
				}
			}

			bool changed = true;
			while (changed) 
			{
				changed = false;
				foreach (IGlyph glyph in glyphs)
				{
					if (!isSupported(glyph))
					{
						continue;
					}

					if (glyph.Parent != null)
					{
						if (glyph.Parent.Bounds.Contains (glyph.Bounds))
						{
							foreach (IGlyph child in glyph.Parent.Children)
							{
								if (!(glyph is IStateGlyph))
								{
									continue;
								}

								if (child != glyph)
								{
									if (child.Bounds.Contains (glyph.Bounds))
									{
										glyph.Parent = child;
										changed = true;
										break;
									}
								}
							}
						} 
					}
				}
			}
		}
		public IGlyph FindInnerMostChildContainingBound (IGlyph glyph, System.Drawing.Rectangle bound, IsSupportedGlyphHandler isSupported, IGlyph excludeGlyph)
		{
			foreach (IGlyph child in glyph.Children)
			{
				if (!isSupported (child))
				{
					continue;
				}
				if (child == excludeGlyph)
				{
					continue;
				}
				if (child.Bounds.Contains (bound))
				{
					return FindInnerMostChildContainingBound (child, bound, isSupported);
				}
			}
			return glyph;
		}
		public IGlyph FindInnerMostChildContainingBound (IGlyph glyph, System.Drawing.Rectangle bound, IsSupportedGlyphHandler isSupported)
		{
			return FindInnerMostChildContainingBound (glyph, bound, isSupported, null);
		}