Esempio n. 1
0
 protected BaseCreateControl(StageBox editor, TPoint startPosition, TPoint endPosition, ControlBase createdControl)
 {
     m_editPanel = editor;
     m_startPosition = startPosition;
     m_endPosition = endPosition;
     m_createControl = createdControl;
 }
Esempio n. 2
0
        /// <summary>
        /// Renders the key in the specified surface.
        /// </summary>
        /// <param name="g">The GDI+ surface to render on.</param>
        /// <param name="scrollCount">The number of times the direction has been scrolled within the timeout.</param>
        public void Render(Graphics g, int scrollCount)
        {
            var pressed = scrollCount > 0;
            var style = GlobalSettings.CurrentStyle.TryGetElementStyle<KeyStyle>(this.Id)
                            ?? GlobalSettings.CurrentStyle.DefaultKeyStyle;
            var defaultStyle = GlobalSettings.CurrentStyle.DefaultKeyStyle;
            var subStyle = pressed ? style?.Pressed ?? defaultStyle.Pressed : style?.Loose ?? defaultStyle.Loose;

            var text = pressed ? scrollCount.ToString() : this.Text;
            var txtSize = g.MeasureString(text, subStyle.Font);
            var txtPoint = new TPoint(
                this.TextPosition.X - (int)(txtSize.Width / 2),
                this.TextPosition.Y - (int)(txtSize.Height / 2));

            // Draw the background
            var backgroundBrush = this.GetBackgroundBrush(subStyle, pressed);
            g.FillPolygon(backgroundBrush, this.Boundaries.ConvertAll<Point>(x => x).ToArray());

            // Draw the text
            g.SetClip(this.GetBoundingBox());
            g.DrawString(text, subStyle.Font, new SolidBrush(subStyle.Text), (Point)txtPoint);
            g.ResetClip();

            // Draw the outline.
            if (subStyle.ShowOutline)
                g.DrawPolygon(new Pen(subStyle.Outline, 1), this.Boundaries.ConvertAll<Point>(x => x).ToArray());
        }
Esempio n. 3
0
File: Rect.cs Progetto: microm/eplib
 public Rect(TPoint pointA, TPoint pointB)
 {
     left = Math.Min(pointA.X, pointB.X);
     top = Math.Min(pointA.Y, pointB.Y);
     right = Math.Max(pointA.X , pointB.X);
     bottom = Math.Max(pointA.Y , pointB.Y);
 }
Esempio n. 4
0
        public override void OnMouseEvent(MouseEvent mouseEvent)
        {
            TPoint currentOffset = mouseEvent.Info.position - mouseEvent.PreviousPosition;

            switch ( mouseEvent.State )
            {
                case MouseEvent.EventState.Move:
                    {
                        Move(currentOffset, m_controls);
                        m_offset += currentOffset;
                    }
                    break;
                case MouseEvent.EventState.LUp:
                    {
                        Move(-m_offset,m_controls);
                        m_offset += currentOffset;
                        ICommand command = new MoveControl(m_controls, m_offset);
                        m_commandManager.CurrentCommand = command;
                        m_commandManager.Execute();

                        m_stateManager.ChangeState( StateType.Idle );
                    }
                    break;
            }
        }
Esempio n. 5
0
File: Rect.cs Progetto: microm/eplib
 public Rect(TPoint position, int width, int height)
 {
     left = position.X;
     top = position.Y;
     this.right = left + width;
     this.bottom = top + height;
 }
Esempio n. 6
0
        public static void Resize(FlagPosition flagPosition,  TPoint offset , Controls controls)
        {
            foreach (ControlBase control in controls)
            {
                Rect controlRect = control.Rect;

                if ((flagPosition & FlagPosition.Left) == FlagPosition.Left)
                {
                    controlRect.Left = controlRect.Left + offset.X;
                }
                else if ((flagPosition & FlagPosition.Right) == FlagPosition.Right)
                {
                    controlRect.Right = controlRect.Right + offset.X;
                }

                if ((flagPosition & FlagPosition.Top) == FlagPosition.Top)
                {
                    controlRect.Top = controlRect.Top + offset.Y;
                }
                else if ((flagPosition & FlagPosition.Bottom) == FlagPosition.Bottom)
                {
                    controlRect.Bottom = controlRect.Bottom + offset.Y;
                }
                control.Rect = controlRect;
            }
        }
