////////////////////////////////////////////////////////////////////////////// public BibleProject(BibleVerse verse) { Program.ConfigHelper.BibleFormatChanged += delegate { RefreshData(); }; this.name = verse.ToString(); // Data currentVerseNum = verse.RefVerse; LoadBibDat(verse); // Load the bible data from the database PrepareForDisplay(); }
public bool PrepSlideDoubleVerse(GfxContext ctx, Dictionary <int, BibleVerse> bibVerses, int currentVerseNum, PresenterFont font) { #region Format data BibleVerse bva = bibVerses[currentVerseNum]; BibleVerse bvb = bibVerses[currentVerseNum + 1]; string firstText = bva.RefVerse + ". " + bva.Text; string secondText = bvb.RefVerse + ". " + bvb.Text; string reference = bva.ToString() + "-" + bvb.RefVerse; #endregion Size nativeSize = DisplayEngine.NativeResolution.Size; #region Measure StringFormat sf = GetStringFormat(); int insideHeight = nativeSize.Height - paddingPixels * 2; int insideWidth = nativeSize.Width - paddingPixels * 2; Point anchorTop = new Point(paddingPixels, paddingPixels); Point anchorBottom = new Point(paddingPixels, paddingPixels + (int)((double)insideHeight / 2)); // Measure the reference blocks int refemSize = (int)(font.SizeInPoints * .9); // actual drawing size is smaller than usual int refBlockHeight = (int)(font.SizeInPoints * 1.2); // Determine top of rectangle // Measure both strings RectangleF r = new RectangleF(paddingPixels, 0, insideWidth, InternalMeasureString(firstText, font, insideWidth, sf).Height); int h1 = (int)r.Height; // Get the size of the verse so we can fix the reference at the bottom int h2 = (int)InternalMeasureString(secondText, font, insideWidth, sf).Height; int offsetY = (int)(((double)insideHeight - h1 - h2 - refBlockHeight) / 2); if (font.VerticalAlignment == VerticalAlignment.Top) { r.Y = paddingPixels; } else if (font.VerticalAlignment == VerticalAlignment.Middle) { r.Y = offsetY; } else { r.Y = nativeSize.Height - paddingPixels * 2 - h1 - h2 - refBlockHeight; } // Size check int standardMax = (int)((double)insideHeight / 2); if (h1 + h2 + refBlockHeight > standardMax) { return(false); } #endregion #region Build context ctx.destSize = DisplayEngine.NativeResolution.Size; ctx.textRegions.Clear(); // Draw the first part GfxTextRegion rVerse = new GfxTextRegion(); ctx.textRegions.Add(rVerse); rVerse.font = font; rVerse.font.HorizontalAlignment = HorizontalAlignment.Left; rVerse.message = firstText; rVerse.bounds = r; GfxTextRegion rVerse2 = new GfxTextRegion(); ctx.textRegions.Add(rVerse2); rVerse2.font = font; rVerse2.message = secondText; r.Y += h1 + refemSize; r.Height = h2; rVerse2.bounds = r; // Reference GfxTextRegion rRef = new GfxTextRegion(); ctx.textRegions.Add(rRef); rRef.font = (PresenterFont)font.Clone(); SetRefFont(rRef.font); rRef.message = reference; r.Y += h2 + refBlockHeight - refemSize; // Move to the bottom of the rectangle rRef.bounds = r; rRef.bounds.Height = refBlockHeight; #endregion return(true); }
public override string ToString() { return(bibVerse.ToString() + " " + bibVerse.Text); }