Exemple #1
0
        public IBlockView ChildHasPoint(Point p, Point origin)
        {
            int y = 0;

            for (int i = 0; i < elements.Count; ++i)
            {
                IBlockView v  = elements[i];
                Point      rp = new Point(0, y);

                if (v.HasPoint(p, origin.Offseted(rp.X, rp.Y)))
                {
                    IBlockView c = v.ChildHasPoint(p, origin.Offseted(rp.X, rp.Y));
                    if (i == 0 && c == v)
                    {
                        // selecting the first block-> select whole stack
                        // but selecting a proper child of the first block should
                        // go normally
                        return(this);
                    }
                    else
                    {
                        return(c);
                    }
                }
                y += elementBitmaps[i].Height - BlockStackView.NotchHeight;
            }
            return(this);
        }
Exemple #2
0
        public IBlockView ChildHasPoint(Point p, Point origin)
        {
            for (int i = 0; i < Contents.Count; ++i)
            {
                IBlockView v  = Contents[i];
                Point      rp = new Point(0, layoutOffsets[i * 2]); // notice that contentOffsets also holds the offset
                if (v.HasPoint(p, origin.Offseted(rp.X, rp.Y)))     // of the "side" graphics, not just the content views
                {
                    IBlockView chp = v.ChildHasPoint(p, origin.Offseted(rp.X, rp.Y));
                    if (chp == v)
                    {
                        return(this);
                    }
                    else
                    {
                        return(chp);
                    }
                }
            }

            for (int i = 0; i < Scripts.Count; ++i)
            {
                IBlockView v  = Scripts[i];
                Point      rp = scriptOffsets[i];
                if (v.HasPoint(p, origin.Offseted(rp.X, rp.Y)))
                {
                    return(v.ChildHasPoint(p, origin.Offseted(rp.X, rp.Y)));
                }
            }
            return(this);
        }
Exemple #3
0
 public IBlockView ChildHasPoint(Point p, Point origin)
 {
     for (int i = 0; i < argViews.Count; ++i)
     {
         IBlockView v  = argViews[i];
         Point      rp = v.RelativePos;
         if (!trueArgs[i] && !(v is ITextualView))
         {
             continue;
         }
         if (v.HasPoint(p, origin.Offseted(rp.X, rp.Y)))
         {
             return(v.ChildHasPoint(p, origin.Offseted(rp.X, rp.Y)));
         }
     }
     return(this);
 }
Exemple #4
0
        private IBlockView HitTest(Point p)
        {
            IBlockView hit = null;

            foreach (KeyValuePair <IBlockView, Point> kv in allViews)
            {
                IBlockView v        = kv.Key;
                Point      location = kv.Value;

                if (v.HasPoint(p, location))
                {
                    hit = v.ChildHasPoint(p, location);
                    break;
                }
            }
            return(hit);
        }
Exemple #5
0
        public IBlockView ChildHasPoint(System.Drawing.Point p, System.Drawing.Point origin)
        {
            IBlockView v  = invokationContent;
            Point      rp = v.RelativePos;

            if (v.HasPoint(p, origin.Offseted(rp.X, rp.Y)))
            {
                IBlockView cv = v.ChildHasPoint(p, origin.Offseted(rp.X, rp.Y));
                if (cv != v)
                {
                    return(cv);
                }
                else
                {
                    return(this);
                }
            }

            return(this);
        }
Exemple #6
0
        public void MarkSelectedView(Point p)
        {
            IBlockView oldMarked = canvasView.Marked;
            string     oldStatus = status;

            status = "";
            IBlockView marked = null;

            foreach (KeyValuePair <IBlockView, Point> kv in allViews)
            {
                IBlockView v        = kv.Key;
                Point      location = kv.Value;

                if (v.HasPoint(p, location))
                {
                    marked = v;
                    status = string.Format("({0},{1}) | Subview under mouse: {2}", p.X, p.Y, v.ChildHasPoint(p, location));
                    break;
                }
            }
            canvasView.Marked = marked;
            if (status != oldStatus || marked != oldMarked)
            {
                Rectangle invalidated = Rectangle.Empty;
                if (marked != null)
                {
                    invalidated = Rectangle.Union(invalidated, ViewBounds(marked));
                }

                if (oldMarked != null)
                {
                    invalidated = Rectangle.Union(invalidated, ViewBounds(oldMarked));
                }
                Update(invalidated);
            }
        }