public TransitionContactPointCircleGlyph(Point centre, int radius, IGlyph parent, TransitionContactEnd whichEnd, TransitionContactPointCircleGlyph otherEnd)
     : base(centre, radius)
 {
     this.Parent = parent;
     this._WhichEnd = whichEnd;
     this._OtherEnd = otherEnd;
 }
        public void MouseDown(object sender, MouseEventArgs e)
        {
            _CurrentGlyph = null;

            _Model.DeSelectAllGlyphs ();

            _Point = new Point (e.X, e.Y);
            IGlyph actualCurrentGlyph;
            _CurrentGlyph = _Model.FindContactPoint (_Point, out actualCurrentGlyph);
            _ActualCurrentGlyph = actualCurrentGlyph;

            if (_CurrentGlyph == null)
            {
                _CurrentGlyph = _Model.FindGlyph (_Point);
                _ActualCurrentGlyph = _CurrentGlyph;
            }
            if (_CurrentGlyph != null)
            {
                System.Diagnostics.Debug.Assert (_ActualCurrentGlyph != null);
                _Context.SelectGlyph (_ActualCurrentGlyph);
                _LastSelectedGlyph = _ActualCurrentGlyph;
            }
            else
            {
                _Context.ShowHeader ();
            }
        }
Ejemplo n.º 3
0
        protected string GlyphNameFrom(IGlyph glyph)
        {
            Stack stack = new Stack();

            while (glyph != null)
            {
                stack.Push(glyph);
                glyph = glyph.Parent;
                while (glyph != null && AcceptParentInFullyQualifiedName(glyph) == false)
                {
                    glyph = glyph.Parent;
                }
            }

            System.Text.StringBuilder builder = new System.Text.StringBuilder();
            bool first = true;

            while (stack.Count > 0)
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    builder.Append(".");
                }
                glyph = stack.Pop() as IGlyph;
                builder.Append(GlyphNameFromString(glyph.Name));
            }
            return(builder.ToString());
        }
 public TransitionContactPointCircleGlyph(Point centre, int radius, IGlyph parent, TransitionContactEnd whichEnd, TransitionContactPointCircleGlyph otherEnd)
     : base(centre, radius)
 {
     this.Parent    = parent;
     this._WhichEnd = whichEnd;
     this._OtherEnd = otherEnd;
 }
Ejemplo n.º 5
0
 public GlyphPlacement(IGlyph glyph, int x, int y, int index)
 {
     this.Glyph = glyph;
     this.X     = x;
     this.Y     = y;
     this.Index = index;
 }
Ejemplo n.º 6
0
        private void horizontal_ContactPoint(IGlyph glyph, OffsetEventArgs offsetEventArgs)
        {
            int expectedYPos = _Bounds.Y + _Bounds.Height / 2;
            int currentYPos  = glyph.Bounds.Y + glyph.Bounds.Height / 2;

            offsetEventArgs.Offset = new Point(offsetEventArgs.Offset.X, expectedYPos - currentYPos);
        }
 public PortLinkContactPointGlyph(Point centre, int radius, IGlyph parent, TransitionContactEnd whichEnd, PortLinkContactPointGlyph otherEnd)
     : base(new Rectangle (centre.X - radius, centre.Y - radius, radius + radius, radius + radius))
 {
     this.Parent = parent;
     this._WhichEnd = whichEnd;
     this._OtherEnd = otherEnd;
 }
Ejemplo n.º 8
0
        public void MouseDown(object sender, MouseEventArgs e)
        {
            _CurrentGlyph = null;

            _Model.DeSelectAllGlyphs();

            _Point = new Point(e.X, e.Y);
            IGlyph actualCurrentGlyph;

            _CurrentGlyph       = _Model.FindContactPoint(_Point, out actualCurrentGlyph);
            _ActualCurrentGlyph = actualCurrentGlyph;

            if (_CurrentGlyph == null)
            {
                _CurrentGlyph       = _Model.FindGlyph(_Point);
                _ActualCurrentGlyph = _CurrentGlyph;
            }
            if (_CurrentGlyph != null)
            {
                System.Diagnostics.Debug.Assert(_ActualCurrentGlyph != null);
                _Context.SelectGlyph(_ActualCurrentGlyph);
                _LastSelectedGlyph = _ActualCurrentGlyph;
            }
            else
            {
                _Context.ShowHeader();
            }
        }