Esempio n. 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="KeyDefinition" /> class.
 /// </summary>
 /// <param name="id">The identifier of the key.</param>
 /// <param name="boundaries">The boundaries.</param>
 /// <param name="keyCodes">The keycodes.</param>
 /// <param name="text">The text of the key.</param>
 /// <param name="textPosition">The position of the text.</param>
 protected KeyDefinition(int id, List<TPoint> boundaries, List<int> keyCodes, string text, TPoint textPosition)
 {
     this.Id = id;
     this.Boundaries = boundaries;
     this.KeyCodes = keyCodes;
     this.Text = text;
     this.TextPosition = textPosition;
 }
Esempio n. 8
0
 public bool ExistsAnchorUnder(TPoint position)
 {
     foreach (Anchors anchor in m_anchors)
     {
         if (anchor.ExistsUnder(position))
         {
             return true;
         }
     }
     return false;
 }
Esempio n. 9
0
 public ControlBase ControlInRect(TPoint position)
 {
     foreach (Anchors anchor in m_anchors)
     {
         if (anchor.Rect.Has(position))
         {
             return anchor.Control;
         }
     }
     return null;
 }
Esempio n. 10
0
        public static void Move(TPoint offset,Controls controls)
        {
            foreach (ControlBase control in controls)
            {
                Rect currentRect = control.Rect;

                currentRect.Left += offset.X;
                currentRect.Top += offset.Y;

                control.Rect = currentRect;
            }
        }
Esempio n. 11
0
        public FlagPosition GetFlag(TPoint position)
        {
            foreach (Anchors anchor in m_anchors)
            {
                FlagPosition flag = anchor.GetFlag(position);
                if (flag != FlagPosition.None)
                {
                    return flag;
                }
            }

            return FlagPosition.None;
        }
Esempio n. 12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="KeyboardKeyDefinition" /> class.
 /// </summary>
 /// <param name="id">The identifier of the key.</param>
 /// <param name="boundaries">The boundaries.</param>
 /// <param name="keyCodes">The keycodes.</param>
 /// <param name="text">The normal text.</param>
 /// <param name="textPosition">The position of the text.</param>
 /// <param name="shiftText">The shift text.</param>
 /// <param name="changeOnCaps">Whether to change to shift text on caps lock.</param>
 public KeyboardKeyDefinition(
     int id,
     List<TPoint> boundaries,
     List<int> keyCodes,
     string text,
     string shiftText,
     bool changeOnCaps,
     TPoint textPosition)
     : base(id, boundaries, keyCodes, text, textPosition)
 {
     this.ShiftText = shiftText;
     this.ChangeOnCaps = changeOnCaps;
 }
Esempio n. 13
0
        /// <summary> Calcualate layout after a position or size change. </summary>
        /// <remarks> This method is defined at XrwRectObj for compatibility, but must be implemented for composite widgets only. </remarks>
        public void CalculateChildLayout()
        {
            TPoint childPosition = new TPoint(_borderWidth, _borderWidth);
            TSize  requestedSize = new TSize(0, 0);

            List <ChildData> childData = new List <ChildData>();

            for (int counter = 0; counter < _children.Count; counter++)
            {
                TSize preferredSize = _children[counter].PreferredSize();
                childData.Add(new ChildData(_children[counter], preferredSize));

                if (requestedSize.Width < preferredSize.Width)
                {
                    requestedSize.Width = preferredSize.Width;
                }
                requestedSize.Height += preferredSize.Height;
                if (counter > 0)
                {
                    requestedSize.Height += _vertSpacing;
                }
            }
            requestedSize.Width  = Math.Max(MIN_WIDTH, requestedSize.Width);
            requestedSize.Height = Math.Max(MIN_HEIGHT, requestedSize.Height);

            for (int counter = 0; counter < childData.Count; counter++)
            {
                ChildData cd = childData[counter];

                cd.Widget._assignedPosition.X = childPosition.X;
                cd.Widget._assignedPosition.Y = childPosition.Y;

                cd.Widget._assignedSize.Width  = requestedSize.Width;
                cd.Widget._assignedSize.Height = cd.Size.Height;

                childPosition.Y = childPosition.Y + cd.Size.Height + _vertSpacing;
            }
            this._assignedSize.Width  = requestedSize.Width + 2 * _borderWidth;
            this._assignedSize.Height = requestedSize.Height + 2 * _borderWidth;
        }
