示例#1
0
 private void krbTabControl1_SelectedIndexChanged(object sender, EventArgs e)
 {
     FastColoredTextBoxNS.FastColoredTextBox myTB = krbTabControl1.SelectedTab.Controls[0] as FastColoredTextBoxNS.FastColoredTextBox;
     documentMap1.Target          = myTB;
     saveToolStripMenuItem.Text   = "Save " + myTB.Parent.Text;
     saveAsToolStripMenuItem.Text = "Save " + myTB.Parent.Text + "As...";
 }
示例#2
0
 private void toolStripButton9_Click(object sender, EventArgs e)
 {
     try
     {
         FastColoredTextBoxNS.FastColoredTextBox myTB = krbTabControl1.SelectedTab.Controls[0] as FastColoredTextBoxNS.FastColoredTextBox;
         bool error = false;
         lua.RegisterFunction("class", this, this.GetType().GetMethod("nullFunction"));
         try
         {
             lua.DoString(Properties.Resources._class + myTB.Text);
         }
         catch (Exception ex)
         {
             error = true;
             toolStripStatusLabel1.Image = Properties.Resources._1;
             toolStripStatusLabel1.Text  = ex.Message;
         }
         finally
         {
             if (!error)
             {
                 toolStripStatusLabel1.Text  = "Successfully Compiled";
                 toolStripStatusLabel1.Image = Properties.Resources._2;
             }
         }
     }
     catch
     {
     }
 }
示例#3
0
 public Form1()
 {
     InitializeComponent();
     txtBox      = new FastColoredTextBox();
     txtBox.Dock = DockStyle.Fill;
     //txtBox.AllowDrop = true;
     //this.panel1.AllowDrop = true;
     this.panel1.Controls.Add(txtBox);
 }
示例#4
0
 public void Setup(FastColoredTextBoxNS.FastColoredTextBox in_fragEditor,
                   FastColoredTextBoxNS.FastColoredTextBox in_vertexeditor,
                   MShader shader)
 {
     frageditor   = in_fragEditor;
     vertexeditor = in_vertexeditor;
     _shader      = shader;
     LoadFragment();
     LoadVertexShader();
 }
示例#5
0
 private void toolStripButton16_Click(object sender, EventArgs e)
 {
     FastColoredTextBoxNS.FastColoredTextBox myTB = krbTabControl1.SelectedTab.Controls[0] as FastColoredTextBoxNS.FastColoredTextBox;
     if (myTB.Bookmarks.Contains(myTB.Selection.Start.iLine))
     {
         myTB.Bookmarks.Remove(myTB.Selection.Start.iLine);
     }
     else
     {
         myTB.Bookmarks.Add(myTB.Selection.Start.iLine);
     }
 }
示例#6
0
        ///Выполнить скрипт SQLite или Postgres.
        private void ExecuteScript(FastColoredTextBoxNS.FastColoredTextBox tb, Connection conLocal)
        {
            string sql = tb.SelectedText;

            if (sql == "")
            {
                sql = tb.Text;
            }
            if (conLocal.Exec(sql))
            {
                sys.SM("Выполнено!", MessageType.Information);
            }
        }
