/// <summary>
 /// Changes cursor style
 /// </summary>
 /// <param name="Style">The Style of the cursor.</param>
 public void SetCursorStyle(CursorStyle Style)
 {
     //Sends the Command to change the Cursor Style
     this.SendCommand(Commands.SET_LCD_CURSOR_STYLE, new byte[1] {
         Convert.ToByte((int)Style)
     });
 }
Example #2
0
            public void ChangeCursor(CursorStyle cursor)
            {
                oldCursor = this.canvas.Cursor;

                switch (cursor)
                {
                default:
                case CursorStyle.PlatformDefault: this.canvas.Cursor = Cursors.Arrow; break;

                case CursorStyle.Selection: this.canvas.Cursor = this.canvas.internalCurrentCursor; break;

                case CursorStyle.Busy: this.canvas.Cursor = Cursors.AppStarting; break;

                case CursorStyle.Hand: this.canvas.Cursor = Cursors.Hand; break;

                case CursorStyle.FullColumnSelect: this.canvas.Cursor = this.canvas.builtInFullColSelectCursor; break;

                case CursorStyle.FullRowSelect: this.canvas.Cursor = this.canvas.builtInFullRowSelectCursor; break;

                case CursorStyle.ChangeRowHeight: this.canvas.Cursor = Cursors.SizeNS; break;

                case CursorStyle.ChangeColumnWidth: this.canvas.Cursor = Cursors.SizeWE; break;

                case CursorStyle.ResizeHorizontal: this.canvas.Cursor = Cursors.SizeWE; break;

                case CursorStyle.ResizeVertical: this.canvas.Cursor = Cursors.SizeNS; break;

                case CursorStyle.Move: this.canvas.Cursor = Cursors.SizeAll; break;

                case CursorStyle.Cross: this.canvas.Cursor = this.canvas.builtInCrossCursor; break;
                }
            }
Example #3
0
        public static void ApplyCursor(StyleSheet sheet, StyleValueHandle[] handles, int specificity, ref StyleValue <CursorStyle> property)
        {
            StyleValueHandle handle = handles[0];
            bool             flag   = handle.valueType == StyleValueType.ResourcePath;

            if (flag)
            {
                string    pathName  = sheet.ReadResourcePath(handles[0]);
                Texture2D texture2D = Panel.loadResourceFunc(pathName, typeof(Texture2D)) as Texture2D;
                if (texture2D != null)
                {
                    Vector2 zero = Vector2.zero;
                    sheet.TryReadFloat(handles, 1, out zero.x);
                    sheet.TryReadFloat(handles, 2, out zero.y);
                    CursorStyle val = new CursorStyle
                    {
                        texture = texture2D,
                        hotspot = zero
                    };
                    StyleSheetApplicator.Apply <CursorStyle>(val, specificity, ref property);
                }
            }
            else if (StyleSheetApplicator.createDefaultCursorStyleFunc != null)
            {
                CursorStyle val2 = StyleSheetApplicator.createDefaultCursorStyleFunc(sheet, handle);
                StyleSheetApplicator.Apply <CursorStyle>(val2, specificity, ref property);
            }
        }
        public static void ApplyCursor(StyleSheet sheet, StyleValueHandle[] handles, int specificity, ref StyleValue <CursorStyle> property)
        {
            var  handle   = handles[0];
            bool isCustom = handle.valueType == StyleValueType.ResourcePath;

            if (isCustom)
            {
                string texturePath = sheet.ReadResourcePath(handles[0]);

                Texture2D tex = Panel.loadResourceFunc(texturePath, typeof(Texture2D)) as Texture2D;
                if (tex != null)
                {
                    Vector2 hotspot = Vector2.zero;
                    sheet.TryReadFloat(handles, 1, out hotspot.x);
                    sheet.TryReadFloat(handles, 2, out hotspot.y);

                    CursorStyle cursor = new CursorStyle()
                    {
                        texture = tex, hotspot = hotspot
                    };
                    Apply(cursor, specificity, ref property);
                }
            }
            else
            {
                // Default cursor
                if (createDefaultCursorStyleFunc != null)
                {
                    CursorStyle cursor = createDefaultCursorStyleFunc(sheet, handle);
                    Apply(cursor, specificity, ref property);
                }
            }
        }
