예제 #1
0
 public void Run(LogPages pages, IEnumerable<PaneGrp> panegrps, BookLayout layout)
 {
     foreach (PaneGrp grp in panegrps)
     {
         pages.AddPaneGrp(grp);
     }
 }
예제 #2
0
 /*
 IDistribAlg m_distrib = DistribAlgs.Complex;
 public string DistribAlg
 {
     get { return m_distrib.Name; }
     set { m_distrib = DistribAlgs.FromName(value); }
 }
 */
 public override void AddToPages(LogPages pages, SongBook book)
 {
     List<PaneGrp> grps = new List<PaneGrp>();
     foreach (var row in book.GetSongs(book.Formatting.Order))
     {
         grps.Add(book.FormatSong(row));
     }
     IDistribAlg alg = DistribAlgs.FromEnum(book.Layout.DistribAlg);
     alg.Run(pages, grps, book.Layout);
 }
예제 #3
0
        public static LogPages FormatSongForPrinting(SongData song, float pgwi, XGraphics infoContext, float pghi, float mmky)
        {
            //PrinterPrintTarget target=new PrinterPrintTarget(
            SongPrintFormatOptions opt = CfgTools.CreateSongPrintFormatOptions(pgwi, infoContext, mmky);
            SongFormatter fmt = new SongFormatter(song.SongText, opt.SongOptions);
            fmt.Run();
            PaneGrp grp = fmt.Result;
            grp.Insert(new SongHeaderPane(opt, song.Title, song.Author != "" ? song.Author : song.GroupName));

            LogPages pages = new LogPages(pghi);
            pages.AddPaneGrp(grp);
            return pages;
        }
예제 #4
0
 public void Run(LogPages pages, IEnumerable<PaneGrp> panegrps, BookLayout layout)
 {
     DistribAlgImpl impl = null;
     switch (layout.DistribType)
     {
         case DistribType.Book:
             impl = new BookDistribAlgImpl(pages, panegrps, layout);
             break;
         case DistribType.Lines:
             impl = new LinesDistribAlgImpl(pages, panegrps, layout);
             break;
     }
     impl.Run();
 }
예제 #5
0
        public FormattedBook(LogPages pages, BookLayout layout, PageDrawOptions opts)
        {
            m_layout = layout;
            m_hcnt = layout.HorizontalCount;
            m_vcnt = layout.VerticalCount;
            m_pagesPerSheet = 2 * m_vcnt * m_hcnt;
            m_opts = opts;

            List<LogPage> tmp = new List<LogPage>();
            tmp.AddRange(pages.Pages);
            m_originalPages = tmp.ToArray();

            m_smallPageCount = pages.Count;

            // logicke stranky doplnene o null
            List<LogPage> virtpages = new List<LogPage>();
            virtpages.AddRange(pages.Pages);

            while (m_smallPageCount % m_pagesPerSheet > 0)
            {
                m_smallPageCount++;
                virtpages.Add(null);
            }

            // logicke stranky doplnene o null obracene
            List<LogPage> revvirtpages = new List<LogPage>();
            revvirtpages.AddRange(virtpages);
            revvirtpages.Reverse();

            m_sheetCount = m_smallPageCount / m_pagesPerSheet;

            m_pages = new LogPage[m_smallPageCount];

            if (layout.DistribType == DistribType.Lines)
            {
                IEnumerator<LogPage> actpage = virtpages.GetEnumerator();
                for (int i = 0; i < m_sheetCount; i++)
                {
                    for (int l = 0; l < m_vcnt; l++)
                    {
                        for (int j = 0; j < 2; j++)
                        {
                            for (int k = 0; k < m_hcnt; k++)
                            {
                                actpage.MoveNext();
                                m_pages[PageIndex(i, k, l, j)] = actpage.Current;
                            }
                        }
                    }
                }
            }
            if (layout.DistribType == DistribType.Book)
            {
                if (m_hcnt % 2 == 1) // liche horizontalne
                {
                    for (int i = 0; i < m_smallPageCount; i++) m_pages[i] = virtpages[i];
                }
                else // sude horizontalne
                {
                    IEnumerator<LogPage> incer = virtpages.GetEnumerator();
                    IEnumerator<LogPage> decer = revvirtpages.GetEnumerator();
                    for (int i = 0; i < m_smallPageCount; i += 4)
                    {
                        incer.MoveNext(); m_pages[i + 0] = incer.Current;
                        incer.MoveNext(); m_pages[i + 1] = incer.Current;
                        decer.MoveNext(); m_pages[i + 2] = decer.Current;
                        decer.MoveNext(); m_pages[i + 3] = decer.Current; 
                    }
                }
            }
        }
예제 #6
0
 public DistribAlgImpl(LogPages pages, IEnumerable<PaneGrp> panegrps, BookLayout layout)
 {
     m_pages = pages;
     m_stack.AddRange(panegrps);
     m_layout = layout;
 }
예제 #7
0
 public LinesDistribAlgImpl(LogPages pages, IEnumerable<PaneGrp> panegrps, BookLayout layout)
     : base(pages, panegrps, layout)
 {
 }
예제 #8
0
 public abstract void AddToPages(LogPages pages, SongBook book);
예제 #9
0
 public LogPages CreateLogPages(SongBook book)
 {
     LogPages pages = new LogPages(book.Layout.SmallPageHeight);
     foreach (SequenceItem item in m_items) item.AddToPages(pages, book);
     return pages;
 }
예제 #10
0
 public override void AddToPages(LogPages pages, SongBook book)
 {
     PaneGrp outline = book.FormatOutline();
     pages.AddPaneGrp(outline);
 }