Ejemplo n.º 9
0
        void BuildStateTransitionParentRelationships()
        {
            foreach (DictionaryEntry de in _EntityLinkRel)
            {
                IGlyph      glyph      = _GlyphLookup [de.Key] as IGlyph;
                StringPair  pair       = de.Value as StringPair;
                IGlyph      parentOne  = _GlyphLookup [pair.One] as IGlyph;
                IGlyph      parentTwo  = _GlyphLookup [pair.Two] as IGlyph;
                IGroupGlyph groupGlyph = glyph as IGroupGlyph;
                int         index      = 0;
                foreach (IGlyph contact in groupGlyph.ContactPoints)
                {
                    switch (index)
                    {
                    case 0:
                    {
                        contact.Parent = parentOne;
                    } break;

                    case 1:
                    {
                        contact.Parent = parentTwo;
                    } break;
                    }
                    index++;
                }
            }
        }
Ejemplo n.º 10
0
        private void vertical_ContactPoint(IGlyph glyph, OffsetEventArgs offsetEventArgs)
        {
            int expectedXPos = _Bounds.X + _Bounds.Width / 2;
            int currentXPos  = glyph.Bounds.X + glyph.Bounds.Width / 2;

            offsetEventArgs.Offset = new Point(expectedXPos - currentXPos, offsetEventArgs.Offset.Y);
        }
Ejemplo n.º 11
0
 protected void RaiseGlyphChange(GlyphChangeHandler handler, object sender, IGlyph glyph)
 {
     if (handler != null)
     {
         handler(sender, glyph);
     }
 }
Ejemplo n.º 12
0
 public void RemoveOwned(IGlyph owned)
 {
     if (_OwnedItems.Contains(owned))
     {
         _OwnedItems.Remove(owned);
     }
 }
 public PortLinkContactPointGlyph(Point centre, int radius, IGlyph parent, TransitionContactEnd whichEnd, PortLinkContactPointGlyph otherEnd)
     : base(new Rectangle(centre.X - radius, centre.Y - radius, radius + radius, radius + radius))
 {
     this.Parent    = parent;
     this._WhichEnd = whichEnd;
     this._OtherEnd = otherEnd;
 }
Ejemplo n.º 14
0
 public void RemoveChild(IGlyph child)
 {
     if (_Children.Contains(child))
     {
         _Children.Remove(child);
     }
 }
Ejemplo n.º 15
0
        protected override bool AcceptParentInFullyQualifiedName(IGlyph glyph)
        {
            System.Diagnostics.Debug.Assert(glyph != null);
            IStateGlyph state = glyph as IStateGlyph;

            System.Diagnostics.Debug.Assert(state != null);
            return(!state.IsOverriding);
        }
