コード例 #1
0
ファイル: Presentation.cs プロジェクト: daisy/obi
 /// <summary>
 /// Signal that the used status of a node has changed.
 /// </summary>
 public void SignalUsedStatusChanged(ObiNode node)
 {
     if (UsedStatusChanged != null)
     {
         UsedStatusChanged(this, new NodeEventArgs <ObiNode>(node));
     }
 }
コード例 #2
0
ファイル: ObiNode.cs プロジェクト: ARLM-Keller/Daisy-Obi
        /// <summary>
        /// Return the correct namespace URI for all Obi nodes.
        /// </summary>
        //public override string XukNamespaceUri { get { return DataModelFactory.NS;

        /// <summary>
        /// Copy the used flag as well as properties.
        /// </summary>
        protected override TreeNode CopyProtected(bool deep, bool inclProperties)
        {
            ObiNode copy = (ObiNode)base.CopyProtected(deep, inclProperties);

            copy.mUsed = mUsed;
            return(copy);
        }
コード例 #3
0
ファイル: Presentation.cs プロジェクト: daisy/obi
 /// <summary>
 /// Find the page number following the one for this node. If the node doesn't have a number,
 /// find the first preceding node that has one.
 /// </summary>
 public PageNumber PageNumberFollowing(ObiNode node)
 {
     while (node != null && !(node is EmptyNode && ((EmptyNode)node).Role_ == EmptyNode.Role.Page))
     {
         node = node.PrecedingNode;
     }
     return(node != null ? ((EmptyNode)node).PageNumber.NextPageNumber() : new PageNumber(1));
 }
コード例 #4
0
 /// <summary>
 /// Insert a node at the given index.
 /// The index is interpreted relatively to the position of the other phrases or sections.
 /// If the index is negative, count backward from the end (i.e. -1 inserts in the last position)
 /// </summary>
 public override void Insert(ObiNode node, int index)
 {
     index = node is EmptyNode ? index < 0 ? FirstSectionIndex + index : index :
             index < 0 ? Children.Count + index : index + FirstSectionIndex;
     ((TreeNode)this).Insert(node, index);
     if (node is PhraseNode && ((PhraseNode)node).Role_ == EmptyNode.Role.Heading)
     {
         DidSetHeading((PhraseNode)node);
     }
 }
コード例 #5
0
ファイル: PhraseNode.cs プロジェクト: ARLM-Keller/Daisy-Obi
 /// <summary>
 /// Allow only phrase nodes to be inserted.
 /// If the index is negative, count backward from the end (-1 is last.)
 /// </summary>
 public override void Insert(ObiNode node, int index)
 {
     if (!(node is PhraseNode))
     {
         throw new Exception("Only phrase nodes can be added as children of a phrase node.");
     }
     if (index < 0)
     {
         index += Children.Count;
     }
     ((TreeNode)this).Insert(node, index);
 }
コード例 #6
0
ファイル: ObiNode.cs プロジェクト: ARLM-Keller/Daisy-Obi
        /// <summary>
        /// Following node in document order: section, then its phrase children, then its section children,
        /// then its siblings, etc.
        /// </summary>
        public virtual ObiNode FollowingNodeAfter(int index_after)
        {
            ObiNode parent = ParentAs <ObiNode>();

            if (parent != null)
            {
                int index_self = parent.Children.IndexOf(this);
                return(Children.Count > index_after + 1 ? (ObiNode)Children.Get(index_after + 1) :
                       index_self < Parent.Children.Count - 1 ? (ObiNode)Parent.Children.Get(index_self + 1) :
                       parent.FollowingNodeAfter(index_self));
            }
            else
            {
                return(null);
            }
        }
コード例 #7
0
ファイル: Presentation.cs プロジェクト: daisy/obi
 /// <summary>
 /// Get the page number for this node. If the node already has a page number, return it.
 /// If it has no page number, find the nearest preceding block with a page number and add one.
 /// </summary>
 public PageNumber PageNumberFor(ObiNode node)
 {
     if (node is EmptyNode && ((EmptyNode)node).Role_ == EmptyNode.Role.Page)
     {
         return(((EmptyNode)node).PageNumber);
     }
     else
     {
         ObiNode n = node.PrecedingNode;
         while (n != null && !(n is EmptyNode && ((EmptyNode)n).Role_ == EmptyNode.Role.Page))
         {
             n = n.PrecedingNode;
         }
         return(n != null ? ((EmptyNode)n).PageNumber.NextPageNumber() : new PageNumber(1));
     }
 }
コード例 #8
0
ファイル: ObiNode.cs プロジェクト: ARLM-Keller/Daisy-Obi
 public void LocateBookMarkAndAssociatedNode()
 {
     AcceptDepthFirst(delegate(urakawa.core.TreeNode n)
     {
         if (n.IsMarked)
         {
             m_Bookmarked = (ObiNode)n;
         }
         // work around to load associate node because the sdk do not have event to indicate suk-in complete
         if (n is EmptyNode && ((EmptyNode)n).Role_ == EmptyNode.Role.Anchor)
         {
             EmptyNode e = ((EmptyNode)n).AssociatedNode;
         }
         return(true);
     }, delegate(urakawa.core.TreeNode n) { });
 }
