Skip to content

Commit 7f10070

Browse files
committed
Addition to #170.
1 parent ad77de0 commit 7f10070

File tree

2 files changed

+21
-18
lines changed

2 files changed

+21
-18
lines changed

ReClass.NET/Forms/MainForm.Functions.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -412,12 +412,10 @@ private void PasteNodeFromClipboardToSelection()
412412

413413
private void EditSelectedNodeName()
414414
{
415-
var selected = memoryViewControl.GetSelectedNodes();
416-
var selectedNode = selected.FirstOrDefault();
417-
418-
if (selected.Count == 1)
415+
var selectedNodes = memoryViewControl.GetSelectedNodes();
416+
if (selectedNodes.Count == 1)
419417
{
420-
memoryViewControl.ShowEditBoxForName(selectedNode);
418+
memoryViewControl.ShowNodeNameEditBox(selectedNodes[0].Node);
421419
}
422420
}
423421

ReClass.NET/UI/MemoryViewControl.cs

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -354,11 +354,7 @@ protected override void OnMouseDoubleClick(MouseEventArgs e)
354354
}
355355
if (hotSpot.Type == HotSpotType.Edit)
356356
{
357-
editBox.BackColor = Program.Settings.SelectedColor;
358-
editBox.HotSpot = hotSpot;
359-
editBox.Visible = true;
360-
361-
editBox.ReadOnly = hotSpot.Id == HotSpot.ReadOnlyId;
357+
ShowNodeNameEditBox(hotSpot);
362358

363359
break;
364360
}
@@ -381,20 +377,29 @@ protected override void OnMouseDoubleClick(MouseEventArgs e)
381377
base.OnMouseDoubleClick(e);
382378
}
383379

384-
public void ShowEditBoxForName(SelectedNodeInfo selection)
380+
public void ShowNodeNameEditBox(BaseNode node)
385381
{
386-
var hotSpot = hotSpots.FirstOrDefault(spot => spot.Address == selection.Address &&
387-
spot.Type == HotSpotType.Edit &&
388-
spot.Text == selection.Node.Name);
382+
if (node == null || node is BaseHexNode)
383+
{
384+
return;
385+
}
386+
387+
var hotSpot = hotSpots
388+
.FirstOrDefault(s => s.Node == node && s.Type == HotSpotType.Edit && s.Id == HotSpot.NameId);
389389
if (hotSpot != null)
390390
{
391-
editBox.BackColor = Program.Settings.SelectedColor;
392-
editBox.HotSpot = hotSpot;
393-
editBox.Visible = true;
394-
editBox.ReadOnly = false;
391+
ShowNodeNameEditBox(hotSpot);
395392
}
396393
}
397394

395+
private void ShowNodeNameEditBox(HotSpot hotSpot)
396+
{
397+
editBox.BackColor = Program.Settings.SelectedColor;
398+
editBox.HotSpot = hotSpot;
399+
editBox.Visible = true;
400+
editBox.ReadOnly = hotSpot.Id == HotSpot.ReadOnlyId;
401+
}
402+
398403
private Point toolTipPosition;
399404
protected override void OnMouseHover(EventArgs e)
400405
{

0 commit comments

Comments
 (0)