Skip to content

Commit 4997d5d

Browse files
committed
Improved ShortcutDialog update 6
Fixing something silly...
1 parent f97a456 commit 4997d5d

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

FlashDevelop/Dialogs/ShortcutDialog.cs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,6 @@ void AssignNewShortcut(ShortcutListItem item, Keys shortcut)
392392
if (item.Custom == shortcut) return;
393393
item.Custom = shortcut;
394394
item.Selected = true;
395-
ResetConflicts(item);
396395
this.GetConflictItems(item);
397396
if (item.HasConflicts)
398397
{
@@ -446,21 +445,19 @@ void GetConflictItems(ShortcutListItem target)
446445
var keys = target.Custom;
447446
if (keys == 0) return;
448447

449-
var conflicts = new List<ShortcutListItem> { target };
448+
List<ShortcutListItem> conflicts = null;
450449

451450
for (int i = 0; i < this.shortcutListItems.Length; i++)
452451
{
453452
var item = this.shortcutListItems[i];
454453

455-
if (item == target) continue;
456-
if (item.Custom == keys)
457-
{
458-
conflicts.Add(item);
459-
item.Conflicts = conflicts;
460-
}
454+
if (item.Custom != keys || item == target) continue;
455+
if (conflicts == null) conflicts = new List<ShortcutListItem> { target };
456+
conflicts.Add(item);
457+
item.Conflicts = conflicts;
461458
}
462459

463-
if (conflicts.Count > 1) target.Conflicts = conflicts;
460+
target.Conflicts = conflicts;
464461
}
465462

466463
/// <summary>
@@ -635,7 +632,6 @@ public List<ShortcutListItem> Conflicts
635632
get { return this.conflicts; }
636633
set
637634
{
638-
if (this.conflicts == value) return;
639635
this.conflicts = value;
640636
UpdateItemHighlightFont(this);
641637
}
@@ -665,10 +661,10 @@ public Keys Custom
665661
get { return this.custom; }
666662
set
667663
{
668-
if (this.custom == value) return;
669664
this.custom = value;
670665
this.KeysString = DataConverter.KeysToString(this.custom);
671666
this.SubItems[1].Text = this.KeysString;
667+
ResetConflicts(this);
672668
UpdateItemHighlightFont(this);
673669
}
674670
}
@@ -695,11 +691,13 @@ public bool IsModified
695691
/// </summary>
696692
public ShortcutListItem(ShortcutItem shortcutItem)
697693
{
698-
this.SubItems.Add(string.Empty);
699-
this.Name = this.Text = shortcutItem.Id;
700694
this.item = shortcutItem;
701695
this.conflicts = null;
702-
this.Custom = shortcutItem.Custom;
696+
this.custom = this.Item.Custom;
697+
this.KeysString = DataConverter.KeysToString(this.Custom);
698+
this.Name = this.Text = this.Id;
699+
this.SubItems.Add(this.KeysString);
700+
UpdateItemHighlightFont(this);
703701
}
704702

705703
/// <summary>

0 commit comments

Comments
 (0)