/// <summary>
        /// Gets the crossection / overlap area / with <c>operant</c>
        /// </summary>
        /// <param name="operand">The operand to get overlap with</param>
        /// <returns>Area of overlap between this and <c>operand</c> area</returns>
        public selectRangeArea getCrossection(selectRangeArea operand)
        {
            selectRangeArea output = new selectRangeArea(this.x, this.y, this.width, this.height);

            if (operand.x > output.x)
            {
                output.TopLeft.x = operand.x;
            }
            if (operand.y > output.y)
            {
                output.TopLeft.y = operand.y;
            }
            if (operand.BottomRight.x < output.BottomRight.x)
            {
                output.BottomRight.x = operand.BottomRight.x;
            }
            if (operand.BottomRight.y < output.BottomRight.y)
            {
                output.BottomRight.y = operand.BottomRight.y;
            }

            output.setToChanged();

            return(output);
        }
        /// <summary>
        /// Gets the horizontal axis.
        /// </summary>
        /// <param name="atY">At y.</param>
        /// <param name="atH">At h.</param>
        /// <returns></returns>
        public selectRange GetHorizontalAxis(Int32 atY, Int32 atH = 1)
        {
            selectRangeArea output = new selectRangeArea(x, atY);

            output.x = x;

            output.y      = atY;
            output.width  = width;
            output.height = atH;
            return(output);
        }
        /// <summary>
        /// Gets the vertical axis.
        /// </summary>
        /// <param name="atX">At x.</param>
        /// <param name="atW">At w.</param>
        /// <returns></returns>
        public selectRangeArea GetVerticalAxis(Int32 atX, Int32 atW = 1)
        {
            selectRangeArea output = new selectRangeArea(atX, y);

            output.x = atX;

            output.y      = y;
            output.width  = atW;
            output.height = height;
            return(output);
        }
예제 #4
0
 /// <summary>
 /// Defines variator zone with odd/even, normal/major/minor vertical, head/headExtension/foot/footExtension, normal/left/right horizontal detection.
 /// </summary>
 /// <param name="__area">The area.</param>
 /// <param name="minorLine">Minor line is every Nth. 0 will disable this alternation</param>
 /// <param name="majorLine">Major line is every Nth. 0 will disable this alternation</param>
 /// <param name="__headZone">The head zone - the top N rows</param>
 /// <param name="__footZone">The foot zone - the last N rows</param>
 /// <param name="__headZoneExtension">The head zone extension are N rows after headZone</param>
 /// <param name="__footZoneExtension">The foot zone extension are N rows before footZone</param>
 /// <param name="__leftZone">The left zone is N columns from left</param>
 /// <param name="__rightZone">The right zone is N columns from right</param>
 public cursorVariator(selectRangeArea __area, Int32 minorLine = 5, Int32 majorLine = 0, Int32 __headZone = 1, Int32 __footZone = 1, Int32 __headZoneExtension = 0, Int32 __footZoneExtension = 0, Int32 __leftZone = 0, Int32 __rightZone = 0)
 {
     _minor             = minorLine;
     _major             = majorLine;
     _headZone          = __footZone;
     _footZone          = __footZone;
     _leftZone          = __leftZone;
     _headZoneExtension = __headZoneExtension;
     _footZoneExtension = __footZoneExtension;
     _rightZone         = __rightZone;
     _area = __area;
 }
예제 #5
0
        /// <summary>
        /// Selects the zone area in.
        /// </summary>
        /// <param name="direction">The direction.</param>
        /// <param name="steps">The steps.</param>
        /// <returns></returns>
        public selectRangeArea selectZoneAreaIn(textCursorZoneCorner direction, Int32 steps = 1)
        {
            Int32 __x = x;
            Int32 __y = y;

            for (int i = 0; i < steps; i++)
            {
                moveInDirection(direction, i);
            }
            selectRangeArea output = new selectRangeArea(__x, __y, x, y);

            moveTo(__x, __y);
            return(output);
        }
        /// <summary>
        /// Adds the specified path.
        /// </summary>
        /// <param name="__path">The path.</param>
        /// <param name="item">The item.</param>
        /// <param name="doClose">if set to <c>true</c> [do close].</param>
        /// <returns></returns>
        public selectRangeAreaNamed Add(String __path, selectRangeArea item, Boolean doClose = false)
        {
            selectRangeAreaNamed tmp = new selectRangeAreaNamed(__path, item.x, item.y);

            if (doClose)
            {
                tmp.setEnd(item.BottomRight.x, item.BottomRight.y);
            }

            //tmp.resize(item.width, item.height);

            items.Add(tmp.path, tmp);
            history.Add(tmp.path);
            return(tmp);
        }