コード例 #9
0
 private void UpdateAssociatedNodeLocationString()
 {
     if (AssociatedNode != null && AssociatedNode.IsRooted)       //@AssociateNode
     {
         ObiNode iterationNode = AssociatedNode;
         m_AssociatedNodeLocation = "";
         while (iterationNode != this.Root)
         {
             if (AssociatedNode != iterationNode)
             {
                 m_AssociatedNodeLocation += "_";
             }
             m_AssociatedNodeLocation += iterationNode.Parent.Children.IndexOf(iterationNode).ToString();
             iterationNode             = iterationNode.ParentAs <ObiNode>();
         }
     }
 }
コード例 #10
0
 /// <summary>
 /// Find the parent node for a new node to be added at the current selection.
 /// The new node can either be a SectionNode or an EmtpyNode.
 /// The rule is to add inside containers and after cursor/phrase block.
 /// </summary>
 public virtual ObiNode ParentForNewNode(ObiNode newNode)
 {
     return(newNode is SectionNode ?
            (Node is SectionNode ? Node.ParentAs <ObiNode>() : Node.AncestorAs <SectionNode>()) :
            (Node is SectionNode ? Node : Node.ParentAs <ObiNode>()));
 }
コード例 #11
0
ファイル: ObiNode.cs プロジェクト: ARLM-Keller/Daisy-Obi
 public abstract void Insert(ObiNode node, int index);
コード例 #12
0
ファイル: ObiNode.cs プロジェクト: ARLM-Keller/Daisy-Obi
        public void InsertAfter(ObiNode node, ObiNode anchor)
        {
            int index = Children.IndexOf(anchor);

            base.Insert(node, index + 1);
        }
コード例 #13
0
ファイル: ObiNode.cs プロジェクト: ARLM-Keller/Daisy-Obi
 public void InsertAfterSelf(ObiNode node)
 {
     Parent.InsertAfter(node, this);
 }
コード例 #14
0
ファイル: ObiNode.cs プロジェクト: ARLM-Keller/Daisy-Obi
        // Our own overrides

        public virtual void AppendChild(ObiNode node)
        {
            base.AppendChild(node);
        }
コード例 #15
0
 public Clipboard(ObiNode node, bool deep)
 {
     mNode = node;
     mDeep = deep;
 }
コード例 #16
0
 public override int IndexForNewNode(ObiNode newNode)
 {
     return(newNode is SectionNode ? Node.Index + 1 : mIndex);
 }
コード例 #17
0
 public virtual int IndexForNewNode(ObiNode newNode)
 {
     return(newNode is SectionNode ?
            (Node is SectionNode ? (Node.Index + 1) : Node.AncestorAs <SectionNode>().SectionChildCount) :
            (Node is SectionNode ? Node.PhraseChildCount : (Node.Index + 1)));
 }
コード例 #18
0
ファイル: ObiNode.cs プロジェクト: ARLM-Keller/Daisy-Obi
        /// <summary>
        /// Get the nearest ancestor of the given type. This is useful to get the section ancestor of a phrase
        /// regardless of its nesting level.
        /// </summary>
        public T AncestorAs <T>() where T : ObiNode
        {
            ObiNode parent = Parent as ObiNode;

            return(parent == null || parent is T ? parent as T : parent.AncestorAs <T>());
        }
コード例 #19
0
ファイル: ObiNode.cs プロジェクト: ARLM-Keller/Daisy-Obi
        public void InsertBefore(ObiNode node, ObiNode anchor)
        {
            int index = Children.IndexOf(anchor);

            base.Insert(node, index);
        }
コード例 #20
0
ファイル: ObiNode.cs プロジェクト: ARLM-Keller/Daisy-Obi
 public void RemoveChild(ObiNode child)
 {
     Children.Remove(child);
 }
コード例 #21
0
 public override ObiNode ParentForNewNode(ObiNode newNode)
 {
     return(newNode is SectionNode?Node.ParentAs <ObiNode>() : Node);
 }
コード例 #22
0
        /// <summary>
        /// Append a child node (of any kind) at the right position.
        /// </summary>
        public override void AppendChild(ObiNode node)
        {
            int index = node is EmptyNode ? FirstSectionIndex : Children.Count;

            ((TreeNode)this).Insert(node, index);
        }
コード例 #23
0
 //public MetadataSelection(RootNode node, ProjectView.MetadataView control, ProjectView.MetadataItemSelection item)
 public MetadataSelection(ObiNode node, ProjectView.MetadataView control, ProjectView.MetadataItemSelection item) //sdk2
     : base(node, control)
 {
     mItem = item;
 }
コード例 #24
0
 public override void Insert(ObiNode node, int index)
 {
     throw new Exception("Empty nodes have no children.");
 }
コード例 #25
0
        public IControlWithSelection Control;  // control in which it is selected

        /// <summary>
        /// Create a new selection object.
        /// </summary>
        public NodeSelection(ObiNode node, IControlWithSelection control)
        {
            Node    = node;
            Control = control;
        }
コード例 #26
0
ファイル: ObiNode.cs プロジェクト: ARLM-Keller/Daisy-Obi
        /// <summary>
        /// Get a command to renumber this node and all following nodes from this number.
        /// </summary>
        public virtual CompositeCommand RenumberCommand(ProjectView.ProjectView view, PageNumber from)
        {
            ObiNode n = FollowingNode;

            return(n == null ? null : n.RenumberCommand(view, from));
        }