示例#1
0
        public ContentAreaManager(ContentArea contentArea)
        {
            BaseContentArea = contentArea;

            var copiedContentArea = new ContentArea(BaseContentArea);

            ContentAreaStack.Push(copiedContentArea);
        }
示例#2
0
        public ContentArea ResetContentAreaStack()
        {
            ContentAreaStack.Clear();

            var copiedContentArea = new ContentArea(BaseContentArea);

            ContentAreaStack.Push(copiedContentArea);

            return(copiedContentArea);
        }
示例#3
0
        public ContentArea CreateSubsectionContentArea(string labelName)
        {
            if (string.IsNullOrEmpty(labelName))
            {
                return(null);
            }

            // if the weave has a name, it is labeled and we want to make it a separate section.

            var subsectionContentArea = new ContentArea()
            {
                IndentLevel = 0
            };

            var currentSection = GetCurrentSection();
            var currentSectionSubsectionAddable = currentSection as ISubsectionAddable;

            if (currentSectionSubsectionAddable != null)
            {
                var theSubsection = currentSectionSubsectionAddable.AddSubsection();
                // A top level section like Sequence should not be perpended with the act
                if (theSubsection is Sequence || theSubsection is Scene)
                {
                    theSubsection.SectionName = labelName;
                }
                else
                {
                    theSubsection.SectionName = currentSection.SectionName + "__" + labelName;
                }

                theSubsection.SpaceToken = new SpaceToken();
                theSubsection.EndLine    = new EndLine();
                theSubsection.SyntacticalElements.Add(new BlankLine());
                subsectionContentArea.AddCurrentSection(theSubsection);

                var startTokenEnsurable = theSubsection as IStartTokenEnsurable;
                if (startTokenEnsurable != null)
                {
                    startTokenEnsurable.EnsureStartToken();
                }

                if (currentSection.SubsectionsSeparatorToken == null)
                {
                    currentSection.SubsectionsSeparatorToken = new SubsectionsSeparatorToken();
                }
            }

            return(subsectionContentArea);
        }
示例#4
0
        public ContentArea CreateIndentedContentArea()
        {
            var current = CurrentContentArea;

            if (current == null)
            {
                return(null);
            }

            var indentedContentArea = new ContentArea()
            {
                IndentLevel = 1 + CurrentContentArea.IndentLevel
            };

            if (ContentAreaStack != null)
            {
                ContentAreaStack.Push(indentedContentArea);
            }

            return(indentedContentArea);
        }
示例#5
0
        /// <summary>Initializes a new instance of the <see cref="ContentArea" /> class.</summary>
        /// <param name="contentArea">The content area.</param>
        public ContentArea(ContentArea contentArea)
        {
            if (contentArea == null)
            {
                return;
            }

            this.MenuChoice = contentArea.MenuChoice;

            this.Act        = contentArea.Act;
            this.Sequence   = contentArea.Sequence;
            this.Scene      = contentArea.Scene;
            this.Moment     = contentArea.Moment;
            this.Slice      = contentArea.Slice;
            this.MicroSlice = contentArea.MicroSlice;
            this.NanoSlice  = contentArea.NanoSlice;

            this.File = contentArea.File;


            //this.LabelDetoured = contentArea.LabelDetoured;

            this.IndentLevel = contentArea.IndentLevel;
        }