コード例 #1
0
        static List <Rectangle> FindClickRects(byte[] fileData, int imageDataStartOffset)
        {
            List <Rectangle> rects  = new List <Rectangle>();
            int    numOfUnk1        = BitConverter.ToInt32(fileData, 4);
            ushort numOfCursorAreas = BitConverter.ToUInt16(fileData, 8);
            ushort numOfUnk2        = BitConverter.ToUInt16(fileData, 0xa);
            int    startPos         = 0xc + (0x10 * numOfUnk1);

            if (numOfUnk1 == 2)
            {
                startPos += 0x10;
            }
            bool lookForNonZeroAfterFirstSeries = false;

            if (numOfUnk2 > 0)
            {
                lookForNonZeroAfterFirstSeries = true;
            }
            byte[]   data                  = new byte[0x4c];
            GCHandle dataHandle            = GCHandle.Alloc(data, GCHandleType.Pinned);
            IntPtr   dataPtr               = dataHandle.AddrOfPinnedObject();
            int      sizeofCursorPos       = Marshal.SizeOf(typeof(CursorPos));
            int      timesThrough          = 0;
            int      nextIncrementAddition = 0;

            while ((startPos + sizeofCursorPos) < imageDataStartOffset)
            {
                Buffer.BlockCopy(fileData, startPos, data, 0, data.Length);
                CursorPos cp = (CursorPos)Marshal.PtrToStructure(dataPtr, typeof(CursorPos));
                if (cp.x1 < 0x10 && startPos > 0x80)
                {
                    startPos += 0x14;
                    continue;
                }
                Rectangle r = new Rectangle(cp.x1, cp.y1, cp.x2 - cp.x1, cp.y2 - cp.y1);
                rects.Add(r);
                startPos += sizeofCursorPos;
                //if (nextIncrementAddition > 0)
                //{
                //    startPos += nextIncrementAddition;
                //    nextIncrementAddition = 0;
                //}
                //if (lookForNonZeroAfterFirstSeries)
                //{
                //    ++timesThrough;
                //    if (timesThrough == numOfCursorAreas)
                //    {
                //        nextIncrementAddition = 0x14;
                //        //while (fileData[startPos] != 0)
                //        //{
                //        //    --startPos;
                //        //}
                //        //++startPos;
                //        lookForNonZeroAfterFirstSeries = false;
                //    }
                //}
            }
            dataHandle.Free();
            return(rects);
        }
コード例 #2
0
 private void MoveUp(KeyEventArgs args)
 {
     if (m_dropDownOpen)
     {
         ItemIndex--;
     }
     else
     {
         if (args.Shift)
         {
             var selectionEnd = GetCursorPosInt() + SelectionLength;
             var point        = CursorToXY(CursorPos.GetUV(GetLines().ToList()));
             point.Y        -= Font.Height;
             CursorPos       = XYToCursor(point.X, point.Y);
             SelectionLength = selectionEnd - GetCursorPosInt();
         }
         else
         {
             SelectionLength = 0;
             var point = CursorToXY(CursorPos.GetUV(GetLines().ToList()));
             point.Y  -= Font.Height;
             CursorPos = XYToCursor(point.X, point.Y);
         }
         Redraw();
         m_additionUndoAction = null;
     }
 }
コード例 #3
0
ファイル: XinputHandler.cs プロジェクト: unknownnf/Touchmote
        public bool setPosition(string key, CursorPos cursorPos)
        {
            key = key.ToLower();
            if (key.Equals("360.stickl") || key.Equals("360.stickr"))
            {
                if (!cursorPos.OutOfReach)
                {
                    Point smoothedPos = cursorPositionHelper.getSmoothedPosition(new Point(cursorPos.RelativeX, cursorPos.RelativeY));

                    double smoothedX = smoothedPos.X;
                    double smoothedY = 1 - smoothedPos.Y; // Y is inverted

                    switch (key)
                    {
                    case "360.stickl":
                        report.StickLX = smoothedX;
                        report.StickLY = smoothedY;
                        break;

                    case "360.stickr":
                        report.StickRX = smoothedX;
                        report.StickRY = smoothedY;
                        break;
                    }
                    return(true);
                }
            }
            return(false);
        }
