Ejemplo n.º 1
0
        public HeadingTreeNodeWrapper(HeadingsNavigator navigator, TreeNode node, TreeNode.Section section, HeadingTreeNodeWrapper parent)
        {
            m_parent     = parent;
            m_navigator  = navigator;
            m_isExpanded = false;

            m_TreeNodeHeading = null;
            m_TreeNodeLevel   = null;

            m_Section = section;

            if ((node == null && m_Section == null) ||
                m_navigator == null)
            {
                return;
            }

            CommandExpandAll   = m_navigator.ViewModel.CommandExpandAll;
            CommandCollapseAll = m_navigator.ViewModel.CommandCollapseAll;

            Tuple <TreeNode, TreeNode> nodes = ComputeLevelNodes(node, m_Section);

            m_TreeNodeLevel   = nodes.Item1;
            m_TreeNodeHeading = nodes.Item2;
        }
Ejemplo n.º 2
0
        private void onProjectUnLoaded(Project project)
        {
            if (m_UndoRedoManagerHooker != null)
            {
                m_UndoRedoManagerHooker.UnHook();
            }
            m_UndoRedoManagerHooker = null;

            View.UnloadProject();

            HeadingsNavigator = null;
        }
Ejemplo n.º 3
0
        private void onProjectLoaded(Project project)
        {
            if (m_session.IsXukSpine)
            {
                return;
            }

            m_UndoRedoManagerHooker = project.Presentations.Get(0).UndoRedoManager.Hook(this);

            HeadingsNavigator = new HeadingsNavigator(project, this);

            View.LoadProject();
        }
Ejemplo n.º 4
0
        private void OnUndoRedoManagerChanged_TextNodeStructureEditCommand(UndoRedoManagerEventArgs eventt, bool done, TextNodeStructureEditCommand command, bool isTransactionEndEvent, bool isNoTransactionOrTrailingEdge)
        {
            DebugFix.Assert(command is TreeNodeInsertCommand || command is TreeNodeRemoveCommand);

            //TreeNode node = (command is TreeNodeInsertCommand) ? ((TreeNodeInsertCommand)command).TreeNode : ((TreeNodeRemoveCommand)command).TreeNode;
            //TreeNode node = command.TreeNode;
            //bool forceInvalidate = (command is TreeNodeInsertCommand && !done) || (command is TreeNodeRemoveCommand && done);
            //bool done_ = (command is TreeNodeInsertCommand) ? !done : done;

            if (isNoTransactionOrTrailingEdge)
            {
                View.UnloadProject();
                HeadingsNavigator = null;

                HeadingsNavigator = new HeadingsNavigator(m_session.DocumentProject, this);
                View.LoadProject();
            }
        }
Ejemplo n.º 5
0
        private void intializeCommands()
        {
            m_Logger.Log("HeadingPaneViewModel.initializeCommands", Category.Debug, Priority.Medium);

            //
            CommandExpandAll = new RichDelegateCommand(
                Tobi_Plugin_NavigationPane_Lang.CmdTreeExpandAll_ShortDesc,
                Tobi_Plugin_NavigationPane_Lang.CmdTreeExpandAll_LongDesc,
                null,
                m_ShellView.LoadTangoIcon("list-add"),
                () => HeadingsNavigator.ExpandAll(),
                () => HeadingsNavigator != null,
                null, null);
            //
            CommandCollapseAll = new RichDelegateCommand(
                Tobi_Plugin_NavigationPane_Lang.CmdTreeCollapseAll_ShortDesc,
                Tobi_Plugin_NavigationPane_Lang.CmdTreeCollapseAll_LongDesc,
                null,
                m_ShellView.LoadTangoIcon("list-remove"),
                () => HeadingsNavigator.CollapseAll(),
                () => HeadingsNavigator != null,
                null, null);
            //
            m_ShellView.RegisterRichCommand(CommandExpandAll);
            m_ShellView.RegisterRichCommand(CommandCollapseAll);
            //
            CommandFindFocus = new RichDelegateCommand(
                @"HEADINGS CommandFindFocus DUMMY TXT",
                @"HEADINGS CommandFindFocus DUMMY TXT",
                null, // KeyGesture set only for the top-level CompositeCommand
                null,
                () =>
            {
                m_ShellView.RaiseEscapeEvent();

                if (View != null)
                {
                    IsSearchVisible = true;
                    FocusHelper.Focus(View.SearchBox);
                    View.SearchBox.SelectAll();
                }
            },
                () => View != null
                //&& View.SearchBox.Visibility == Visibility.Visible
                && View.SearchBox.IsEnabled,
                null, //Settings_KeyGestures.Default,
                null  //PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Nav_TOCFindNext)
                );
            //
            CommandFindNext = new RichDelegateCommand(
                @"HEADINGS CommandFindNext DUMMY TXT", //UserInterfaceStrings.TreeFindNext,
                @"HEADINGS CommandFindNext DUMMY TXT", //UserInterfaceStrings.TreeFindNext_,
                null,                                  // KeyGesture set only for the top-level CompositeCommand
                null,
                () =>
            {
                m_ShellView.RaiseEscapeEvent();

                HeadingsNavigator.FindNext(true);
            },
                () => HeadingsNavigator != null && !string.IsNullOrEmpty(HeadingsNavigator.SearchTerm),
                null, //Settings_KeyGestures.Default,
                null  //PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Nav_TOCFindNext)
                );
            //
            CommandFindPrev = new RichDelegateCommand(
                @"HEADINGS CommandFindPrev DUMMY TXT", //UserInterfaceStrings.TreeFindPrev,
                @"HEADINGS CommandFindPrev DUMMY TXT", //UserInterfaceStrings.TreeFindPrev_,
                null,                                  // KeyGesture set only for the top-level CompositeCommand
                null,
                () =>
            {
                m_ShellView.RaiseEscapeEvent();

                HeadingsNavigator.FindPrevious(true);
            },
                () => HeadingsNavigator != null && !string.IsNullOrEmpty(HeadingsNavigator.SearchTerm),
                null, //Settings_KeyGestures.Default,
                null  //PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Nav_TOCFindPrev)
                );


            /*
             *          CommandExpand = new RichDelegateCommand(
             *              UserInterfaceStrings.TreeExpand,
             *              UserInterfaceStrings.TreeExpand_,
             *              null,
             *              shellView.LoadGnomeNeuIcon("Neu_list-add"),
             *              ()=> _headingsNavigator.Expand((HeadingTreeNodeWrapper)obj),
             *              ()=> (_headingsNavigator != null && (obj as HeadingTreeNodeWrapper).HasChildren && !(obj as HeadingTreeNodeWrapper).IsExpanded));
             */
            //

            /*
             *          CommandCollapse = new RichDelegateCommand(
             *              UserInterfaceStrings.TreeCollapse,
             *              UserInterfaceStrings.TreeCollapse_,
             *              null,
             *              shellView.LoadGnomeNeuIcon("Neu_list-remove"),
             *              ()=> _headingsNavigator.Collapse((HeadingTreeNodeWrapper)obj),
             *              ()=> (_headingsNavigator != null && (obj as HeadingTreeNodeWrapper).HasChildren && (obj as HeadingTreeNodeWrapper).IsExpanded));
             */
            /*CommandEditText = new RichDelegateCommand(
             *  UserInterfaceStrings.TreeEdit,
             *  UserInterfaceStrings.TreeEdit_,
             *  null,
             *  shellView.LoadTangoIcon("accessories-text-editor"),
             *  ()=> _headingsNavigator.EditText((HeadingTreeNodeWrapper)obj),
             *  ()=> _headingsNavigator!=null);*/
        }