Ejemplo n.º 16
0
        void LoadGlyphCommon(TextReader sr, IGlyph glyph)
        {
            glyph.Note = LoadText(sr, "NOTE:", "");

            string doNotInstrument = LoadText(sr, "DEBUG_DONOTINSTRUMENT", false.ToString());

            glyph.DoNotInstrument = bool.Parse(doNotInstrument);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// 指定した文字が単語の途中にあるかどうかを返します。
        /// </summary>
        /// <param name="g"></param>
        /// <returns></returns>
        public virtual bool IsInWord(IGlyph g)
        {
            var cat = Char.GetUnicodeCategory(((Glyph)g).Character);

            return(cat == UnicodeCategory.DecimalDigitNumber ||
                   cat == UnicodeCategory.LowercaseLetter ||
                   cat == UnicodeCategory.UppercaseLetter);
        }
Ejemplo n.º 18
0
        Rectangle GetReparentBounds(IGlyph currentGlyph)
        {
#warning Kludge that counteracts the inflating of bounds for easier selection purposes - which makes reparenting worse.
            Rectangle currentGlyphBounds = currentGlyph.Bounds;
            currentGlyphBounds = new Rectangle(currentGlyphBounds.Location, currentGlyphBounds.Size);
            currentGlyphBounds.Inflate(-5, -5);
            return(currentGlyphBounds);
        }
Ejemplo n.º 19
0
        public override void ExecuteAndUpdateCurrentLine()
        {
            switch (CurrentLine)
            {
            case 0:
                CurrentLine = 3;
                return;

            case 3:
                CurrentLine = 6;
                return;

            case 6:
                IGlyph glyph1 = ((ArrayIterator)arrayIterator).GetGlyphByIndex(status.I - 1);
                status.CanEdit = true;
                status.E       = ((Square)glyph1).Text;
                break;

            case 7:
                //判断for语句条件是否成立,如果成立,CurrentLine = 8;不成立,CurrentLine = 10;
                if (status.J > status.Length - 1)
                {
                    CurrentLine = 10;
                    return;
                }
                break;

            case 8:
                //移动一个图形元素.
                movedGlyphs.Add(((ArrayIterator)arrayIterator).GetGlyphByIndex(status.J));
                IGlyph tempGlyph  = ((ArrayIterator)arrayIterator).GetGlyphByIndex(status.J);
                IGlyph tempGlyph1 = new Square(tempGlyph.Bounds.X - tempGlyph.Bounds.Width - squareSpace, tempGlyph.Bounds.Y, squareSize, status.图形背景色, status.图形外观, ((Square)tempGlyph).Text);
                ((ArrayIterator)arrayIterator).MoveGlyphHorizon(status.J, tempGlyph1, 0);
                string c = status.L[status.J].ToString();
                status.CanEdit = true;
                status.L       = status.L.Remove(status.J - 1, 1);
                status.CanEdit = true;
                status.L       = status.L.Insert(status.J - 1, c);
                status.CanEdit = true;
                status.J++;
                CurrentLine = 7;
                return;

            case 10:
                //线性表长度减1
                status.CanEdit = true;
                status.Length--;
                status.CanEdit = true;
                status.L       = status.L.Remove(status.Length, 1);
                //删除最后一个结点
                ((ArrayIterator)arrayIterator).DeleteGlyph(status.Length);
                break;

            case 11:
                return;
            }
            CurrentLine++;
        }
 void SaveBounds(TextWriter sw, string elementType, IGlyph glyph)
 {
     sw.WriteLine (elementType);
     sw.WriteLine (glyph.Id);
     sw.WriteLine (glyph.Bounds.X);
     sw.WriteLine (glyph.Bounds.Y);
     sw.WriteLine (glyph.Bounds.Width);
     sw.WriteLine (glyph.Bounds.Height);
 }
Ejemplo n.º 21
0
 public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destType)
 {
     if (destType == typeof(string) && value is IGlyph)
     {
         IGlyph glyph = (IGlyph)value;
         return(glyph.Name);
     }
     return(base.ConvertTo(context, culture, value, destType));
 }
Ejemplo n.º 22
0
        protected void DoGlyphCreated(IGlyph createdGlyph)
        {
            GlyphCreatedHandler handler = GlyphCreated;

            if (handler != null)
            {
                handler(createdGlyph);
            }
        }
Ejemplo n.º 23
0
 void SaveBounds(TextWriter sw, string elementType, IGlyph glyph)
 {
     sw.WriteLine(elementType);
     sw.WriteLine(glyph.Id);
     sw.WriteLine(glyph.Bounds.X);
     sw.WriteLine(glyph.Bounds.Y);
     sw.WriteLine(glyph.Bounds.Width);
     sw.WriteLine(glyph.Bounds.Height);
 }
Ejemplo n.º 24
0
        public static string Process(string[] glyphs, Size size, char on, char off)
        {
            if (glyphs == null || glyphs[0] == null)
            {
                return("glyph error");
            }

            IGlyph glyphConverter = Converters[size];
            Dictionary <char, string[]> alphabet = glyphConverter.Alphabet;

            // make sure the correct characters are used
            if (on != IGlyph.On)
            {
                for (int i = 0; i < glyphs.Length; ++i)
                {
                    glyphs[i] = glyphs[i].Replace(on, IGlyph.On);
                }
            }
            if (off != IGlyph.Off)
            {
                for (int i = 0; i < glyphs.Length; ++i)
                {
                    glyphs[i] = glyphs[i].Replace(off, IGlyph.Off);
                }
            }

            // make sure the glyph adheres to the correct size
            int length = glyphs[0].Length % glyphConverter.Width;

            if (length != 0)
            {
                string empty = new string(IGlyph.Off, 5 - length);
                for (int i = 0; i < glyphs.Length; ++i)
                {
                    glyphs[i] += empty;
                }
            }

            // convert glyph to letter
            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < glyphs[0].Length; i += glyphConverter.Width)
            {
                char letter = '?';
                IEnumerable <string> glyph = glyphs.Select(s => s.Substring(i, glyphConverter.Width));
                foreach (KeyValuePair <char, string[]> pair in alphabet)
                {
                    if (pair.Value != null && pair.Value.SequenceEqual(glyph))
                    {
                        letter = pair.Key;
                        break;
                    }
                }
                sb.Append(letter);
            }
            return(sb.ToString());
        }
