Exemplo n.º 1
0
 private void Copy_ToolStripButton_Click(object sender, EventArgs e)
 {
     if (tabControlCode.TabCount > 0)
     {
         FastColoredTextBox textBox = tabControlCode.SelectedTab.Controls[0] as FastColoredTextBox;
         textBox.Copy();
         textBox.Focus();
     }
 }
Exemplo n.º 2
0
        private void toolStripButton1_Click_1(object sender, EventArgs e)
        {
            FastColoredTextBox textBox = tabControlCode.SelectedTab.Controls[0] as FastColoredTextBox;

            if (textBox.SelectionLength > 0)
            {
                textBox.Copy();
            }
            textBox.Focus();
        }
Exemplo n.º 3
0
        private void CopiarArchivo()
        {
            if (tabArchivo.SelectedIndex != -1)
            {
                TabPage            sPage      = tabArchivo.SelectedTab;
                FastColoredTextBox ctbArchivo = (FastColoredTextBox)sPage.Controls[0];

                if (!ctbArchivo.Selection.Text.Equals(""))
                {
                    ctbArchivo.Copy();
                }
            }
        }
Exemplo n.º 4
0
      public static bool moveBlockDown(bool figureIsMarked)
      {
          if (rangeOk && figureIsMarked)
          {
              string key = "";
              if (type == xmlMarkerType.Figure)
              {
                  key = xmlMarker.figureEnd;
              }
              else if (type == xmlMarkerType.Group)
              {
                  key = xmlMarker.groupEnd;
              }

              int newPos = -1;
              if (key.Length > 1)
              {
                  newPos = findDown(key, end + 1) + 1;  //   find next xmlEnd marker
              }
              if (newPos >= end)
              {
                  if (gcode.loggerTrace)
                  {
                      Logger.Trace(" moveBlockDown Start {0} {1}", newPos, fCTB.Lines[newPos]);
                  }
                  Bookmarks tmp = new Bookmarks(fCTB);
                  tmp.Clear();
                  fCTB.Copy();
                  Range oldSelection = fCTB.Selection.Clone();

                  Place selStart;
                  selStart.iLine = newPos;
                  selStart.iChar = 0;
                  Range mySelection = new Range(fCTB);
                  mySelection.Start = mySelection.End = selStart;
                  fCTB.Selection    = mySelection;
                  fCTB.Paste();                         // insert code at new position
                  fCTB.InsertText("\r\n");

                  fCTB.Selection = oldSelection;
                  fCTB.Cut();
                  List <int> remove = new List <int>();
                  remove.Add(start);
                  fCTB.RemoveLines(remove);             // remove empty line after cut
                  return(true);
              }
          }
          return(false);
      }
Exemplo n.º 5
0
        public void Copy()
        {
            Logger.GetInstance().Debug("Copy() >>");

            try
            {
                _innerTextbox.Copy();
            }
            catch (Exception e)
            {
                throw e;
            }

            Logger.GetInstance().Debug("<< Copy()");
        }
Exemplo n.º 6
0
 // Copy.
 private void buttonCopy_Click(object sender, EventArgs e)
 {
     codeEditor.Copy();
 }
 public void CopyWithMarkup()
 {
     _tb.Copy();
 }
Exemplo n.º 8
0
 public void Copy()
 {
     textBox.Copy();
 }
Exemplo n.º 9
0
        private void bt_copy_Click(object sender, EventArgs e)
        {
            FastColoredTextBox fctb = ((FastColoredTextBox)(tabControl1.SelectedTab.Controls[0]));

            fctb.Copy();
        }
Exemplo n.º 10
0
 private void copyToolStripButton_Click(object sender, EventArgs e)
 {
     if (lastSelectedTextControl.SelectionLength > 0)
         lastSelectedTextControl.Copy();
 }