Esempio n. 14
0
            internal void Init(TPoint p0, TPoint p1, double[] vec)
            {
                var dim      = vec.Length;
                var scale    = new double[dim].Set(0.0);
                var invDelta = new double[dim];

                for (int d = 0; d < dim; d++)
                {
                    invDelta[d] = Fun.IsTiny(vec[d]) ? 0.0 : 1.0 / vec[d];
                }

                // Compute the scaling factors due to the projection of the
                // cylinder around the line onto the coorindate planes.
                for (int d0 = 0; d0 < dim - 1; d0++)
                {
                    var dx0 = vec[d0];
                    for (int d1 = d0 + 1; d1 < dim; d1++)
                    {
                        var dx1 = vec[d1];
                        var s   = Fun.Sqrt(dx0 * dx0 + dx1 * dx1);
                        var s0  = Fun.IsTiny(dx1)
                                    ? double.MaxValue : s / Fun.Abs(dx1);
                        if (s0 > scale[d0])
                        {
                            scale[d0] = s0;
                        }
                        var s1 = Fun.IsTiny(dx0)
                                    ? double.MaxValue : s / Fun.Abs(dx0);
                        if (s1 > scale[d1])
                        {
                            scale[d1] = s1;
                        }
                    }
                }
                MinP     = p0; MaxP = p1;
                P0       = p0; P1 = p1;
                InvDelta = invDelta; Scale = scale;
            }
Esempio n. 15
0
        virtual public bool canMove(int teamId, TPoint from, TPoint to)
        {
            if (TPoint.manhattan(from, to) != 1)
            {
                return(false);
            }
            IGhost tar = getGhost(from);

            if (tar == null || tar.getTeamId() != teamId)
            {
                return(false);
            }

            /*
             * if (isInGoal(teamId, to))
             * {
             *  if (tar.getType() == GhostType.Good)
             *  {
             *      return true;
             *  }
             *  else
             *  {
             *      return false;
             *  }
             * }
             */
            if (!isInField(to))
            {
                return(false);
            }
            IGhost next = getGhost(to);

            if (next != null && next.getTeamId() == teamId)
            {
                return(false);
            }
            return(true);
        }
Esempio n. 16
0
 /// <summary>
 /// Returns a new version of this element definition with the specified properties changed.
 /// </summary>
 /// <param name="boundaries">The new boundaries, or <c>null</c> if not changed.</param>
 /// <param name="deviceId">The new Device Id, or <c>null</c> if not changed.</param>
 /// <param name="buttonNumber">The new Button Number, or <c>0</c> if not changed.</param>
 /// <param name="text">The new text, or <c>null</c> if not changed.</param>
 /// <param name="shiftText">The new shift text, or <c>null</c> if not changed.</param>
 /// <param name="changeOnCaps">The new change on caps, or <c>null</c> if not changed.</param>
 /// <param name="textPosition">The new text position, or <c>null</c> if not changed.</param>
 /// <returns>The new element definition.</returns>
 public DirectInputAxisDefinition Modify(
     List <TPoint> boundaries = null, string deviceId     = null, string axisOne = null, string axisTwo   = null, int axisOneMax = 0, int axisTwoMax = 0, int stickWidth = 0, int stickHeight = 0,
     int invertAxisOne        = -1, int invertAxisTwo     = -1, string text      = null, string shiftText = null,
     bool?changeOnCaps        = null, TPoint textPosition = null)
 {
     return(new DirectInputAxisDefinition(
                this.Id,
                boundaries ?? this.Boundaries.Select(x => x.Clone()).ToList(),
                text ?? this.Text,
                shiftText ?? this.ShiftText,
                deviceId != null && Guid.Parse(deviceId) != Guid.Empty ? Guid.Parse(deviceId) : this.DeviceId,
                changeOnCaps ?? this.ChangeOnCaps,
                axisOne ?? this.AxisOne,
                axisTwo ?? this.AxisTwo,
                axisOneMax != 0 ? axisOneMax : this.AxisOneMax,
                axisTwoMax != 0 ? axisTwoMax : this.AxisTwoMax,
                stickWidth != 0 ? stickWidth : this.StickWidth,
                stickHeight != 0 ? stickHeight : this.StickHeight,
                invertAxisOne != -1 ? invertAxisOne : this.InvertAxisOne,
                invertAxisTwo != -1 ? invertAxisTwo : this.InvertAxisTwo,
                textPosition ?? this.TextPosition,
                this.CurrentManipulation));
 }
Esempio n. 17
0
        /// <summary>
        /// Adds a boundary on the edge that is highlighted.
        /// </summary>
        /// <param name="location">To location to add the point at.</param>
        /// <returns>The new version of this key definition with the boundary added.</returns>
        public override KeyDefinition AddBoundary(TPoint location)
        {
            if (this.CurrentManipulation == null)
            {
                return(this);
            }
            if (this.CurrentManipulation.Type != ElementManipulationType.MoveEdge)
            {
                throw new Exception("Attempting to add a boundary to something other than an edge.");
            }

            var newBoundaries = this.Boundaries.ToList();

            newBoundaries.Insert(this.CurrentManipulation.Index + 1, location);

            return(new MouseScrollDefinition(
                       this.Id,
                       newBoundaries,
                       this.KeyCodes.Single(),
                       this.Text,
                       GlobalSettings.Settings.UpdateTextPosition ? null : this.TextPosition,
                       this.CurrentManipulation));
        }
