//--------------------------------------------------------------------// // M e t h o d // // m e t r i c s S a v e F i l e R p t // //--------------------------------------------------------------------// // // // Store current target report file metrics data. // // // //--------------------------------------------------------------------// public static void metricsSaveFileRpt( ToolCommonData.eToolIds crntToolId, ReportCore.eRptFileFmt rptFileFmt, ReportCore.eRptChkMarks rptChkMarks, Boolean flagOptRptWrap) { Int32 tmpFmt = (Int32)rptFileFmt; Int32 tmpChkMarks = (Int32)rptChkMarks; if (crntToolId == ToolCommonData.eToolIds.MakeOverlay) { ToolMakeOverlayPersist.saveDataRpt(tmpFmt); } else if (crntToolId == ToolCommonData.eToolIds.PrintLang) { ToolPrintLangPersist.saveDataRpt(tmpFmt, tmpChkMarks, flagOptRptWrap); } else if (crntToolId == ToolCommonData.eToolIds.PrnAnalyse) { ToolPrnAnalysePersist.saveDataRpt(tmpFmt); } else if (crntToolId == ToolCommonData.eToolIds.SoftFontGenerate) { ToolSoftFontGenPersist.saveDataRpt(tmpFmt, tmpChkMarks); } else if (crntToolId == ToolCommonData.eToolIds.StatusReadback) { ToolStatusReadbackPersist.saveDataRpt(tmpFmt); } else if (crntToolId == ToolCommonData.eToolIds.SymbolSetGenerate) { ToolSymbolSetGenPersist.saveDataRpt(tmpFmt); } }
//--------------------------------------------------------------------// // M e t h o d // // b t n S a v e R e p o r t _ C l i c k // //--------------------------------------------------------------------// // // // Called when the 'Save Report' button is clicked. // // // //--------------------------------------------------------------------// private void btnSaveReport_Click(object sender, RoutedEventArgs e) { Boolean flagOffsetHex, flagOptRptWrap = false; ReportCore.eRptFileFmt rptFileFmt = ReportCore.eRptFileFmt.NA; ReportCore.eRptChkMarks rptChkMarks = ReportCore.eRptChkMarks.NA; if (_options.IndxGenOffsetFormat == PrnParseConstants.eOptOffsetFormats.Decimal) { flagOffsetHex = false; } else { flagOffsetHex = true; } TargetCore.metricsReturnFileRpt(ToolCommonData.eToolIds.PrnAnalyse, ref rptFileFmt, ref rptChkMarks, ref flagOptRptWrap); if (tabCtrl.SelectedItem == tabStatistics) { ToolPrnAnalyseReport.generate(eInfoType.Statistics, rptFileFmt, _tableStatistics, _prnFilename, _fileSize, flagOffsetHex, _options); } else if (tabCtrl.SelectedItem == tabContent) { ToolPrnAnalyseReport.generate(eInfoType.Content, rptFileFmt, _tableContent, _prnFilename, _fileSize, flagOffsetHex, _options); } else { ToolPrnAnalyseReport.generate(eInfoType.Analysis, rptFileFmt, _tableAnalysis, _prnFilename, _fileSize, flagOffsetHex, _options); } }
//--------------------------------------------------------------------// // M e t h o d // // m e t r i c s R e t u r n F i l e R p t // //--------------------------------------------------------------------// // // // Load and return current report file metrics data. // // // //--------------------------------------------------------------------// public static void metricsReturnFileRpt( ToolCommonData.eToolIds crntToolId, ref ReportCore.eRptFileFmt rptFileFmt, ref ReportCore.eRptChkMarks rptChkMarks, ref Boolean flagOptWrap) { metricsLoadFileRpt(crntToolId); rptFileFmt = _rptFileFmt; rptChkMarks = _rptChkMarks; flagOptWrap = _flagOptRptWrap; }
//--------------------------------------------------------------------// // M e t h o d // // b t n S a v e R e p o r t _ C l i c k // //--------------------------------------------------------------------// // // // Called when the 'Save report' button is clicked. // // // //--------------------------------------------------------------------// private void btnSaveReport_Click(object sender, RoutedEventArgs e) { Boolean flagOffsetHex, flagOptRptWrap = false; ReportCore.eRptFileFmt rptFileFmt = ReportCore.eRptFileFmt.NA; ReportCore.eRptChkMarks rptChkMarks = ReportCore.eRptChkMarks.NA; if (_options.IndxGenOffsetFormat == PrnParseConstants.eOptOffsetFormats.Decimal) { flagOffsetHex = false; } else { flagOffsetHex = true; } TargetCore.metricsReturnFileRpt(ToolCommonData.eToolIds.MakeOverlay, ref rptFileFmt, ref rptChkMarks, ref flagOptRptWrap); if (_crntPDL == ToolCommonData.ePrintLang.PCL) { ToolMakeOverlayReport.generate(rptFileFmt, _tableProgress, _prnFilename, _ovlFilenamePCL, flagOffsetHex, _options); } else { ToolMakeOverlayReport.generate(rptFileFmt, _tableProgress, _prnFilename, _ovlFilenamePCLXL, flagOffsetHex, _options); } btnSaveReport.Visibility = Visibility.Visible; }
//--------------------------------------------------------------------// // M e t h o d // // m e t r i c s L o a d F i l e R p t // //--------------------------------------------------------------------// // // // Load current target report file metrics data. // // // //--------------------------------------------------------------------// public static void metricsLoadFileRpt( ToolCommonData.eToolIds crntToolId) { Int32 tmpFmt = 0, tmpChkMarks = 0; Byte indxFmtNA = (Byte)ReportCore.eRptFileFmt.NA; Byte indxOptChkNA = (Byte)ReportCore.eRptChkMarks.NA; Boolean flagNA = false; //----------------------------------------------------------------// if (crntToolId == ToolCommonData.eToolIds.MakeOverlay) { ToolMakeOverlayPersist.loadDataRpt(ref tmpFmt); } else if (crntToolId == ToolCommonData.eToolIds.PrintLang) { ToolPrintLangPersist.loadDataRpt(ref tmpFmt, ref tmpChkMarks, ref _flagOptRptWrap); } else if (crntToolId == ToolCommonData.eToolIds.PrnAnalyse) { ToolPrnAnalysePersist.loadDataRpt(ref tmpFmt); } else if (crntToolId == ToolCommonData.eToolIds.SoftFontGenerate) { ToolSoftFontGenPersist.loadDataRpt(ref tmpFmt, ref tmpChkMarks); } else if (crntToolId == ToolCommonData.eToolIds.StatusReadback) { ToolStatusReadbackPersist.loadDataRpt(ref tmpFmt); } else if (crntToolId == ToolCommonData.eToolIds.SymbolSetGenerate) { ToolSymbolSetGenPersist.loadDataRpt(ref tmpFmt); } else { flagNA = true; } //----------------------------------------------------------------// if (flagNA) { tmpFmt = indxFmtNA; } else { if (tmpFmt >= indxFmtNA) { tmpFmt = 0; } if (tmpChkMarks >= indxOptChkNA) { tmpChkMarks = 0; } } _rptFileFmt = (ReportCore.eRptFileFmt)tmpFmt; _rptChkMarks = (ReportCore.eRptChkMarks)tmpChkMarks; }
//--------------------------------------------------------------------// // F i e l d s // // Class variables. // // // //--------------------------------------------------------------------// //--------------------------------------------------------------------// // M e t h o d // // g e n e r a t e // //--------------------------------------------------------------------// // // // Generate the report. // // // //--------------------------------------------------------------------// public static void generate(ReportCore.eRptFileFmt rptFileFmt, ReportCore.eRptChkMarks rptChkMarks, DataTable tableDonor, DataTable tableMapping, DataTable tableTarget, DataTable tableChars, String fontNameTTF, String fontFilenameTTF, String fontFilenamePCL) { Object stream = null; Object writer = null; Boolean OK = false; String fileExt; String saveFilename = null; if (rptFileFmt == ReportCore.eRptFileFmt.html) { fileExt = "html"; } else if (rptFileFmt == ReportCore.eRptFileFmt.xml) { fileExt = "xml"; } else { fileExt = "txt"; } saveFilename = fontFilenamePCL + "_report." + fileExt; OK = ReportCore.docOpen(rptFileFmt, ref saveFilename, ref stream, ref writer); if (OK) { ReportCore.docInitialise(rptFileFmt, writer, true, false, 0, null, null, null); reportHddr(rptFileFmt, writer, fontNameTTF, fontFilenameTTF, fontFilenamePCL); reportHddrSub(rptFileFmt, writer, "Donor font details"); reportBodyStd(rptFileFmt, rptChkMarks, writer, tableDonor); reportHddrSub(rptFileFmt, writer, "Mapping details"); reportBodyStd(rptFileFmt, rptChkMarks, writer, tableMapping); reportHddrSub(rptFileFmt, writer, "Target font details"); reportBodyStd(rptFileFmt, rptChkMarks, writer, tableTarget); reportHddrSub(rptFileFmt, writer, "Generated character details"); reportBodyChars(rptFileFmt, rptChkMarks, writer, tableChars); ReportCore.docFinalise(rptFileFmt, writer); ReportCore.docClose(rptFileFmt, stream, writer); } }
//--------------------------------------------------------------------// // M e t h o d // // r e p o r t B o d y S t d // //--------------------------------------------------------------------// // // // Write details of specified two-column table to report file. // // // //--------------------------------------------------------------------// private static void reportBodyStd( ReportCore.eRptFileFmt rptFileFmt, ReportCore.eRptChkMarks rptChkMarks, Object writer, DataTable table) { const Int32 colCt = 2; const String c0Name = "Name"; const String c1Name = "Value"; const Int32 lc0 = 21; const Int32 lc1 = 57; String[] colHddrs; String[] colNames; Int32[] colSizes; Int32 ctItems; ctItems = table.Rows.Count; colHddrs = new String[colCt] { c0Name, c1Name }; colNames = new String[colCt] { c0Name, c1Name }; colSizes = new Int32[colCt] { lc0, lc1 }; ctItems = table.Rows.Count; //----------------------------------------------------------------// // // // Open the table and Write the column header text. // // // //----------------------------------------------------------------// ReportCore.tableHddrData(writer, rptFileFmt, false, colCt, colHddrs, colSizes); //----------------------------------------------------------------// // // // Write the data rows. // // // //----------------------------------------------------------------// for (Int32 i = 0; i < ctItems; i++) { DataRow row = table.Rows[i]; ReportCore.tableRowData(writer, rptFileFmt, rptChkMarks, colCt, null, row, colNames, colSizes); } //----------------------------------------------------------------// // // // Write any required end tags. // // // //----------------------------------------------------------------// ReportCore.tableClose(writer, rptFileFmt); }
//--------------------------------------------------------------------// // M e t h o d // // r e p o r t B o d y C h a r s // //--------------------------------------------------------------------// // // // Write details of generated characters to report file. // // // //--------------------------------------------------------------------// private static void reportBodyChars( ReportCore.eRptFileFmt rptFileFmt, ReportCore.eRptChkMarks rptChkMarks, Object writer, DataTable table) { const Int32 colCt = 13; const String c0Name = "DecCode"; const String c1Name = "HexCode"; const String c2Name = "Unicode"; const String c3Name = "Glyph"; const String c4Name = "Abs"; const String c5Name = "Prev"; const String c6Name = "Comp"; const String c7Name = "Depth"; const String c8Name = "Width"; const String c9Name = "LSB"; const String c10Name = "Height"; const String c11Name = "TSB"; const String c12Name = "Length"; const String c0Hddr = "DecCode"; const String c1Hddr = "HexCode"; const String c2Hddr = "Unicode"; const String c3Hddr = "Glyph"; const String c4Hddr = "Abs?"; const String c5Hddr = "Prev?"; const String c6Hddr = "Comp?"; const String c7Hddr = "Depth"; const String c8Hddr = "Width"; const String c9Hddr = "LSB"; const String c10Hddr = "Height"; const String c11Hddr = "TSB"; const String c12Hddr = "Length"; const Int32 lc0 = 7; const Int32 lc1 = 7; const Int32 lc2 = 7; const Int32 lc3 = 5; const Int32 lc4 = 5; const Int32 lc5 = 5; const Int32 lc6 = 5; const Int32 lc7 = 5; const Int32 lc8 = 5; const Int32 lc9 = 6; const Int32 lc10 = 6; const Int32 lc11 = 6; const Int32 lc12 = 6; String[] colHddrs; String[] colNames; Int32[] colSizes; Int32 ctItems; ctItems = table.Rows.Count; colHddrs = new String[colCt] { c0Hddr, c1Hddr, c2Hddr, c3Hddr, c4Hddr, c5Hddr, c6Hddr, c7Hddr, c8Hddr, c9Hddr, c10Hddr, c11Hddr, c12Hddr }; colNames = new String[colCt] { c0Name, c1Name, c2Name, c3Name, c4Name, c5Name, c6Name, c7Name, c8Name, c9Name, c10Name, c11Name, c12Name }; colSizes = new Int32[colCt] { lc0, lc1, lc2, lc3, lc4, lc5, lc6, lc7, lc8, lc9, lc10, lc11, lc12 }; //----------------------------------------------------------------// // // // Open the table and Write the column header text. // // // //----------------------------------------------------------------// ReportCore.tableHddrData(writer, rptFileFmt, false, colCt, colHddrs, colSizes); //----------------------------------------------------------------// // // // Write the data rows. // // // //----------------------------------------------------------------// for (Int32 i = 0; i < ctItems; i++) { DataRow row = table.Rows[i]; ReportCore.tableRowData(writer, rptFileFmt, rptChkMarks, colCt, null, row, colNames, colSizes); } //----------------------------------------------------------------// // // // Write any required end tags. // // // //----------------------------------------------------------------// ReportCore.tableClose(writer, rptFileFmt); }
//--------------------------------------------------------------------// // M e t h o d // // r b R p t C h k M a r k s T x t S y m _ C l i c k // //--------------------------------------------------------------------// // // // Called when the report option 'true/false' as 'plus/minus' radio // // button is selected. // // // //--------------------------------------------------------------------// private void rbRptChkMarksTxtSym_Click(object sender, RoutedEventArgs e) { _rptChkMarks = ReportCore.eRptChkMarks.txtsym; }
//--------------------------------------------------------------------// // M e t h o d // // r b R p t C h k M a r k s T e x t _ C l i c k // //--------------------------------------------------------------------// // // // Called when the report option 'true/false' as 'text' radio // // button is selected. // // // //--------------------------------------------------------------------// private void rbRptChkMarksText_Click(object sender, RoutedEventArgs e) { _rptChkMarks = ReportCore.eRptChkMarks.text; }
//--------------------------------------------------------------------// // M e t h o d // // i n i t i a l i s e // //--------------------------------------------------------------------// // // // Initialise 'target' data. // // // //--------------------------------------------------------------------// private void initialise() { btnOK.Visibility = Visibility.Hidden; //----------------------------------------------------------------// // // // Tool and PDL identifiers. // // // //----------------------------------------------------------------// if (_crntSubId == ToolCommonData.eToolSubIds.None) { txtCrntTool.Text = Enum.GetName(typeof(ToolCommonData.eToolIds), _crntToolId); } else { txtCrntTool.Text = Enum.GetName(typeof(ToolCommonData.eToolIds), _crntToolId) + "|" + Enum.GetName(typeof(ToolCommonData.eToolSubIds), _crntSubId); } txtCrntPDL.Text = _crntPDL.ToString(); //----------------------------------------------------------------// // // // Report file data. // // // //----------------------------------------------------------------// if ((_crntToolId == ToolCommonData.eToolIds.MakeOverlay) || (_crntToolId == ToolCommonData.eToolIds.PrintLang) || (_crntToolId == ToolCommonData.eToolIds.PrnAnalyse) || (_crntToolId == ToolCommonData.eToolIds.SoftFontGenerate) || (_crntToolId == ToolCommonData.eToolIds.StatusReadback) || (_crntToolId == ToolCommonData.eToolIds.SymbolSetGenerate)) { grpRptFile.Visibility = Visibility.Visible; lbFileNA.Visibility = Visibility.Hidden; btnOK.Visibility = Visibility.Visible; TargetCore.metricsReturnFileRpt(_crntToolId, ref _rptFileFmt, ref _rptChkMarks, ref _flagOptRptWrap); if (_rptFileFmt == ReportCore.eRptFileFmt.html) { rbRptFmtHtml.IsChecked = true; } else if (_rptFileFmt == ReportCore.eRptFileFmt.xml) { rbRptFmtXml.IsChecked = true; } else { rbRptFmtText.IsChecked = true; } grpRptChkMarks.Visibility = Visibility.Hidden; grpRptOpt.Visibility = Visibility.Hidden; if (_crntToolId == ToolCommonData.eToolIds.PrintLang) { grpRptChkMarks.Visibility = Visibility.Visible; grpRptOpt.Visibility = Visibility.Visible; if (_rptChkMarks >= ReportCore.eRptChkMarks.NA) { _rptChkMarks = ReportCore.eRptChkMarks.text; } if (_rptChkMarks == ReportCore.eRptChkMarks.boxsym) { rbRptChkMarksBoxSym.IsChecked = true; } else if (_rptChkMarks == ReportCore.eRptChkMarks.txtsym) { rbRptChkMarksTxtSym.IsChecked = true; } else { rbRptChkMarksText.IsChecked = true; } if (_flagOptRptWrap) { chkRptOptWrap.IsChecked = true; } else { chkRptOptWrap.IsChecked = false; } } else if (_crntToolId == ToolCommonData.eToolIds.SoftFontGenerate) { grpRptChkMarks.Visibility = Visibility.Visible; if (_rptChkMarks >= ReportCore.eRptChkMarks.NA) { _rptChkMarks = ReportCore.eRptChkMarks.text; } if (_rptChkMarks == ReportCore.eRptChkMarks.boxsym) { rbRptChkMarksBoxSym.IsChecked = true; } else if (_rptChkMarks == ReportCore.eRptChkMarks.txtsym) { rbRptChkMarksTxtSym.IsChecked = true; } else { rbRptChkMarksText.IsChecked = true; } } } else { grpRptFile.Visibility = Visibility.Hidden; lbFileNA.Visibility = Visibility.Visible; } //----------------------------------------------------------------// // // // Set the (hidden) slider object to the passed-in scale value. // // The slider is used as the source binding for a scale // // transform in the (child) Options dialogue window, so that all // // windows use the same scaling mechanism as the main window. // // // // NOTE: it would be better to bind the transform directly to the // // scale value (set and stored in the Main window), but (so // // far) I've failed to find a way to bind directly to a // // class object Property value. // // // //----------------------------------------------------------------// Double windowScale = MainFormData.WindowScale; zoomSlider.Value = windowScale; //----------------------------------------------------------------// // // // Setting sizes to the resizeable DockPanel element doesn't work!// // // //----------------------------------------------------------------// this.Height = 350 * windowScale; this.Width = 730 * windowScale; }