public MoveToNextLine ( |
||
zElement | ||
Результат | void |
public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { var arrayComponents = m_sVariable.Split(new char[] { ';' }); if (1 > arrayComponents.Length) { return(false); } int nXPush; if (!int.TryParse(arrayComponents[0], out nXPush)) { return(false); } var nYPush = 0; if (2 <= arrayComponents.Length) { if (!int.TryParse(arrayComponents[1], out nYPush)) { return(false); } } zProcessData.CurrentX += nXPush; zProcessData.CurrentY += nYPush; if (zProcessData.CurrentX > zElement.width) { zProcessData.MoveToNextLine(zElement); } return(false); }
public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { var arrayComponents = m_sVariable.Split(new char[] { ';' }); if (1 > arrayComponents.Length) { return false; } int nXPush; if (!int.TryParse(arrayComponents[0], out nXPush)) { return false; } var nYPush = 0; if (2 <= arrayComponents.Length) { if (!int.TryParse(arrayComponents[1], out nYPush)) { return false; } } zProcessData.CurrentX += nXPush; zProcessData.CurrentY += nYPush; if (zProcessData.CurrentX > zElement.width) { zProcessData.MoveToNextLine(zElement); } return false; }
public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { int nSpaces; if (!int.TryParse(m_sVariable, out nSpaces)) { return(false); } LineNumber = zProcessData.CurrentLine; float fWidth = (float)nSpaces * ((float)zProcessData.FontSpaceWidth + (float)zElement.wordspace); if (0 == fWidth) { return(false); } if (zProcessData.CurrentX + fWidth >= zElement.width) { if (Optional) { return(false); } zProcessData.MoveToNextLine(zElement); } TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, fWidth, zProcessData.FontSpaceHeight); zProcessData.CurrentX += fWidth; return(true); }
public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { int nSpaces; if (!int.TryParse(m_sVariable, out nSpaces)) { return false; } LineNumber = zProcessData.CurrentLine; float fWidth = (float)nSpaces * ((float)zProcessData.FontSpaceWidth + (float)zElement.wordspace); if (0 == fWidth) { return false; } if (zProcessData.CurrentX + fWidth >= zElement.width) { if (Optional) { return false; } zProcessData.MoveToNextLine(zElement); } TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, fWidth, zProcessData.FontSpaceHeight); zProcessData.CurrentX += fWidth; return true; }
public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { m_zFontBrush = zProcessData.FontBrush; m_zFont = zProcessData.Font; m_fFontHeight = zProcessData.FontHeight; m_fXOffset = zProcessData.CurrentXOffset; m_fYOffset = zProcessData.CurrentYOffset; LineNumber = zProcessData.CurrentLine; m_fFontOutlineSize = m_zFont.Size; // TODO: stop recalculating this, store it in the processData if (0 != zElement.outlinethickness) { switch (m_zFont.Unit) { case GraphicsUnit.Point: m_fFontOutlineSize = zGraphics.DpiY * (m_zFont.Size / 72f); break; default: Logger.AddLogLine("This font is using the Unit: {0} (not currently supported)".FormatString(m_zFont.Unit.ToString())); break; } } m_rectMeasuredRectangle = MeasureDisplayStringWidth(zGraphics, m_sVariable, m_zFont); var fMeasuredWidth = m_rectMeasuredRectangle.Width; var fMeasuredHeight = Math.Max(m_rectMeasuredRectangle.Height, m_fFontHeight); if (zProcessData.CurrentX + fMeasuredWidth > zElement.width) { zProcessData.MoveToNextLine(zElement); } TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, fMeasuredWidth, fMeasuredHeight); zProcessData.CurrentX += fMeasuredWidth; return(true); }
public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { zProcessData.MoveToNextLine(zElement); return false; }
public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { m_zFontBrush = zProcessData.FontBrush; m_zFont = zProcessData.Font; m_fFontHeight = zProcessData.FontHeight; m_fXOffset = zProcessData.CurrentXOffset; m_fYOffset = zProcessData.CurrentYOffset; LineNumber = zProcessData.CurrentLine; // TODO: stop recalculating this, store it in the processData if (0 != zElement.outlinethickness) { m_fFontOutlineSize = zGraphics.DpiY * (m_zFont.Size / CardMakerMDI.Instance.ApplicationDPI); } m_rectMeasuredRectangle = MeasureDisplayStringWidth(zGraphics, m_sVariable, m_zFont); var fMeasuredWidth = m_rectMeasuredRectangle.Width; if (zProcessData.CurrentX + fMeasuredWidth > zElement.width) { zProcessData.MoveToNextLine(zElement); } TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, fMeasuredWidth, m_rectMeasuredRectangle.Height); zProcessData.CurrentX += fMeasuredWidth; return true; }
public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { var arrayComponents = m_sVariable.Split(new char[] { ';' }); if (1 > arrayComponents.Length) { return(false); } LineNumber = zProcessData.CurrentLine; m_sImageFile = arrayComponents[0]; var zBmp = DrawItem.LoadImageFromCache(m_sImageFile); if (null == zBmp) { return(false); } var fLineHeightPercent = -1f; // SOOOOO much duplication switch (arrayComponents.Length) { case 1: TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, zBmp.Width, zBmp.Height); break; case 2: float.TryParse(arrayComponents[1], out fLineHeightPercent); TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, zBmp.Width, zBmp.Height); break; case 3: if (float.TryParse(arrayComponents[1], out m_fXOffset) && float.TryParse(arrayComponents[2], out m_fYOffset)) { TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, zBmp.Width, zBmp.Height); } break; case 4: float.TryParse(arrayComponents[1], out fLineHeightPercent); if (float.TryParse(arrayComponents[2], out m_fXOffset) && float.TryParse(arrayComponents[3], out m_fYOffset)) { TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, zBmp.Width, zBmp.Height); } break; case 5: // width and height are absolute (even overlapping drawing) { int nWidth; int nHeight; if (float.TryParse(arrayComponents[1], out m_fXOffset) && float.TryParse(arrayComponents[2], out m_fYOffset) && int.TryParse(arrayComponents[3], out nWidth) && int.TryParse(arrayComponents[4], out nHeight)) { TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, nWidth, nHeight); } } break; } if (TargetRect == RectangleF.Empty) { return(false); } m_fXOffset += zProcessData.CurrentXOffset; m_fYOffset += zProcessData.CurrentYOffset; if (-1f != fLineHeightPercent) { var aspectRatio = TargetRect.Width / TargetRect.Height; var fNewHeight = fLineHeightPercent * (zProcessData.FontHeight == 0f ? 1f : (float)zProcessData.FontHeight); var fNewWidth = fNewHeight * aspectRatio; TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, fNewWidth, fNewHeight); } // newline eval if (TargetRect.Width + TargetRect.X > zElement.width) { zProcessData.MoveToNextLine(zElement); TargetRect = new RectangleF(0, zProcessData.CurrentY, TargetRect.Width, TargetRect.Height); } // cap off excessively wide images if (TargetRect.Width + TargetRect.X > zElement.width) { TargetRect = new RectangleF(TargetRect.X, TargetRect.Y, zElement.width, TargetRect.Height); } // Center the image on the line based on font height or line height (todo figure out which...) TargetRect = new RectangleF(TargetRect.X, TargetRect.Y + (((float)zProcessData.FontHeight - (float)TargetRect.Height) / 2f), TargetRect.Width, TargetRect.Height); zProcessData.CurrentX += TargetRect.Width; return(true); }
public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { zProcessData.MoveToNextLine(zElement); return(false); }
public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { var arrayComponents = m_sVariable.Split(new char[] { ';' }); if (1 > arrayComponents.Length) { return false; } LineNumber = zProcessData.CurrentLine; m_sImageFile = arrayComponents[0]; var zBmp = DrawItem.LoadImageFromCache(m_sImageFile); if (null == zBmp) { return false; } var fLineHeightPercent = -1f; // SOOOOO much duplication switch (arrayComponents.Length) { case 1: TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, zBmp.Width, zBmp.Height); break; case 2: float.TryParse(arrayComponents[1], out fLineHeightPercent); TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, zBmp.Width, zBmp.Height); break; case 3: if (float.TryParse(arrayComponents[1], out m_fXOffset) && float.TryParse(arrayComponents[2], out m_fYOffset)) { TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, zBmp.Width, zBmp.Height); } break; case 4: float.TryParse(arrayComponents[1], out fLineHeightPercent); if (float.TryParse(arrayComponents[2], out m_fXOffset) && float.TryParse(arrayComponents[3], out m_fYOffset)) { TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, zBmp.Width, zBmp.Height); } break; case 5: // width and height are absolute (even overlapping drawing) { int nWidth; int nHeight; if (float.TryParse(arrayComponents[1], out m_fXOffset) && float.TryParse(arrayComponents[2], out m_fYOffset) && int.TryParse(arrayComponents[3], out nWidth) && int.TryParse(arrayComponents[4], out nHeight)) { TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, nWidth, nHeight); } } break; } if (TargetRect == RectangleF.Empty) { return false; } m_fXOffset += zProcessData.CurrentXOffset; m_fYOffset += zProcessData.CurrentYOffset; if (-1f != fLineHeightPercent) { var aspectRatio = TargetRect.Width / TargetRect.Height; var fNewHeight = fLineHeightPercent * (zProcessData.FontHeight == 0f ? 1f : (float)zProcessData.FontHeight); var fNewWidth = fNewHeight * aspectRatio; TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, fNewWidth, fNewHeight); } // newline eval if (TargetRect.Width + TargetRect.X > zElement.width) { zProcessData.MoveToNextLine(zElement); TargetRect = new RectangleF(0, zProcessData.CurrentY, TargetRect.Width, TargetRect.Height); } // cap off excessively wide images if (TargetRect.Width + TargetRect.X > zElement.width) { TargetRect = new RectangleF(TargetRect.X, TargetRect.Y, zElement.width, TargetRect.Height); } // Center the image on the line based on font height or line height (todo figure out which...) TargetRect = new RectangleF(TargetRect.X, TargetRect.Y + (((float)zProcessData.FontHeight - (float)TargetRect.Height) / 2f), TargetRect.Width, TargetRect.Height); zProcessData.CurrentX += TargetRect.Width; return true; }
public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { m_zFontBrush = zProcessData.FontBrush; m_zFont = zProcessData.Font; m_fFontHeight = zProcessData.FontHeight; m_fXOffset = zProcessData.CurrentXOffset; m_fYOffset = zProcessData.CurrentYOffset; LineNumber = zProcessData.CurrentLine; m_fFontOutlineSize = m_zFont.Size; // TODO: stop recalculating this, store it in the processData if (0 != zElement.outlinethickness) { switch (m_zFont.Unit) { case GraphicsUnit.Point: m_fFontOutlineSize = zGraphics.DpiY * (m_zFont.Size / 72f); break; default: Logger.AddLogLine("This font is using the Unit: {0} (not currently supported)".FormatString(m_zFont.Unit.ToString())); break; } } m_rectMeasuredRectangle = MeasureDisplayStringWidth(zGraphics, m_sVariable, m_zFont); var fMeasuredWidth = m_rectMeasuredRectangle.Width; var fMeasuredHeight = Math.Max(m_rectMeasuredRectangle.Height, m_fFontHeight); if (zProcessData.CurrentX + fMeasuredWidth > zElement.width) { zProcessData.MoveToNextLine(zElement); } TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, fMeasuredWidth, fMeasuredHeight); zProcessData.CurrentX += fMeasuredWidth; return true; }