C# Class TextEditor.LempDemoForm

Exibir arquivo Open project: qwertie/ecsharp

Private Properties

Property Type Description
AddNewTextEditor LempDemoPanel
DoEditAction void
DoSave bool
DoSaveAs bool
HaveSelection bool
IsModified bool
OnSettingsChanged void
OpenFiles void
RemoveTextEditor void
SetModifiedFlag void
TextEditorForm_DragDrop void
TextEditorForm_DragEnter void
TextEditor_FormClosing void
menuBracketMatchingStyle_Click void
menuEditFind_Click void
menuEditReplace_Click void
menuEnableVirtualSpace_Click void
menuFileClose_Click void
menuFileExit_Click void
menuFileNew_Click void
menuFileOpen_Click void
menuFileSaveAs_Click void
menuFileSave_Click void
menuFindAgainReverse_Click void
menuFindAgain_Click void
menuGoToNextBookmark_Click void
menuGoToPrevBookmark_Click void
menuHighlightCurrentRow_Click void
menuSetFont_Click void
menuSetTabSize_Click void
menuShowLineNumbers_Click void
menuShowNewlines_Click void
menuShowSpaces_Click void
menuSplitTextArea_Click void
menuToggleBookmark_Click void
saveOutputPaneToolStripMenuItem_Click void

Public Methods

Method Description
LempDemoForm ( ) : System

Private Methods

Method Description
AddNewTextEditor ( string title, string initialText = "" ) : LempDemoPanel
DoEditAction ( LempDemoPanel panel, ICSharpCode action ) : void

Performs an action encapsulated in IEditAction.

There is an implementation of IEditAction for every action that the user can invoke using a shortcut key (arrow keys, Ctrl+X, etc.) The editor control doesn't provide a public funciton to perform one of these actions directly, so I wrote DoEditAction() based on the code in TextArea.ExecuteDialogKey(). You can call ExecuteDialogKey directly, but it is more fragile because it takes a Keys value (e.g. Keys.Left) instead of the action to perform. Clipboard commands could also be done by calling methods in editor.ActiveTextAreaControl.TextArea.ClipboardHandler.

DoSave ( LempDemoPanel panel ) : bool
DoSaveAs ( LempDemoPanel panel ) : bool
HaveSelection ( ) : bool
IsModified ( TextEditorControl editor ) : bool

Gets whether the file in the specified editor is modified.

TextEditorControl doesn't maintain its own internal modified flag, so we use the '*' shown after the file name to represent the modified state.

OnSettingsChanged ( ) : void

Show current settings on the Options menu

We don't have to sync settings between the editors because they all share the same DefaultTextEditorProperties object.

OpenFiles ( string fns ) : void
RemoveTextEditor ( LempDemoPanel panel ) : void
SetModifiedFlag ( TextEditorControl editor, bool flag ) : void
TextEditorForm_DragDrop ( object sender, DragEventArgs e ) : void
TextEditorForm_DragEnter ( object sender, DragEventArgs e ) : void

We handle DragEnter and DragDrop so users can drop files on the editor.

TextEditor_FormClosing ( object sender, FormClosingEventArgs e ) : void
menuBracketMatchingStyle_Click ( object sender, EventArgs e ) : void
menuEditFind_Click ( object sender, EventArgs e ) : void
menuEditReplace_Click ( object sender, EventArgs e ) : void
menuEnableVirtualSpace_Click ( object sender, EventArgs e ) : void
menuFileClose_Click ( object sender, EventArgs e ) : void
menuFileExit_Click ( object sender, EventArgs e ) : void
menuFileNew_Click ( object sender, EventArgs e ) : void
menuFileOpen_Click ( object sender, EventArgs e ) : void
menuFileSaveAs_Click ( object sender, EventArgs e ) : void
menuFileSave_Click ( object sender, EventArgs e ) : void
menuFindAgainReverse_Click ( object sender, EventArgs e ) : void
menuFindAgain_Click ( object sender, EventArgs e ) : void
menuGoToNextBookmark_Click ( object sender, EventArgs e ) : void
menuGoToPrevBookmark_Click ( object sender, EventArgs e ) : void
menuHighlightCurrentRow_Click ( object sender, EventArgs e ) : void
menuSetFont_Click ( object sender, EventArgs e ) : void
menuSetTabSize_Click ( object sender, EventArgs e ) : void
menuShowLineNumbers_Click ( object sender, EventArgs e ) : void
menuShowNewlines_Click ( object sender, EventArgs e ) : void
menuShowSpaces_Click ( object sender, EventArgs e ) : void
menuSplitTextArea_Click ( object sender, EventArgs e ) : void

Toggles whether the editor control is split in two parts.

Exercise for the reader: modify TextEditorControl and TextAreaControl so it shows a little "splitter stub" like you see in other apps, that allows the user to split the text editor by dragging it.

menuToggleBookmark_Click ( object sender, EventArgs e ) : void
saveOutputPaneToolStripMenuItem_Click ( object sender, EventArgs e ) : void

Method Details

LempDemoForm() public method

public LempDemoForm ( ) : System
return System