コード例 #1
0
        public void Generate(Project project, IXenonASTElement _Parent)
        {
            Slide titleslide = new Slide
            {
                Name = "UNNAMED_2parttitle",
                Number = project.NewSlideNumber,
                Lines = new List<SlideLine>(),
                Asset = "",
                Format = SlideFormat.TwoPartTitle,
                MediaType = MediaType.Image
            };

            SlideLineContent slcpart1 = new SlideLineContent() { Data = Part1 };
            SlideLineContent slcpart2 = new SlideLineContent() { Data = Part2 };

            SlideLine slpart1 = new SlideLine() { Content = new List<SlideLineContent>() { slcpart1 } };
            SlideLine slpart2 = new SlideLine() { Content = new List<SlideLineContent>() { slcpart2 } };

            titleslide.Lines.Add(slpart1);
            titleslide.Lines.Add(slpart2);

            titleslide.Data["orientation"] = Orientation;

            if (project.GetAttribute("alphatranscol").Count > 0)
            {
                titleslide.Colors.Add("keytrans", GraphicsHelper.ColorFromRGB(project.GetAttribute("alphatranscol").FirstOrDefault()));
            }


            project.Slides.Add(titleslide);


        }
コード例 #2
0
        public void Generate(Project project, IXenonASTElement _Parent)
        {
            Slide sermonslide = new Slide
            {
                Name      = "UNNAMED_sermon",
                Number    = project.NewSlideNumber,
                Lines     = new List <SlideLine>(),
                Asset     = "",
                Format    = SlideFormat.SermonTitle,
                MediaType = MediaType.Image
            };

            SlideLineContent slcref = new SlideLineContent()
            {
                Data = Reference
            };
            SlideLineContent slctitle = new SlideLineContent()
            {
                Data = Title
            };
            SlideLineContent slcpreacher = new SlideLineContent()
            {
                Data = Preacher
            };

            SlideLine slref = new SlideLine()
            {
                Content = new List <SlideLineContent>()
                {
                    slcref
                }
            };
            SlideLine sltitle = new SlideLine()
            {
                Content = new List <SlideLineContent>()
                {
                    slctitle
                }
            };
            SlideLine slpreacher = new SlideLine()
            {
                Content = new List <SlideLineContent>()
                {
                    slcpreacher
                }
            };

            sermonslide.Lines.Add(sltitle);
            sermonslide.Lines.Add(slref);
            sermonslide.Lines.Add(slpreacher);

            if (project.GetAttribute("alphatranscol").Count > 0)
            {
                sermonslide.Colors.Add("keytrans", GraphicsHelper.ColorFromRGB(project.GetAttribute("alphatranscol").FirstOrDefault()));
            }


            project.Slides.Add(sermonslide);
        }
コード例 #3
0
        public void Generate(Project project, IXenonASTElement _Parent)
        {
            Slide readingslide = new Slide();

            readingslide.Name      = "UNNAMED_reading";
            readingslide.Number    = project.NewSlideNumber;
            readingslide.Lines     = new List <SlideLine>();
            readingslide.Asset     = "";
            readingslide.Format    = SlideFormat.Reading;
            readingslide.MediaType = MediaType.Image;

            SlideLineContent slcref = new SlideLineContent()
            {
                Data = Reference
            };
            SlideLineContent slcname = new SlideLineContent()
            {
                Data = Name
            };

            SlideLine slref = new SlideLine()
            {
                Content = new List <SlideLineContent>()
                {
                    slcref
                }
            };
            SlideLine slname = new SlideLine()
            {
                Content = new List <SlideLineContent>()
                {
                    slcname
                }
            };

            readingslide.Lines.Add(slname);
            readingslide.Lines.Add(slref);

            if (project.GetAttribute("alphatranscol").Count > 0)
            {
                readingslide.Colors.Add("keytrans", GraphicsHelper.ColorFromRGB(project.GetAttribute("alphatranscol").FirstOrDefault()));
            }

            project.Slides.Add(readingslide);
        }
