public CurrentSelections(CurrentSelections existing) { Sections = CopyDictionary(existing.Sections); SelectedSection = existing.SelectedSection; SelectedLabel = existing.SelectedLabel; SelectedAddress = existing.SelectedAddress; }
private void tsmiUndoRedo_Click(object sender, EventArgs e) { if (((sender == tsmiUndo || sender == bUndo) && currentState > 1 ) || ((sender == tsmiRedo || sender == bRedo) && currentState < history.Count )) { if (sender == tsmiUndo || sender == bUndo) currentState--; else currentState++; tsmiUndo.Enabled = bUndo.Enabled = tsmiSave.Enabled = bSave.Enabled = currentState > 1; tsmiRedo.Enabled = bRedo.Enabled = currentState < history.Count; selections = new CurrentSelections(history[currentState - 1]); lbSections.Items.Clear(); foreach (String section in selections.Sections.Keys) { lbSections.Items.Add(section); } lbSections.SelectedItem = selections.SelectedSection.Length > 0 ? selections.SelectedSection : null; if (lbSections.SelectedIndex < 0) { propertyGrid.SelectedObject = null; DisableEditor(); } else { if (selections.SelectedLabel.Length > 0) { try { GridItem gi = GetGridItem(selections.SelectedLabel.Trim(), null); if (gi != null) { gi.Expanded = true; propertyGrid.SelectedGridItem = GetGridItem(selections.SelectedLabel, gi.Expandable ? selections.SelectedAddress : null); } } catch { } } } if (propertyGrid.SelectedGridItem == null ? false : (propertyGrid.SelectedGridItem.Label.Trim() == Patch.Keys[Patch.Key.Attach]) || (propertyGrid.SelectedGridItem.Label.Trim() == Patch.Keys[Patch.Key.Original]) || (propertyGrid.SelectedGridItem.Label.Trim() == Patch.Keys[Patch.Key.Patch]) || (propertyGrid.SelectedGridItem.Label.Trim() == Patch.Keys[Patch.Key.Description])) propertyGrid_SelectedGridItemChanged(propertyGrid, new SelectedGridItemChangedEventArgs(propertyGrid.SelectedGridItem, propertyGrid.SelectedGridItem)); // Change text at richTextBoxEditor } }