Esempio n. 18
0
        /// <summary>
        /// Handles updating a boundary, sets the new boundaries and invokes the changed event.
        /// </summary>
        private void btnUpdateBoundary_Click(object sender, EventArgs e)
        {
            if (this.lstBoundaries.SelectedItem == null)
            {
                return;
            }

            var updateIndex = this.lstBoundaries.SelectedIndex;
            var newBoundary = new TPoint(this.txtBoundaries.X, this.txtBoundaries.Y);

            if (this.lstBoundaries.Items.Cast <TPoint>().Any(p => p.X == newBoundary.X && p.Y == newBoundary.Y))
            {
                return;
            }

            this.lstBoundaries.Items.RemoveAt(updateIndex);
            this.lstBoundaries.Items.Insert(updateIndex, newBoundary);
            this.lstBoundaries.SelectedIndex = updateIndex;

            this.currentDefinition =
                this.currentDefinition.ModifyMouse(boundaries: this.lstBoundaries.Items.Cast <TPoint>().ToList());
            this.DefinitionChanged?.Invoke(this.currentDefinition);
        }
        /// <summary> Calcualate layout after a position or size change. </summary>
        /// <remarks> This method is defined at XrwRectObj for compatibility, but must be implemented for composite widgets only. </remarks>
        public void CalculateChildLayout()
        {
            TPoint           childPosition         = new TPoint(_borderWidth, _borderWidth);
            List <ChildData> childData             = new List <ChildData>();
            TSize            childrenPreferredSize = new TSize(0, 0);

            for (int counter = 0; counter < _children.Count; counter++)
            {
                TSize preferredSize = _children[counter].PreferredSize();
                childData.Add(new ChildData(_children[counter], preferredSize));

                if (childrenPreferredSize.Width < preferredSize.Width)
                {
                    childrenPreferredSize.Width = preferredSize.Width;
                }
                if (childrenPreferredSize.Height < preferredSize.Height)
                {
                    childrenPreferredSize.Height = preferredSize.Height;
                }
            }

            for (int counter = 0; counter < childData.Count; counter++)
            {
                ChildData cd = childData[counter];

                if (cd.Widget.ExpandToAvailableWidth == true)
                {
                    cd.Size.Width = childrenPreferredSize.Width;
                }
                if (cd.Widget.ExpandToAvailableHeight == true)
                {
                    cd.Size.Height = childrenPreferredSize.Height;
                }

                GeometryManagerAccess.SetAssignedGeometry(cd.Widget, childPosition, cd.Size);
            }
        }
Esempio n. 20
0
 public override void OnMouseEvent(MouseEvent mouseEvent)
 {
     switch(mouseEvent.State)
     {
         case MouseEvent.EventState.LDown:
             {
                 m_startPosition = mouseEvent.Info.position;
             }
             break;
         case MouseEvent.EventState.LUp:
             {
                 if (CanControlAdd(m_createCommand.CheckImage) == false)
                 {
                     return;
                 }
                 m_createCommand.StartPosition = m_startPosition;
                 m_createCommand.EndPosition = mouseEvent.Info.position;
                 m_commandManager.CurrentCommand = m_createCommand;
                 m_commandManager.Execute();
                 m_stateManager.ChangeState( StateType.Idle );
             }
             break;
     }
 }