コード例 #4
0
 private void Backspace(KeyEventArgs args)
 {
     if (InputForm != InputFormEnum.None)
     {
         var undo = MakeUndoAction();
         if (SelectionLength != 0)
         {
             DeleteSelection();
         }
         else if (GetCursorPosInt() > 0)
         {
             if (args.Control)
             {
                 Regex  r      = new Regex(@"\S*\s*$");
                 string before = Text.Substring(0, GetCursorPosInt());
                 var    match  = r.Match(before);
                 CursorPos       = new CP(match.Index);
                 SelectionLength = match.Length;
                 DeleteSelection();
             }
             else
             {
                 Text = Text.Remove(GetCursorPosInt() - 1, 1);
                 var lines = GetLines().ToList();
                 CursorPos = new CP(Math.Max(0, CursorPos.Pos - 1), CursorPos.GetUV(lines).X == 0);
             }
             Redraw();
         }
         m_additionUndoAction = null;
         undo.SetRedo(m_state);
     }
 }
コード例 #5
0
        private void Home(KeyEventArgs args)
        {
            if (args.Shift)
            {
                var end   = GetCursorPosInt() + SelectionLength;
                var lines = GetLines().ToList();
                var uv    = CursorPos.GetUV(lines);
                CursorPos       = new CP(lines.Take(uv.Y).Select(l => l.Length).Concat(0.Only()).Sum());
                SelectionLength = end - CursorPos.Pos;
            }
            else
            {
                SelectionLength = 0;
            }

            if (args.Control)
            {
                CursorPos = new CP(0);
            }
            else
            {
                var lines = GetLines().ToList();
                var uv    = CursorPos.GetUV(lines);
                CursorPos = new CP(lines.Take(uv.Y).Select(l => l.Length).Concat(0.Only()).Sum());
            }

            m_additionUndoAction = null;
        }
コード例 #6
0
ファイル: ScriptUI.cs プロジェクト: wangyakai01/APSIMClassic
        public override void OnSave()
        {
            // --------------------------------------
            // Save the script box if it has changd.
            // --------------------------------------
            string Contents = "";

            if ((GenericUI != null))
            {
                GenericUI.OnSave();
                Contents = GenericUI.GetData();
            }

            List <XmlNode> refs = new List <XmlNode>();

            refs = XmlHelper.ChildNodes(Data, "reference");

            Data.RemoveAll();

            if (!string.IsNullOrEmpty(Contents))
            {
                XmlDocument Doc = new XmlDocument();
                Doc.LoadXml(Contents);
                Data.AppendChild(Data.OwnerDocument.ImportNode(Doc.DocumentElement, true));
            }

            foreach (XmlNode xn in refs)
            {
                Data.AppendChild(Data.OwnerDocument.ImportNode(xn, true));
            }

            XmlHelper.SetValue(Data, "text", TextBox.Text);

            // Store the cursor and text scroll position for the TextBox
            // Firstly find the top visible line number
            int lineVisible = 0;

            while ((lineVisible < TextBox.DisplayLines.Count) && !TextBox.DisplayLines.IsPointVisible(new Point(0, lineVisible)))
            {
                lineVisible++;
            }

            if (TextBox.Selection != null)
            {
                int       charIndex = TextBox.Selection.SelectionStart;
                CursorPos position  = new CursorPos();
                position.TopLine   = lineVisible;
                position.CharIndex = charIndex;
                if (!positions.ContainsKey(this.NodePath))
                {
                    positions.Add(this.NodePath, position);
                }
                else
                {
                    positions[this.NodePath] = position;
                }
            }
        }
コード例 #7
0
ファイル: TouchHandler.cs プロジェクト: unknownnf/Touchmote
 public bool setPosition(string key, Provider.CursorPos cursorPos)
 {
     if (key.ToLower().Equals("touch"))
     {
         positionToPush = cursorPos;
         return(true);
     }
     return(false);
 }
コード例 #8
0
ファイル: TouchHandler.cs プロジェクト: unknownnf/Touchmote
        public bool endUpdate()
        {
            if (positionToPush != null)
            {
                this.setPosition(positionToPush);

                positionToPush = null;
            }
            return(true);
        }