Example #5
0
 void LoadSettings()
 {
     foreach (ConfigNode node in GameDatabase.Instance.GetConfigNodes("MAFSettings"))
     {
         if ((object)node != null)
         {
             if (node.HasValue("toggleKey"))
             {
                 try {
                     toggleKeyString = ((string)node.GetValue("toggleKey")).ToUpperInvariant();
                     toggleKeyCode   = (KeyCode)Enum.Parse(typeof(KeyCode), toggleKeyString);
                 } catch (ArgumentException) {
                     Debug.Log("[MAF]: Invalid keycode in toggleKey config node; skipped");
                 }
             }
             if (node.HasValue("flightModeKey"))
             {
                 try {
                     flightModeKeyString = ((string)node.GetValue("flightModeKey")).ToUpperInvariant();
                     flightModeKeyCode   = (KeyCode)Enum.Parse(typeof(KeyCode), flightModeKeyString);
                 } catch (ArgumentException) {
                     Debug.Log("[MAF]: Invalid keycode in flightModeKey config node; skipped");
                 }
             }
             if (node.HasValue("cursorStyle"))
             {
                 object temp = Enum.Parse(typeof(CursorStyle), (string)node.GetValue("cursorStyle"));
                 if (temp != null)
                 {
                     cursor = (CursorStyle)temp;
                 }
             }
             if (node.HasValue("mouseSensitivity"))
             {
                 int.TryParse(node.GetValue("mouseSensitivity"), out mouseSensitivity);
             }
             if (node.HasValue("cursorOpacity"))
             {
                 float.TryParse(node.GetValue("cursorOpacity"), out cursorOpacity);
             }
             if (node.HasValue("cursorSize"))
             {
                 float.TryParse(node.GetValue("cursorSize"), out cursorSize);
             }
             if (node.HasValue("invertX"))
             {
                 bool.TryParse(node.GetValue("invertX"), out invertX);
             }
             if (node.HasValue("invertY"))
             {
                 bool.TryParse(node.GetValue("invertY"), out invertX);
             }
         }
     }
     DetectFARLoaded();
 }
        public static bool ApplyAndCompare(ref StyleValue <CursorStyle> current, StyleValue <CursorStyle> other)
        {
            CursorStyle oldValue = current.value;

            if (current.Apply(other, StylePropertyApplyMode.CopyIfEqualOrGreaterSpecificity))
            {
                return(oldValue != other.value);
            }
            return(false);
        }
Example #7
0
        internal static CursorStyle CreateDefaultCursorStyle(StyleSheet sheet, StyleValueHandle handle)
        {
            int         type   = StyleSheetCache.GetEnumValue <MouseCursor>(sheet, handle);
            CursorStyle cursor = new CursorStyle()
            {
                texture = null, hotspot = Vector2.zero, defaultCursorId = type
            };

            return(cursor);
        }
 public void SetCursor(CursorStyle cursor)
 {
     if (cursor.texture != null)
     {
         EditorGUIUtility.SetCurrentViewCursor(cursor.texture, cursor.hotspot, MouseCursor.CustomCursor);
     }
     else
     {
         EditorGUIUtility.SetCurrentViewCursor(null, Vector2.zero, (MouseCursor)cursor.defaultCursorId);
     }
 }
Example #9
0
        override public void CopyFrom(Style style)
        {
            base.CopyFrom(style);

            FancyLabelStyle flstyle = style as FancyLabelStyle;

            if (flstyle != null)
            {
                Cursor = flstyle.Cursor;
            }
        }
Example #10
0
        override public void MergeWith(Style style)
        {
            base.MergeWith(style);

            FancyLabelStyle flstyle = style as FancyLabelStyle;

            //Only merge if inbound style is set and current style is not set
            if ((flstyle != null) && (!flstyle.IsEmpty) && (IsEmpty))
            {
                Cursor = flstyle.Cursor;
            }
        }