コード例 #4
0
        public void Generate(Project project, IXenonASTElement _Parent)
        {
            Slide slide = new Slide
            {
                Name      = "UNNAMED_titledliturgyverse",
                Number    = project.NewSlideNumber,
                Lines     = new List <SlideLine>(),
                Asset     = "",
                Format    = SlideFormat.LiturgyTitledVerse,
                MediaType = MediaType.Image
            };


            Dictionary <string, string> otherspeakers = new Dictionary <string, string>();
            var s = project.GetAttribute("otherspeakers");

            foreach (var item in s)
            {
                var match = Regex.Match(item, "(?<speaker>(.*)-(?<text>.*))").Groups;
                otherspeakers.Add(match["speaker"].Value, match["text"].Value);
            }


            LiturgyLayoutEngine layoutEngine = new LiturgyLayoutEngine();

            layoutEngine.BuildLines(Text, otherspeakers);
            layoutEngine.BuildTextLines(project.Layouts.TitleLiturgyVerseLayout.Textbox);

            slide.Data["lines"]       = layoutEngine.LiturgyTextLines;
            slide.Data["title"]       = Title;
            slide.Data["reference"]   = Reference;
            slide.Data["drawspeaker"] = DrawSpeaker;

            if (project.GetAttribute("alphatranscol").Count > 0)
            {
                slide.Colors.Add("keytrans", GraphicsHelper.ColorFromRGB(project.GetAttribute("alphatranscol").FirstOrDefault()));
            }


            project.Slides.Add(slide);
        }
コード例 #5
0
        public void Generate(Project project, IXenonASTElement _Parent)
        {
            // create a liturgy image slide
            Slide imageslide = new Slide
            {
                Name   = "UNNAMED_image",
                Number = project.NewSlideNumber,
                Lines  = new List <SlideLine>()
            };
            string assetpath = "";
            var    asset     = project.Assets.Find(p => p.Name == AssetName);

            if (asset != null)
            {
                assetpath = asset.CurrentPath;
            }
            SlideLineContent slc = new SlideLineContent()
            {
                Data = assetpath
            };
            SlideLine sl = new SlideLine()
            {
                Content = new List <SlideLineContent>()
                {
                    slc
                }
            };

            imageslide.Lines.Add(sl);
            imageslide.Format    = SlideFormat.LiturgyImage;
            imageslide.Asset     = assetpath;
            imageslide.MediaType = MediaType.Image;

            if (project.GetAttribute("alphatranscol").Count > 0)
            {
                imageslide.Colors.Add("keytrans", GraphicsHelper.ColorFromRGB(project.GetAttribute("alphatranscol").FirstOrDefault()));
            }

            project.Slides.Add(imageslide);
        }
コード例 #6
0
        public void Generate(Project project, IXenonASTElement _Parent)
        {
            Slide titleslide = new Slide
            {
                Name      = "UNNAMED_anthemtitle",
                Number    = project.NewSlideNumber,
                Lines     = new List <SlideLine>(),
                Asset     = "",
                Format    = SlideFormat.AnthemTitle,
                MediaType = MediaType.Image
            };

            SlideLineContent slcatitle = new SlideLineContent()
            {
                Data = AnthemTitle
            };
            SlideLineContent slcmusician = new SlideLineContent()
            {
                Data = Musician
            };
            SlideLineContent slcaccompanianst = new SlideLineContent()
            {
                Data = Accompanianst
            };
            SlideLineContent slccredits = new SlideLineContent()
            {
                Data = Credits
            };

            SlideLine slatitle = new SlideLine()
            {
                Content = new List <SlideLineContent>()
                {
                    slcatitle
                }
            };
            SlideLine slmusician = new SlideLine()
            {
                Content = new List <SlideLineContent>()
                {
                    slcmusician
                }
            };
            SlideLine slaccompanianst = new SlideLine()
            {
                Content = new List <SlideLineContent>()
                {
                    slcaccompanianst
                }
            };
            SlideLine slcredits = new SlideLine()
            {
                Content = new List <SlideLineContent>()
                {
                    slccredits
                }
            };

            titleslide.Lines.Add(slatitle);
            titleslide.Lines.Add(slmusician);
            titleslide.Lines.Add(slaccompanianst);
            titleslide.Lines.Add(slcredits);

            if (project.GetAttribute("alphatranscol").Count > 0)
            {
                titleslide.Colors.Add("keytrans", GraphicsHelper.ColorFromRGB(project.GetAttribute("alphatranscol").FirstOrDefault()));
            }


            project.Slides.Add(titleslide);
        }