Esempio n. 21
0
        /// <summary> Initialize local ressources for all constructors. </summary>
        /// <param name="assignedPosition"> The position of the top left top corner assigned by the window manager (for shell widgets) or geometry management (by non-shell widgets). Passed as reference to avoid structure copy constructor calls. <see cref="TPoint"/> </param>
        public void InitializeOverrideShellResources(ref TPoint assignedPosition)
        {
            TInt depth = X11lib.XDefaultDepth(_display, _screenNumber);

            X11lib.WindowAttributeMask  mask       = X11lib.WindowAttributeMask.CWOverrideRedirect | X11lib.WindowAttributeMask.CWSaveUnder;
            X11lib.XSetWindowAttributes attributes = new X11lib.XSetWindowAttributes();
            attributes.override_redirect = (TBoolean)1;
            attributes.save_under        = (TBoolean)1;
            _window = X11lib.XCreateWindow(_display, X11lib.XDefaultRootWindow(_display), (TInt)assignedPosition.X, (TInt)assignedPosition.Y, (TUint)_assignedSize.Width, (TUint)_assignedSize.Height,
                                           0, depth, (TUint)X11lib.WindowClass.InputOutput, IntPtr.Zero, mask, ref attributes);
            if (_window == IntPtr.Zero)
            {
                Console.WriteLine(CLASS_NAME + "::InitializeOverrideShellResources () ERROR. Can not create menu shell.");
                return;
            }

            _hasOwnWindow = true;

            X11lib.XSelectInput(_display, _window,
                                EventMask.ExposureMask | EventMask.ButtonPressMask | EventMask.ButtonReleaseMask |
                                EventMask.EnterWindowMask | EventMask.LeaveWindowMask | EventMask.PointerMotionMask |
                                EventMask.FocusChangeMask | EventMask.KeyPressMask | EventMask.KeyReleaseMask |
                                EventMask.SubstructureNotifyMask);

            /* Create the foreground Graphics Context. */
            if (_gc != IntPtr.Zero)
            {
                if (XrwApplicationSettings.VERBOSE_OUTPUT_TO_CONSOLE)
                {
                    Console.WriteLine(CLASS_NAME + "::InitializeOverrideShellResources () Replace the foreground GC.");
                }
                X11lib.XFreeGC(_display, _gc);
                _gc = IntPtr.Zero;
            }
            _gc = X11lib.XCreateGC(_display, _window, 0, IntPtr.Zero);
        }
Esempio n. 22
0
 /// <summary>
 /// Returns a new version of this element definition with the specified properties changed.
 /// </summary>
 /// <param name="boundaries">The new boundaries, or <c>null</c> if not changed.</param>
 /// <param name="keyCode">The new key code, or <c>null</c> if not changed.</param>
 /// <param name="text">The new text, or <c>null</c> if not changed.</param>
 /// <param name="textPosition">The new text position, or <c>null</c> if not changed.</param>
 /// <returns>The new element definition.</returns>
 public override KeyDefinition ModifyMouse(List <TPoint> boundaries = null, int?keyCode = null, string text = null, TPoint textPosition = null)
 {
     return(new MouseScrollDefinition(
                this.Id,
                boundaries ?? this.Boundaries.Select(x => x.Clone()).ToList(),
                keyCode ?? this.KeyCodes.Single(),
                text ?? this.Text,
                textPosition ?? this.TextPosition,
                this.CurrentManipulation));
 }
Esempio n. 23
0
 public MouseEvent(EventState eventState, MouseInfo mouseInfo, TPoint previousPosition)
 {
     m_curInfo = mouseInfo;
     m_state = eventState;
     m_previousPosition = previousPosition;
 }
Esempio n. 24
0
 static public TPoint add(TPoint p1, Way w)
 {
     return(add(p1, fromWay(w)));
 }
Esempio n. 25
0
 static public int manhattan(TPoint p1, TPoint p2)
 {
     return(manhattan(p1.x, p1.y, p2.x, p2.y));
 }
Esempio n. 26
0
 /// <summary> Initializing constructor. </summary>
 /// <param name="display">The display pointer, that specifies the connection to the X server. <see cref="IntPtr"/> </param>
 /// <param name="screenNumber"> The appropriate screen number on the host server. <see cref="System.Int32"/> </param>
 /// <param name="parentWindow"> The X11 *** parent *** window that will be the parent for an X11 *** own ** window. <see cref="IntPtr"/> </param>
 /// <param name="assignedPosition"> The position of the top left top corner assigned by the window manager (for shell widgets) or geometry management (by non-shell widgets). <see cref="TPoint"/> </param>
 /// <param name="fixedSize"> The fixed size, that ist to use (if set) rather than the calcualated size. <see cref="TIntSize"/> </param>
 /// <param name="label"> The label to display. <see cref="System.String"/> </param>
 /// <param name="offBitmap"> The right bitmap to display. <see cref="XrwBitmap"/> </param>
 /// <param name="offShared"> Indicate wether the offBitmap is shared (desposed by caller) or private (disposed together with tis label). <see cref="System.Boolean"/> </param>
 /// <param name="onBitmap"> The left bitmap to display. <see cref="XrwBitmap"/> </param>
 /// <param name="onShared"> Indicate wether the onBitmap is shared (desposed by caller) or private (disposed together with tis label). <see cref="System.Boolean"/> </param>
 public XrwRadio(IntPtr display, X11.TInt screenNumber, IntPtr parentWindow, ref TPoint assignedPosition, ref TSize fixedSize, string label, X11Graphic offBitmap, bool offShared, X11Graphic onBitmap, bool onShared)
     : base(display, screenNumber, parentWindow, ref assignedPosition, ref fixedSize, label, offBitmap, offShared, onBitmap, onShared)
 {
 }
