Inheritance: System.Windows.Forms.Form
Esempio n. 1
0
 protected override void OnCommandClick(string command)
 {
     base.OnCommandClick(command);
     if ((command == FIND_COMMAND) || (command == REPLACE_COMMAND) ||
         (command == FIND_ALL_COMMAND) || (command == REPLACE_ALL_COMMAND))
     {
         if (scintillaEditor.IsSomeSelectedText())
         {
             _lastSearchText = scintillaEditor.SelectedText;
         }
         else
         {
             _lastSearchText = string.Empty;
         }
         ShowFindReplaceDialog(command == REPLACE_COMMAND || command == REPLACE_ALL_COMMAND,
                               command == FIND_ALL_COMMAND || command == REPLACE_ALL_COMMAND);
     }
     else if (command == FIND_NEXT_COMMAND)
     {
         if (_lastSearchText.Length > 0)
         {
             scintillaEditor.FindNextOccurrence(_lastSearchText, _lastCaseSensitive, true);
         }
     }
     else if (command == GOTO_LINE_COMMAND)
     {
         GotoLineDialog gotoLineDialog = new GotoLineDialog
         {
             Minimum    = 0,
             Maximum    = scintillaEditor.LineCount,
             LineNumber = scintillaEditor.CurrentLine
         };
         if (gotoLineDialog.ShowDialog() != DialogResult.OK)
         {
             return;
         }
         scintillaEditor.GoToLine(gotoLineDialog.LineNumber);
     }
 }
Esempio n. 2
0
 protected override void OnCommandClick(string command)
 {
     if (command == CUT_COMMAND)
     {
         scintilla.Cut();
     }
     else if (command == COPY_COMMAND)
     {
         scintilla.Copy();
     }
     else if (command == PASTE_COMMAND)
     {
         scintilla.Paste();
     }
     else if (command == UNDO_COMMAND)
     {
         if (scintilla.CanUndo())
         {
             scintilla.Undo();
         }
     }
     else if (command == REDO_COMMAND)
     {
         if (scintilla.CanRedo())
         {
             scintilla.Redo();
         }
     }
     else if (command == SHOW_AUTOCOMPLETE_COMMAND)
     {
         scintilla.ShowAutocompleteNow();
     }
     else if (command == TOGGLE_BREAKPOINT_COMMAND)
     {
         ToggleBreakpointOnCurrentLine();
     }
     else if (command == MATCH_BRACE_COMMAND)
     {
         scintilla.ShowMatchingBrace(true);
     }
     else if (command == SHOW_MATCHING_SCRIPT_OR_HEADER_COMMAND)
     {
         if (_showMatchingScript != null)
         {
             _showMatchingScript(this.Script);
         }
     }
     else if (command == GOTO_LINE_COMMAND)
     {
         GotoLineDialog gotoLineDialog = new GotoLineDialog
         {
             Minimum = 0,
             Maximum = scintilla.LineCount,
             LineNumber = scintilla.CurrentLine
         };
         if (gotoLineDialog.ShowDialog() != DialogResult.OK) return;
         GoToLine(gotoLineDialog.LineNumber);
     }
     else if ((command == FIND_COMMAND) || (command == REPLACE_COMMAND)
         || (command == FIND_ALL_COMMAND) || (command == REPLACE_ALL_COMMAND))
     {
         if (scintilla.IsSomeSelectedText())
         {
             _lastSearchText = scintilla.SelectedText;
         }
         else _lastSearchText = string.Empty;
         ShowFindReplaceDialog(command == REPLACE_COMMAND || command == REPLACE_ALL_COMMAND,
             command == FIND_ALL_COMMAND || command == REPLACE_ALL_COMMAND);
     }
     else if (command == FIND_NEXT_COMMAND)
     {
         if (_lastSearchText.Length > 0)
         {
             scintilla.FindNextOccurrence(_lastSearchText, _lastCaseSensitive, true);
         }
     }
     UpdateToolbarButtonsIfNecessary();
 }
