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; }
public PaneGrp FormatSong(SongData song) { if (m_formatted.ContainsKey(song.LocalID)) return m_formatted[song.LocalID]; SongFormatter fmt = new SongFormatter(song.SongText, SongFormatOptions); fmt.Run(); PaneGrp grp = fmt.Result; grp.Insert(new SongHeaderPane(BookFormatOptions, song.Title, song.Author)); grp.Add(new SongSeparatorPane(BookFormatOptions)); m_formatted[song.LocalID] = grp; return m_formatted[song.LocalID]; }
/* public ISongSource SongSource { get { return m_source; } set { m_source = value; m_bsrc = m_source.GetBindingSource(); m_bsrc.PositionChanged += src_PositionChanged; } } */ private void Redraw() { if (m_drawtext != null) { if (edcolumns.Value == 1) { SongFormatter fmt = new SongFormatter(m_drawtext, CfgTools.CreateSongViewFormatOptions(panel1.Width / ViewScale)); fmt.Run(); m_panegrp = fmt.Result; panel1.Height = (int)(m_panegrp.FullHeight * ViewScale); m_colheight = m_colwidth = 0; } else { SongFormatter fmt = new SongFormatter(m_drawtext, CfgTools.CreateSongViewFormatOptions(panel1.Width / ViewScale / (int)edcolumns.Value)); fmt.Run(); m_panegrp = fmt.Result; int colcnt = (int)edcolumns.Value; m_colwidth = (ClientSize.Width - 8 - m_colhspace * (colcnt - 1)) / colcnt; m_colheight = ClientSize.Height - 8 - panel2.Height; m_cols.Clear(); m_cols.Add(new List<Pane>()); float colhi = 0; foreach (Pane pane in m_panegrp.Panes) { if (colhi + pane.Height * ViewScale > m_colheight) { m_cols.Add(new List<Pane>()); colhi = 0; } List<Pane> lastpanes = m_cols[m_cols.Count - 1]; if (lastpanes.Count == 0 && pane.IsDelimiter) { // preskocime delimitery na zacatku } else { colhi += pane.Height * ViewScale; lastpanes.Add(pane); } } panel1.Height = m_colheight; panel1.Width = m_cols.Count * m_colwidth + (m_cols.Count - 1) * m_colhspace; } } else { m_panegrp = null; panel1.Height = 0; } panel1.Invalidate(); }