Skip to content
This repository was archived by the owner on Sep 11, 2023. It is now read-only.

Commit 97ca122

Browse files
committed
improved file names / added ESC shortcut
1 parent b32753d commit 97ca122

File tree

5 files changed

+22
-12
lines changed

5 files changed

+22
-12
lines changed

.editorconfig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ csharp_style_prefer_index_operator = true:suggestion
111111
csharp_style_prefer_range_operator = true:suggestion
112112
csharp_style_throw_expression = true:suggestion
113113
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
114-
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
114+
csharp_style_unused_value_expression_statement_preference = discard_variable:none
115115

116116
# 'using' directive preferences
117117
csharp_using_directive_placement = outside_namespace:suggestion
@@ -204,3 +204,6 @@ dotnet_naming_style.begins_with_i.required_prefix = I
204204
dotnet_naming_style.begins_with_i.required_suffix =
205205
dotnet_naming_style.begins_with_i.word_separator =
206206
dotnet_naming_style.begins_with_i.capitalization = pascal_case
207+
208+
# IDE0058: Expression value is never used
209+
dotnet_diagnostic.IDE0058.severity = none

UI/MainWindow.xaml.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,8 @@ private void AddEditorElement(string filePath, string name, bool SelectMe)
204204
layoutDocument.Content = editor;
205205
EditorsReferences.Add(editor);
206206
DockingPane.Children.Add(layoutDocument);
207-
if (SelectMe)
208-
{
209-
layoutDocument.IsSelected = true;
210-
}
207+
layoutDocument.IsSelected = SelectMe;
208+
editor.editor.TextArea.Caret.Show();
211209
}
212210

213211
private void DockingManager_ActiveContentChanged(object sender, EventArgs e)

UI/MainWindowCommands.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ private void Command_New()
4949
int newFileNum = 0;
5050
do
5151
{
52-
newFilePath = Path.Combine(Program.Configs[Program.SelectedConfig].SMDirectories[0], $"new {++newFileNum}.sp");
52+
newFilePath = Path.Combine(Program.Configs[Program.SelectedConfig].SMDirectories[0], $"New Plugin ({++newFileNum}).sp");
5353
} while (File.Exists(newFilePath));
54-
54+
5555
File.Create(newFilePath).Close();
5656

57-
AddEditorElement(newFilePath, $"new {newFileNum}.sp", true);
57+
AddEditorElement(newFilePath, $"New Plugin ({newFileNum}).sp", true);
5858
}
5959

6060
private void Command_NewFromTemplate()
@@ -494,15 +494,15 @@ private async void DownloadCompleted(object sender, AsyncCompletedEventArgs e)
494494
Process.Start(OutFile);
495495
await this.ShowMessageAsync(
496496
Program.Translations.GetLanguage("JavaOpened"),
497-
Program.Translations.GetLanguage("JavaSuggestRestart"),
497+
Program.Translations.GetLanguage("JavaSuggestRestart"),
498498
MessageDialogStyle.Affirmative);
499499
}
500500
else
501501
{
502502
// Otherwise, just offer a manual download
503503
if (await this.ShowMessageAsync(
504504
Program.Translations.GetLanguage("JavaDownErrorTitle"),
505-
Program.Translations.GetLanguage("JavaDownErrorMessage"),
505+
Program.Translations.GetLanguage("JavaDownErrorMessage"),
506506
MessageDialogStyle.AffirmativeAndNegative, MetroDialogOptions) == MessageDialogResult.Affirmative)
507507
{
508508
Process.Start(new ProcessStartInfo

UI/Windows/NewFileWindow.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
55
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
66
Width="800" Height="500" ResizeMode="NoResize" WindowStartupLocation="CenterOwner" GlowBrush="{DynamicResource AccentColorBrush}"
7-
Title="New" ShowTitleBar="False">
7+
Title="New" ShowTitleBar="False" KeyDown="MetroWindow_KeyDown">
88
<controls:MetroWindow.Resources>
99
<ResourceDictionary>
1010
<ResourceDictionary.MergedDictionaries>

UI/Windows/NewFileWindow.xaml.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
namespace SPCode.UI.Windows
1414
{
1515
/// <summary>
16-
/// Interaction logic for AboutWindow.xaml
16+
/// Interaction logic for NewFileWindow.xaml
1717
/// </summary>
1818
public partial class NewFileWindow
1919
{
@@ -182,6 +182,14 @@ private void TemplateListBox_KeyDown(object sender, KeyEventArgs e)
182182
}
183183
}
184184

185+
private void MetroWindow_KeyDown(object sender, KeyEventArgs e)
186+
{
187+
if (e.Key == Key.Escape)
188+
{
189+
Close();
190+
}
191+
}
192+
185193
private void GoToSelectedTemplate()
186194
{
187195
var destFile = new FileInfo(PathBox.Text);
@@ -190,6 +198,7 @@ private void GoToSelectedTemplate()
190198
Program.MainWindow.TryLoadSourceFile(destFile.FullName, true, true, true);
191199
Close();
192200
}
201+
193202
}
194203

195204
public class TemplateInfo

0 commit comments

Comments
 (0)