Example #11
0
        /// <summary>
        /// Set the cursor style on the LCD device screen.
        /// </summary>
        /// <param name="style">Style to set.</param>
        public void SetCursorStyle(CursorStyle style)
        {
            ThrowIfNotConnected();
            if (!Enum.IsDefined(typeof(CursorStyle), style))
            {
                throw new ArgumentException("Must specify a valid cursor style", nameof(style));
            }
            var buffer   = new[] { (byte)style };
            var command  = new CommandPacket(CommandType.SetCursorStyle, (byte)buffer.Length, buffer);
            var response = _deviceConnection?.SendReceive(command);

            VerifyResponsePacket(response, CommandType.SetCursorStyle);
        }
Example #12
0
            public void ChangeSelectionCursor(CursorStyle cursor)
            {
                switch (cursor)
                {
                default:
                case CursorStyle.PlatformDefault:
                    this.canvas.internalCurrentCursor = Cursors.Arrow;
                    break;

                case CursorStyle.Hand:
                    this.canvas.internalCurrentCursor = Cursors.Hand;
                    break;
                }
            }
Example #13
0
            public void ChangeSelectionCursor(CursorStyle cursor)
            {
                switch (cursor)
                {
                default:
                case CursorStyle.PlatformDefault:
                    this.control.internalCurrentCursor = this.control.CellsSelectionCursor;
                    break;

                case CursorStyle.Hand:
                    this.control.internalCurrentCursor = Cursors.Hand;
                    break;
                }
            }
Example #14
0
        private bool SetCursorStyle(CursorStyle cursorStyle)
        {
            byte type = 12;

            byte[] data = new byte[1];

            if (0 > (int)cursorStyle || 3 < (int)cursorStyle)
            {
                throw new ArgumentOutOfRangeException("cursorStyle", "must be a valid value in the enum");
            }

            data[0] = (byte)cursorStyle;
            return(SendReturnBool(type, 1, data));
        }
Example #15
0
        public static void ApplyCursor(StyleSheet sheet, StyleValueHandle[] handles, int specificity, ref StyleValue <CursorStyle> property)
        {
            float     hotspotX;
            float     hotspotY;
            int       cursorId;
            Texture2D texture;

            CompileCursor(sheet, handles, out hotspotX, out hotspotY, out cursorId, out texture);
            CursorStyle cursor = new CursorStyle()
            {
                texture = texture, hotspot = new Vector2(hotspotX, hotspotY), defaultCursorId = cursorId
            };

            Apply(cursor, specificity, ref property);
        }
        public void SetCursor(CursorStyle cursor)
        {
            if (GUIView.current == null)
            {
                // Cannot set the cursor if the current view is null.
                return;
            }

            if (cursor.texture != null)
            {
                EditorGUIUtility.SetCurrentViewCursor(cursor.texture, cursor.hotspot, MouseCursor.CustomCursor);
            }
            else
            {
                EditorGUIUtility.SetCurrentViewCursor(null, Vector2.zero, (MouseCursor)cursor.defaultCursorId);
            }
        }
Example #17
0
        public void SetCursorStyle(CursorStyle style)
        {
            switch (style)
            {
            case CursorStyle.Default:
            {
                cursor.color = Color.white;
                break;
            }

            case CursorStyle.Activateable:
            {
                cursor.color = Color.red;
                break;
            }
            }
        }
Example #18
0
    public void OnColorChange(Color c)
    {
        ColorPallete.SetActive(false);
        MarkupSettings.Instance.PenColor = c;
        UpdateDrawer();

        ShapeHolder.SetActive(true);

        GameObject[] cursors = CursorManager.Instance.AllCursors;
        foreach (GameObject cursor in cursors)
        {
            CursorStyle ps = cursor.GetComponent <CursorStyle>();
            if (ps)
            {
                ps.SetColor(c);
            }
        }
    }
Example #19
0
        internal static void AnsiParser_OsCommand_SetCursorStyle(
            CursorStyle expectedStyle, params string[] param
            )
        {
            var dispatched = 0;
            var events     = new AnsiParserEvents
            {
                SetCursor = (style) =>
                {
                    ++dispatched;
                    Assert.Equal(expectedStyle, style);
                }
            };

            var sut = new AnsiParser(events: events);

            Osc(sut, OsCommand.SetCursorStyle, param);
            Assert.Equal(1, dispatched);
        }