示例#7
0
文件: Form1.cs 项目: baf2117/compi2
      private void button2_Click(object sender, EventArgs e)
      {
          TabPage tabPagex = new System.Windows.Forms.TabPage();

          tabPagex.Location = new System.Drawing.Point(4, 22);
          tabPagex.Name     = "tabPage" + index;
          tabPagex.Padding  = new System.Windows.Forms.Padding(3);
          tabPagex.Size     = new System.Drawing.Size(699, 289);
          tabPagex.TabIndex = index;
          tabPagex.Text     = "ventana" + index;
          tabPagex.UseVisualStyleBackColor = true;
          index++;

          FastColoredTextBox ventanax = new FastColoredTextBoxNS.FastColoredTextBox();

          ((System.ComponentModel.ISupportInitialize)(ventanax)).BeginInit();

          ventanax.AutoCompleteBracketsList = new char[] {
              '(',
              ')',
              '{',
              '}',
              '[',
              ']',
              '\"',
              '\"',
              '\'',
              '\''
          };
          System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
          ventanax.AutoScrollMinSize = new System.Drawing.Size(27, 14);
          ventanax.BackBrush         = null;
          ventanax.CharHeight        = 14;
          ventanax.CharWidth         = 8;
          ventanax.Cursor            = System.Windows.Forms.Cursors.IBeam;
          ventanax.DisabledColor     = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(180)))), ((int)(((byte)(180)))), ((int)(((byte)(180)))));
          ventanax.IsReplaceMode     = false;
          ventanax.Location          = new System.Drawing.Point(0, 0);
          ventanax.Name           = "ventana" + index;
          ventanax.Paddings       = new System.Windows.Forms.Padding(0);
          ventanax.SelectionColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(255)))));
          ventanax.ServiceColors  = ((FastColoredTextBoxNS.ServiceColors)(resources.GetObject("ventana.ServiceColors")));
          ventanax.Size           = new System.Drawing.Size(818, 289);
          ventanax.TabIndex       = 9;
          ventanax.Zoom           = 100;
          ventanax.TextChanged   += new System.EventHandler <FastColoredTextBoxNS.TextChangedEventArgs>(this.ventana_TextChanged);

          tabPagex.Controls.Add(ventanax);

          this.tabControl1.Controls.Add(tabPagex);
      }
示例#8
0
        private void lagFreeCirclesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FastColoredTextBoxNS.FastColoredTextBox myTB = krbTabControl1.SelectedTab.Controls[0] as FastColoredTextBoxNS.FastColoredTextBox;
            myTB.InsertText(Properties.Resources.LagFreeCircles);
            Range r = myTB.Range.Clone();

            r.End = new Place(myTB[myTB.LinesCount - 1].Count, myTB.LinesCount - 1);
            var pattern = Regex.Escape("function OnLoad()");

            foreach (var found in r.GetRanges(pattern))
            {
                myTB.Selection = found;
                myTB.Text.Insert(found.Start.iChar + 1, "test");
            }
        }
 private void AppendTextInBox(FastColoredTextBoxNS.FastColoredTextBox box, string text)
 {
     if (this.InvokeRequired)
     {
         try
         {
             this.Invoke((Action <FastColoredTextBoxNS.FastColoredTextBox, string>)AppendTextInBox, fastColoredTextBox1, text);
         }
         catch
         { /*Script was prematurely murdered*/ }
     }
     else
     {
         box.Text += text;
     }
 }
示例#10
0
        private Place CharnoToPlace(FastColoredTextBoxNS.FastColoredTextBox tb, int charnoo)
        {
            int charno = charnoo - 1;
            int chrs   = 0;
            int ls     = 0;

            foreach (string l in tb.Lines)
            {
                if (charno < (chrs + (l.Length - 1)))
                {
                    return(new Place(charno - ((l.Length - 1) + chrs), ls));
                }
                chrs += l.Length;
                ls++;
            }
            return(new Place(-1, -1));
        }
示例#11
0
 private void toolStripButton3_Click(object sender, EventArgs e)
 {
     FastColoredTextBoxNS.FastColoredTextBox myTB = krbTabControl1.SelectedTab.Controls[0] as FastColoredTextBoxNS.FastColoredTextBox;
     myTB.SaveToFile("test.lua", Encoding.UTF8);
 }
示例#12
0
 /// <summary>
 ///     Find Form
 /// </summary>
 /// <param name="tb"></param>
 /// )
 public FindForm(FastColoredTextBox tb)
 {
     InitializeComponent();
     this.tb = tb;
     tbFind.Select(0, 1);
 }
示例#13
0
 public Bookmarks(FastColoredTextBox tb)
 {
     this.tb          = tb;
     tb.LineInserted += tb_LineInserted;
     tb.LineRemoved  += tb_LineRemoved;
 }