Esempio n. 27
0
 public bool equals(TPoint p)
 {
     return(p.x == x && p.y == y);
 }
Esempio n. 28
0
 public Move(TPoint pos, Way way)
 {
     this.pos = pos;
     this.way = way;
 }
Esempio n. 29
0
 /// <summary>
 /// Handles changing the text position, sets the new text position and invokes the changed event.
 /// </summary>
 private void txtTextPosition_ValueChanged(Controls.VectorTextBox sender, TPoint newValue)
 {
     this.UpdateTextPosition();
 }
Esempio n. 30
0
 public MouseInfo(bool leftButton, bool rightButton, TPoint position)
     : this(leftButton, false, rightButton, position, 0)
 {
 }
Esempio n. 31
0
 /// <summary>
 /// Initializes a new instance of the <see cref="KeyDefinition" /> class.
 /// </summary>
 /// <param name="id">The identifier of the key.</param>
 /// <param name="boundaries">The boundaries.</param>
 /// <param name="keyCodes">The keycodes.</param>
 /// <param name="text">The text of the key.</param>
 /// <param name="textPosition">The position of the text.</param>
 protected KeyDefinition(int id, List <TPoint> boundaries, List <int> keyCodes, string text, TPoint textPosition)
 {
     this.Id           = id;
     this.Boundaries   = boundaries;
     this.KeyCodes     = keyCodes;
     this.Text         = text;
     this.TextPosition = textPosition;
 }
Esempio n. 32
0
        /// <summary> Initializing constructor. </summary>
        /// <param name="display">The display pointer, that specifies the connection to the X server. <see cref="IntPtr"/> </param>
        /// <param name="screenNumber"> The appropriate screen number on the host server. <see cref="System.Int32"/> </param>
        /// <param name="parentWindow"> The X11 *** parent *** window that will be the parent for an X11 *** own ** window. <see cref="IntPtr"/> </param>
        /// <param name="assignedPosition"> The position of the top left top corner assigned by the window manager (for shell widgets) or geometry management (by non-shell widgets). <see cref="TPoint"/> </param>
        /// <param name="fixedSize"> The fixed size, that ist to use (if set) rather than the calcualated size. <see cref="TIntSize"/> </param>
        /// <param name="label"> The label to display. <see cref="System.String"/> </param>
        public XrwCommand(IntPtr display, X11.TInt screenNumber, IntPtr parentWindow, ref TPoint assignedPosition, ref TSize fixedSize, string label)
            : base(display, screenNumber, parentWindow, ref assignedPosition, ref fixedSize, label)
        {
            // Create a *** own *** window and exchange the *** parent ***  window against it.
            base.InitializeOwnWindow();

            InitializeCommandRessources();
        }
Esempio n. 33
0
 public MouseInfo(bool leftButton,bool middleButton, bool rightButton, TPoint position)
     : this(leftButton, middleButton, rightButton, position, 0)
 {
 }
Esempio n. 34
0
 // Prev Pos Save
 public void Update()
 {
     m_previousPosition = m_curInfo.position;
 }
Esempio n. 35
0
 public static int GetFaceTemplateUsingFeatures(int Image, ref TPoint[] FacialFeatures, out byte[] FaceTemplate)
 {
     FaceTemplate = new byte[FSDK.TemplateSize];
     return FSDK_GetFaceTemplateUsingFeatures_Old(Image, FacialFeatures, FaceTemplate);
 }
Esempio n. 36
0
        public override Move move(IField field, int teamId, int remainTurn)
        {
            List <Move> availableMoveList = new List <Move>();

            //可能なMoveをピックアップ
            while (availableMoveList.Count == 0)
            {
                //team1なら下、team0なら上方向を優先するため、その反対を一定確率で除外する。
                Way removeWay =  mRand.NextDouble() < 0.3 ? Way.Center :
                                teamId == 0 ? Way.Down : Way.Up;

                for (int y = 0; y < IField.cFieldHeight; y++)
                {
                    for (int x = 0; x < IField.cFieldWidth; x++)
                    {
                        foreach (Way w in WayUtil.way4)
                        {
                            if (w == removeWay)
                            {
                                continue;
                            }

                            if (field.canMove(teamId, new TPoint(x, y), TPoint.add(new taiyo.TPoint(x, y), TPoint.fromWay(w))))
                            {
                                availableMoveList.Add(new Move(new TPoint(x, y), w));
                            }
                        }
                    }
                }
            }


            return(availableMoveList[mRand.Next() % availableMoveList.Count]);
        }
