Used internally, not for own use.
示例#1
0
 public void SetIMEWindowLocation(int x, int y)
 {
     if (Ime.disableIME || this.hIMEWnd == IntPtr.Zero)
     {
         return;
     }
     Ime.POINT pOINT = new Ime.POINT()
     {
         x = x,
         y = y
     };
     Ime.COMPOSITIONFORM cOMPOSITIONFORM = new Ime.COMPOSITIONFORM()
     {
         dwStyle      = 2,
         ptCurrentPos = pOINT,
         rcArea       = new Ime.RECT()
     };
     try
     {
         Ime.SendMessage(this.hIMEWnd, 643, new IntPtr(12), cOMPOSITIONFORM);
     }
     catch (AccessViolationException accessViolationException)
     {
         this.Handle(accessViolationException);
     }
 }
示例#2
0
        public void UpdateCaretPosition()
        {
            if (this.textArea.TextEditorProperties.CaretLine)
            {
                this.textArea.Invalidate();
            }
            else if (this.caretImplementation.RequireRedrawOnPositionChange)
            {
                this.textArea.UpdateLine(this.oldLine);
                if (this.line != this.oldLine)
                {
                    this.textArea.UpdateLine(this.line);
                }
            }
            else if (this.textArea.MotherTextAreaControl.TextEditorProperties.LineViewerStyle == LineViewerStyle.FullRow && this.oldLine != this.line)
            {
                this.textArea.UpdateLine(this.oldLine);
                this.textArea.UpdateLine(this.line);
            }
            this.oldLine = this.line;
            if (this.hidden || this.textArea.MotherTextEditorControl.IsInUpdate)
            {
                this.outstandingUpdate = true;
                return;
            }
            this.outstandingUpdate = false;
            this.ValidateCaretPos();
            int   num            = this.line;
            int   drawingXPos    = this.textArea.TextView.GetDrawingXPos(num, this.column);
            Point screenPosition = this.ScreenPosition;

            if (drawingXPos < 0)
            {
                this.caretImplementation.Destroy();
            }
            else
            {
                this.CreateCaret();
                if (!this.caretImplementation.SetPosition(screenPosition.X, screenPosition.Y))
                {
                    this.caretImplementation.Destroy();
                    Caret.caretCreated = false;
                    this.UpdateCaretPosition();
                }
            }
            if (this.ime != null)
            {
                this.ime.HWnd = this.textArea.Handle;
                this.ime.Font = this.textArea.Document.TextEditorProperties.Font;
            }
            else
            {
                this.ime = new Ime(this.textArea.Handle, this.textArea.Document.TextEditorProperties.Font);
            }
            this.ime.SetIMEWindowLocation(screenPosition.X, screenPosition.Y);
            this.currentPos = screenPosition;
        }
示例#3
0
        public void UpdateCaretPosition()
        {
            if (textArea.MotherTextAreaControl.TextEditorProperties.LineViewerStyle == LineViewerStyle.FullRow && oldLine != line)
            {
                textArea.UpdateLine(oldLine);
                textArea.UpdateLine(line);
            }
            oldLine = line;


            if (hidden || textArea.MotherTextEditorControl.IsUpdating)
            {
                return;
            }
            try {
                if (!caretCreated)
                {
                    CreateCaret();
                }
                if (caretCreated)
                {
                    ValidateCaretPos();
                    int lineNr = this.line;
                    int xpos   = textArea.TextView.GetDrawingXPos(lineNr, this.column);
                    //LineSegment lineSegment = textArea.Document.GetLineSegment(lineNr);
                    Point pos = ScreenPosition;
                    if (xpos >= 0)
                    {
                        bool success = SetCaretPos(pos.X, pos.Y);
                        if (!success)
                        {
                            DestroyCaret();
                            caretCreated = false;
                            UpdateCaretPosition();
                        }
                    }
                    // set the input method editor location
                    if (ime == null)
                    {
                        ime = new Ime(textArea.Handle, textArea.Document.TextEditorProperties.Font);
                    }
                    else
                    {
                        ime.Font = textArea.Document.TextEditorProperties.Font;
                    }
                    ime.SetIMEWindowLocation(pos.X + 2,
                                             pos.Y);

                    currentPos = pos;
                }
            } catch (Exception e) {
                Console.WriteLine("Got exception while update caret position : " + e);
            }
        }
示例#4
0
        public Ime(IntPtr hWnd, System.Drawing.Font font)
        {
            string environmentVariable = Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432");

            if (environmentVariable == "IA64" || environmentVariable == "AMD64" || Environment.OSVersion.Platform == PlatformID.Unix || Environment.Version >= new Version(4, 0))
            {
                Ime.disableIME = true;
            }
            else
            {
                this.hIMEWnd = Ime.ImmGetDefaultIMEWnd(hWnd);
            }
            this.hWnd = hWnd;
            this.font = font;
            this.SetIMEWindowFont(font);
        }
示例#5
0
 private void SetIMEWindowFont(System.Drawing.Font f)
 {
     if (Ime.disableIME || this.hIMEWnd == IntPtr.Zero)
     {
         return;
     }
     if (this.lf == null)
     {
         this.lf = new Ime.LOGFONT();
         f.ToLogFont(this.lf);
         this.lf.lfFaceName = f.Name;
     }
     try
     {
         Ime.SendMessage(this.hIMEWnd, 643, new IntPtr(10), this.lf);
     }
     catch (AccessViolationException accessViolationException)
     {
         this.Handle(accessViolationException);
     }
 }