Ejemplo n.º 25
0
		private void horizontal_ContactPoint (IGlyph glyph, OffsetEventArgs offsetEventArgs)
		{
			if (glyph is IOperationContactPointGlyph)
			{
				int expectedYPos = _Bounds.Y + _Bounds.Height / 2;
				int currentYPos = glyph.Bounds.Y + glyph.Bounds.Height / 2;
				offsetEventArgs.Offset = new Point (offsetEventArgs.Offset.X, expectedYPos - currentYPos);
			}
		}
Ejemplo n.º 26
0
		private void vertical_ContactPoint (IGlyph glyph, OffsetEventArgs offsetEventArgs)
		{
			if (glyph is IOperationContactPointGlyph)
			{
				int expectedXPos = _Bounds.X + _Bounds.Width / 2;
				int currentXPos = glyph.Bounds.X + glyph.Bounds.Width / 2;
				offsetEventArgs.Offset = new Point (expectedXPos - currentXPos, offsetEventArgs.Offset.Y);
			}
		}
Ejemplo n.º 27
0
 void BuildStateParentRelationships()
 {
     foreach (DictionaryEntry de in _ParentChildRel)
     {
         IGlyph glyph  = _GlyphLookup [de.Key] as IGlyph;
         IGlyph parent = _GlyphLookup [de.Value] as IGlyph;
         glyph.Parent = parent;
     }
 }
Ejemplo n.º 28
0
        protected override void contactPoint_OffsetChanged(IGlyph glyph, OffsetEventArgs offsetEventArgs)
        {
            Point offset = offsetEventArgs.Offset;
            int   index  = _ContactPoints.IndexOf(glyph);

            if (glyph is IOperationPortGlyph)
            {
                _Bounds.Offset(offset);
                foreach (IGlyph contactPoint in ContactPoints)
                {
                    if (contactPoint is IOperationContactPointGlyph)
                    {
                        ReOffsetContactPoint(contactPoint, offset);
                    }
                }
            }
            else
            {
                switch (index)
                {
                case 0:
                {
                    _Bounds.X      += offset.X;
                    _Bounds.Width  -= offset.X;
                    _Bounds.Height += offset.Y;
                    ReOffsetContactPoint(2, offset);
                    ReOffsetContactPoint(3, offset);
                } break;

                case 1:
                {
                    _Bounds.Width  += offset.X;
                    _Bounds.Height += offset.Y;
                    ReOffsetContactPoint(2, offset);
                    ReOffsetContactPoint(3, offset);
                } break;

                case 2:
                {
                    _Bounds.Y      += offset.Y;
                    _Bounds.Height -= offset.Y;
                    _Bounds.Width  += offset.X;
                    ReOffsetContactPoint(0, offset);
                    ReOffsetContactPoint(1, offset);
                } break;

                case 3:
                {
                    _Bounds.Height += offset.Y;
                    _Bounds.Width  += offset.X;
                    ReOffsetContactPoint(0, offset);
                    ReOffsetContactPoint(1, offset);
                } break;
                }
            }
        }
Ejemplo n.º 29
0
        public IGlyph FindGlyph(System.Drawing.Point point)
        {
            IGlyph glyph = InnerFindGlyph(point);

            if (ContainsDeletedGlyph(glyph))
            {
                System.Diagnostics.Debug.Assert(false, "Deleted glyph found in _Glyphs or glyph.Children - see InnerFindGlyph ()");
            }
            return(glyph);
        }