コード例 #7
0
        public void Generate(Project project, IXenonASTElement _Parent)
        {
            LiturgyVerseLayoutEngine layoutEngine = new LiturgyVerseLayoutEngine();

            layoutEngine.BuildLines(Content.Select(p => p.TextContent).ToList());
            layoutEngine.BuildSlideLines(project.Layouts.LiturgyLayout.GetRenderInfo());


            Slide liturgyslide = new Slide
            {
                Asset     = string.Empty,
                Name      = "UNNAMED_liturgy",
                Number    = project.NewSlideNumber,
                Format    = SlideFormat.LiturgyVerse,
                MediaType = MediaType.Image
            };

            double lineheight = -project.Layouts.LiturgyLayout.InterLineSpacing;

            if (project.GetAttribute("alphatranscol").Count > 0)
            {
                liturgyslide.Colors.Add("keytrans", GraphicsHelper.ColorFromRGB(project.GetAttribute("alphatranscol").FirstOrDefault()));
            }



            foreach (var line in layoutEngine.LayoutLines)
            {
                bool overheight = lineheight + project.Layouts.LiturgyLayout.InterLineSpacing + line.height > project.Layouts.LiturgyLayout.GetRenderInfo().TextBox.Height;
                if (overheight)
                {
                    // need to start a new slide for this one
                    project.Slides.Add(liturgyslide);
                    // create new slide
                    liturgyslide = new Slide
                    {
                        Asset     = string.Empty,
                        Name      = "UNNAMED_liturgy",
                        Number    = project.NewSlideNumber,
                        Format    = SlideFormat.LiturgyVerse,
                        MediaType = MediaType.Image
                    };
                    lineheight = 0;
                    if (project.GetAttribute("alphatranscol").Count > 0)
                    {
                        liturgyslide.Colors.Add("keytrans", GraphicsHelper.ColorFromRGB(project.GetAttribute("alphatranscol").FirstOrDefault()));
                    }
                }
                lineheight += project.Layouts.LiturgyLayout.InterLineSpacing + line.height;
                liturgyslide.Lines.Add(
                    new SlideLine()
                {
                    Content =
                    {
                        new SlideLineContent()
                        {
                            Data = string.Join("", line.words).Trim(), Attributes ={ ["width"]                                                             = line.width, ["height"] = line.height }
                        }
                    }
                }
                    );
            }
            liturgyslide.Data["title"]     = Title;
            liturgyslide.Data["reference"] = Reference;
            // add slide to project
            project.Slides.Add(liturgyslide);
        }