Esempio n. 37
0
 public override ControlBase GetControlByPoint(TPoint position)
 {
     if (position.IsIn(Rect))
     {
         foreach (ControlBase child in m_layeredCollection)
         {
             ControlBase controlUnderPos = child.GetControlByPoint(position);
             if (controlUnderPos != null) return controlUnderPos;
         }
         return this;
     }
     return null;
 }
Esempio n. 38
0
        public bool IsInSelectedRect(TPoint position)
        {
            foreach (Anchors anchor in m_anchors)
            {
                if (anchor.Control is ControlContainer)
                {
                    if (anchor.MoveAnchor.rect.Has(position))
                        return true;

                    continue;
                }

                if (anchor.Rect.Has(position))
                {
                    return true;
                }
            }
            return false;
        }
Esempio n. 39
0
 private CreateButton(StageBox editor, TPoint startPosition, TPoint endPosition, ControlBase createdControl)
     : base(editor, startPosition, endPosition, createdControl)
 {
 }
Esempio n. 40
0
 public TCircle()
 {
     Center = new TPoint(); Radius = 1;
 }
Esempio n. 41
0
 public TPoint(TPoint other)
     : this(other.x, other.y)
 {
 }
Esempio n. 42
0
 public static int DetectFacialFeatures(int Image, out TPoint[] FacialFeatures)
 {
     FacialFeatures = new TPoint[FSDK.FSDK_FACIAL_FEATURE_COUNT];
     return FSDK_DetectFacialFeatures_Old(Image, FacialFeatures);
 }
Esempio n. 43
0
 static public TPoint add(TPoint p1, TPoint p2)
 {
     return(new TPoint(p1.x + p2.x, p1.y + p2.y));
 }
Esempio n. 44
0
 public static int DetectFacialFeaturesInRegion(int Image, ref TFacePosition FacePosition, out TPoint[] FacialFeatures)
 {
     FacialFeatures = new TPoint[FSDK.FSDK_FACIAL_FEATURE_COUNT];
     return FSDK_DetectFacialFeaturesInRegion_Old(Image, ref FacePosition, FacialFeatures);
 }
Esempio n. 45
0
 static public int manhattan(TPoint p, int x, int y)
 {
     return(manhattan(p.x, p.y, x, y));
 }
Esempio n. 46
0
 public static int ExtractFaceImage(int Image, ref TPoint[] FacialFeatures, int Width, int Height, ref int ExtractedFaceImage, out TPoint[] ResizedFeatures)
 {
     ResizedFeatures = new TPoint[FSDK.FSDK_FACIAL_FEATURE_COUNT];
     return FSDK_ExtractFaceImage_Old(Image, FacialFeatures, Width, Height, ref ExtractedFaceImage, ResizedFeatures);
 }
Esempio n. 47
0
 public ResizeControl(Controls controls, FlagPosition flagPosition, TPoint offset)
 {
     m_controls.Set(controls.Get());
     m_flagPosition = flagPosition;
     m_offset = offset;
 }
Esempio n. 48
0
 public static int GetFaceTemplateUsingEyes(int Image, ref TPoint[] eyeCoords, out byte[] FaceTemplate)
 {
     FaceTemplate = new byte[FSDK.TemplateSize];
     return FSDK_GetFaceTemplateUsingEyes_Old(Image, eyeCoords, FaceTemplate);
 }
Esempio n. 49
0
 public virtual void ComputeBoundingBox()
 {
     LeftFloatPosition  = TPoint.Zero;
     RightFloatPosition = new TPoint(Parent.BoundingBox.Width, 0);
 }
Esempio n. 50
0
 public MouseInfo(bool leftButton, bool middleButton, bool rightButton, TPoint position, int delta)
 {
     this.leftButton = leftButton;
     this.middleButton = middleButton;
     this.rightButton = rightButton;
     this.position = position;
     this.delta = delta;
 }