Ejemplo n.º 30
0
 public void AddOwned(IGlyph owned)
 {
     if (!_OwnedItems.Contains(owned))
     {
         _OwnedItems.Add(owned);
         // must be after _OwnedItems.Add since owned.Owner = owner
         // calls back to owner.AddOwned (owned)
         owned.Owner = this;
     }
 }
Ejemplo n.º 31
0
 public void AddChild(IGlyph child)
 {
     if (!_Children.Contains(child))
     {
         _Children.Add(child);
         // must be after _Children.Add since child.Parent = parent
         // calls back to parent.AddChild (child)
         child.Parent = this;
     }
 }
Ejemplo n.º 32
0
        public TextBlock GetGlyph(Type glyphType, double fontSize)
        {
            IGlyph    glyph = GetGlyphInstance(glyphType);
            TextBlock tb    = new TextBlock();

            tb.FontFamily     = GetFontFamily(glyphType);
            tb.Text           = glyph.GlyphCode;
            tb.FontSize       = fontSize;
            tb.BaselineOffset = fontSize * GetBaseLineOffsetFactor(glyphType);
            return(tb);
        }
        public void ShouldReturnHuman()
        {
            //Arrange
            GlyphValidInputResponseAction subject = new GlyphValidInputResponseAction();

            //Act
            IGlyph actual = subject.Response("AB");

            //Assert
            actual.Value().Should().Be("A");
        }
Ejemplo n.º 34
0
        public int CountParentDepth()
        {
            int    depth = 0;
            IGlyph p     = _Parent;

            while (p != null)
            {
                depth++;
                p = p.Parent;
            }
            return(depth);
        }
Ejemplo n.º 35
0
 public void MoveGlyphHorizon(int glyphIndex, IGlyph insertGlyph, int direction)
 {
     if (direction == 1)           //说明向右移
     {
         glyphArray.RemoveAt(glyphIndex + 1);
         glyphArray.Insert(glyphIndex + 1, insertGlyph);
     }
     else if (direction == 0)           //说明向左移
     {
         glyphArray.RemoveAt(glyphIndex - 1);
         glyphArray.Insert(glyphIndex - 1, insertGlyph);
     }
 }
Ejemplo n.º 36
0
 IGlyph InnerFindGlyph(IGlyph glyph, System.Drawing.Point point)
 {
     foreach (IGlyph child in glyph.Children)
     {
         if (child.ContainsPoint(point))
         {
             if (ContainsGlyph(child))
             {
                 return(InnerFindGlyph(child, point));
             }
         }
     }
     return(glyph);
 }
Ejemplo n.º 37
0
		IGlyph InnerFindGlyph (IGlyph glyph, System.Drawing.Point point)
		{
			foreach (IGlyph child in glyph.Children)
			{
				if (child.ContainsPoint (point))
				{
					if (ContainsGlyph (child))
					{
						return InnerFindGlyph (child, point);
					}
				}
			}
			return glyph;
		}
Ejemplo n.º 38
0
		public void SetCurrentItemNewColor(IGlyph glyph,Color newColor,Color oldColor)
		{
			INode currentNode = headNode.Next;
			
			while(currentNode != null)
			{
				if(currentNode.ToString() == glyph.ToString())
				{
					currentNode.BackColor = newColor;
				}
				else
				{
					currentNode.BackColor = oldColor;
				}
				currentNode = currentNode.Next;
			}
			
		}
Ejemplo n.º 39
0
        protected void WriteGlyphXml(XmlTextWriter writer, IGlyph glyph)
        {
            writer.WriteStartElement (glyph.GetType ().Name);
            try
            {
                WriteGlyphProperties (writer, glyph);

                foreach (IGlyph child in glyph.Children)
                {
                    // only internal glyphs are owned i.e. contact points, etc. - so skip them.
                    if (child.Owner == null)
                    {

                        WriteGlyphXml (writer, child);
                    }
                }

            }
            finally
            {
                writer.WriteEndElement ();
            }
        }
Ejemplo n.º 40
0
		void ReOffsetChild (IGlyph child, Point point)
		{
			child.Offset (point);
		}
Ejemplo n.º 41
0
		public NullIterator(IGlyph glyph)
		{
			this.glyph = glyph;
		}