コード例 #9
0
 public unsafe GlfwEvents(WindowHandle *handle)
 {
     Handle = handle;
     GlfwProvider.GLFW.Value.SetCharCallback(handle, (a, b) => Char?.Invoke(a, b));
     GlfwProvider.GLFW.Value.SetKeyCallback(handle, (a, b, c, d, e) => Key?.Invoke(a, b, c, d, e));
     GlfwProvider.GLFW.Value.SetMouseButtonCallback(handle, (a, b, c, d) => MouseButton?.Invoke(a, b, c, d));
     GlfwProvider.GLFW.Value.SetCursorEnterCallback(handle, (a, b) => CursorEnter?.Invoke(a, b));
     GlfwProvider.GLFW.Value.SetCursorPosCallback(handle, (a, b, c) => CursorPos?.Invoke(a, b, c));
     GlfwProvider.GLFW.Value.SetScrollCallback(handle, (a, b, c) => Scroll?.Invoke(a, b, c));
 }
コード例 #10
0
        public void PcommCoreTestsSetCursorPos()
        {
            PcommCore pcommCore = new PcommCore("A");

            pcommCore.LinkToScreen <IBM_i_Main_MenuScreen>((IBM_i_Main_MenuScreen) =>
            {
                CursorPos point = IBM_i_Main_MenuScreen.SearchText("User tasks");

                return(true);
            });
        }
コード例 #11
0
 private void MoveCaret()
 {
     //if (InputForm != InputFormEnum.None)
     {
         var pos = CursorToXY(CursorPos.GetUV(GetLines().ToList()));
         if (m_caret != null)
         {
             m_caret.MoveTo((int)(pos.X), (int)pos.Y - Font.Height / 2);
         }
     }
 }
コード例 #12
0
    // Start is called before the first frame update
    public void Init()
    {
        cursorPos       = new CursorPos();
        displayIsDirty  = true;
        consoleElements = new Queue <ConsoleElement>(ConsoleElements);
        resetBuffer();

        if (consoleElements.Count > 0)
        {
            consoleElements.Peek().Init();
        }
    }
コード例 #13
0
        public CursorPos SearchText(string text)
        {
            CursorPos point = new CursorPos();
            int       row = 1, col = 1;
            bool      isFind = renderObj.SearchText(text, 1, ref row, ref col);

            if (isFind)
            {
                point.Row = row;
                point.Col = col;
            }
            return(point);
        }
コード例 #14
0
ファイル: TouchHandler.cs プロジェクト: unknownnf/Touchmote
        public TouchHandler(ITouchProviderHandler handler, long id)
        {
            this.id      = id;
            this.handler = handler;
            ulong touchStartID = (ulong)(id - 1) * 4 + 1;//This'll make sure the touch point IDs won't be the same. DuoTouch uses a span of 4 IDs.

            this.duoTouch      = new DuoTouch(Settings.Default.pointer_positionSmoothing, touchStartID);
            this.lastCursorPos = new CursorPos(0, 0, 0, 0, 0);

            this.timeoutTimer          = new System.Timers.Timer();
            this.timeoutTimer.Interval = Settings.Default.pointer_cursorStillHideTimeout;
            this.timeoutTimer.Elapsed += timeoutTimer_Elapsed;
            this.timeoutTimer.Enabled  = true;
            this.timeoutTimer.Start();
        }
