예제 #1
0
        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);
            }
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
        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);
                }
            }
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
            }
        }
예제 #6
0
        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);
        }
예제 #7
0
        private void InsertNewRow(bool isTemporary, bool insertAfterCurrent)
        {
            OutlinerNote currentRow = OutlinerTree.SelectedItem;
            if (currentRow == null)
                return;

            OutlinerNote parent;
            int indexToInsert;
            __LastColumn = 0;

            if (insertAfterCurrent == true)
            {
                if (currentRow.IsExpanded == true && currentRow.SubNotes.Count > 0)
                {
                    parent = currentRow;
                    indexToInsert = 0;
                }
                else
                {
                    parent = currentRow.Parent;
                    indexToInsert = parent.SubNotes.IndexOf(currentRow) + 1;
                }
            }
            else
            {
                parent = currentRow.Parent;
                indexToInsert = parent.SubNotes.IndexOf(currentRow);
            }

            OutlinerNote newNote = new OutlinerNote(parent);
            parent.SubNotes.Insert(indexToInsert, newNote);
            newNote.Temporary = isTemporary;

            int columnIdx = 0;

            OutlinerTree.MakeActive(newNote, columnIdx, false, new EventHandler(DocumentHelpers.ApplyStyleAfterMakeActive));
            Document.UndoManager.PushUndoAction(new UndoInsertRow(newNote, columnIdx));
            newNote.UpdateParentCheckboxes();
        }