Ejemplo n.º 42
0
		IGlyph CreateVisitedGlyph(IGlyph glyph)
		{
			int count = ((ArrayIterator)visitedIterator).Count;
			int diameter = 35;
			int x = 1;
			int y = 1;
			IPadContent animationPad = WorkbenchSingleton.Workbench.GetPad(typeof(NetFocus.DataStructure.Gui.Pads.AnimationPad));
			if(animationPad != null)
			{
				x = 10 + count * (diameter + 5);
				y = animationPad.Control.Height - diameter - 10;
			}
			string text = ((IBiTreeNode)glyph).Text;

			return new BiTreeNode(x,y,diameter,status.遍历过结点颜色,text);

		}
Ejemplo n.º 43
0
		IGlyph CreateStackItem(IGlyph nodeGlyph)
		{
			int itemCount = ((StackIterator)stackIterator).ItemCount;
			int x = 2;
			int y = 10;
			int width = 1;
			int height = 28;
			IPadContent stackPad = WorkbenchSingleton.Workbench.GetPad(typeof(NetFocus.DataStructure.Gui.Pads.StackPad));
			if(stackPad != null)
			{
				y = stackPad.Control.Height - (itemCount + 1) * (2 + 28) - 1;
				width = stackPad.Control.Width - 6;
			}
			string text = ((IBiTreeNode)nodeGlyph).Text;

			return new StackItem(x,y,width,height,SystemColors.Control,GlyphAppearance.Popup,text);

		}
Ejemplo n.º 44
0
 protected abstract void contactPoint_OffsetChanged(IGlyph glyph, OffsetEventArgs offsetEventArgs);
 public OperationPortGlyph(Rectangle bounds, IGlyph parent, string portName)
     : base(bounds)
 {
     this.Parent = parent;
     _PortName = portName;
 }
Ejemplo n.º 46
0
 void linkGlyph_Clicked(IGlyph glyph, Figure figure, DPoint pt)
 {
     ExecLink(figure);
 }
        void LoadGlyphCommon(TextReader sr, IGlyph glyph)
        {
            glyph.Note = LoadText (sr, "NOTE:", "");

            string doNotInstrument = LoadText (sr, "DEBUG_DONOTINSTRUMENT", false.ToString ());
            glyph.DoNotInstrument = bool.Parse (doNotInstrument);
        }
