public override void Undo(OutlinerDocument document, TreeListView treeListView) { OutlinerNote rootNote = null; for (int i = 0; i < __SavedCheckboxes.Count; i++) { OutlinerNote note = document.FindOutlinerNoteById(__SavedCheckboxes[i].NodeId); note.SetCheckedForCurrentNote(__SavedCheckboxes[i].IsChecked); if (rootNote == null) { rootNote = note; } } for (int i = 0; i < __SavedCheckboxes.Count; i++) { OutlinerNote note = document.FindOutlinerNoteById(__SavedCheckboxes[i].NodeId); note.UpdateParentCheckboxes(); } if (__SelectNote && rootNote != null) { treeListView.MakeActive(rootNote, -1, false); } rootNote.UpdateParentCheckboxes(); rootNote.OnPropertyChanged("IsChecked"); rootNote.OnPropertyChanged("IsCheckedDirect"); }
public override void Undo(OutlinerDocument document, TreeListView treeListView) { var note = document.FindOutlinerNoteById(__NoteId); if (note == null) return; treeListView.MakeActive(note, -1, false); note.CreateInlineNote(DocumentHelpers.RestoreDocumentFromStream(__Document)); note.InlineNoteDocument.Tag = __DocumentTag; }
public override void Redo(OutlinerDocument document, TreeListView treeListView) { OutlinerNote newParent = document.FindOutlinerNoteById(__ParentNoteId); OutlinerNote newNote = new OutlinerNote(newParent); newNote.Clone(__SavedNote); DocumentHelpers.CopyNodesRecursively(newNote, __SavedNote); newParent.SubNotes.Insert(__Index, newNote); treeListView.MakeActive(newNote, __ColumnIndexBeforeUndo, false); }
public override void Redo(OutlinerDocument document, TreeListView treeListView) { var note = document.FindOutlinerNoteById(__NoteId); if (note == null) { return; } treeListView.MakeActive(note, -1, false); note.CreateInlineNote(DocumentHelpers.RestoreDocumentFromStream(__Document)); note.InlineNoteDocument.Tag = __DocumentTag; }
public override void Redo(OutlinerDocument document, TreeListView treeListView) { OutlinerNote note = document.FindOutlinerNoteById(__NoteId); OutlinerNote newParent = document.FindOutlinerNoteById(__ParentNoteIdAfter); Debug.Assert(newParent != null); note.Parent.SubNotes.Remove(note); OutlinerNote newNote = new OutlinerNote(newParent); newNote.Clone(note); DocumentHelpers.CopyNodesRecursively(newNote, note); newParent.SubNotes.Insert(__IndexAfter, newNote); treeListView.MakeActive(newNote, -1, false); }
public override void Redo(OutlinerDocument document, TreeListView treeListView) { OutlinerNote note = document.FindOutlinerNoteById(__NodeId); note.IsChecked = __WasChecked; if (__SelectNote) { treeListView.MakeActive(note, -1, false); } note.UpdateParentCheckboxes(); note.OnPropertyChanged("IsChecked"); note.OnPropertyChanged("IsCheckedDirect"); }
public override void Undo(OutlinerDocument document, TreeListView treeListView) { OutlinerNote note = document.FindOutlinerNoteById(__NoteId); if (note == null) { return; } __Before.Seek(0, SeekOrigin.Begin); FlowDocument flowDocument; if (__IsInlineNote) { flowDocument = note.InlineNoteDocument; } else { flowDocument = (FlowDocument)note.Columns[__ColumnId].ColumnData; } if (flowDocument == null) { return; } TextRange range = new TextRange(flowDocument.ContentStart, flowDocument.ContentEnd); if (__After == null) { __After = new MemoryStream(); range.Save(__After, DataFormats.Xaml); __FontPropertiesAfter = new FontProperties(flowDocument); } range.Load(__Before, DataFormats.Xaml); __FontPropertiesBefore.ApplyToFlowDocument(flowDocument); if (__WasSelected) { treeListView.MakeActive(note, -1, false); } }
public override void Redo(OutlinerDocument document, TreeListView treeListView) { OutlinerNote note = document.FindOutlinerNoteById(__NoteId); if (note == null) { return; } __After.Seek(0, SeekOrigin.Begin); FlowDocument flowDocument = (FlowDocument)note.Columns[__ColumnId].ColumnData; TextRange range = new TextRange(flowDocument.ContentStart, flowDocument.ContentEnd); range.Load(__After, DataFormats.Xaml); __FontPropertiesAfter.ApplyToFlowDocument(flowDocument); if (__WasSelected) { treeListView.MakeActive(note, -1, false); } }
public static void DeleteRow(OutlinerNote row, TreeListView outlinerTree, int columnIndex) { int idx = row.Parent.SubNotes.IndexOf(row); row.Parent.SubNotes.Remove(row); row.UpdateParentCheckboxes(); if (row.Parent.SubNotes.Count > 0) { if (row.Parent.SubNotes.Count > idx) outlinerTree.MakeActive(row.Parent.SubNotes[idx], columnIndex, false); else outlinerTree.MakeActive(row.Parent.SubNotes[row.Parent.SubNotes.Count - 1], columnIndex, false); } }
public static void DecreaseIndent(OutlinerNote selectedRow, TreeListView outlinerTree, bool applyStyle) { int activeColumn = DocumentHelpers.GetFocusedColumnIdx(outlinerTree, selectedRow); bool inlineNoteFocused = IsInlineNoteFocused(outlinerTree); OutlinerNote newRow = new OutlinerNote(selectedRow.Parent.Parent); newRow.Clone(selectedRow); newRow.Parent.IsExpanded = true; newRow.IsExpanded = true; DocumentHelpers.CopyNodesRecursively(newRow, selectedRow); int currentRowIndex = selectedRow.Parent.SubNotes.IndexOf(selectedRow); for (int i = currentRowIndex + 1; i < selectedRow.Parent.SubNotes.Count; i++) { OutlinerNote note = selectedRow.Parent.SubNotes[i]; OutlinerNote newNote = new OutlinerNote(newRow); newNote.Clone(note); DocumentHelpers.CopyNodesRecursively(newNote, note); newRow.SubNotes.Add(newNote); } for (int i = selectedRow.Parent.SubNotes.Count - 1; i > currentRowIndex; i--) selectedRow.Parent.SubNotes.RemoveAt(i); int parentIdx = selectedRow.Parent.Parent.SubNotes.IndexOf(selectedRow.Parent); selectedRow.Parent.Parent.SubNotes.Insert(parentIdx + 1, newRow); selectedRow.Parent.SubNotes.Remove(selectedRow); selectedRow.Parent.UpdateParentCheckboxes(); newRow.UpdateParentCheckboxes(); if (applyStyle) outlinerTree.MakeActive(newRow, activeColumn, inlineNoteFocused, new EventHandler(ApplyStyleAfterMakeActive)); else outlinerTree.MakeActive(newRow, activeColumn, inlineNoteFocused); }
public override void Undo(OutlinerDocument document, TreeListView treeListView) { OutlinerNote rootNote = null; for (int i = 0; i < __SavedCheckboxes.Count; i++) { OutlinerNote note = document.FindOutlinerNoteById(__SavedCheckboxes[i].NodeId); note.SetCheckedForCurrentNote(__SavedCheckboxes[i].IsChecked); if (rootNote == null) rootNote = note; } for (int i = 0; i < __SavedCheckboxes.Count; i++) { OutlinerNote note = document.FindOutlinerNoteById(__SavedCheckboxes[i].NodeId); note.UpdateParentCheckboxes(); } if (__SelectNote && rootNote != null) { treeListView.MakeActive(rootNote, -1, false); } rootNote.UpdateParentCheckboxes(); rootNote.OnPropertyChanged("IsChecked"); rootNote.OnPropertyChanged("IsCheckedDirect"); }
public override void Undo(OutlinerDocument document, TreeListView treeListView) { OutlinerNote note = document.FindOutlinerNoteById(__NoteId); if (note == null) return; __Before.Seek(0, SeekOrigin.Begin); FlowDocument flowDocument; if (__IsInlineNote) flowDocument = note.InlineNoteDocument; else flowDocument = (FlowDocument)note.Columns[__ColumnId].ColumnData; if (flowDocument == null) return; TextRange range = new TextRange(flowDocument.ContentStart, flowDocument.ContentEnd); if (__After == null) { __After = new MemoryStream(); range.Save(__After, DataFormats.Xaml); __FontPropertiesAfter = new FontProperties(flowDocument); } range.Load(__Before, DataFormats.Xaml); __FontPropertiesBefore.ApplyToFlowDocument(flowDocument); if (__WasSelected) treeListView.MakeActive(note, -1, false); }
public override void Redo(OutlinerDocument document, TreeListView treeListView) { OutlinerNote note = document.FindOutlinerNoteById(__NoteId); if (note == null) return; __After.Seek(0, SeekOrigin.Begin); FlowDocument flowDocument = (FlowDocument)note.Columns[__ColumnId].ColumnData; TextRange range = new TextRange(flowDocument.ContentStart, flowDocument.ContentEnd); range.Load(__After, DataFormats.Xaml); __FontPropertiesAfter.ApplyToFlowDocument(flowDocument); if (__WasSelected) treeListView.MakeActive(note, -1, false); }
public static void IncreaseIndentWithLimit(OutlinerNote row, OutlinerNote limit, bool isInlineNoteFocused, TreeListView outlinerTree, bool applyStyle) { if (!CanIncreaseIndent(row)) return; int activeColumn = DocumentHelpers.GetFocusedColumnIdx(outlinerTree, row); ObservableCollection<OutlinerNote> parentCollection = row.Document.GetParentCollection(row); int idx = GetNoteIndexAtParent(row); parentCollection.Remove(row); OutlinerNote newNote = new OutlinerNote(parentCollection[idx - 1]); newNote.Clone(row); int insertIntoIdx = parentCollection[idx - 1].SubNotes.Count; if (limit == row) DocumentHelpers.CopyNodesRecursively(parentCollection[idx - 1], row); else DocumentHelpers.CopyNodesRecursively(newNote, parentCollection[idx - 1], row, limit); parentCollection[idx - 1].SubNotes.Insert(insertIntoIdx, newNote); parentCollection[idx - 1].IsExpanded = true; row.Parent.UpdateParentCheckboxes(); newNote.UpdateParentCheckboxes(); if (applyStyle) outlinerTree.MakeActive(newNote, activeColumn, isInlineNoteFocused, new EventHandler(ApplyStyleAfterMakeActive)); else outlinerTree.MakeActive(newNote, activeColumn, isInlineNoteFocused); }
public static void MoveNodeUp(OutlinerNote selectedItem, TreeListView outlinerTree, int activeColumn, bool isInlineNoteActive) { int selectedIndex = selectedItem.Parent.SubNotes.IndexOf(selectedItem); if (selectedIndex == 0) return; OutlinerNote newNote = new OutlinerNote(selectedItem.Parent); newNote.Clone(selectedItem); CopyNodesRecursively(newNote, selectedItem); selectedItem.Parent.SubNotes.Remove(selectedItem); selectedItem.Parent.SubNotes.Insert(selectedIndex - 1, newNote); outlinerTree.MakeActive(newNote, activeColumn, isInlineNoteActive); }
public override void Redo(OutlinerDocument document, TreeListView treeListView) { OutlinerNote note = document.FindOutlinerNoteById(__NodeId); note.IsChecked = __WasChecked; if (__SelectNote) treeListView.MakeActive(note, -1, false); note.UpdateParentCheckboxes(); note.OnPropertyChanged("IsChecked"); note.OnPropertyChanged("IsCheckedDirect"); }