示例#14
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="tb">Underlaying textbox</param>
 /// <param name="insertedText">Text for inserting</param>
 public InsertTextCommand(FastColoredTextBox tb, string insertedText) : base(tb)
 {
     this.insertedText = insertedText;
 }
示例#15
0
 private void toolStripButton17_Click(object sender, EventArgs e)
 {
     FastColoredTextBoxNS.FastColoredTextBox myTB = krbTabControl1.SelectedTab.Controls[0] as FastColoredTextBoxNS.FastColoredTextBox;
     myTB.GotoNextBookmark(myTB.Selection.Start.iLine);
 }
示例#16
0
        public string GetRtf(Range r)
        {
            _tb = r.Tb;
            var styles         = new Dictionary <StyleIndex, object>();
            var sb             = new StringBuilder();
            var tempSb         = new StringBuilder();
            var currentStyleId = StyleIndex.None;

            r.Normalize();
            var currentLine = r.Start.ILine;

            styles[currentStyleId] = null;
            _colorTable.Clear();
            //
            var lineNumberColor = GetColorTableNumber(r.Tb.LineNumberColor);

            if (IncludeLineNumbers)
            {
                tempSb.AppendFormat(@"{{\cf{1} {0}}}\tab", currentLine + 1, lineNumberColor);
            }
            //
            foreach (var p in r)
            {
                var c = r.Tb[p.ILine][p.IChar];
                if (c.Style != currentStyleId)
                {
                    Flush(sb, tempSb, currentStyleId);
                    currentStyleId         = c.Style;
                    styles[currentStyleId] = null;
                }

                if (p.ILine != currentLine)
                {
                    for (var i = currentLine; i < p.ILine; i++)
                    {
                        tempSb.AppendLine(@"\line");
                        if (IncludeLineNumbers)
                        {
                            tempSb.AppendFormat(@"{{\cf{1} {0}}}\tab", i + 2, lineNumberColor);
                        }
                    }
                    currentLine = p.ILine;
                }
                switch (c.C)
                {
                case '\\':
                    tempSb.Append(@"\\");
                    break;

                case '{':
                    tempSb.Append(@"\{");
                    break;

                case '}':
                    tempSb.Append(@"\}");
                    break;

                default:
                    var ch   = c.C;
                    var code = (int)ch;
                    if (code < 128)
                    {
                        tempSb.Append(c.C);
                    }
                    else
                    {
                        tempSb.AppendFormat(@"{{\u{0}}}", code);
                    }
                    break;
                }
            }
            Flush(sb, tempSb, currentStyleId);

            //build color table
            var list = new SortedList <int, Color>();

            foreach (var pair in _colorTable)
            {
                list.Add(pair.Value, pair.Key);
            }

            tempSb.Length = 0;
            tempSb.AppendFormat(@"{{\colortbl;");

            foreach (var pair in list)
            {
                tempSb.Append(GetColorAsString(pair.Value) + ";");
            }
            tempSb.AppendLine("}");

            //
            if (UseOriginalFont)
            {
                sb.Insert(0, string.Format(@"{{\fonttbl{{\f0\fmodern {0};}}}}{{\fs{1} ",
                                           _tb.Font.Name, (int)(2 * _tb.Font.SizeInPoints), _tb.CharHeight));
                sb.AppendLine(@"}");
            }

            sb.Insert(0, tempSb.ToString());

            sb.Insert(0, @"{\rtf1\ud\deff0");
            sb.AppendLine(@"}");

            return(sb.ToString());
        }
示例#17
0
 /// <summary>
 /// Shows VisualMarker
 /// Call this method in Draw method, when you need to show VisualMarker for your style
 /// </summary>
 protected virtual void AddVisualMarker(FastColoredTextBox tb, StyleVisualMarker marker)
 {
     tb.AddVisualMarker(marker);
 }
示例#18
0
 protected char[] RememberBrackets(FastColoredTextBox tb)
 {
     return(new[] { tb.LeftBracket, tb.RightBracket, tb.LeftBracket2, tb.RightBracket2 });
 }