Ejemplo n.º 48
0
		public override void ExecuteAndUpdateCurrentLine()
		{
			switch (CurrentLine)
			{
				case 0:
					CurrentLine = 2;
					return;
				case 2:  //i = low;  j = high;  R[0] = R[i];
					status.CanEdit = true;
					status.I = status.Low;
					status.CanEdit = true;
					status.J = status.High;
					AssignValue(0,status.I);
					ch = status.R[status.I - 1].ToString();
					CurrentLine = 4;
					return;
				case 4:  //while(R[j].key >= R[0].key && j > i){
					glyphJ = ((ArrayIterator)arrayIterator).GetGlyphByIndex(status.J);
					if(glyphJ != null)
					{
						nullIteratorJ = new VerticalPointer(glyphJ.Bounds.X + 10,glyphJ.Bounds.Y + glyphJ.Bounds.Height + 2,Color.Red,"j",GlyphAppearance.Flat).CreateIterator();
					}
					indexArray.Clear();
					currentIndex = status.J;
					AddIndexToIndexArray(currentIndex);
					((ArrayIterator)arrayIterator).SetElementsBackColor(indexArray,status.当前背景色,status.图形背景色);

					if(status.R[status.J - 1] < ch[0] || status.J <= status.I)
					{
						CurrentLine = 7;
						return;
					}
					break;
				case 5:  //j--;
					status.CanEdit = true;
					status.J--;
					glyphJ = ((ArrayIterator)arrayIterator).GetGlyphByIndex(status.J);
					if(glyphJ != null)
					{
						nullIteratorJ = new VerticalPointer(glyphJ.Bounds.X + 10,glyphJ.Bounds.Y + glyphJ.Bounds.Height + 2,Color.Red,"j",GlyphAppearance.Flat).CreateIterator();
					}
					CurrentLine = 4;
					return;
				case 7:  //if(j > i){
					if(status.J <= status.I)
					{
						CurrentLine = 10;
						return;
					}
					break;
				case 8:  //R[i] = R[j]; i++;
					AssignValue(status.I,status.J);

					string c = status.R[status.J - 1].ToString();
					status.CanEdit = true;
					status.R = status.R.Remove(status.I - 1,1);
					status.CanEdit = true;
					status.R = status.R.Insert(status.I - 1,c);
					status.CanEdit = true;
					status.I++;
					glyphI = ((ArrayIterator)arrayIterator).GetGlyphByIndex(status.I);
					if(glyphI != null)
					{
						nullIteratorI = new VerticalPointer(glyphI.Bounds.X - 10,glyphI.Bounds.Y + glyphI.Bounds.Height + 2,Color.Red,"i",GlyphAppearance.Flat).CreateIterator();
					}
					CurrentLine = 10;
					return;
				case 10: //while(R[i].key <= R[0].key && j > i){
					glyphI = ((ArrayIterator)arrayIterator).GetGlyphByIndex(status.I);
					if(glyphI != null)
					{
						nullIteratorI = new VerticalPointer(glyphI.Bounds.X - 10,glyphI.Bounds.Y + glyphI.Bounds.Height + 2,Color.Red,"i",GlyphAppearance.Flat).CreateIterator();
					}

					indexArray.Clear();
					currentIndex = status.I;
					AddIndexToIndexArray(currentIndex);
					((ArrayIterator)arrayIterator).SetElementsBackColor(indexArray,status.当前背景色,status.图形背景色);

					if(status.R[status.I - 1] > ch[0] || status.J <= status.I)
					{
						CurrentLine = 13;
						return;
					}
					break;
				case 11: //i++;
					status.CanEdit = true;
					status.I++;
					glyphI = ((ArrayIterator)arrayIterator).GetGlyphByIndex(status.I);
					if(glyphI != null)
					{
						nullIteratorI = new VerticalPointer(glyphI.Bounds.X - 10,glyphI.Bounds.Y + glyphI.Bounds.Height + 2,Color.Red,"i",GlyphAppearance.Flat).CreateIterator();
					}
					CurrentLine = 10;
					return;
				case 13:  //if(j > i){
					if(status.J <= status.I)
					{
						CurrentLine = 16;
						return;
					}
					break;
				case 14: //R[j] = R[i]; j--;
					AssignValue(status.J,status.I);
					string c1 = status.R[status.I - 1].ToString();
					status.CanEdit = true;
					status.R = status.R.Remove(status.J - 1,1);
					status.R = status.R.Insert(status.J - 1,c1);
					status.CanEdit = true;
					status.J--;
					glyphJ = ((ArrayIterator)arrayIterator).GetGlyphByIndex(status.J);
					if(glyphJ != null)
					{
						nullIteratorJ = new VerticalPointer(glyphJ.Bounds.X + 10,glyphJ.Bounds.Y + glyphJ.Bounds.Height + 2,Color.Red,"j",GlyphAppearance.Flat).CreateIterator();
					}
					CurrentLine = 16;
					return;
				case 16: //while(i == j);
					if(status.J != status.I)
					{
						CurrentLine = 4;
						return;
					}
					break;
				case 17: //R[i] = R[0];
					AssignValue(status.I,0);
					status.CanEdit = true;
					status.R = status.R.Remove(status.I - 1,1);
					status.CanEdit = true;
					status.R = status.R.Insert(status.I - 1,ch);
					break;
				case 18: //return;
					return;
			}
			CurrentLine++;
		}
Ejemplo n.º 49
0
 protected virtual void ReOffsetContactPoint(IGlyph contact, Point point)
 {
     contact.OffsetChanged -= new OffsetChangedHandler (contactPoint_OffsetChanged);
     contact.Offset (point);
     contact.OffsetChanged += new OffsetChangedHandler (contactPoint_OffsetChanged);
 }