예제 #7
0
        /// <summary>
        /// Selects the current zone RangeArea accorting to marigin, pading and ZoneMode
        /// </summary>
        /// <returns>Area struct with coordinates and dimensions</returns>
        public selectRangeArea selectZoneArea()
        {
            Int32       __x         = x;
            Int32       __y         = y;
            selectRange cursorStart = new selectRange(x, y);

            moveToCorner(textCursorZoneCorner.UpLeft);
            selectRange zoneTopLeft = new selectRange(x, y);

            moveToCorner(textCursorZoneCorner.DownRight);
            x = __x;
            y = __y;
            selectRangeArea output = new selectRangeArea(zoneTopLeft.x, zoneTopLeft.y, x, y);

            return(output);
        }
예제 #8
0
        /// <summary>
        /// Vraca rastojanje izmedju trenutne pozicije kursora i datog kraja/coska
        /// </summary>
        /// <param name="__corner">The corner.</param>
        /// <returns></returns>
        public selectRangeArea selectAreaToCorner(textCursorZoneCorner __corner = textCursorZoneCorner.default_corner)
        {
            if (__corner == textCursorZoneCorner.default_corner)
            {
                __corner = default_direction;
            }
            Int32 __x = x;
            Int32 __y = y;

            moveToCorner(__corner);
            Int32           _dX = x - __x;
            Int32           _dY = y - __y;
            selectRangeArea res = new selectRangeArea(__x, __y, _dX, _dY);

            x = __x;
            y = __y;

            return(res);
        }
        /// <summary>
        /// Gets the boundary rectangle to hold all subzones with the specified role.
        /// </summary>
        /// <param name="role">The role of subzone or subzones to select</param>
        /// <param name="scope">The scope to look into for each subzone</param>
        /// <returns></returns>
        public selectRangeArea getBoundaryOf(cursorZoneRole role, textCursorZone scope = textCursorZone.innerZone)
        {
            selectRangeArea range = null; //new selectRangeArea(0,0,0,0);
            String          key   = role.ToString();

            foreach (KeyValuePair <string, cursorZone> z in items)
            {
                if (z.Key.StartsWith(key, StringComparison.InvariantCultureIgnoreCase))
                {
                    if (range == null)
                    {
                        range = z.Value.selectRangeArea(scope);
                    }
                    else
                    {
                        range.expandToWrap(z.Value.selectRangeArea(scope));
                    }
                }
            }
            return(range);
        }
예제 #10
0
        /// <summary>
        /// Gets the pencil according to <see cref="pencilType"/>
        /// </summary>
        /// <param name="ptype">The ptype.</param>
        /// <returns>area covered by pencil</returns>
        /// <exception cref="System.ArgumentOutOfRangeException"></exception>
        public selectRangeArea getPencil(pencilType ptype, Int32 thickness = 0)
        {
            selectRangeArea output = new selectRangeArea(x, y, x, y);

            switch (ptype)
            {
            case pencilType.point:
                return(output);

                break;

            case pencilType.active:
                return(pencilAbsolute);

                break;

            case pencilType.useDefault:
                return(projectArea(pencilDefault));

                break;

            case pencilType.zoneHorizontal:
                output.reset(frame.left(currentZone), y, frame.getWidth(currentZone), thickness);
                break;

            case pencilType.zoneVertical:
                output.reset(x, frame.top(currentZone), thickness, frame.getHeight(currentZone));
                break;

            case pencilType.zoneArea:
                output.reset(frame.left(currentZone), frame.top(currentZone), frame.getWidth(currentZone), frame.getHeight(currentZone));
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            return(output);
        }
예제 #11
0
        /// <summary>
        /// Expands this rangeArea to have specified rangeArea inside its boundaries
        /// </summary>
        /// <param name="areaToWrap">The area to wrap.</param>
        public void expandToWrap(selectRangeArea areaToWrap)
        {
            if (areaToWrap.BottomRight.x > BottomRight.x)
            {
                BottomRight.x = areaToWrap.BottomRight.x;
            }

            if (areaToWrap.BottomRight.y > BottomRight.y)
            {
                BottomRight.y = areaToWrap.BottomRight.y;
            }

            if (areaToWrap.TopLeft.x < TopLeft.x)
            {
                TopLeft.x = areaToWrap.TopLeft.x;
            }

            if (areaToWrap.TopLeft.y < TopLeft.y)
            {
                TopLeft.y = areaToWrap.TopLeft.y;
            }

            isChanged = true;
        }
예제 #12
0
        public selectRangeArea selectZonePoint()
        {
            selectRangeArea output = new selectRangeArea(x, y, x, y);

            return(output);
        }
예제 #13
0
        /// <summary>
        /// Projects an area onto current cursor position and returns its crosection with allowed zone frame  area if it colides with current frame zone
        /// </summary>
        /// <param name="area">The area.</param>
        /// <returns>area or part of area within allowed zone frame</returns>
        public selectRangeArea projectArea(selectRangeArea area)
        {
            selectRangeArea output = new selectRangeArea(x, y, x + area.width, y + area.height);

            return(frame.selectRangeArea(currentZone).getCrossection(output));
        }