示例#19
0
文件: Form1.cs 项目: baf2117/compi2
      private void Directorios_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
      {
          if (e.Node.ImageIndex != 0)
          {
              String direc = e.Node.Name;

              foreach (TabPage tab in tabControl1.Controls)
              {
                  if (tab.Name.Equals(direc))
                  {
                      return;
                  }
              }

              String[] archs  = direc.Split('\\');
              int      tama   = archs.Count();
              String   Nombre = archs[tama - 1];

              TabPage tabPagex = new System.Windows.Forms.TabPage();
              tabPagex.Location = new System.Drawing.Point(4, 22);
              tabPagex.Name     = direc;
              tabPagex.Padding  = new System.Windows.Forms.Padding(3);
              tabPagex.Size     = new System.Drawing.Size(699, 289);
              tabPagex.TabIndex = index;
              tabPagex.Text     = Nombre;
              tabPagex.UseVisualStyleBackColor = true;


              FastColoredTextBox ventanax = new FastColoredTextBoxNS.FastColoredTextBox();
              ((System.ComponentModel.ISupportInitialize)(ventanax)).BeginInit();

              ventanax.AutoCompleteBracketsList = new char[] {
                  '(',
                  ')',
                  '{',
                  '}',
                  '[',
                  ']',
                  '\"',
                  '\"',
                  '\'',
                  '\''
              };
              System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
              ventanax.AutoScrollMinSize = new System.Drawing.Size(27, 14);
              ventanax.BackBrush         = null;
              ventanax.CharHeight        = 14;
              ventanax.CharWidth         = 8;
              ventanax.Cursor            = System.Windows.Forms.Cursors.IBeam;
              ventanax.DisabledColor     = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(180)))), ((int)(((byte)(180)))), ((int)(((byte)(180)))));
              ventanax.IsReplaceMode     = false;
              ventanax.Location          = new System.Drawing.Point(0, 0);
              ventanax.Name           = direc;
              ventanax.Paddings       = new System.Windows.Forms.Padding(0);
              ventanax.SelectionColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(255)))));
              ventanax.ServiceColors  = ((FastColoredTextBoxNS.ServiceColors)(resources.GetObject("ventana.ServiceColors")));
              ventanax.Size           = new System.Drawing.Size(818, 289);
              ventanax.TabIndex       = 9;
              ventanax.Zoom           = 100;
              ventanax.TextChanged   += new System.EventHandler <FastColoredTextBoxNS.TextChangedEventArgs>(this.ventana_TextChanged);

              string[] lines = System.IO.File.ReadAllLines(direc);

              String conte = "";
              foreach (string line in lines)
              {
                  conte += "\n" + line;
              }

              ventanax.Text = conte;

              tabPagex.Controls.Add(ventanax);

              this.tabControl1.Controls.Add(tabPagex);
          }
      }
示例#20
0
 protected virtual void Subscribe(FastColoredTextBox target)
 {
     target.Scroll              += target_Scroll;
     target.SelectionChanged    += target_SelectionChanged;
     target.VisibleRangeChanged += target_VisibleRangeChanged;
 }
示例#21
0
 public SyntaxHighlighter(FastColoredTextBox currentTb)
 {
     this.currentTb = currentTb;
 }
 public FindForm(FastColoredTextBox tb)
 {
     InitializeComponent();
     this.tb = tb;
 }
示例#23
0
 protected virtual void UnSubscribe(FastColoredTextBox target)
 {
     target.Scroll -= new ScrollEventHandler(Target_Scroll);
     target.SelectionChangedDelayed -= new EventHandler(Target_SelectionChanged);
     target.VisibleRangeChanged     -= new EventHandler(Target_VisibleRangeChanged);
 }
