Beispiel #1
0
        public void DrawPage(XGraphics gfx, PointF pagepos, PageDrawOptions opts)
        {
            float acty = 0;

            for (int i = 0; i < m_noDelimPageCount; i++)
            {
                Pane pane = m_panes[i];
                pane.Draw(gfx, new PointF(pagepos.X, pagepos.Y + acty), true);
                acty += pane.Height;
            }

            if (opts != null)
            {
                string header = opts.Header.Replace("%c", PageNumber.ToString());
                string footer = opts.Footer.Replace("%c", PageNumber.ToString());

                if (header != "")
                {
                    float hdrwi = (float)gfx.MeasureString(header, opts.HeaderFont).Width;
                    float hdrhi = (float)gfx.MeasureString(header, opts.HeaderFont).Height;
                    gfx.DrawString(header, opts.HeaderFont, opts.HeaderColor, new PointF(pagepos.X + opts.PageWidth / 2 - hdrwi / 2, pagepos.Y - hdrhi), XStringFormat.TopLeft);
                }
                if (footer != "")
                {
                    float ftrwi = (float)gfx.MeasureString(footer, opts.FooterFont).Width;
                    gfx.DrawString(footer, opts.FooterFont, opts.FooterColor, new PointF(pagepos.X + opts.PageWidth / 2 - ftrwi / 2, pagepos.Y + opts.PageHeight), XStringFormat.TopLeft);
                }
            }
        }
Beispiel #2
0
 public void ClearCaches()
 {
     m_formatted.Clear();
     m_songFormatOptions = null;
     m_bookFormatOptions = null;
     m_pageDrawOptions = null;
     m_fbook = null;
 }
        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; 
                    }
                }
            }
        }
 public NormalPreviewSource(FormattedBook book, PageDrawOptions opts)
 {
     m_book = book;
     m_opts = opts;
 }
 public PolyLogPagePreview(FormattedBook book, PageDrawOptions opts, int skipCount, int groupSize)
 {
     m_book = book;
     m_opts = opts;
     m_skipCount = skipCount;
     m_groupSize = groupSize;
     m_smallWidth = m_book.Layout.SmallPageWidth + m_book.Layout.DistLeftMM + m_book.Layout.DistRightMM;
     m_smallHeight = m_book.Layout.SmallPageHeight + m_book.Layout.DistTopMM + m_book.Layout.DistBottomMM;
 }
 public void DrawBigPage(XGraphics gfx, int sheet, int side, PageDrawOptions opts)
 {
     for (int x = 0; x < m_hcnt; x++)
     {
         for (int y = 0; y < m_vcnt; y++)
         {
             LogPage page = m_pages[PageIndex(sheet, x, y, side)];
             if (page != null)
             {
                 PointF pagepos = m_layout.GetPagePos(x, y);
                 page.DrawPage(gfx, pagepos, opts);
             }
         }
     }
 }