Example #1
0
        //ピクセル単位のサイズを受け取り、チップを表示
        public void SplitterDragging(int width, int height)
        {
            SizeF charSize = GetRenderProfile().Pitch;

            Win32.SystemMetrics sm = GEnv.SystemMetrics;
            width  = (int)Math.Floor(((float)width - sm.ScrollBarWidth - sm.ControlBorderWidth * 2) / charSize.Width);
            height = (int)Math.Floor((float)(height - sm.ControlBorderHeight * 2) / charSize.Height);
            ShowSizeTip(width, height);
        }
Example #2
0
        public Size CalcTerminalSize(RenderProfile prof)
        {
            SizeF charPitch = prof.Pitch;

            Win32.SystemMetrics sm = GEnv.SystemMetrics;
            int width  = (int)Math.Floor((float)(this.ClientSize.Width - sm.ScrollBarWidth - CharacterDocumentViewer.BORDER * 2) / charPitch.Width);
            int height = (int)Math.Floor((float)(this.ClientSize.Height - CharacterDocumentViewer.BORDER * 2 + prof.LineSpacing) / (charPitch.Height + prof.LineSpacing));

            if (width <= 0)
            {
                width = 1;                         //極端なリサイズをすると負の値になることがある
            }
            if (height <= 0)
            {
                height = 1;
            }
            return(new Size(width, height));
        }
Example #3
0
        //IMEの位置合わせなど。日本語入力開始時、現在のキャレット位置からIMEをスタートさせる。
        private void AdjustIMEComposition()
        {
            TerminalDocument document = GetDocument();
            IntPtr           hIMC     = Win32.ImmGetContext(this.Handle);
            RenderProfile    prof     = GetRenderProfile();

            //フォントのセットは1回やればよいのか?
            Win32.LOGFONT lf = new Win32.LOGFONT();
            prof.CalcFont(null, CharGroup.Zenkaku).ToLogFont(lf);
            Win32.ImmSetCompositionFont(hIMC, lf);

            Win32.COMPOSITIONFORM form = new Win32.COMPOSITIONFORM();
            form.dwStyle = Win32.CFS_POINT;
            Win32.SystemMetrics sm = GEnv.SystemMetrics;
            //Debug.WriteLine(String.Format("{0} {1} {2}", document.CaretColumn, charwidth, document.CurrentLine.CharPosToDisplayPos(document.CaretColumn)));
            form.ptCurrentPos.x = sm.ControlBorderWidth + (int)(prof.Pitch.Width * (document.CaretColumn));
            form.ptCurrentPos.y = sm.ControlBorderHeight + (int)((prof.Pitch.Height + prof.LineSpacing) * (document.CurrentLineNumber - document.TopLineNumber));
            bool r = Win32.ImmSetCompositionWindow(hIMC, ref form);

            Debug.Assert(r);
            Win32.ImmReleaseContext(this.Handle, hIMC);
        }