コード例 #15
0
        //public bool SelectSchemeID(string clientno, int selCol = 4, int xCol = 16, int PreservedCol = 39, int NonPresCol = 50)
        //{

        //    CursorPos point = base.SearchText(clientno);

        //    if (point.IsMatched)
        //    {
        //        base.SetText("Y", selCol, point.Row);

        //        base.SetText("X", xCol, point.Row);

        //        base.SetText("100", PreservedCol, point.Row);

        //        base.SetText("100", NonPresCol, point.Row);

        //        base.Enter(selCol,point.Row);

        //        return point.IsMatched;
        //    }
        //    else
        //    {
        //        return point.IsMatched;
        //    }
        //}
        public bool SelectClientNO(string clientNo, int selCol = 4, int xCol = 16, int PreservedCol = 39, int NonPresCol = 50)
        {
            CursorPos point = base.SearchText(clientNo);

            if (point.IsMatched)
            {
                base.SetText("Y", point.Row, selCol);

                base.SetText("X", point.Row, xCol);

                base.SetText("100", point.Row, PreservedCol);

                base.SetText("100", point.Row, NonPresCol);

                base.Enter(point.Row, selCol);

                return(point.IsMatched);
            }
            else
            {
                //string currnetTips = GetText(17, 7, 9);
                //if (currnetTips == tips)
                //{
                //    SendKey(KeyBoard.Reset);
                //    return point.IsMatched;
                //}
                //else
                //{
                //    PageUp();
                //    Thread.Sleep(500);
                //    return SelectClientNO(clientNo, currnetTips);
                //}
                string tips = GetText(22, 79, 1);
                if (tips == "+")
                {
                    PageDown();
                    Thread.Sleep(500);
                    return(SelectClientNO(clientNo));
                }
                else
                {
                    return(false);
                }
            }
        }
コード例 #16
0
ファイル: TouchHandler.cs プロジェクト: unknownnf/Touchmote
        private bool alternativeStickCursor(string key, double value)
        {
            value = value * 1.4; //We give it a default upscale so we can reach the edges of the screen.
            CursorPos fromPos;

            if (positionToPush != null)
            {
                fromPos = positionToPush;
            }
            else
            {
                fromPos = lastCursorPos;
            }
            if (key.ToLower().Equals("touchx-"))
            {
                int x = (int)((this.duoTouch.screenBounds.Width / 2) - value * (this.duoTouch.screenBounds.Width / 2) + 0.5);
                x = x < 0 ? 0 : x;
                positionToPush = new CursorPos(x, fromPos.Y, 0, 0, 0);
                return(true);
            }
            else if (key.ToLower().Equals("touchx+"))
            {
                int x = (int)((this.duoTouch.screenBounds.Width / 2) + value * (this.duoTouch.screenBounds.Width / 2) + 0.5);
                x = x > this.duoTouch.screenBounds.Width - 1 ? this.duoTouch.screenBounds.Width - 1 : x;
                positionToPush = new CursorPos(x, fromPos.Y, 0, 0, 0);
                return(true);
            }
            else if (key.ToLower().Equals("touchy-"))
            {
                int y = (int)((this.duoTouch.screenBounds.Height / 2) + value * (this.duoTouch.screenBounds.Height / 2) + 0.5);
                y = y > this.duoTouch.screenBounds.Height - 1 ? this.duoTouch.screenBounds.Height - 1 : y;
                positionToPush = new CursorPos(fromPos.X, y, 0, 0, 0);
                return(true);
            }
            else if (key.ToLower().Equals("touchy+"))
            {
                int y = (int)((this.duoTouch.screenBounds.Height / 2) - value * (this.duoTouch.screenBounds.Height / 2) + 0.5);
                y = y < 0 ? 0 : y;
                positionToPush = new CursorPos(fromPos.X, y, 0, 0, 0);
                return(true);
            }
            return(false);
        }
コード例 #17
0
ファイル: Common.cs プロジェクト: zhangtingfeng/unity3dGame
    public static CursorPos getCursorPos(UnityEngine.Camera mycamera, UnityEngine.GameObject kongjian)
    {
        ;//要转化到的目的摄像机,通常canvas在这个摄像机下(即canvas的render mode设置为这个摄像机)
         //Image kongjian;//自己要获取屏幕坐标的控件,可以是image,也可以是button等等


        float x = mycamera.WorldToScreenPoint(kongjian.transform.position).x;
        float y = mycamera.WorldToScreenPoint(kongjian.transform.position).y;

        CursorPos ddCursorPosd = new CursorPos();

        ddCursorPosd.x = x;
        ddCursorPosd.y = y;
        return(ddCursorPosd);
        //x,y即为控件在屏幕的坐标camera.WorldToScreenPoint()方法返回的是一个position类型 是vector3类型,camera为要转化到的目标摄像机,传入的参数为控件的世界坐标
        //————————————————
        //版权声明:本文为CSDN博主「然然嘿嘿」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
        //原文链接:https://blog.csdn.net/sinat_23079759/java/article/details/53159858
    }