Exemplo n.º 11
0
        private void KeyDown(object sender, KeyEventArgs e)
        {
            if ((txt.Selection.Start.iLine < txt.LinesCount - 1 || txt.Selection.Start.iChar < 2) &&
                ((char)e.KeyData == 13 || e.KeyData == (Keys.Alt | Keys.V) || e.KeyData == (Keys.Alt | Keys.X) ||
                 ((char)e.KeyData != ' ' && (char)e.KeyData != '\t' && !char.IsControl((char)e.KeyData) && (Control.ModifierKeys & ~Keys.Shift) == 0)))
            {
                if (e.KeyData == (Keys.Alt | Keys.X))
                {
                    txt.Copy();
                    e.Handled = true;
                }
                else
                {
                    txt.Selection = lastselection;
                }
            }

            switch (e.KeyCode)
            {
            /*case Keys.LButton: // Mac bugfix
             *      if((e.Modifiers & Keys.Shift) != 0)
             *              txt.Selection = new Range(txt, 0, txt.Selection.Start.iLine, txt.Selection.End.iChar, txt.Selection.End.iLine);
             *      else
             *              txt.Selection = new Range(txt, 0, txt.Selection.Start.iLine, 0, txt.Selection.Start.iLine);
             *      e.Handled = true;
             *      break;
             * case Keys.MButton: // Mac bugfix
             *      if((e.Modifiers & Keys.Shift) != 0)
             *              txt.Selection = new Range(txt, txt.GetLineLength(txt.Selection.End.iLine), txt.Selection.End.iLine, txt.Selection.End.iChar, txt.Selection.End.iLine);
             *      else
             *              txt.Selection = new Range(txt, txt.GetLineLength(txt.Selection.End.iLine), txt.Selection.End.iLine, txt.GetLineLength(txt.Selection.End.iLine), txt.Selection.End.iLine);
             *      e.Handled = true;
             *      break;*/

            case Keys.Up:
            {
                string current = txt.Lines[txt.LinesCount - 1].Substring(2);
                if (HistoryUp(ref current))
                {
                    ReplaceLastLineText(current);
                }
            }
                e.Handled = true;
                break;

            case Keys.Down:
            {
                string current = txt.Lines[txt.LinesCount - 1].Substring(2);
                if (HistoryDown(ref current))
                {
                    ReplaceLastLineText(current);
                }
            }
                e.Handled = true;
                break;

            case Keys.Left:
            case Keys.Back:
                if (txt.Selection.Start.iChar < 2 || (txt.Selection.Start.iChar == 2 && txt.SelectionLength == 0))
                {
                    e.Handled = true;
                }
                break;

            case Keys.Enter:
            case Keys.Cancel:             // Mac num-block return key
                txt.GoEnd();
                string method = txt.Lines[txt.LinesCount - 1].Substring(2);

                string output = Execute(method);

                /*if(method.Equals("clear"))
                 * {
                 *      txt.Clear();
                 *      txt.AppendText("> ");
                 *      txt.SelectionStart += 2;
                 *      e.Handled = true;
                 *      break;
                 * }
                 *
                 * if(output != null && output != "")
                 * {
                 *      //txt.AppendText('\n' + output);
                 *      string[] lines = output.Split('\n');
                 *      foreach(string line in lines)
                 *              txt.AppendText('\n' + line);
                 *      txt.GoEnd();
                 * }
                 *
                 * txt.AppendText("\n");
                 * txt.AppendText("> ");
                 * txt.SelectionStart += 3;
                 * //new Range(txt, 0, txt.Selection.Start.iLine, txt.Selection.Start.iChar, txt.Selection.Start.iLine).ReadOnly = true;*/

                printMethod = false;                 // Printing method is only required when playing back
                ActionManager.Do(PrintCommandAction, method, output);
                printMethod = true;

                e.Handled = true;
                break;

            default:
                if ((e.Modifiers & Keys.Control) != 0 && e.KeyCode >= Keys.D0 && e.KeyCode <= Keys.D9)
                {
                    if ((e.Modifiers & Keys.Shift) != 0)
                    {
                        string current = txt.Lines[txt.LinesCount - 1].Substring(2);
                        StoreMacro(e.KeyCode - Keys.D0, current);
                        PrintOutput(string.Format("Macro {0} set to \"{1}\"", e.KeyCode - Keys.D0, current));
                    }
                    else
                    {
                        ReplaceLastLineText(RecallMacro(e.KeyCode - Keys.D0));
                    }
                    break;
                }
                break;
            }
        }