Example #20
0
            public void ChangeCursor(CursorStyle cursor)
            {
                oldCursor = this.control.Cursor;

                switch (cursor)
                {
                default:
                case CursorStyle.PlatformDefault: this.control.Cursor = Cursors.Default; break;

                case CursorStyle.Selection: this.control.Cursor = this.control.internalCurrentCursor; break;

                case CursorStyle.Busy: this.control.Cursor = Cursors.WaitCursor; break;

                case CursorStyle.Hand: this.control.Cursor = Cursors.Hand; break;

                case CursorStyle.FullColumnSelect:
                    this.control.Cursor = this.control.FullColumnSelectionCursor != null ?
                                          this.control.FullColumnSelectionCursor : this.control.builtInFullColSelectCursor;
                    break;

                case CursorStyle.FullRowSelect:
                    this.control.Cursor = this.control.FullRowSelectionCursor != null ?
                                          this.control.FullRowSelectionCursor : this.control.builtInFullRowSelectCursor;
                    break;

                case CursorStyle.EntireSheet:
                    this.control.Cursor = this.control.EntireSheetSelectionCursor != null ?
                                          this.control.EntireSheetSelectionCursor : this.control.builtInEntireSheetSelectCursor;
                    break;

                case CursorStyle.ChangeColumnWidth: this.control.Cursor = Cursors.VSplit; break;

                case CursorStyle.ChangeRowHeight: this.control.Cursor = Cursors.HSplit; break;

                case CursorStyle.ResizeHorizontal: this.control.Cursor = Cursors.SizeWE; break;

                case CursorStyle.ResizeVertical: this.control.Cursor = Cursors.SizeNS; break;

                case CursorStyle.Move: this.control.Cursor = Cursors.SizeAll; break;

                case CursorStyle.Cross: this.control.Cursor = this.control.builtInCrossCursor; break;
                }
            }
Example #21
0
        private void UpdateDrag(bool firstFrame = false)
        {
            if (currentDragEvent == null)
            {
                return;
            }

            if (currentDragEvent.lockCursor && currentDragEvent.cursor != null)
            {
                Cursor.SetCursor(currentDragEvent.cursor.texture, currentDragEvent.cursor.hotSpot, CursorMode.Auto);
                currentCursor = currentDragEvent.cursor;
            }

            currentDragEvent.MousePosition = MousePosition;
            currentDragEvent.Modifiers     = m_KeyboardState.modifiersThisFrame;

            if (firstFrame)
            {
                RunDragEvent(m_ElementsThisFrame, InputEventType.DragEnter);
                currentDragEvent.Update();
            }
            else
            {
                RunDragEvent(m_ExitedElements, InputEventType.DragExit);
                RunDragEvent(m_EnteredElements, InputEventType.DragEnter);
                currentDragEvent.Update();
                RunDragEvent(m_ElementsThisFrame,
                             mouseState.DidMove ? InputEventType.DragMove : InputEventType.DragHover);
            }

            if (currentDragEvent.IsCanceled)
            {
                EndDrag(InputEventType.DragCancel);
            }

            if (currentDragEvent.IsDropped)
            {
                EndDrag(InputEventType.DragDrop);
            }
        }