コード例 #18
0
        public bool SelectClientNOForWithDraw(string clientNO, string MemEngName, bool noCaseSelected = false, bool nameCaseSelected = false, int selCol = 4, int xCol = 16, int PreservedCol = 39, int NonPresCol = 50)
        {
            CursorPos point     = base.SearchText(clientNO);
            CursorPos NamePoint = base.SearchText(MemEngName);

            if (point.IsMatched)
            {
                base.SetText("Y", point.Row, selCol);

                base.SetText("X", point.Row, xCol);

                base.SetText("100", point.Row, PreservedCol);
                noCaseSelected = true;
            }
            if (NamePoint.IsMatched)
            {
                base.SetText("Y", NamePoint.Row - 1, selCol);
                base.SetText("100", NamePoint.Row - 1, NonPresCol);
                nameCaseSelected = true;
            }
            if (nameCaseSelected && noCaseSelected)
            {
                base.Enter();
                return(true);
            }
            else
            {
                string tips = GetText(22, 79, 1);
                if (tips == "+")
                {
                    PageDown();
                    Thread.Sleep(500);
                    return(SelectClientNOForWithDraw(clientNO, MemEngName, noCaseSelected, nameCaseSelected));
                }
                else
                {
                    return(false);
                }
            }
        }
コード例 #19
0
ファイル: TouchHandler.cs プロジェクト: unknownnf/Touchmote
        private bool normalStickCursor(string key, double value)
        {
            int       step = (int)Math.Round(30 * value);
            CursorPos fromPos;

            if (positionToPush != null)
            {
                fromPos = positionToPush;
            }
            else
            {
                fromPos = lastCursorPos;
            }
            if (key.ToLower().Equals("touchx-"))
            {
                int x = fromPos.X - step < 0 ? 0 : fromPos.X - step;
                positionToPush = new CursorPos(x, fromPos.Y, 0, 0, 0);
                return(true);
            }
            else if (key.ToLower().Equals("touchx+"))
            {
                int x = fromPos.X + step > this.duoTouch.screenBounds.Width - 1 ? this.duoTouch.screenBounds.Width - 1 : fromPos.X + step;
                positionToPush = new CursorPos(x, fromPos.Y, 0, 0, 0);
                return(true);
            }
            else if (key.ToLower().Equals("touchy-"))
            {
                int y = fromPos.Y + step > this.duoTouch.screenBounds.Height - 1 ? this.duoTouch.screenBounds.Height - 1 : fromPos.Y + step;
                positionToPush = new CursorPos(fromPos.X, y, 0, 0, 0);
                return(true);
            }
            else if (key.ToLower().Equals("touchy+"))
            {
                int y = fromPos.Y - step < 0 ? 0 : fromPos.Y - step;
                positionToPush = new CursorPos(fromPos.X, y, 0, 0, 0);
                return(true);
            }
            return(false);
        }
コード例 #20
0
ファイル: SJ353.cs プロジェクト: yan15029969266/EpassProject
        public void SelectSchemCode(string trustId, int selCol = 6)
        {
            if (base.IsHaveNext())
            {
                CursorPos point = base.SearchText(trustId);

                if (point.IsMatched)

                {
                    base.SetText("Y", selCol, point.Row);

                    base.Enter(point.Row, point.Col);
                }
                else
                {
                    base.PageDown();

                    SelectSchemCode(trustId, selCol);
                }
            }
            else if (base.IsBottom())
            {
                CursorPos point = base.SearchText(trustId);
                base.SetText("Y", selCol, point.Row);

                if (point.IsMatched)

                {
                    base.SetText("Y", point.Row, selCol);

                    base.Enter(point.Row, point.Col);
                }
                else
                {
                    Message.Add("can't find the trustId" + trustId);
                    //throw new Exception("can't find the member");
                }
            }
        }
