コード例 #1
0
ファイル: XIDE.cs プロジェクト: CallMeFoxie/XIDE
        private void UpdateNumberLabels(SmartTextBox rtb)
        {
            LineLabel lLbl = (rtb.Tag as TabInfo).Liner;

            int Start = rtb.GetLineFromCharIndex(rtb.GetCharIndexFromPosition(new Point(0, 0)));
            int Stop  = rtb.GetLineFromCharIndex(rtb.GetCharIndexFromPosition(new Point(0, rtb.ClientRectangle.Height)));

            if (lLbl != null)
            {
                lLbl.minNumber = Start + 1;
                lLbl.maxNumber = Stop + 1;

                lLbl.Invalidate();

                if (Helper.IsUnix())
                {
                    lLbl.Location = new Point(0, (int)Math.Ceiling((decimal)rtb.GetPositionFromCharIndex(0).Y % (rtb.Font.Height)));
                }
                else
                {
                    int d = rtb.GetPositionFromCharIndex(0).Y % (rtb.Font.Height);
                    lLbl.Location = new Point(0, (int)Math.Ceiling((decimal)rtb.GetPositionFromCharIndex(0).Y % (rtb.Font.Height + 1)) + 2);
                }
            }
        }
コード例 #2
0
ファイル: XIDE.cs プロジェクト: CallMeFoxie/XIDE
        private void UpdateNumberLabels(SmartTextBox rtb)
        {
            LineLabel lLbl = (rtb.Tag as TabInfo).Liner;

            int Start = rtb.GetLineFromCharIndex(rtb.GetCharIndexFromPosition(new Point(0, 0)));
            int Stop = rtb.GetLineFromCharIndex(rtb.GetCharIndexFromPosition(new Point(0, rtb.ClientRectangle.Height)));

            if (lLbl != null)
            {
                lLbl.minNumber = Start + 1;
                lLbl.maxNumber = Stop + 1;

                lLbl.Invalidate();

                if (Helper.IsUnix())
                {
                    lLbl.Location = new Point(0, (int)Math.Ceiling((decimal)rtb.GetPositionFromCharIndex(0).Y % (rtb.Font.Height)));
                }
                else
                {
                    int d = rtb.GetPositionFromCharIndex(0).Y % (rtb.Font.Height);
                    lLbl.Location = new Point(0, (int)Math.Ceiling((decimal)rtb.GetPositionFromCharIndex(0).Y % (rtb.Font.Height + 1)) + 2);
                }
            }
        }
コード例 #3
0
ファイル: XIDE.cs プロジェクト: CallMeFoxie/XIDE
        private void OpenNewTab(string OpenedFile)
        {
            TabInfo ti = new TabInfo();
            ti.File = OpenedFile;

            TabPage tp = new TabPage(new FileInfo(OpenedFile).Name);
            tabTabs.TabPages.Add(tp);

            SmartTextBox rtb = new SmartTextBox();
            rtb.AcceptsTab = true;
            rtb.Dock = DockStyle.Fill;
            rtb.LinkClicked += rtb_LinkClicked;
            rtb.Highlights = this.Highlights;
            rtb.Hints = Hints;
            rtb.Suggestions = Suggestions;

            Panel pnlParent = new Panel();
            pnlParent.Padding = new Padding(0, 0, 0, 0);
            pnlParent.Controls.Add(rtb);
            pnlParent.Dock = DockStyle.Fill;

            Panel pnlNumbers = new Panel();
            pnlNumbers.Dock = DockStyle.Left;
            pnlNumbers.Width = 35;
            pnlNumbers.Height = tabTabs.Height;

            LineLabel lLbl = new LineLabel();
            lLbl.Width = pnlNumbers.Size.Width - 3;
            lLbl.Height = pnlNumbers.Height;
            lLbl.Location = new Point(0, 1);
            lLbl.Font = new Font(FontFamily.GenericMonospace, 8);
            lLbl.MouseDown += lLbl_Click;

            if (Helper.IsUnix())
                lLbl.LineSpacing = 13f;

            pnlNumbers.Controls.Add(lLbl);
            pnlParent.Controls.Add(pnlNumbers);

            ti.Liner = lLbl;
            ti.Rtb = rtb;

            rtb.KeyDown += txtCode_KeyDown;
            rtb.SelectionTabs = new int[] { 12, 25, 37, 50 };
            rtb.Font = txtLog.Font = new System.Drawing.Font(FontFamily.GenericMonospace, 8);
            rtb.TextChanged += txtCode_TextChanged;
            rtb.VScroll += txtCode_VScroll;
            rtb.KeyPress += txtCode_KeyPress;

            rtb.Tag = ti;

            tp.Controls.Add(pnlParent);

            tp.Tag = ti;

            if (File.Exists(OpenedFile))
            {
                StreamReader rd = new StreamReader(OpenedFile);
                rtb.Text = rd.ReadToEnd();
                rd.Close();
            }

            tabTabs.SelectedTab = tp;
            ti.TitleFileName = new FileInfo(OpenedFile).Name;

            RebuildTitle(tabTabs.SelectedIndex);
        }