示例#6
0
文件: Caret.cs 项目: radtek/Portfolio
        public void UpdateCaretPosition()
        {
            Log("UpdateCaretPosition");

            if (caretImplementation.RequireRedrawOnPositionChange)
            {
                textArea.UpdateLine(oldLine);
                if (line != oldLine)
                {
                    textArea.UpdateLine(line);
                }
            }
            else
            {
                if (textArea.MotherTextAreaControl.TextEditorProperties.LineViewerStyle == LineViewerStyle.FullRow && oldLine != line)
                {
                    textArea.UpdateLine(oldLine);
                    textArea.UpdateLine(line);
                }
            }
            oldLine = line;


            if (hidden || textArea.MotherTextEditorControl.IsInUpdate)
            {
                outstandingUpdate = true;
                return;
            }
            else
            {
                outstandingUpdate = false;
            }
            ValidateCaretPos();
            int lineNr = this.line;
            int xpos   = textArea.TextView.GetDrawingXPos(lineNr, this.column);
            //LineSegment lineSegment = textArea.Document.GetLineSegment(lineNr);
            Point pos = ScreenPosition;

            if (xpos >= 0)
            {
                CreateCaret();
                bool success = caretImplementation.SetPosition(pos.X, pos.Y);
                if (!success)
                {
                    caretImplementation.Destroy();
                    caretCreated = false;
                    UpdateCaretPosition();
                }
            }
            else
            {
                caretImplementation.Destroy();
            }

            // set the input method editor location
            if (ime == null)
            {
                ime = new Ime(textArea.Handle, textArea.Document.TextEditorProperties.Font);
            }
            else
            {
                ime.HWnd = textArea.Handle;
                ime.Font = textArea.Document.TextEditorProperties.Font;
            }
            ime.SetIMEWindowLocation(pos.X, pos.Y);

            currentPos = pos;
        }
示例#7
0
        public void UpdateCaretPosition()
        {
            if (textArea.MotherTextAreaControl.TextEditorProperties.LineViewerStyle == LineViewerStyle.FullRow && oldLine != line) {
                textArea.UpdateLine(oldLine);
                textArea.UpdateLine(line);
            }
            oldLine = line;

            if (hidden || textArea.MotherTextEditorControl.IsUpdating) {
                return;
            }
            if (!caretCreated) {
                CreateCaret();
            }
            if (caretCreated) {
                ValidateCaretPos();
                int lineNr = this.line;
                int xpos = textArea.TextView.GetDrawingXPos(lineNr, this.column);
                //LineSegment lineSegment = textArea.Document.GetLineSegment(lineNr);
                Point pos = ScreenPosition;
                if (xpos >= 0) {
                    bool success = SetCaretPos(pos.X, pos.Y);
                    if (!success) {
                        DestroyCaret();
                        caretCreated = false;
                        UpdateCaretPosition();
                    }
                }
                // set the input method editor location
                if (ime == null) {
                    ime = new Ime(textArea.Handle, textArea.Document.TextEditorProperties.Font);
                } else {
                    ime.HWnd = textArea.Handle;
                    ime.Font = textArea.Document.TextEditorProperties.Font;
                }
                ime.SetIMEWindowLocation(pos.X, pos.Y);

                currentPos = pos;
            }
        }
示例#8
0
		public void UpdateCaretPosition()
		{
			Log("UpdateCaretPosition");
			
			if (textArea.TextEditorProperties.CaretLine) {
				textArea.Invalidate();
			} else {
				if (caretImplementation.RequireRedrawOnPositionChange) {
					textArea.UpdateLine(oldLine);
					if (line != oldLine)
						textArea.UpdateLine(line);
				} else {
					if (textArea.MotherTextAreaControl.TextEditorProperties.LineViewerStyle == LineViewerStyle.FullRow && oldLine != line) {
						textArea.UpdateLine(oldLine);
						textArea.UpdateLine(line);
					}
				}
			}
			oldLine = line;
			
			
			if (hidden || textArea.MotherTextEditorControl.IsInUpdate) {
				outstandingUpdate = true;
				return;
			} else {
				outstandingUpdate = false;
			}
			ValidateCaretPos();
			int lineNr = this.line;
			int xpos = textArea.TextView.GetDrawingXPos(lineNr, this.column);
			//LineSegment lineSegment = textArea.Document.GetLineSegment(lineNr);
			Point pos = ScreenPosition;
			if (xpos >= 0) {
				CreateCaret();
				bool success = caretImplementation.SetPosition(pos.X, pos.Y);
				if (!success) {
					caretImplementation.Destroy();
					caretCreated = false;
					UpdateCaretPosition();
				}
			} else {
				caretImplementation.Destroy();
			}
			
			// set the input method editor location
			if (ime == null) {
				ime = new Ime(textArea.Handle, textArea.Document.TextEditorProperties.Font);
			} else {
				ime.HWnd = textArea.Handle;
				ime.Font = textArea.Document.TextEditorProperties.Font;
			}
			ime.SetIMEWindowLocation(pos.X, pos.Y);
			
			currentPos = pos;
		}