コード例 #21
0
ファイル: MouseHandler.cs プロジェクト: unknownnf/Touchmote
        public bool setPosition(string key, CursorPos cursorPos)
        {
            key = key.ToLower();
            if (key.Equals("mouse"))
            {
                if (!cursorPos.OutOfReach)
                {
                    Point smoothedPos = cursorPositionHelper.getRelativePosition(new Point(cursorPos.X, cursorPos.Y));
                    this.inputSimulator.Mouse.MoveMouseToPositionOnVirtualDesktop((65535 * smoothedPos.X), (65535 * smoothedPos.Y));
                    return(true);
                }
            }

            if (key.Equals("fpsmouse"))
            {
                Point smoothedPos = cursorPositionHelper.getSmoothedPosition(new Point(cursorPos.RelativeX, cursorPos.RelativeY));

                /*
                 * TODO: Consider sensor bar position?
                 * if (Settings.Default.pointer_sensorBarPos == "top")
                 * {
                 *  smoothedPos.Y = smoothedPos.Y - Settings.Default.pointer_sensorBarPosCompensation;
                 * }
                 * else if (Settings.Default.pointer_sensorBarPos == "bottom")
                 * {
                 *  smoothedPos.Y = smoothedPos.Y + Settings.Default.pointer_sensorBarPosCompensation;
                 * }
                 */
                double deadzone = Settings.Default.fpsmouse_deadzone; // TODO: Move to settings
                double shiftX   = Math.Abs(smoothedPos.X - 0.5) > deadzone ? smoothedPos.X - 0.5 : 0;
                double shiftY   = Math.Abs(smoothedPos.Y - 0.5) > deadzone ? smoothedPos.Y - 0.5 : 0;

                this.inputSimulator.Mouse.MoveMouseBy((int)(Settings.Default.fpsmouse_speed * shiftX), (int)(Settings.Default.fpsmouse_speed * shiftY));

                return(true);
            }
            return(false);
        }
コード例 #22
0
        private void End(KeyEventArgs args)
        {
            if (args.Shift)
            {
                var start = GetCursorPosInt() + SelectionLength;
                var lines = GetLines().ToList();
                var pos   = CursorPos.End(lines);
                SelectionLength = start - pos.Pos;
            }
            else
            {
                SelectionLength = 0;
            }

            if (args.Control)
            {
                CursorPos = new CP(int.MaxValue);
            }
            else
            {
                CursorPos = CursorPos.End(GetLines().ToList());
            }
            m_additionUndoAction = null;
        }
コード例 #23
0
 public ToneTalkpoint(string filePath, CursorPos position, bool doesContinue, Tones tone) : base(filePath, position, doesContinue)
 {
     this.talkpointTone = tone;
     this.isCustomTone  = false;
 }
コード例 #24
0
 private static extern bool GetCursorPos(out CursorPos pt);
コード例 #25
0
 private static extern IntPtr WindowFromPoint(CursorPos pos);
コード例 #26
0
 private static void SetCursorPos(CursorPos pos)
 {
     Console.SetCursorPosition(pos.X, pos.Y);
 }
コード例 #27
0
 private void Start()
 {
     cursor = GameObject.Find("Canvas").GetComponent <CursorPos>();
 }
コード例 #28
0
        public void PutChar(char ch)
        {
            if (ch == '\n')
            {
                cursorY++;
                cursorX = 0;
            }
            else
            {
                // First, see if we've already inserted something at this position. If so, delete the old visuals.
                var cursorPos = new CursorPos(cursorX, cursorY);
                if (visualPairs.ContainsKey(cursorPos))
                {
                    var pair = visualPairs[cursorPos];
                    visuals.Remove(pair.Background);
                    visuals.Remove(pair.Character);
                    visualPairs.Remove(cursorPos);
                }

                var backgroundVisual  = new DrawingVisual();
                var backgroundContext = backgroundVisual.RenderOpen();

                var x = fontCharSize.Width * cursorX;
                var y = fontCharSize.Height * cursorY;

                Brush fg, bg;
                if (reverse)
                {
                    fg = FontsAndColorsService.Background;
                    bg = FontsAndColorsService.Foreground;
                }
                else
                {
                    fg = FontsAndColorsService.Foreground;
                    bg = FontsAndColorsService.Background;
                }

                var backgroundRect = new Rect(
                    Math.Floor(x),
                    Math.Floor(y),
                    Math.Ceiling(fontCharSize.Width + .5),
                    Math.Ceiling(fontCharSize.Height));

                backgroundContext.DrawRectangle(bg, null, backgroundRect);

                backgroundContext.Close();

                visuals.Insert(0, backgroundVisual);

                var textVisual  = new DrawingVisual();
                var textContext = textVisual.RenderOpen();

                textContext.DrawText(
                    new FormattedText(
                        ch.ToString(),
                        CultureInfo.CurrentUICulture,
                        FlowDirection.LeftToRight,
                        GetTypeface(),
                        FontsAndColorsService.FontSize,
                        fg,
                        new NumberSubstitution(NumberCultureSource.User, CultureInfo.CurrentUICulture, NumberSubstitutionMethod.AsCulture),
                        TextFormattingMode.Display),
                    new Point(x, y));

                textContext.Close();

                visuals.Add(textVisual);

                var newPair = new VisualPair(backgroundVisual, textVisual);
                visualPairs.Add(cursorPos, newPair);

                cursorX++;
            }
        }