Esempio n. 3
0
 protected override void OnCommandClick(string command)
 {
     base.OnCommandClick(command);
     if ((command == FIND_COMMAND) || (command == REPLACE_COMMAND)
         || (command == FIND_ALL_COMMAND) || (command == REPLACE_ALL_COMMAND))
     {
         if (scintillaEditor.IsSomeSelectedText())
         {
             _lastSearchText = scintillaEditor.SelectedText;
         }
         else _lastSearchText = string.Empty;
         ShowFindReplaceDialog(command == REPLACE_COMMAND || command == REPLACE_ALL_COMMAND,
             command == FIND_ALL_COMMAND || command == REPLACE_ALL_COMMAND);
     }
     else if (command == FIND_NEXT_COMMAND)
     {
         if (_lastSearchText.Length > 0)
         {
             scintillaEditor.FindNextOccurrence(_lastSearchText, _lastCaseSensitive, true);
         }
     }
     else if (command == GOTO_LINE_COMMAND)
     {
         GotoLineDialog gotoLineDialog = new GotoLineDialog
         {
             Minimum = 1,
             Maximum = scintillaEditor.LineCount,
             LineNumber = scintillaEditor.CurrentLine + 1
         };
         if (gotoLineDialog.ShowDialog() != DialogResult.OK) return;
         scintillaEditor.GoToLine(gotoLineDialog.LineNumber);
     }
 }
Esempio n. 4
0
 protected override void OnCommandClick(string command)
 {
     if (command == CUT_COMMAND)
     {
         scintilla.Cut();
     }
     else if (command == COPY_COMMAND)
     {
         scintilla.Copy();
     }
     else if (command == PASTE_COMMAND)
     {
         scintilla.Paste();
     }
     else if (command == UNDO_COMMAND)
     {
         if (scintilla.CanUndo())
         {
             scintilla.Undo();
         }
     }
     else if (command == REDO_COMMAND)
     {
         if (scintilla.CanRedo())
         {
             scintilla.Redo();
         }
     }
     else if (command == SHOW_AUTOCOMPLETE_COMMAND)
     {
         scintilla.ShowAutocompleteNow();
     }
     else if (command == TOGGLE_BREAKPOINT_COMMAND)
     {
         ToggleBreakpointOnCurrentLine();
     }
     else if (command == MATCH_BRACE_COMMAND)
     {
         scintilla.ShowMatchingBrace(true);
     }
     else if (command == SHOW_MATCHING_SCRIPT_OR_HEADER_COMMAND)
     {
         if (_showMatchingScript != null)
         {
             _showMatchingScript(this.Script);
         }
     }
     else if (command == GOTO_LINE_COMMAND)
     {
         GotoLineDialog gotoLineDialog = new GotoLineDialog
         {
             Minimum    = 1,
             Maximum    = scintilla.LineCount,
             LineNumber = scintilla.CurrentLine + 1
         };
         if (gotoLineDialog.ShowDialog() != DialogResult.OK)
         {
             return;
         }
         GoToLine(gotoLineDialog.LineNumber);
     }
     else if ((command == FIND_COMMAND) || (command == REPLACE_COMMAND) ||
              (command == FIND_ALL_COMMAND) || (command == REPLACE_ALL_COMMAND))
     {
         if (scintilla.IsSomeSelectedText())
         {
             _lastSearchText = scintilla.SelectedText;
         }
         else
         {
             _lastSearchText = string.Empty;
         }
         ShowFindReplaceDialog(command == REPLACE_COMMAND || command == REPLACE_ALL_COMMAND,
                               command == FIND_ALL_COMMAND || command == REPLACE_ALL_COMMAND);
     }
     else if (command == FIND_NEXT_COMMAND)
     {
         if (_lastSearchText.Length > 0)
         {
             scintilla.FindNextOccurrence(_lastSearchText, _lastCaseSensitive, true);
         }
     }
     UpdateToolbarButtonsIfNecessary();
 }