Example #22
0
 void LoadSettings()
 {
     foreach (ConfigNode node in GameDatabase.Instance.GetConfigNodes("MAFSettings"))
     {
         if ((object)node != null)
         {
             if (node.HasValue("toggleKey"))
             {
                 toggleKeyString = ((string)node.GetValue("toggleKey")).ToUpperInvariant();
                 toggleKeyCode   = (KeyCode)Enum.Parse(typeof(KeyCode), toggleKeyString);
             }
             if (node.HasValue("flightModeKey"))
             {
                 flightModeKeyString = ((string)node.GetValue("flightModeKey")).ToUpperInvariant();
                 flightModeKeyCode   = (KeyCode)Enum.Parse(typeof(KeyCode), flightModeKeyString);
             }
             if (node.HasValue("cursorStyle"))
             {
                 object temp = Enum.Parse(typeof(CursorStyle), (string)node.GetValue("cursorStyle"));
                 if (temp != null)
                 {
                     cursor = (CursorStyle)temp;
                 }
             }
             if (node.HasValue("mouseSensitivity"))
             {
                 float.TryParse(node.GetValue("mouseSensitivity"), out mouseSensitivity);
             }
             if (node.HasValue("invertX"))
             {
                 bool.TryParse(node.GetValue("invertX"), out invertX);
             }
             if (node.HasValue("invertY"))
             {
                 bool.TryParse(node.GetValue("invertY"), out invertX);
             }
         }
     }
     DetectFARLoaded();
 }