コード例 #4
0
ファイル: XIDE.cs プロジェクト: CallMeFoxie/XIDE
 private void txtCode_KeyDown(object sender, KeyEventArgs e)
 {
     SmartTextBox rtb = (sender as SmartTextBox);
 }
コード例 #5
0
ファイル: XIDE.cs プロジェクト: CallMeFoxie/XIDE
        private void OpenNewTab(string OpenedFile)
        {
            TabInfo ti = new TabInfo();

            ti.File = OpenedFile;

            TabPage tp = new TabPage(new FileInfo(OpenedFile).Name);

            tabTabs.TabPages.Add(tp);

            SmartTextBox rtb = new SmartTextBox();

            rtb.AcceptsTab   = true;
            rtb.Dock         = DockStyle.Fill;
            rtb.LinkClicked += rtb_LinkClicked;
            rtb.Highlights   = this.Highlights;
            rtb.Hints        = Hints;
            rtb.Suggestions  = Suggestions;

            Panel pnlParent = new Panel();

            pnlParent.Padding = new Padding(0, 0, 0, 0);
            pnlParent.Controls.Add(rtb);
            pnlParent.Dock = DockStyle.Fill;

            Panel pnlNumbers = new Panel();

            pnlNumbers.Dock   = DockStyle.Left;
            pnlNumbers.Width  = 35;
            pnlNumbers.Height = tabTabs.Height;

            LineLabel lLbl = new LineLabel();

            lLbl.Width      = pnlNumbers.Size.Width - 3;
            lLbl.Height     = pnlNumbers.Height;
            lLbl.Location   = new Point(0, 1);
            lLbl.Font       = new Font(FontFamily.GenericMonospace, 8);
            lLbl.MouseDown += lLbl_Click;

            if (Helper.IsUnix())
            {
                lLbl.LineSpacing = 13f;
            }

            pnlNumbers.Controls.Add(lLbl);
            pnlParent.Controls.Add(pnlNumbers);

            ti.Liner = lLbl;
            ti.Rtb   = rtb;

            rtb.KeyDown      += txtCode_KeyDown;
            rtb.SelectionTabs = new int[] { 12, 25, 37, 50 };
            rtb.Font          = txtLog.Font = new System.Drawing.Font(FontFamily.GenericMonospace, 8);
            rtb.TextChanged  += txtCode_TextChanged;
            rtb.VScroll      += txtCode_VScroll;
            rtb.KeyPress     += txtCode_KeyPress;

            rtb.Tag = ti;

            tp.Controls.Add(pnlParent);

            tp.Tag = ti;

            if (File.Exists(OpenedFile))
            {
                StreamReader rd = new StreamReader(OpenedFile);
                rtb.Text = rd.ReadToEnd();
                rd.Close();
            }

            tabTabs.SelectedTab = tp;
            ti.TitleFileName    = new FileInfo(OpenedFile).Name;

            RebuildTitle(tabTabs.SelectedIndex);
        }