Ejemplo n.º 50
0
		protected override void contactPoint_OffsetChanged(IGlyph glyph, OffsetEventArgs offsetEventArgs)
		{
			Point offset = offsetEventArgs.Offset;
			int index = _ContactPoints.IndexOf (glyph);
			if (glyph is IOperationPortGlyph)
			{
				_Bounds.Offset (offset);
				foreach (IGlyph contactPoint in ContactPoints)
				{
					if (contactPoint is IOperationContactPointGlyph)
					{
						ReOffsetContactPoint (contactPoint, offset);
					}
				}
			} 
			else 
			{
				switch (index)
				{
					case 0: 
					{
						_Bounds.X += offset.X; 
						_Bounds.Width -= offset.X; 
						_Bounds.Height += offset.Y;
						ReOffsetContactPoint (2, offset); 
						ReOffsetContactPoint (3, offset);
					} break;
					case 1: 
					{
						_Bounds.Width += offset.X; 
						_Bounds.Height += offset.Y; 
						ReOffsetContactPoint (2, offset);
						ReOffsetContactPoint (3, offset);
					} break;
					case 2: 
					{ 
						_Bounds.Y += offset.Y; 
						_Bounds.Height -= offset.Y; 
						_Bounds.Width += offset.X; 
						ReOffsetContactPoint (0, offset);
						ReOffsetContactPoint (1, offset);
					} break;
					case 3: 
					{
						_Bounds.Height += offset.Y; 
						_Bounds.Width += offset.X; 
						ReOffsetContactPoint (0, offset);
						ReOffsetContactPoint (1, offset);
					} break;
				}
			}
		}
Ejemplo n.º 51
0
 public bool ContainsGlyph(IGlyph glyph)
 {
     return false;
 }
Ejemplo n.º 52
0
 protected override void contactPoint_OffsetChanged(IGlyph glyph, OffsetEventArgs offsetEventArgs)
 {
     int index = _ContactPoints.IndexOf (glyph);
     switch (index)
     {
         case 0:
         {
             _From.Offset (offsetEventArgs.Offset.X, offsetEventArgs.Offset.Y);
         } break;
         case 1:
         {
             _To.Offset (offsetEventArgs.Offset.X, offsetEventArgs.Offset.Y);
         } break;
     }
 }
 Rectangle GetBoundsFrom(Point point, IGlyph glyph)
 {
     Rectangle bounds = glyph.Bounds;
     return new Rectangle (point, bounds.Size);
 }
Ejemplo n.º 54
0
 protected virtual void AddContactPoint(IGlyph contactPoint)
 {
     contactPoint.Owner = this;
     _ContactPoints.Add (contactPoint);
     contactPoint.OffsetChanged += new OffsetChangedHandler(contactPoint_OffsetChanged);
 }
 public OperationContactPointGlyph(Rectangle bounds, IGlyph parent, OffsetChangedHandler positionAlg)
     : base(bounds)
 {
     this.Parent = parent;
     _PositionAlg = positionAlg;
 }
        public void SelectGlyph(IGlyph glyph)
        {
            glyph.Selected = true;

            DoGlyphChange (glyph);
        }
Ejemplo n.º 57
0
		public void PushGlyph(IGlyph glyph)
		{
			arrayList.Add(glyph);
		}
 protected void DoGlyphChange(IGlyph glyph)
 {
     _GlyphPropertyWindow.Glyph = glyph;
 }
Ejemplo n.º 59
0
 protected override void contactPoint_OffsetChanged(IGlyph glyph, OffsetEventArgs offsetEventArgs)
 {
     Point offset = offsetEventArgs.Offset;
     int index = _ContactPoints.IndexOf (glyph);
     switch (index)
     {
         case 0:
         {
             _Bounds.X += offset.X;
             _Bounds.Width -= offset.X;
             _Bounds.Height += offset.Y;
             ReOffsetContactPoint (2, offset);
             ReOffsetContactPoint (3, offset);
         } break;
         case 1:
         {
             _Bounds.Width += offset.X;
             _Bounds.Height += offset.Y;
             ReOffsetContactPoint (2, offset);
             ReOffsetContactPoint (3, offset);
         } break;
         case 2:
         {
             _Bounds.Y += offset.Y;
             _Bounds.Height -= offset.Y;
             _Bounds.Width += offset.X;
             ReOffsetContactPoint (0, offset);
             ReOffsetContactPoint (1, offset);
         } break;
         case 3:
         {
             _Bounds.Height += offset.Y;
             _Bounds.Width += offset.X;
             ReOffsetContactPoint (0, offset);
             ReOffsetContactPoint (1, offset);
         } break;
     }
 }
 private void creator_GlyphCreated(IGlyph glyph)
 {
     if (resetToHandCheckBox.Checked)
     {
         SelectMoveInteractor ();
     }
 }