示例#24
0
        public string GetHtml(Range r)
        {
            this.tb = r.tb;
            Dictionary <StyleIndex, object> styles = new Dictionary <StyleIndex, object>();
            StringBuilder sb             = new StringBuilder();
            StringBuilder tempSB         = new StringBuilder();
            StyleIndex    currentStyleId = StyleIndex.None;

            r.Normalize();
            int currentLine = r.Start.iLine;

            styles[currentStyleId] = null;
            //
            if (UseOriginalFont)
            {
                sb.AppendFormat("<font style=\"font-family: {0}, monospace; font-size: {1}pt; line-height: {2}px;\">",
                                r.tb.Font.Name, r.tb.Font.SizeInPoints, r.tb.CharHeight);
            }

            //
            if (IncludeLineNumbers)
            {
                tempSB.AppendFormat("<span class=lineNumber>{0}</span>  ", currentLine + 1);
            }
            //
            bool hasNonSpace = false;

            foreach (Place p in r)
            {
                Char c = r.tb[p.iLine][p.iChar];
                if (c.style != currentStyleId)
                {
                    Flush(sb, tempSB, currentStyleId);
                    currentStyleId         = c.style;
                    styles[currentStyleId] = null;
                }

                if (p.iLine != currentLine)
                {
                    for (int i = currentLine; i < p.iLine; i++)
                    {
                        tempSB.Append(UseBr ? "<br>" : "\r\n");
                        if (IncludeLineNumbers)
                        {
                            tempSB.AppendFormat("<span class=lineNumber>{0}</span>  ", i + 2);
                        }
                    }
                    currentLine = p.iLine;
                    hasNonSpace = false;
                }
                switch (c.c)
                {
                case ' ':
                    if ((hasNonSpace || !UseForwardNbsp) && !UseNbsp)
                    {
                        goto default;
                    }

                    tempSB.Append("&nbsp;");
                    break;

                case '<':
                    tempSB.Append("&lt;");
                    break;

                case '>':
                    tempSB.Append("&gt;");
                    break;

                case '&':
                    tempSB.Append("&amp;");
                    break;

                default:
                    hasNonSpace = true;
                    tempSB.Append(c.c);
                    break;
                }
            }
            Flush(sb, tempSB, currentStyleId);

            if (UseOriginalFont)
            {
                sb.Append("</font>");
            }

            //build styles
            if (UseStyleTag)
            {
                tempSB.Length = 0;
                tempSB.Append("<style type=\"text/css\">");
                foreach (var styleId in styles.Keys)
                {
                    tempSB.AppendFormat(".fctb{0}{{ {1} }}\r\n", GetStyleName(styleId), GetCss(styleId));
                }
                tempSB.Append("</style>");

                sb.Insert(0, tempSB.ToString());
            }

            if (IncludeLineNumbers)
            {
                sb.Insert(0, LineNumbersCSS);
            }

            return(sb.ToString());
        }
示例#25
0
 private void toolStripButton19_Click(object sender, EventArgs e)
 {
     FastColoredTextBoxNS.FastColoredTextBox myTB = krbTabControl1.SelectedTab.Controls[0] as FastColoredTextBoxNS.FastColoredTextBox;
     myTB.ShowReplaceDialog();
 }
示例#26
0
 /// <summary>
 /// Construstor
 /// </summary>
 /// <param name="tb">Underlaying textbox</param>
 public ClearSelectedCommand(FastColoredTextBox tb) : base(tb)
 {
 }
示例#27
0
 public FindForm(FastColoredTextBoxNS.FastColoredTextBox fctb)
 {
     InitializeComponent();
     _fctb = fctb;
 }
示例#28
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="tb">Underlaying textbox</param>
 /// <param name="c">Inserting char</param>
 public InsertCharCommand(FastColoredTextBox tb, char c) : base(tb)
 {
     this.c = c;
 }
示例#29
0
        //string Language;

        public FindForm(FastColoredTextBox tb)
        {
            InitializeComponent();
            this.tb = tb;
            //Language = tb.InterfaceLanguage;
        }
 internal MacrosManager(FastColoredTextBox ctrl)
 {
     UnderlayingControl        = ctrl;
     AllowMacroRecordingByUser = true;
 }