Esempio n. 51
0
        /// <summary> Initializing constructor. </summary>
        /// <param name="display">The display pointer, that specifies the connection to the X server. <see cref="System.IntPtr"/> </param>
        /// <param name="screenNumber"> The appropriate screen number on the host server. <see cref="System.Int32"/> </param>
        /// <param name="parentWindow"> The X11 *** parent *** window for X11 calls. This widget has no X11 *** own *** window. <see cref="System.IntPtr"/> </param>
        /// <param name="assignedPosition"> The position of the top left top corner assigned by the window manager (for shell widgets) or geometry management (by non-shell widgets). Passed as reference to avoid structure copy constructor calls. <see cref="TPoint"/> </param>
        /// <param name="fixedSize"> The fixed size, that ist to use (if set) rather than the calcualated size. Passed as reference to avoid structure copy constructor calls. <see cref="TIntSize"/> </param>
        /// <param name="label"> The label to display. <see cref="System.String"/> </param>
        /// <param name="leftBitmap"> The left bitmap to display. <see cref="XrwBitmap"/> </param>
        /// <param name="leftShared"> Indicate wether the leftBitmap is shared (desposed by caller) or private (disposed together with tis label). <see cref="System.Boolean"/> </param>
        /// <param name="rightBitmap"> The right bitmap to display. <see cref="XrwBitmap"/> </param>
        /// <param name="rightShared"> Indicate wether the rightBitmap is shared (desposed by caller) or private (disposed together with tis label). <see cref="System.Boolean"/> </param>
        public XrwCommand(IntPtr display, X11.TInt screenNumber, IntPtr parentWindow, ref TPoint assignedPosition, ref TSize fixedSize, string label, X11Graphic leftBitmap, bool leftShared, X11Graphic rightBitmap, bool rightShared)
            : base(display, screenNumber, parentWindow, ref assignedPosition, ref fixedSize, label, leftBitmap, leftShared, rightBitmap, rightShared)
        {
            // Create a *** own *** window and exchange the *** parent ***  window against it.
            base.InitializeOwnWindow();

            InitializeCommandRessources();
        }
Esempio n. 52
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);

            if (m_bPlay)
                return;

            if (e.Button != System.Windows.Forms.MouseButtons.Right)
                return;

            if (CurrentImage == null)
                return;

            TPoint newPivot = new TPoint( e.X - m_startPos.X , e.Y - m_startPos.Y );
            m_selectImgData.Pivot = newPivot;

            Invalidate();
        }
Esempio n. 53
0
 /// <summary> Initializing constructor. </summary>
 /// <param name="display">The display pointer, that specifies the connection to the X server. <see cref="IntPtr"/> </param>
 /// <param name="screenNumber"> The appropriate screen number on the host server. <see cref="System.Int32"/> </param>
 /// <param name="parentWindow"> The X11 *** parent *** window for X11 calls. This widget has no X11 *** own *** window. <see cref="IntPtr"/> </param>
 /// <param name="assignedPosition"> The position of the top left top corner assigned by the window manager (for shell widgets) or geometry management (by non-shell widgets). Passed as reference to avoid structure copy constructor calls. <see cref="TPoint"/> </param>
 /// <param name="fixedSize"> The fixed size, that ist to use (if set) rather than the calcualated size. Passed as reference to avoid structure copy constructor calls. <see cref="TSize"/> </param>
 public XrwComposite(IntPtr display, X11.TInt screenNumber, IntPtr parentWindow, ref TPoint assignedPosition, ref TSize fixedSize)
     : base(display, screenNumber, parentWindow, ref assignedPosition, ref fixedSize)
 {
     _borderWidth = XrwTheme.CompositeBorderWidth;
 }
Esempio n. 54
0
 // вхождение в составные зоны - Исключающий полигон в полигоне
 public static bool PointInDoubleZone(TPoint point, TPolygon in_parent_zone, TPolygon not_in_childzone)
 {
     return(PointInPolygon(point, in_parent_zone, MaxError) & (!PointInPolygon(point, not_in_childzone, MaxError)));
 }
Esempio n. 55
0
 private CreateLabel(StageBox editor, TPoint startPosition, TPoint endPosition, ControlBase control)
     : base(editor,startPosition,endPosition,control)
 {
 }
Esempio n. 56
0
 // вхождение в составные зоны - Исключающий эллипс в эллипсе
 public static bool PointInDoubleZone(TPoint point, TEllipse in_parent_zone, TEllipse not_in_childzone, double EPS)
 {
     return(PointInEllipse(point, in_parent_zone, EPS) & (!PointInEllipse(point, not_in_childzone, EPS)));
 }
Esempio n. 57
0
 public TPoint toPos()
 {
     return(TPoint.add(pos, TPoint.fromWay(way)));
 }
Esempio n. 58
0
 // вхождение в составные зоны - Исключающий эллипс в эллипсе
 public static bool PointInDoubleZone(TPoint point, TEllipse in_parent_zone, TEllipse not_in_childzone)
 {
     return(PointInEllipse(point, in_parent_zone, MaxError) & (!PointInEllipse(point, not_in_childzone, MaxError)));
 }
Esempio n. 59
0
 public MoveControl(Controls controls, TPoint offset)
 {
     m_controls.Set(controls.Get());
     m_offset = offset;
 }
Esempio n. 60
0
 public TEllipse()
 {
     Center = new TPoint(); XRadius = 1; YRadius = 1;
 }