mirror of
https://github.com/greenshot/greenshot
synced 2025-08-14 02:37:03 -07:00
Fix for BUG-1698: the focus lost event on the editor element "font family" caused the key handling for the element (l -> line etc) to be active again, this change suppresses this.
This commit is contained in:
parent
1582b01e03
commit
cfb4711692
2 changed files with 18 additions and 14 deletions
|
@ -154,8 +154,11 @@ namespace Greenshot.Drawing {
|
|||
if (e.PropertyName.Equals("Selected")) {
|
||||
if (!Selected && _textBox.Visible) {
|
||||
HideTextBox();
|
||||
} else if (Selected && Status==EditStatus.DRAWING) {
|
||||
} else if (Selected && Status == EditStatus.DRAWING) {
|
||||
ShowTextBox();
|
||||
} else if (Selected && Status == EditStatus.IDLE && _textBox.Visible) {
|
||||
// Fix (workaround) for BUG-1698
|
||||
_parent.KeysLocked = true;
|
||||
}
|
||||
}
|
||||
if (_textBox.Visible) {
|
||||
|
@ -184,7 +187,7 @@ namespace Greenshot.Drawing {
|
|||
|
||||
private void CreateTextBox() {
|
||||
_textBox = new TextBox();
|
||||
|
||||
|
||||
_textBox.ImeMode = ImeMode.On;
|
||||
_textBox.Multiline = true;
|
||||
_textBox.AcceptsTab = true;
|
||||
|
@ -199,22 +202,22 @@ namespace Greenshot.Drawing {
|
|||
private void ShowTextBox() {
|
||||
_parent.KeysLocked = true;
|
||||
_parent.Controls.Add(_textBox);
|
||||
EnsureTextBoxContrast();
|
||||
EnsureTextBoxContrast();
|
||||
_textBox.Show();
|
||||
_textBox.Focus();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Makes textbox background dark if text color is very bright
|
||||
/// </summary>
|
||||
private void EnsureTextBoxContrast() {
|
||||
Color lc = GetFieldValueAsColor(FieldType.LINE_COLOR);
|
||||
if (lc.R > 203 && lc.G > 203 && lc.B > 203) {
|
||||
_textBox.BackColor = Color.FromArgb(51, 51, 51);
|
||||
} else {
|
||||
_textBox.BackColor = Color.White;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Makes textbox background dark if text color is very bright
|
||||
/// </summary>
|
||||
private void EnsureTextBoxContrast() {
|
||||
Color lc = GetFieldValueAsColor(FieldType.LINE_COLOR);
|
||||
if (lc.R > 203 && lc.G > 203 && lc.B > 203) {
|
||||
_textBox.BackColor = Color.FromArgb(51, 51, 51);
|
||||
} else {
|
||||
_textBox.BackColor = Color.White;
|
||||
}
|
||||
}
|
||||
|
||||
private void HideTextBox() {
|
||||
_parent.Focus();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue