public static void ApplyStyleAfterMakeActive(object sender, EventArgs e) { MakeActiveArgs ema = (MakeActiveArgs)e; DocumentHelpers.ApplyLevelStyle( ema.Note, ema.Edit); }
public static void IncreaseIndent(OutlinerNote row, TreeListView outlinerTree, bool applyStyle) { if (!CanIncreaseIndent(row)) { return; } int activeColumn = DocumentHelpers.GetFocusedColumnIdx(outlinerTree, row); bool isInlineNoteFocused = DocumentHelpers.IsInlineNoteFocused(outlinerTree); ObservableCollection <OutlinerNote> parentCollection = row.Document.GetParentCollection(row); int idx = GetNoteIndexAtParent(row); parentCollection.Remove(row); OutlinerNote newNote = new OutlinerNote(parentCollection[idx - 1]); newNote.Clone(row); DocumentHelpers.CopyNodesRecursively(newNote, row); parentCollection[idx - 1].SubNotes.Add(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 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); } }