Example #23
0
        /// <summary>
        /// 获取鼠标的样式
        /// </summary>
        /// <param name="style"></param>
        /// <returns></returns>
        public static Cursor Getter(CursorStyle style)
        {
            Cursor cursor = Cursors.Arrow;

            try
            {
                //获取要切换的鼠标样式类型
                switch (style)
                {
                case CursorStyle.Cross:
                    cursor = GetResource(@"pack://*****:*****@"pack://application:,,,/Albert.DrawingKernel;component/Resources/Cursor/aero_move.cur");
                    break;

                case CursorStyle.Pick:
                    cursor = GetResource(@"pack://*****:*****@"pack://application:,,,/Albert.DrawingKernel;component/Resources/Cursor/select.cur");
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
            }

            return(cursor);
        }
Example #24
0
        private void ProcessMouseInput()
        {
            // if element does not have state requested -> hover flag, drag listener, pointer events = none, don't add
            // buckets feel like a lot of overhead
            // for each element, track if has overflowing children
            // if it does not and element is culled, skip directly to children's children and repeat
            // if aabb yMin is below screen height or aabb ymax is less than 0 -> cull

            // broadphase culling and input querying are related
            // neither uses render bounds, just obb and aabb
            // if dragging only attempt intersections with elements who have drag responders
            // if not dragging only attempt intersections with elements who have hover state (if mouse is present) or drag create or mouse / touch interactions

            LightList <UIElement> queryResults = (LightList <UIElement>)m_LayoutSystem.QueryPoint(mouseState.mousePosition, LightList <UIElement> .Get());

            // todo -- bug!
            queryResults.Sort((a, b) => {
                int viewDepthComparison = b.View.Depth - a.View.Depth;
                if (viewDepthComparison != 0)
                {
                    return(viewDepthComparison);
                }

                if (b.layoutBox.layer != a.layoutBox.layer)
                {
                    return(b.layoutBox.layer - a.layoutBox.layer);
                }

                if (b.layoutBox.zIndex != a.layoutBox.zIndex)
                {
                    return(b.layoutBox.zIndex - a.layoutBox.zIndex);
                }

                return(b.layoutBox.traversalIndex - a.layoutBox.traversalIndex);
            });

            m_AllElementsThisFrame.Clear();
            m_AllElementsThisFrame.AddRange(queryResults);

            if (!IsDragging)
            {
                LightList <UIElement> ancestorElements = LightList <UIElement> .Get();

                if (queryResults.size > 0)
                {
                    /*
                     * Every following element must be a parent of the first.
                     * This makes no sense for drag events but a lot for every other.
                     */
                    UIElement firstElement = queryResults[0];
                    ancestorElements.Add(firstElement);

                    for (int index = 1; index < queryResults.size; index++)
                    {
                        UIElement element = queryResults[index];
                        if (IsParentOf(element, firstElement))
                        {
                            ancestorElements.Add(element);
                        }
                    }

                    LightList <UIElement> .Release(ref queryResults);

                    queryResults = ancestorElements;
                }
            }

            bool didMouseMove = mouseState.DidMove;

            if (didMouseMove)
            {
                for (int i = 0; i < hoveredElements.size; i++)
                {
                    UIElement element = hoveredElements.array[i];

                    if ((element.flags & UIElementFlags.EnabledFlagSet) != UIElementFlags.EnabledFlagSet)
                    {
                        hoveredElements.RemoveAt(i--);
                        continue;
                    }

                    if (!queryResults.Contains(element))
                    {
                        hoveredElements.RemoveAt(i--);
                        element.style.ExitState(StyleState.Hover);
                    }
                }

                for (int i = 0; i < queryResults.Count; i++)
                {
                    UIElement element = queryResults.array[i];

                    if ((element.style.currentState & StyleState.Hover) == 0)
                    {
                        hoveredElements.Add(element);
                        element.style.EnterState(StyleState.Hover);
                    }
                }
            }

            for (int i = 0; i < queryResults.Count; i++)
            {
                UIElement element = queryResults[i];

                m_ElementsThisFrame.Add(element);

                if (!m_ElementsLastFrame.Contains(element))
                {
                    m_EnteredElements.Add(element);
                }

                if (IsMouseLeftDownThisFrame)
                {
                    element.style?.EnterState(StyleState.Active);
                    m_ActiveElements.Add(element);
                }
            }

            for (int i = 0; i < m_ElementsLastFrame.Count; i++)
            {
                if (!m_ElementsThisFrame.Contains(m_ElementsLastFrame[i]))
                {
                    m_ExitedElements.Add(m_ElementsLastFrame[i]);
                }
            }

            if (IsMouseLeftUpThisFrame)
            {
                for (int i = 0; i < m_ActiveElements.Count; i++)
                {
                    m_ActiveElements[i].style?.ExitState(StyleState.Active);
                }

                m_ActiveElements.Clear();
            }

            if (!IsDragging)
            {
                CursorStyle newCursor = null;
                if (m_ElementsThisFrame.Count > 0)
                {
                    for (int i = 0; i < m_ElementsThisFrame.Count; i++)
                    {
                        UIElement element = m_ElementsThisFrame[i];
                        if (element.isDestroyed)
                        {
                            continue;
                        }

                        if (element.style.IsDefined(StylePropertyId.Cursor))
                        {
                            newCursor = element.style.Cursor;
                            if (!newCursor.Equals(currentCursor))
                            {
                                Cursor.SetCursor(newCursor.texture, newCursor.hotSpot, CursorMode.Auto);
                            }

                            break;
                        }
                    }
                }

                if (currentCursor != null && newCursor == null)
                {
                    Cursor.SetCursor(null, new Vector2(0, 0), CursorMode.Auto);
                }

                currentCursor = newCursor;

                if (mouseState.AnyMouseDownThisFrame)
                {
                    m_MouseDownElements.AddRange(m_ElementsThisFrame);
                }
            }

            LightList <UIElement> .Release(ref queryResults);
        }
Example #25
0
        public override bool OnMouseMove(Point location, MouseButtons buttons)
        {
            bool isProcessed = false;

            switch (sheet.operationStatus)
            {
            case OperationStatus.AdjustColumnWidth:
                if (sheet.currentColWidthChanging >= 0 &&
                    buttons == MouseButtons.Left)
                {
                    ColumnHeader colHeader = sheet.cols[sheet.currentColWidthChanging];
                    sheet.headerAdjustNewValue = location.X - colHeader.Left;
                    if (sheet.headerAdjustNewValue < 0)
                    {
                        sheet.headerAdjustNewValue = 0;
                    }

                    this.sheet.controlAdapter.ChangeCursor(CursorStyle.ChangeColumnWidth);
                    this.sheet.RequestInvalidate();
                    isProcessed = true;
                }
                break;

            case OperationStatus.Default:
            {
                if (sheet.currentColWidthChanging == -1 && sheet.currentRowHeightChanging == -1)
                {
                    int col = -1;

                    // find the column index
                    bool inline = sheet.FindColumnByPosition(location.X, out col) &&
                                  sheet.HasSettings(WorksheetSettings.Edit_AllowAdjustColumnWidth);

                    if (col >= 0)
                    {
                        CursorStyle curStyle = inline ? CursorStyle.ChangeColumnWidth :
                                               (sheet.selectionMode == WorksheetSelectionMode.None ? CursorStyle.Selection : CursorStyle.FullColumnSelect);

                        var header = sheet.cols[col];

                        // check if header body exists
                        if (header.Body != null)
                        {
                            // let cell's body decide the mouse behavior
                            var arg = new WorksheetMouseEventArgs(sheet, new Point(
                                                                      ((location.X - header.Left) * this.scaleFactor),
                                                                      (location.Y / this.scaleFactor)), location, buttons, 1)
                            {
                                CursorStyle = curStyle
                            };

                            isProcessed = header.Body.OnMouseMove(
                                new Size(header.InnerWidth * this.scaleFactor, sheet.colHeaderHeight), arg);

                            curStyle = arg.CursorStyle;
                        }

                        sheet.controlAdapter.ChangeCursor(curStyle);
                    }
                }
            }
            break;

            case OperationStatus.FullColumnSelect:
            case OperationStatus.FullSingleColumnSelect:
                if (buttons == MouseButtons.Left)
                {
                    sheet.controlAdapter.ChangeCursor(CursorStyle.FullColumnSelect);
                    sheet.SelectRangeEndByMouse(this.PointToController(location));

                    isProcessed = true;
                }
                break;
            }

            return(isProcessed);
        }
 /// <summary>
 ///     Set the cursor style to underline or block.  The cursor can also be blinking or solid.
 /// </summary>
 /// <param name="style">New cursor style (Block/Underline, Blinking/Solid).</param>
 public void SetCursorStyle(CursorStyle style)
 {
     Send(new[] { ExtendedCommandCharacter, (byte)style });
 }
 void LoadSettings()
 {
     foreach(ConfigNode node in GameDatabase.Instance.GetConfigNodes("MAFSettings"))
         if((object)node != null)
         {
             if (node.HasValue("toggleKey"))
             {
                 toggleKeyString = ((string)node.GetValue("toggleKey")).ToUpperInvariant();
                 toggleKeyCode = (KeyCode)Enum.Parse(typeof(KeyCode), toggleKeyString);
             }
             if (node.HasValue("flightModeKey"))
             {
                 flightModeKeyString = ((string)node.GetValue("flightModeKey")).ToUpperInvariant();
                 flightModeKeyCode = (KeyCode)Enum.Parse(typeof(KeyCode), flightModeKeyString);
             }
             if (node.HasValue("cursorStyle"))
             {
                 object temp = Enum.Parse(typeof(CursorStyle), (string)node.GetValue("cursorStyle"));
                 if (temp != null)
                     cursor = (CursorStyle)temp;
             }
             if (node.HasValue("mouseSensitivity"))
             {
                 float.TryParse(node.GetValue("mouseSensitivity"), out mouseSensitivity);
             }
             if(node.HasValue("invertX"))
             {
                 bool.TryParse(node.GetValue("invertX"), out invertX);
             }
             if (node.HasValue("invertY"))
             {
                 bool.TryParse(node.GetValue("invertY"), out invertX);
             }
         }
     DetectFARLoaded();
 }
Example #28
0
 /// <summary>
 /// Turns on the display.
 /// </summary>
 /// <param name="mode"></param>
 /// <example>Example usage:
 /// <code language = "C#">
 /// _lcd.DisplayOn(SerialLCD.CursorStyle.NoCursor);
 /// </code>
 /// <code language = "VB">
 /// _lcd.DisplayOn(SerialLCD.CursorStyle.NoCursor)
 /// </code>
 /// </example>
 public void DisplayOn(CursorStyle mode)
 {
     _serialLcd.WriteByte((byte)(mode));
 }
Example #29
0
 /// <summary>
 /// Set the cursor style to underline or block.  The cursor can also be blinking or solid.
 /// </summary>
 /// <param name="style">New cursor style (Block/Underline, Blinking/Solid).</param>
 public void SetCursorStyle(CursorStyle style)
 {
     Write(new byte[] { EXTENDED_LCD_COMMAND_CHARACTER, (byte)style });
 }
Example #30
0
        private Cursor GetCursor(CursorStyle style)
        {
            switch (style)
            {
            case CursorStyle.AppStarting: return(Cursors.AppStarting);

            case CursorStyle.Arrow: return(Cursors.Arrow);

            case CursorStyle.Cross: return(Cursors.Cross);

            case CursorStyle.Default: return(Cursors.Default);

            case CursorStyle.Hand: return(Cursors.Hand);

            case CursorStyle.Help: return(Cursors.Help);

            case CursorStyle.HSplit: return(Cursors.HSplit);

            case CursorStyle.IBeam: return(Cursors.IBeam);

            case CursorStyle.No: return(Cursors.No);

            case CursorStyle.NoMove2D: return(Cursors.NoMove2D);

            case CursorStyle.NoMoveHoriz: return(Cursors.NoMoveHoriz);

            case CursorStyle.NoMoveVert: return(Cursors.NoMoveVert);

            case CursorStyle.PanEast: return(Cursors.PanEast);

            case CursorStyle.PanNE: return(Cursors.PanNE);

            case CursorStyle.PanNorth: return(Cursors.PanNorth);

            case CursorStyle.PanNW: return(Cursors.PanNW);

            case CursorStyle.PanSE: return(Cursors.PanSE);

            case CursorStyle.PanSouth: return(Cursors.PanSouth);

            case CursorStyle.PanSW: return(Cursors.PanSW);

            case CursorStyle.PanWest: return(Cursors.PanWest);

            case CursorStyle.SizeAll: return(Cursors.SizeAll);

            case CursorStyle.SizeNESW: return(Cursors.SizeNESW);

            case CursorStyle.SizeNS: return(Cursors.SizeNS);

            case CursorStyle.SizeNWSE: return(Cursors.SizeNWSE);

            case CursorStyle.SizeWE: return(Cursors.SizeWE);

            case CursorStyle.UpArrow: return(Cursors.UpArrow);

            case CursorStyle.VSplit: return(Cursors.VSplit);

            case CursorStyle.WaitCursor: return(Cursors.WaitCursor);

            default: return(Cursors.Default);
            }
        }
Example #31
0
 public void SetStyle(CursorStyle style)
 {
     Cursor.Current = GetCursor(style);
 }
Example #32
0
 /// <summary>
 /// Gets the cursor style. Returns 'cursor: {0};' without the quotes,
 /// and with {0} replaced by the cursor style. This method may
 /// also return a compound style, such as 'cursor: {0};cursor: {1};'.
 /// Always ends in a trailing semicolon;
 /// </summary>
 /// <param name="cursor">The cursor.</param>
 /// <returns></returns>
 public static string GetStyle(CursorStyle cursor)
 {
     string result = null;
     switch (cursor)
     {
         case CursorStyle.ResizeEast:
             result = "cursor: e-resize;";
             break;
         case CursorStyle.ResizeNorth:
             result = "cursor: n-resize;";
             break;
         case CursorStyle.ResizeNorthEast:
             result = "cursor: ne-resize;";
             break;
         case CursorStyle.ResizeNorthWest:
             result = "cursor: nw-resize;";
             break;
         case CursorStyle.ResizeSouth:
             result = "cursor: s-resize;";
             break;
         case CursorStyle.ResizeSouthEast:
             result = "cursor: se-resize;";
             break;
         case CursorStyle.ResizeSouthWest:
             result = "cursor: sw-resize;";
             break;
         case CursorStyle.ResizeWest:
             result = "cursor: w-resize;";
             break;
         case CursorStyle.AllScroll:
             result = "cursor: all-scroll;";
             break;
         case CursorStyle.ColumnResize:
             result = "cursor: col-resize;";
             break;
         case CursorStyle.RowResize:
             result = "cursor: row-resize;";
             break;
         case CursorStyle.NoDrop:
             result = "cursor: no-drop;";
             break;
         case CursorStyle.NotAllowed:
             result = "cursor: not-allowed;";
             break;
         case CursorStyle.VerticalText:
             result = "cursor: vertical-text;";
             break;
         case CursorStyle.Inherit:
             return "";
         case CursorStyle.HandAndPointer:
             result = HandAndPointer;
             break;
         default:
             result = "cursor: " + cursor.ToString().ToLower() + ";";
             break;
     }
     return result;
 }