Skip to content

Commit

Permalink
Better method naming
Browse files Browse the repository at this point in the history
Better method naming
  • Loading branch information
0x7c13 committed Jan 12, 2020
1 parent 1edd031 commit 173d504
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/Notepads/Controls/TextEditor/ITextEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void Init(TextFile textFile,

Encoding GetEncoding();

void CopyPlainTextToWindowsClipboard(TextControlCopyingToClipboardEventArgs args);
void CopySelectedTextToWindowsClipboard(TextControlCopyingToClipboardEventArgs args);

void RevertAllChanges();

Expand Down
10 changes: 5 additions & 5 deletions src/Notepads/Controls/TextEditor/TextEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public TextEditor()
TextEditorCore.TextChanging += TextEditorCore_OnTextChanging;
TextEditorCore.SelectionChanged += TextEditorCore_OnSelectionChanged;
TextEditorCore.KeyDown += TextEditorCore_OnKeyDown;
TextEditorCore.CopyPlainTextToWindowsClipboardRequested += TextEditorCore_CopyPlainTextToWindowsClipboardRequested;
TextEditorCore.CopySelectedTextToWindowsClipboardRequested += TextEditorCore_CopySelectedTextToWindowsClipboardRequested;
TextEditorCore.ContextFlyout = new TextEditorContextFlyout(this, TextEditorCore);

// Init shortcuts
Expand All @@ -201,7 +201,7 @@ public void Dispose()
TextEditorCore.TextChanging -= TextEditorCore_OnTextChanging;
TextEditorCore.SelectionChanged -= TextEditorCore_OnSelectionChanged;
TextEditorCore.KeyDown -= TextEditorCore_OnKeyDown;
TextEditorCore.CopyPlainTextToWindowsClipboardRequested -= TextEditorCore_CopyPlainTextToWindowsClipboardRequested;
TextEditorCore.CopySelectedTextToWindowsClipboardRequested -= TextEditorCore_CopySelectedTextToWindowsClipboardRequested;

if (TextEditorCore.ContextFlyout is TextEditorContextFlyout contextFlyout)
{
Expand Down Expand Up @@ -666,7 +666,7 @@ public void Focus()
}
}

public void CopyPlainTextToWindowsClipboard(TextControlCopyingToClipboardEventArgs args)
public void CopySelectedTextToWindowsClipboard(TextControlCopyingToClipboardEventArgs args)
{
if (args != null)
{
Expand Down Expand Up @@ -760,9 +760,9 @@ private void TextEditorCore_OnTextChanging(RichEditBox textEditor, RichEditBoxTe
TextChanging?.Invoke(this, EventArgs.Empty);
}

private void TextEditorCore_CopyPlainTextToWindowsClipboardRequested(object sender, TextControlCopyingToClipboardEventArgs e)
private void TextEditorCore_CopySelectedTextToWindowsClipboardRequested(object sender, TextControlCopyingToClipboardEventArgs e)
{
CopyPlainTextToWindowsClipboard(e);
CopySelectedTextToWindowsClipboard(e);
}

public void ShowFindAndReplaceControl(bool showReplaceBar)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public MenuFlyoutItem Copy
Key = VirtualKey.C,
IsEnabled = false,
});
_copy.Click += (sender, args) => _textEditor.CopyPlainTextToWindowsClipboard(null);
_copy.Click += (sender, args) => _textEditor.CopySelectedTextToWindowsClipboard(null);
}
return _copy;
}
Expand Down
10 changes: 5 additions & 5 deletions src/Notepads/Controls/TextEditor/TextEditorCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class TextEditorCore : RichEditBox

public event EventHandler<double> FontZoomFactorChanged;

public event EventHandler<TextControlCopyingToClipboardEventArgs> CopyPlainTextToWindowsClipboardRequested;
public event EventHandler<TextControlCopyingToClipboardEventArgs> CopySelectedTextToWindowsClipboardRequested;

private const char RichEditBoxDefaultLineEnding = '\r';

Expand Down Expand Up @@ -100,7 +100,7 @@ public TextEditorCore()
VerticalAlignment = VerticalAlignment.Stretch;
HandwritingView.BorderThickness = new Thickness(0);

CopyingToClipboard += TextEditorCore_CopyingToClipboard;
CopyingToClipboard += TextEditorCore_CopySelectedTextToWindowsClipboard;
Paste += TextEditorCore_Paste;
TextChanging += OnTextChanging;
SelectionChanged += OnSelectionChanged;
Expand All @@ -122,7 +122,7 @@ public TextEditorCore()
// Unhook events and clear state
public void Dispose()
{
CopyingToClipboard -= TextEditorCore_CopyingToClipboard;
CopyingToClipboard -= TextEditorCore_CopySelectedTextToWindowsClipboard;
Paste -= TextEditorCore_Paste;
TextChanging -= OnTextChanging;
SelectionChanged -= OnSelectionChanged;
Expand Down Expand Up @@ -466,9 +466,9 @@ private async void TextEditorCore_Paste(object sender, TextControlPasteEventArgs
await PastePlainTextFromWindowsClipboard(args);
}

private void TextEditorCore_CopyingToClipboard(RichEditBox sender, TextControlCopyingToClipboardEventArgs args)
private void TextEditorCore_CopySelectedTextToWindowsClipboard(RichEditBox sender, TextControlCopyingToClipboardEventArgs args)
{
CopyPlainTextToWindowsClipboardRequested?.Invoke(sender, args);
CopySelectedTextToWindowsClipboardRequested?.Invoke(sender, args);
}

private void SetDefaultTabStopAndLineSpacing(FontFamily font, double fontSize)
Expand Down

0 comments on commit 173d504

Please sign in to comment.