コード例 #29
0
ファイル: Common.cs プロジェクト: zhangtingfeng/unity3dGame
 //模拟鼠标左键点击
 public static void MouseClickSimulate(CursorPos ddCursorPosdd)
 {
     SetCursorPos(ddCursorPosdd.x.toInt32(), ddCursorPosdd.y.toInt32());
     mouse_event(MouseEventFlag.LeftDown, 0, 0, 0, UIntPtr.Zero);
     mouse_event(MouseEventFlag.LeftUp, 0, 0, 0, UIntPtr.Zero);
 }
コード例 #30
0
ファイル: Talkpoint.cs プロジェクト: enigmaeth/CodeTalk
 public Talkpoint(string filePath, CursorPos position, bool doesContinue = false)
 {
     this.filePath     = filePath;
     this.position     = position;
     this.doesContinue = doesContinue;
 }
コード例 #31
0
 public ToneTalkpoint(string filePath, CursorPos position, bool doesContinue, CustomTone customTone) : base(filePath, position, doesContinue)
 {
     this.customTalkpointTone = customTone;
     this.isCustomTone        = true;
 }
コード例 #32
0
ファイル: View.cs プロジェクト: mohammadul/addondev
        public void GetVPos(int x, int y, ref CursorPos curPos)
        {
            //x = 0;
            int tl = udScr_tl_;
            int vl = vScrollBar.Value - udScr_vrl_;
            int rl = y / m_lineHeight + udScr_vrl_;
            if (rl >= 0) // View上端より下の場合、下方向を調べる
                while (tl < doc.LineList.Count && doc.GetvlCnt(tl) <= rl)
                {
                    vl += doc.GetvlCnt(tl);
                    rl -= doc.GetvlCnt(tl);
                    ++tl;
                }
            else           // View上端より上の場合、上方向を調べる
                while (0 <= tl && rl < 0)
                {
                    vl -= doc.GetvlCnt(tl);
                    rl += doc.GetvlCnt(tl);
                    --tl;
                }

            if (tl == doc.LineList.Count) // EOFより下に行ってしまう場合の補正
            {
                --tl;
                vl -= doc.GetvlCnt(tl);
                rl = doc.GetvlCnt(tl) - 1;
            }
            else if (tl == -1) // ファイル頭より上に行ってしまう場合の補正
            {
                tl = vl = rl = 0;
            }

            curPos.tl = tl;
            curPos.vl = vl + rl;
            curPos.rl = rl;

            if (rl < doc.GetvlCnt(tl))
            {
                string str = doc.LineList[tl].LineText;
                int adend = doc.LineList[tl].WrapList[rl];
                int ad = (rl == 0 ? 0 : doc.LineList[tl].WrapList[rl - 1]);
                int vx = (rl == 0 ? 0 : getStringWidth(str[ad++].ToString()));

                while (ad < adend)
                {
                    //int nvx = (str[ad]=='\t'
                    //    ? fnt().nextTab(vx)
                    //    :  vx + fnt().W(&str[ad])
                    //);
                    int nvx = vx + getStringWidth(str[ad].ToString());

                    if (x + 2 < nvx)
                        break;
                    vx = nvx;
                    ++ad;
                }

                curPos.ad = ad;
                curPos.rx = curPos.vx = vx;
            }
            else
            {
                curPos.ad = curPos.rx = curPos.vx = 0;
            }
        }