void PrintProfileLong(Rectangle bounds, PrintPageEventArgs args) { SolidBrush solidBrush = new SolidBrush(Color.Black); int vPos = bounds.Top; StringFormat format = new StringFormat(StringFormatFlags.NoClip) { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Near }; if (_pageNumber == 1) { int num = PpInfo(bounds, args) + 6; Font font = new Font("Arial", 12f, FontStyle.Bold | FontStyle.Underline, GraphicsUnit.Pixel); args.Graphics.DrawString("Extended " + MidsContext.Character.Alignment + " Profile", font, solidBrush, new RectangleF(bounds.Left + 15, num, bounds.Width, 15f), format); vPos = num + 15; } Font font1 = new Font("Arial", 12f, FontStyle.Bold, GraphicsUnit.Pixel); if (_sectionCompleted == PrintWhat.None) { _endOfPage = false; // mutates vPos int num = BuildPowerListLong(ref vPos, bounds, 12, PrintWhat.Powers, args); if (_endOfPage) { return; } string s = "------------"; args.Graphics.DrawString(s, font1, solidBrush, new RectangleF(bounds.Left + 15, num, bounds.Width, 15f), format); vPos = num + 15; _sectionCompleted = PrintWhat.Powers; } if (_sectionCompleted == PrintWhat.Powers) { _endOfPage = false; vPos = BuildPowerListLong(ref vPos, bounds, 12, PrintWhat.Inherent, args); if (_endOfPage) { return; } _sectionCompleted = PrintWhat.Inherent; if (MidsContext.Character.Archetype.Epic) { string s = "------------"; args.Graphics.DrawString(s, font1, solidBrush, new RectangleF((bounds.Left + 15), vPos, bounds.Width, 15f), format); vPos += 15; } } if (_sectionCompleted == PrintWhat.Inherent && MidsContext.Character.Archetype.Epic) { _endOfPage = false; BuildPowerListLong(ref vPos, bounds, 12, PrintWhat.EpicInherent, args); if (_endOfPage) { return; } } _printingProfile = false; }
void PrintBegin(object sender, PrintEventArgs e) { _pageNumber = 0; _pIndex = 0; _printingProfile = MidsContext.Config.PrintProfile != ConfigData.PrintOptionProfile.None; _printingHistory = MidsContext.Config.PrintHistory; _sectionCompleted = PrintWhat.None; }
/// <summary> /// Determines the template type from the name /// </summary> /// <returns></returns> public TemplateType GetTemplateType() { if (PrintWhat.ToUpper().StartsWith("[DAY]")) { return(TemplateType.Day); } else if (PrintWhat.ToUpper().StartsWith("[WORKWEEK]")) { return(TemplateType.WorkWeek); } else if (PrintWhat.ToUpper().StartsWith("[FULLWEEK]")) { return(TemplateType.FullWeek); } else { return(TemplateType.Month); } }
int BuildPowerListLong( ref int vPos, RectangleF bounds, int fontSize, PrintWhat selection, PrintPageEventArgs args) { if (_pIndex < 0) { _endOfPage = true; _printingProfile = false; return(vPos); } var format = new StringFormat(StringFormatFlags.NoWrap | StringFormatFlags.NoClip); var solidBrush = new SolidBrush(Color.Black); int pgIdx = -1; var font = new Font("Arial", fontSize, FontStyle.Bold, GraphicsUnit.Pixel); bool isEnd = false; int levelVar = 0; for (int pIndex = _pIndex; pIndex <= MidsContext.Character.CurrentBuild.Powers.Count - 1; ++pIndex) { bool include = false; switch (selection) { case PrintWhat.Powers: if (MidsContext.Character.CurrentBuild.Powers[pIndex].Chosen) { include = true; } break; case PrintWhat.Inherent: if (!MidsContext.Character.CurrentBuild.Powers[pIndex].Chosen && MidsContext.Character.CurrentBuild.Powers[pIndex].Power != null) { include = !MidsContext.Character.CurrentBuild.Powers[pIndex].Power.IsEpic; if (include && MidsContext.Character.CurrentBuild.Powers[pIndex].Slots.Length < 1) { include = false; } } break; case PrintWhat.EpicInherent: if (!MidsContext.Character.CurrentBuild.Powers[pIndex].Chosen && MidsContext.Character.CurrentBuild.Powers[pIndex].Power != null) { include = MidsContext.Character.CurrentBuild.Powers[pIndex].Power.IsEpic; } break; } if (!MidsContext.Character.CurrentBuild.Powers[pIndex].Chosen & MidsContext.Character.CurrentBuild.Powers[pIndex].SubPowers.Length > 0) { include = false; } if (!include) { continue; } levelVar = MidsContext.Character.CurrentBuild.Powers[pIndex].Level + 1; string s1 = "Level " + levelVar + ":"; string s2 = MidsContext.Character.CurrentBuild.Powers[pIndex].Power != null ? MidsContext.Character.CurrentBuild.Powers[pIndex].Power.DisplayName : "[No Power]"; string s3 = ""; if (vPos - (double)bounds.Top + (MidsContext.Character.CurrentBuild.Powers[pIndex].Slots.Length + 1) * fontSize * 1.25 > bounds.Height) { pgIdx = pIndex; isEnd = true; break; } for (int index = 0; index <= MidsContext.Character.CurrentBuild.Powers[pIndex].Slots.Length - 1; ++index) { if (!string.IsNullOrEmpty(s3)) { s3 += '\n'; } string str1; if (index == 0) { str1 = s3 + "(A) "; } else { levelVar = MidsContext.Character.CurrentBuild.Powers[pIndex].Slots[index].Level + 1; } str1 = s3 + "(" + levelVar + ") "; if (MidsContext.Character.CurrentBuild.Powers[pIndex].Slots[index].Enhancement.Enh > -1) { IEnhancement enhancement = DatabaseAPI.Database.Enhancements[MidsContext.Character.CurrentBuild.Powers[pIndex].Slots[index].Enhancement.Enh]; switch (enhancement.TypeID) { case Enums.eType.Normal: string relativeString1 = Enums.GetRelativeString(MidsContext.Character.CurrentBuild.Powers[pIndex].Slots[index].Enhancement.RelativeLevel, false); string str2; if (!string.IsNullOrEmpty(relativeString1) & relativeString1 != "X") { str2 = str1 + relativeString1 + " " + DatabaseAPI.Database.EnhGradeStringLong[(int)MidsContext.Character.CurrentBuild.Powers[pIndex].Slots[index].Enhancement.Grade] + " - "; } else { str2 = relativeString1 != "X" ? str1 + DatabaseAPI.Database.EnhGradeStringLong[(int)MidsContext.Character.CurrentBuild.Powers[pIndex].Slots[index].Enhancement.Grade] + " - " : str1 + "Disabled " + DatabaseAPI.Database.EnhGradeStringLong[(int)MidsContext.Character.CurrentBuild.Powers[pIndex].Slots[index].Enhancement.Grade] + " - "; } str1 = str2 + " "; break; case Enums.eType.SpecialO: string relativeString2 = Enums.GetRelativeString(MidsContext.Character.CurrentBuild.Powers[pIndex].Slots[index].Enhancement.RelativeLevel, false); string str3; if (!string.IsNullOrEmpty(relativeString2) & relativeString2 != "X") { str3 = str1 + relativeString2 + " " + enhancement.GetSpecialName() + " - "; } else { str3 = relativeString2 != "X" ? str1 + enhancement.GetSpecialName() + " - " : str1 + "Disabled " + enhancement.GetSpecialName() + " - "; } str1 = str3 + " "; break; case Enums.eType.None: break; case Enums.eType.InventO: break; case Enums.eType.SetO: break; default: throw new ArgumentOutOfRangeException(); } s3 = str1 + enhancement.LongName; switch (enhancement.TypeID) { case Enums.eType.InventO: levelVar = MidsContext.Character.CurrentBuild.Powers[pIndex].Slots[index].Enhancement.IOLevel + 1; s3 = s3 + " - IO:" + levelVar; continue; case Enums.eType.SetO: levelVar = MidsContext.Character.CurrentBuild.Powers[pIndex].Slots[index].Enhancement.IOLevel + 1; s3 = s3 + " - IO:" + levelVar; continue; case Enums.eType.None: break; case Enums.eType.Normal: break; case Enums.eType.SpecialO: //s3 = s3.Remove(0,11); break; default: continue; } } else { s3 = str1 + "[Empty]"; } } if (string.IsNullOrEmpty(s1) && string.IsNullOrEmpty(s2) && string.IsNullOrEmpty(s3)) { continue; } var layoutRectangle = new RectangleF(bounds.Left + 15f, vPos, bounds.Width, fontSize * 1.25f); args.Graphics.DrawString(s1, font, solidBrush, layoutRectangle, format); layoutRectangle = new RectangleF(bounds.Left + 80f, vPos, bounds.Width, fontSize * 1.25f); args.Graphics.DrawString(s2, font, solidBrush, layoutRectangle, format); vPos += (int)(fontSize * 1.25); layoutRectangle = new RectangleF(bounds.Left + 90f, vPos, bounds.Width, MidsContext.Character.CurrentBuild.Powers[pIndex].Slots.Length * fontSize * 1.25f); args.Graphics.DrawString(s3, font, solidBrush, layoutRectangle, format); vPos += (int)((fontSize * 1.25 * 1.1) + (fontSize * 1.25 * (MidsContext.Character.CurrentBuild.Powers[pIndex].Slots.Length - 1))); } _pIndex = pgIdx; if (isEnd) { _endOfPage = true; } else { _pIndex = 0; } return(vPos); }