Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix images in the input text box. #1592

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
200 changes: 97 additions & 103 deletions UndertaleModTool/Windows/TextInput.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 17 additions & 3 deletions UndertaleModTool/Windows/TextInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
{
InitializeComponent();

Icon = new Icon(App.GetResourceStream(new Uri("pack://application:,,,/icon.ico")).Stream); // "UndertaleModTool/icon.ico"

Check warning on line 71 in UndertaleModTool/Windows/TextInput.cs

View workflow job for this annotation

GitHub Actions / build_gui (windows-latest, Debug, false, true)

This call site is reachable on all platforms. 'Icon' is only supported on: 'windows'.

Check warning on line 71 in UndertaleModTool/Windows/TextInput.cs

View workflow job for this annotation

GitHub Actions / build_gui (windows-latest, Debug, false, false)

This call site is reachable on all platforms. 'Icon' is only supported on: 'windows'.

Check warning on line 71 in UndertaleModTool/Windows/TextInput.cs

View workflow job for this annotation

GitHub Actions / build_gui (windows-latest, Debug, false, false)

This call site is reachable on all platforms. 'Icon' is only supported on: 'windows'.
Message = message;
Title = title;
DefaultValue = defaultValue;
Expand All @@ -80,7 +80,7 @@
label1.Text = message;
richTextBox1.Multiline = AllowMultiline;
richTextBox1.DetectUrls = false;
richTextBox1.LanguageOption = RichTextBoxLanguageOptions.UIFonts; //prevents the bug with Japanese characters
richTextBox1.LanguageOption = RichTextBoxLanguageOptions.UIFonts; // Prevents the bug with Japanese characters
richTextBox1.ReadOnly = readOnly;

label1.AutoSize = false;
Expand All @@ -100,7 +100,7 @@

private void TextInput_Load(object sender, EventArgs e)
{
richTextBox1.Clear(); //remove "Input text here"
richTextBox1.Clear(); // Remove "Input text here"

if (DefaultValue.Length > 0)
{
Expand All @@ -111,14 +111,28 @@

if (richTextBox1.ReadOnly)
{
richTextBox1.BackColor = TextBoxBGColor; //restore color to default one.
richTextBox1.BackColor = TextBoxBGColor; // Restore color to default one.
richTextBox1.ContextMenuStrip = textCopyMenu;
}
}

private void richTextBox1_TextChanged(object sender, EventArgs e)
{
}
private void richTextBox1_KeyDown(object sender, KeyEventArgs e)
{
// Prevent image pasting
// Based on this - https://stackoverflow.com/questions/13703083/prevent-images-in-rich-text-box
// TODO: What if you use a different key combination when you run the app from Wine on Linux?
if (e.Control && e.KeyCode == Keys.V
|| e.Shift && e.KeyCode == Keys.Insert)
{
if (Clipboard.ContainsText())
richTextBox1.Paste(DataFormats.GetFormat(DataFormats.Text));

e.Handled = true;
}
}

private void button1_Click(object sender, EventArgs e)
{
Expand Down
Loading