Ejemplo n.º 1
0
        /// <summary>
        /// Create a section node belonging to this presentation.
        /// </summary>
        public SectionNode CreateSectionNode()
        {
            SectionNode node = (SectionNode)m_ObiNodeFactory.createNode(XukAble.GetXukName(typeof(SectionNode)).z(PrettyFormat), DataModelFactory.NS); //sdk2 :local ObiNode factory used

            urakawa.property.channel.ChannelsProperty channelsProperty = PropertyFactory.CreateChannelsProperty();
            node.AddProperty(channelsProperty);
            // Create the text media object for the label with a default label
            TextMedia labelMedia = MediaFactory.CreateTextMedia();

            labelMedia.Text = Localizer.Message("default_section_label");
            channelsProperty.SetMedia(ChannelsManager.GetOrCreateTextChannel(), labelMedia);
            return(node);
        }
Ejemplo n.º 2
0
        // Copy the section and its contents (shallow)
        protected override TreeNode CopyProtected(bool deep, bool inclProperties)
        {
            SectionNode copy = (SectionNode)base.CopyProtected(deep, inclProperties);

            // Even when doing a shallow copy, we still should copy children (!)
            if (!deep)
            {
                for (int i = 0; i < PhraseChildCount; ++i)
                {
                    copy.AppendChild((EmptyNode)PhraseChild(i).Copy(true, true));
                }
            }
            return(copy);
        }
Ejemplo n.º 3
0
 private void TraverseAndCollectAllSubSections(SectionNode node, List <SectionNode> sectionsList)
 {
     if (node.SectionChildCount == 0)
     {
         return;
     }
     else
     {
         for (int i = 0; i < node.SectionChildCount; i++)
         {
             SectionNode n = node.SectionChild(i);
             sectionsList.Add(n);
             TraverseAndCollectAllSubSections(n, sectionsList);
         }
     }
 }
Ejemplo n.º 4
0
        public EmptyNode GetAnchorForReferencedNode(EmptyNode referencedNode)
        {
            List <EmptyNode> nodesToRemove = new List <EmptyNode>();

            for (int i = 0; i < m_ListOfAnchorNodes.Count; i++)
            {
                EmptyNode n = m_ListOfAnchorNodes[i];
                if (!n.IsRooted)
                {
                    m_ListOfAnchorNodes.Remove(n);
                    --i;
                    continue;
                }
                if (n.AssociatedNode != null && n.AssociatedNode == referencedNode)
                {
                    return(n);
                }
            }
            for (int i = 0; i < m_ListOfSectionsToBeIteratedForAnchors.Count; i++)
            {
                SectionNode section = m_ListOfSectionsToBeIteratedForAnchors[i];
                EmptyNode   anchor  = null;
                for (int j = 0; j < section.PhraseChildCount; j++)
                {
                    EmptyNode n = section.PhraseChild(j);
                    if (n.Role_ == EmptyNode.Role.Anchor)
                    {
                        ListOfAnchorNodes_Add(n);
                        if (n.AssociatedNode == referencedNode)
                        {
                            anchor = n;
                        }
                    }
                }

                m_ListOfSectionsToBeIteratedForAnchors.Remove(section);
                i--;
                if (anchor != null)
                {
                    return(anchor);
                }
            }
            return(null);
        }
Ejemplo n.º 5
0
        private int mIndex;  // cursor index in the strip

        public StripIndexSelection(SectionNode node, IControlWithSelection control, int index)
            : base(node, control)
        {
            mIndex = index;
        }
Ejemplo n.º 6
0
 public TextSelection(SectionNode node, IControlWithSelection control, string text)
     : base(node, control)
 {
     mText = text;
 }
Ejemplo n.º 7
0
        /// <summary>
        /// A new phrase is being recorded, so create and return it.
        /// </summary>
        public PhraseNode StartRecordingPhrase(Events.Audio.Recorder.PhraseEventArgs e, SectionNode parent, int index)
        {
            PhraseNode phrase = CreatePhraseNode(e.Audio);

            parent.Insert(phrase, index);
            return(phrase);
        }
Ejemplo n.º 8
0
        public void MergeProject()
        {
            m_SectionsToMerge.Clear();
            try
            {                //1
                Uri     uri        = new Uri(m_SourceProjectPath, UriKind.Absolute);
                bool    pretty     = m_session.Presentation.Project.PrettyFormat;
                Project subproject = new Project();

                OpenXukAction action = new OpenXukAction(subproject, uri);
                action.ShortDescription = "...";
                action.LongDescription  = "...";
                action.Execute();
                subproject.PrettyFormat = pretty;

                Presentation subpresentation = subproject.Presentations.Get(0);
                // compare audio formats
                if (m_session.Presentation.MediaDataManager.DefaultPCMFormat.Data.BitDepth != subpresentation.MediaDataManager.DefaultPCMFormat.Data.BitDepth ||
                    m_session.Presentation.MediaDataManager.DefaultPCMFormat.Data.BlockAlign != subpresentation.MediaDataManager.DefaultPCMFormat.Data.BlockAlign ||
                    m_session.Presentation.MediaDataManager.DefaultPCMFormat.Data.SampleRate != subpresentation.MediaDataManager.DefaultPCMFormat.Data.SampleRate)
                {
                    throw new System.Exception("Audio format of project does not match");
                }
                TreeNode subroot      = subpresentation.RootNode;
                int      sectionCount = ((ObiRootNode)subroot).SectionChildCount;
                if (sectionCount == 0)
                {
                    return;
                }
                int progressValue = 0;

                reportProgress(progressValue, "");
                SectionNode section = ((ObiRootNode)subroot).SectionChild(0);
                while (section != null)
                {                //2
                    if (RequestCancellation)
                    {
                        return;
                    }
                    TreeNode importedLevel = section.Export(m_session.Presentation);

                    ObiRootNode parent = (ObiRootNode)m_session.Presentation.RootNode;
                    //parent.AppendChild((SectionNode) importedLevel);
                    m_SectionsToMerge.Add((SectionNode)importedLevel);
                    progressValue += 90 / sectionCount;
                    reportProgress(progressValue,
                                   string.Format(Localizer.Message("MergeProject_SectionProgress"), section.Label));
                    //System.Windows.Forms.MessageBox.Show(section.GetText().ToString());
                    section = section.NextSibling;
                }            //-2
            }                //-1
                             //catch (Exception ex)
                             //{//1
            //messageBoxAlert("PROBLEM:\n " + xukPath, null);
            //m_session.messageBoxText("MERGE PROBLEM", xukPath, ex.Message);

            //throw ex;
            //System.Windows.Forms.MessageBox.Show(ex.ToString());
            //}//-1


            finally
            {
            }
            reportProgress(100, "");
        }