コード例 #8
0
        public void Generate(Project project, IXenonASTElement _Parent)
        {
            Dictionary <string, string> otherspeakers = new Dictionary <string, string>();
            // get otherspeakers from project

            var s = project.GetAttribute("otherspeakers");

            foreach (var item in s)
            {
                var match = Regex.Match(item, "(?<speaker>(.*))-(?<text>.*)").Groups;
                otherspeakers.Add(match["speaker"].Value, match["text"].Value);
            }



            LiturgyLayoutEngine layoutEngine = new LiturgyLayoutEngine();

            layoutEngine.BuildLines(Content.Select(p => p.TextContent).ToList(), otherspeakers, ForceSpeakerStartOnNewline);
            layoutEngine.BuildSlideLines(project.Layouts.LiturgyLayout.GetRenderInfo());
            layoutEngine.BuildTextLines(project.Layouts.LiturgyLayout.Text);


            // override colors if requried on slide

            bool overridespeakercolor    = false;
            bool overridetextcolor       = false;
            bool overridebackgroundcolor = false;

            System.Drawing.Color liturgyspeakercolor    = new System.Drawing.Color();
            System.Drawing.Color liturgytextcolor       = new System.Drawing.Color();
            System.Drawing.Color liturgybackgroundcolor = new System.Drawing.Color();
            System.Drawing.Color liturgytransppcolor    = System.Drawing.Color.Gray;

            if (project.GetAttribute("litspeakertextcol").Count > 0)
            {
                liturgyspeakercolor  = GraphicsHelper.ColorFromRGB(project.GetAttribute("litspeakertextcol").FirstOrDefault());
                overridespeakercolor = true;
            }
            if (project.GetAttribute("littextcol").Count > 0)
            {
                liturgytextcolor  = GraphicsHelper.ColorFromRGB(project.GetAttribute("littextcol").FirstOrDefault());
                overridetextcolor = true;
            }
            if (project.GetAttribute("litbackgroundcol").Count > 0)
            {
                liturgybackgroundcolor  = GraphicsHelper.ColorFromRGB(project.GetAttribute("litbackgroundcol").FirstOrDefault());
                overridebackgroundcolor = true;
            }
            if (project.GetAttribute("alphatranscol").Count > 0)
            {
                liturgytransppcolor = GraphicsHelper.ColorFromRGB(project.GetAttribute("alphatranscol").FirstOrDefault());
            }



            // turn lines into slides

            /*
             *  We start by computing the height of each line
             *  Add this to the running total height of the slide's lines + min interline spacing
             *  Once we can't fit any more declare a slide, figure out the slide
             *
             *  Also must follow the 3 golden rules of slide layout
             *
             *  1. If the starting speaker is [C] Congregation, no other speaker allowed on the slide (or if starting speaker is [R] respondant
             *  2. There may be no more than 2 speakers per slide
             *  3. If a logical-line requires wrapping the line must be the first line of the slide
             */

            Slide liturgyslide = new Slide
            {
                Asset     = string.Empty,
                Name      = "UNNAMED_liturgy",
                Number    = project.NewSlideNumber,
                Format    = SlideFormat.Liturgy,
                MediaType = MediaType.Image,
            };

            if (overridespeakercolor)
            {
                liturgyslide.Colors["alttext"] = liturgyspeakercolor;
            }
            if (overridetextcolor)
            {
                liturgyslide.Colors["text"] = liturgytextcolor;
            }
            if (overridebackgroundcolor)
            {
                liturgyslide.Colors["keybackground"] = liturgybackgroundcolor;
            }
            liturgyslide.Colors["keytrans"] = liturgytransppcolor;


            double lineheight = -project.Layouts.LiturgyLayout.InterLineSpacing;

            string lastspeaker  = "";
            int    speakers     = 0;
            string startspeaker = layoutEngine.LiturgyTextLines.FirstOrDefault().Speaker ?? "";

            foreach (var line in layoutEngine.LiturgyTextLines)
            {
                if (lastspeaker != line.Speaker)
                {
                    speakers++;
                }

                bool overheight             = lineheight + project.Layouts.LiturgyLayout.InterLineSpacing + line.Height > project.Layouts.LiturgyLayout.GetRenderInfo().TextBox.Height;
                bool overspeakerswitch      = speakers > 2;                                                                                 // Rule 2
                bool incorrrectspeakerorder = (startspeaker == "C" && line.Speaker != "C") || (startspeaker == "R" && line.Speaker != "R"); // Rule 1
                bool paragraphwrapissue     = speakers > 1 && line.MultilineParagraph;                                                      // Rule 3
                if (overheight || overspeakerswitch || incorrrectspeakerorder || paragraphwrapissue)
                {
                    // need to start a new slide for this one
                    project.Slides.Add(liturgyslide);
                    // create new slide
                    liturgyslide = new Slide
                    {
                        Asset     = string.Empty,
                        Name      = "UNNAMED_liturgy",
                        Number    = project.NewSlideNumber,
                        Format    = SlideFormat.Liturgy,
                        MediaType = MediaType.Image,
                    };
                    if (overridespeakercolor)
                    {
                        liturgyslide.Colors["alttext"] = liturgyspeakercolor;
                    }
                    if (overridetextcolor)
                    {
                        liturgyslide.Colors["text"] = liturgytextcolor;
                    }
                    if (overridebackgroundcolor)
                    {
                        liturgyslide.Colors["keybackground"] = liturgybackgroundcolor;
                    }
                    liturgyslide.Colors["keytrans"] = liturgytransppcolor;

                    lineheight   = 0;
                    startspeaker = line.Speaker;
                    lastspeaker  = line.Speaker;
                    speakers     = 1;
                }
                lastspeaker = line.Speaker;
                lineheight += project.Layouts.LiturgyLayout.InterLineSpacing + line.Height;
                liturgyslide.Lines.Add(
                    new SlideLine()
                {
                    Content =
                    {
                        new SlideLineContent()
                            {
                            Data = line.Speaker, Attributes ={ ["width"]                                       = line.Width, ["height"] = line.Height }
                            },
                        new SlideLineContent()
                            {
                            Data       = string.Join("", line.Words.Select(w => w.Value)).Trim(),
                            Attributes =
                            {
                            ["textline"] = line,
                            ["width"]    = line.Width,
                            ["height"]   = line.Height
                            }
                            }
                    }
                }
                    );
            }
            // add slide to project
            project.Slides.Add(liturgyslide);
        }