private void btnCalculateNumberOfLines_Click(System.Object sender, System.EventArgs e) { Main.dLineHeightInPoints = (int)NumericUpDownLineHeight.Value; Main.dMarginTopInPoints = (int)NumericUpDownTopMarginInPoints.Value; Main.dMarginBottomInPoints = NumericUpDownBottomMarginInPoints.Value; Main.dPageHeightInPoints = decimal.Parse(tbPageHeightInPoints.Text); int dMargins = (int) (Main.dMarginTopInPoints + Main.dMarginBottomInPoints); Main.sColumnHeightInPoints = (Main.dPageHeightInPoints - dMargins).ToString(); Main.sColumnHeightInLines = (decimal.Parse(Main.sColumnHeightInPoints) / Main.dLineHeightInPoints).ToString(); tbColumnHeightInLines.Text = Main.sColumnHeightInLines; Main main = new Main(); main.writeIniFile(); }
private void writeCSS() { try { StreamWriter sw = new StreamWriter(Main.sGeneratedStylesheetFileName); // dim at beginning sw.WriteLine("/***********************************************************************************/"); sw.WriteLine("/******************************** start of CSS file ********************************/"); sw.WriteLine("/***********************************************************************************/"); // sw.WriteLine(); sw.WriteLine(); sw.WriteLine("/*** The box model starts with the text ***/"); sw.WriteLine("/*** Surrounding the text is padding ***/"); sw.WriteLine("/*** Surrounding the padding is border ***/"); sw.WriteLine("/*** Surrounding the border is margin ***/"); sw.WriteLine(); sw.WriteLine("/*** Shortcut for identifying the 4 sides of box model ***/"); sw.WriteLine("/*** attribute: top right bottom left ***/"); sw.WriteLine(); sw.WriteLine("/*** All units must be declared except for 0 ***/"); sw.WriteLine("/*** If unit is not declared then attribute is ignored ***/"); sw.WriteLine(); // writeSettings() // # Basic sw.WriteLine(); sw.WriteLine("/***********************************/"); sw.WriteLine("/********** Page settings **********/"); sw.WriteLine("/***********************************/"); sw.WriteLine(); sw.WriteLine("@page {"); sw.WriteLine(); sw.WriteLine(Constants.vbTab + "marks: crop cross" + " ;"); sw.WriteLine(Constants.vbTab + "font-family: " + sFontName + " ;"); sw.WriteLine(Constants.vbTab + "font-style: " + sFaceName + " ;"); sw.WriteLine(Constants.vbTab + "font-size: " + sFontSize + "pt ;"); sw.WriteLine(Constants.vbTab + "line-height: " + sSpacingInterline + "pt;"); sw.WriteLine(Constants.vbTab + "text-align: " + getAlignmentJustify(sParJustify) + " ;"); sw.WriteLine(Constants.vbTab + "size: " + sPageWidth + " " + sPageHeight + " " + sPageOrientation + " ;"); sw.WriteLine(Constants.vbTab + "margin-top: " + sMarginTop + " ;"); // units come with sMarginTop sw.WriteLine(Constants.vbTab + "margin-bottom: " + sMarginBottom + " ;"); sw.WriteLine(Constants.vbTab + "margin-inside: " + sMarginInside + " ;"); sw.WriteLine(Constants.vbTab + "margin-outside: " + sMarginOutside + " ;"); sw.WriteLine(); sw.WriteLine(" @top-center {"); sw.WriteLine(Constants.vbTab + "content: string(bookx, start) ' ' string(chapterx, start) ':' string(versex, start) ' " + Common.ConvertUnicodeToString("\\2014") + " ' string(chapterx, last) ':' string(versex, last) ;"); sw.WriteLine(Constants.vbTab + "}"); // closing marker for top-center sw.WriteLine(); sw.WriteLine(" @footnotes {"); sw.WriteLine(Constants.vbTab + "border-top: thin solid black ;"); sw.WriteLine(Constants.vbTab + "padding: 0.3em 0 ;"); sw.WriteLine(Constants.vbTab + "margin-top: 0.6em ;"); sw.WriteLine(Constants.vbTab + "margin-left: 2pi ;"); sw.WriteLine(Constants.vbTab + "border-top: thin solid black ;"); sw.WriteLine(Constants.vbTab + "}"); // closing marker for footnotes sw.WriteLine(Constants.vbTab + "}"); // closing marker for page sw.WriteLine(); sw.WriteLine(); sw.WriteLine("@page :first {"); sw.WriteLine(); sw.WriteLine(" @top-center {"); sw.WriteLine(Constants.vbTab + "content: normal ;"); sw.WriteLine(Constants.vbTab + "}"); // closing marker for top-center sw.WriteLine(); sw.WriteLine(); sw.WriteLine(" @bottom-center {"); sw.WriteLine(Constants.vbTab + "content: counter(page);"); sw.WriteLine(Constants.vbTab + "}"); // closing marker for bottom-center sw.WriteLine(); sw.WriteLine(); sw.WriteLine(" @bottom-right {"); sw.WriteLine(Constants.vbTab + "content: normal ;"); sw.WriteLine(Constants.vbTab + "}"); // closing marker for bottom-right sw.WriteLine(); sw.WriteLine(Constants.vbTab + "}"); // closing marker for page: first sw.WriteLine(); sw.WriteLine(); sw.WriteLine("@page :left {"); sw.WriteLine(); if (sRunningHeaderPageNumberLocation == "Outside") { sw.WriteLine(" @top-left {"); } else if (sRunningHeaderPageNumberLocation == "Center") { sw.WriteLine(" @top-center {"); } else if (sRunningHeaderPageNumberLocation == "Inside") { sw.WriteLine(" @top-right {"); } else { // default position sw.WriteLine(" @bottom-left {"); } sw.WriteLine(Constants.vbTab + "content: counter(page);"); sw.WriteLine(Constants.vbTab + "}"); // closing marker for bottom-left sw.WriteLine(Constants.vbTab + "}"); // closing marker for page left sw.WriteLine(); sw.WriteLine(); sw.WriteLine("@page :right {"); sw.WriteLine(); if (sRunningHeaderPageNumberLocation == "Outside") { sw.WriteLine(" @top-right {"); } else if (sRunningHeaderPageNumberLocation == "Center") { sw.WriteLine(" @top-center {"); } else if (sRunningHeaderPageNumberLocation == "Inside") { sw.WriteLine(" @top-left {"); } else { // default position sw.WriteLine(" @bottom-right {"); } sw.WriteLine(Constants.vbTab + "content: counter(page);"); sw.WriteLine(Constants.vbTab + "}"); // closing marker for bottom-right sw.WriteLine(Constants.vbTab + "}"); // closing marker for page right sw.WriteLine(); sw.WriteLine("/***********************************/"); sw.WriteLine("/********** Titles *****************/"); sw.WriteLine("/***********************************/"); sw.WriteLine(); sw.WriteLine(".mainTitle {"); sw.WriteLine(); sw.WriteLine(Constants.vbTab + "string-set: bookx content() ;"); sw.WriteLine(Constants.vbTab + "font-size: " + sTitleMainSize + "pt ;"); sw.WriteLine(Constants.vbTab + "font-style: " + sFontTitleSectionStyle + " ;"); sw.WriteLine(Constants.vbTab + "line-height: " + s_mt_cLeading + "pt ;"); sw.WriteLine(Constants.vbTab + "margin-before: " + s_mt_pSpaceBefore + "pt ;"); sw.WriteLine(Constants.vbTab + "margin-after: " + s_mt_pSpaceAfter + "pt ;"); // xxx this may be default to always set centered sw.WriteLine(Constants.vbTab + "text-align: " + getAlignmentCenter(sAlignTitleSection) + " ;"); //sw.WriteLine(vbtab + "string-set: h1 ;") sw.WriteLine(Constants.vbTab + "}"); // closing marker for h1.book sw.WriteLine(); sw.WriteLine(); sw.WriteLine(".secondaryTitle {"); sw.WriteLine(); // sw.WriteLine(vbTab + "string-set: bookx content() ;") sw.WriteLine(Constants.vbTab + "font-size: " + s_mt2_cSize + "pt ;"); sw.WriteLine(Constants.vbTab + "line-height: " + s_mt2_cLeading + "pt ;"); sw.WriteLine(Constants.vbTab + "margin-before: " + s_mt2_pSpaceBefore + "pt ;"); sw.WriteLine(Constants.vbTab + "margin-after: " + s_mt2_pSpaceAfter + "pt ;"); // sw.WriteLine(vbtab + "string-set: h1 ;") // xxx this may be default to always set centered sw.WriteLine(Constants.vbTab + "text-align: " + getAlignmentCenter(sAlignTitleSection) + " ;"); sw.WriteLine(Constants.vbTab + "}"); // closing marker for h2.book sw.WriteLine(); sw.WriteLine(Constants.vbTab + "/***********************************/"); sw.WriteLine(Constants.vbTab + "/********** introduction ***********/"); sw.WriteLine(Constants.vbTab + "/***********************************/"); sw.WriteLine(); sw.WriteLine(".introduction {"); sw.WriteLine(Constants.vbTab + "columns: 1 ;"); sw.WriteLine(Constants.vbTab + "font-style: italic ;"); sw.WriteLine(Constants.vbTab + "border-bottom-width: 1pt ;"); sw.WriteLine(Constants.vbTab + "border-bottom-style: solid ;"); sw.WriteLine(Constants.vbTab + "padding: 0 0 6pt 0 ;"); sw.WriteLine(Constants.vbTab + "margin: 0 0 6pt 0 ;"); sw.WriteLine(Constants.vbTab + "}"); // closing marker for introduction sw.WriteLine(); sw.WriteLine(Constants.vbTab + "/***********************************/"); sw.WriteLine(Constants.vbTab + "/********** scripture text *********/"); sw.WriteLine(Constants.vbTab + "/***********************************/"); sw.WriteLine(); sw.WriteLine(".scriptureText {"); sw.WriteLine(Constants.vbTab + "columns: " + sNumberOfColumns + " ;"); sw.WriteLine(Constants.vbTab + "column-gap: " + sColumnGutter + " ;"); if (sColumnGutterRule == "Yes") { sw.WriteLine("/* Value: <column-rule-width> || <border-style> || [ <color> | transparent ] */"); sw.WriteLine(Constants.vbTab + "column-rule: thin solid black ;"); } else { // skip } sw.WriteLine(Constants.vbTab + "column-fill: balance ;"); // hyphenation file is found with the document file // its name is fixed as hyphenation.txt sw.WriteLine(Constants.vbTab + "prince-hyphenate-patterns: url(" + Main.sDocumentPath + "\\hyphenation.txt ;"); sw.WriteLine(Constants.vbTab + "column-fill: balance ;"); sw.WriteLine(Constants.vbTab + "hyphens: auto ;"); sw.WriteLine(Constants.vbTab + "hyphenate-before: 2 ;"); sw.WriteLine(Constants.vbTab + "hyphenate-after: 3 ;"); sw.WriteLine(Constants.vbTab + "hyphenate-lines: 1 ;"); sw.WriteLine(Constants.vbTab + "widows: 1 ;"); sw.WriteLine(Constants.vbTab + "ophans: 1 ;"); sw.WriteLine(Constants.vbTab + "}"); // closing marker for scripture text sw.WriteLine(); // # Chapter sw.WriteLine(Constants.vbTab + "/***********************************/"); sw.WriteLine(Constants.vbTab + "/********** chapter number *********/"); sw.WriteLine(Constants.vbTab + "/***********************************/"); sw.WriteLine(); sw.WriteLine(".chapterNumber {"); sw.WriteLine(); sw.WriteLine(Constants.vbTab + "string-set: chapterx content() ;"); // InDesign Middle East if (sIDME == "yes") { // rtl sw.WriteLine(Constants.vbTab + "float: right ; "); sw.WriteLine(Constants.vbTab + "padding: 1% 0 0 5% ; "); } else { // l2r sw.WriteLine(Constants.vbTab + "float: left ;"); sw.WriteLine(Constants.vbTab + "padding: 1% 5% 0 0 ; "); } // floats and vertical align don't mix -- without float it bumps second line -- sw.WriteLine(vbTab + "vertical-align: top;") // two line drop cap sw.WriteLine(Constants.vbTab + "font-size: 270% ;"); // arrived at number by trial and error sw.WriteLine(Constants.vbTab + "font-weight: bold ;"); sw.WriteLine(Constants.vbTab + "line-height: 86% ;"); // arrived at number by trial and error sw.WriteLine(Constants.vbTab + "margin: 0 ;"); sw.WriteLine(Constants.vbTab + "prince-bookmark-level: 1 ;"); // sw.WriteLine(vbtab + "font-family: sans-serif ;") sw.WriteLine(Constants.vbTab + "}"); // closing marker for chapter number sw.WriteLine(); // # Verse sw.WriteLine(Constants.vbTab + "/***********************************/"); sw.WriteLine(Constants.vbTab + "/********** verse number ***********/"); sw.WriteLine(Constants.vbTab + "/***********************************/"); sw.WriteLine(); sw.WriteLine(".verseNumber {"); sw.WriteLine(); sw.WriteLine(Constants.vbTab + "string-set: versex content() ;"); // InDesign Middle East if (sIDME == "yes") { // rtl sw.WriteLine(Constants.vbTab + "padding: 0 0 0 0.5pt ; "); } else { // l2r sw.WriteLine(Constants.vbTab + "padding: 0 0.5pt 0 0 ; "); } sw.WriteLine(Constants.vbTab + "margin: 0 ;"); if (sVerseFormatBold == "Yes") { sw.WriteLine(Constants.vbTab + "font-weight: bold ;"); } else { sw.WriteLine(Constants.vbTab + "font-weight: normal ;"); } if (sVerseFormatRaised == "Yes") { sw.WriteLine(Constants.vbTab + "vertical-align: 0.3em ;"); sw.WriteLine(Constants.vbTab + "font-size: 70% ;"); } else { // leave normal sw.WriteLine(Constants.vbTab + "vertical-align: none;"); sw.WriteLine(Constants.vbTab + "font-size: 100% ;"); } // sw.WriteLine(vbtab + "font-family: sans-serif ;") sw.WriteLine(Constants.vbTab + "}"); // closing marker for verse number sw.WriteLine(); sw.WriteLine(); sw.WriteLine(".verseNumber1 {"); sw.WriteLine(); if (sVerseFirstInChapterDisplay == "Yes") { sw.WriteLine(Constants.vbTab + "string-set: versex content() ;"); // InDesign Middle East if (sIDME == "yes") { // rtl sw.WriteLine(Constants.vbTab + "padding: 0 0 0 0.5pt ; "); } else { // l2r sw.WriteLine(Constants.vbTab + "padding: 0 0.5pt 0 0 ; "); } sw.WriteLine(Constants.vbTab + "margin: 0 ;"); if (sVerseFormatBold == "Yes") { sw.WriteLine(Constants.vbTab + "font-weight: bold ;"); } else { sw.WriteLine(Constants.vbTab + "font-weight: normal ;"); } if (sVerseFormatRaised == "Yes") { sw.WriteLine(Constants.vbTab + "vertical-align: 0.3em ;"); sw.WriteLine(Constants.vbTab + "font-size: 70% ;"); } else { // leave normal sw.WriteLine(Constants.vbTab + "vertical-align: none;"); sw.WriteLine(Constants.vbTab + "font-size: 100% ;"); } // sw.WriteLine(vbtab + "font-family: sans-serif ;") } else { // skip display of verse 1 } sw.WriteLine(Constants.vbTab + "}"); // closing marker for verse number sw.WriteLine(); sw.WriteLine("/***********************************/"); sw.WriteLine("/********** Footnotes***************/"); sw.WriteLine("/***********************************/"); sw.WriteLine(); sw.WriteLine(Constants.vbTab + "/***********************************/"); sw.WriteLine(Constants.vbTab + "/********** footnote text **********/"); sw.WriteLine(Constants.vbTab + "/***********************************/"); sw.WriteLine(); sw.WriteLine(".footnote {"); sw.WriteLine(); // InDesign Middle East if (sIDME == "Yes") { // rtl // sw.WriteLine(vbtab + "float: right ; ") // sw.WriteLine(vbtab + "padding: 0 0 0 0.5pt ; ") } else { // l2r // sw.WriteLine(vbtab + "float: left ;") //sw.WriteLine(vbtab + "padding: 0 0.5pt 0 0 ; ") } // sw.WriteLine(vbtab + "display: none ;") // sw.WriteLine(vbtab + "display: footnote ;") sw.WriteLine(Constants.vbTab + "display: prince-footnote ;"); // sw.WriteLine(vbtab + "position: footnote ;") sw.WriteLine(Constants.vbTab + "position: footnote ;"); // sw.WriteLine(vbtab + "list-style-position: inside ;") sw.WriteLine(Constants.vbTab + "font-size: " + sFontSizeNotes + "pt ;"); sw.WriteLine(Constants.vbTab + "line-height: " + sSpacingInterlineNotes + "pt ;"); sw.WriteLine(Constants.vbTab + "margin: 0 ;"); // sw.WriteLine(vbtab + "font-family: sans-serif ;") sw.WriteLine(Constants.vbTab + "}"); // closing marker for footnote sw.WriteLine(); // /* cross-references and footnotes */ //.crossReference{ // display: none; // display: footnote; // display: prince-footnote; // position: footnote; // list-style-position:inside; // font-size: 9pt; // line-height: none; // font-family:arial, helvetica, sans-serif; // color: black; // text-align: left; // text-indent: 0; // margin-left: 4em; // font-weight: normal; //} sw.WriteLine(Constants.vbTab + "/***********************************/"); sw.WriteLine(Constants.vbTab + "/********** cross-reference text ***/"); sw.WriteLine(Constants.vbTab + "/***********************************/"); sw.WriteLine(); sw.WriteLine(".crossReference {"); sw.WriteLine(); sw.WriteLine(Constants.vbTab + "text-align: " + getAlignmentLeftOrRight() + " ; "); // sw.WriteLine(vbtab + "display: none ;") // sw.WriteLine(vbtab + "display: footnote ;") sw.WriteLine(Constants.vbTab + "display: prince-footnote ;"); // sw.WriteLine(vbtab + "position: footnote ;") sw.WriteLine(Constants.vbTab + "position: footnote ;"); // sw.WriteLine(vbtab + "list-style-position: inside ;") sw.WriteLine(Constants.vbTab + "font-size: " + sFontSizeNotes + "pt ;"); sw.WriteLine(Constants.vbTab + "line-height: " + sSpacingInterlineNotes + "pt ;"); sw.WriteLine(Constants.vbTab + "margin: 0 ;"); sw.WriteLine(Constants.vbTab + "text-indent: 0 ;"); sw.WriteLine(Constants.vbTab + "margin: 0 ;"); // InDesign Middle East if (sIDME == "yes") { sw.WriteLine(Constants.vbTab + "margin-right: 2em ;"); } else { sw.WriteLine(Constants.vbTab + "margin-left: 2em ;"); } // sw.WriteLine(vbtab + "font-family: sans-serif ;") sw.WriteLine(Constants.vbTab + "}"); // closing marker for cross-reference sw.WriteLine(); sw.WriteLine(Constants.vbTab + "/***********************************/"); sw.WriteLine(Constants.vbTab + "/**** footnote caller in text ******/"); sw.WriteLine(Constants.vbTab + "/***********************************/"); sw.WriteLine(); sw.WriteLine(".footnote::footnote-call {"); sw.WriteLine(); // InDesign Middle East if (sIDME == "Yes") { // rtl // sw.WriteLine(vbtab + "float: right ; ") } else { // l2r // sw.WriteLine(vbtab + "float: left ;") } sw.WriteLine(Constants.vbTab + "content: '\\2021' ' '; "); // font style??? sw.WriteLine(vbtab + "font-style: " + sFootnoteCallerFontStyle + " ; ") sw.WriteLine(Constants.vbTab + "font-size: " + s_noteCaller_cSize + "pt ;"); sw.WriteLine(Constants.vbTab + "font-style: " + s_noteCaller_cTypeface + " ;"); // ??? sw.WriteLine(vbtab + "font-:" + s_noteCaller_cNoBreak + " ;") // sw.WriteLine(vbtab + "vertical-align: super ;") sw.WriteLine(Constants.vbTab + "vertical-align: " + s_noteCaller_cBaselineShift + "pt ;"); sw.WriteLine(Constants.vbTab + "line-height: none ;"); // important to maintain register sw.WriteLine(Constants.vbTab + "}"); // closing marker for footnote-caller in text sw.WriteLine(); ///* marker in the body text indicating a cross-reference*/ //.crossReference::footnote-call { // color:purple; //content: '\2020' ' '; // font-size: 6pt; // vertical-align: super; // line-height: none; //} sw.WriteLine(Constants.vbTab + "/***********************************/"); sw.WriteLine(Constants.vbTab + "/*** footnote marker in footnote ***/"); sw.WriteLine(Constants.vbTab + "/***********************************/"); sw.WriteLine(); sw.WriteLine(".footnote::footnote-marker {"); sw.WriteLine(); sw.WriteLine(Constants.vbTab + "text-align: " + getAlignmentLeftOrRight() + " ; "); // sw.WriteLine(vbtab + "content: '\2021' ' '; ") // font style??? sw.WriteLine(vbtab + "font-style: " + sFootnoteCallerFontStyle + " ; ") sw.WriteLine(Constants.vbTab + "font-size: " + s_noteCaller_cSize + "pt ;"); sw.WriteLine(Constants.vbTab + "font-style: " + s_noteCaller_cTypeface + " ;"); if (sFootnoteIncludeReference == "Yes") { sw.WriteLine(Constants.vbTab + "content: string(chapterx) ':' string(versex) ' ' ;"); sw.WriteLine(Constants.vbTab + "font-style: " + sFootnoteReferenceFontStyle + " ;"); } else { // no reference included } // ??? sw.WriteLine(vbtab + "font-:" + s_noteCaller_cNoBreak + " ;") sw.WriteLine(Constants.vbTab + "vertical-align: super ;"); sw.WriteLine(Constants.vbTab + "line-height: none ;"); // important to maintain register sw.WriteLine(Constants.vbTab + "}"); // closing marker for footnote-marker in footnote sw.WriteLine(); ///* marker in the body text indicating a footnote*/ //.footnote::footnote-call { // color:purple; //content: '\2021' ' '; // font-size: 6pt; // vertical-align: super; // line-height: none; //} ///* marker in footnote in front of the text */ //.footnote::footnote-marker { // /* font-size: 10pt; */ // font-weight: bold; ///* content: '\2020' ' ' string(chapterx) ":" string(versex) ' =? ' ;*/ // /* content: string(chapterx) ":" string(versex) ' = ' ;*/ ///* non breaking space below*/ // content: string(chapterx) ":" string(versex) ' ' ; // text-align: left; //} ///* marker in footnote for the cross-reference */ //.crossReference::footnote-marker { // /* font-size: 10pt;*/ // font-weight: bold; ///* content: string(chapterx) ":" string(versex) ' = ' ;*/ ///* multiple spaces are removed*/ ///* non breaking space below*/ // content: string(chapterx) ":" string(versex) ' '; // text-align:left; //} ///* end of: cross-references and footnotes */ // 88888888888888888888888888888888888888888888888 // /* page break inside:avoid added to li */ //} ///* verse number immediately following p*/ //p > .verseNumber:first-child { // string-set: versex content(); // font-family: san-serif; // // font-size: 8pt; // vertical-align: top; // color: green; // margin: 0; // padding-top: 0pt; // padding-right: 0.5pt; /* add a fixed space amount before the attached text*/ // padding-bottom: 0; // padding-left:0; ///* page break inside:avoid added to li */ //} ///* verse numbers in poetry */ //p.line1 > .verseNumber{ // /* margin-left: -1.5em; don't know why this offset works*/ // margin-left: -1.5em; // color: red; // float: right; //} //p.line2 > .verseNumber{ // /* margin-left: -1.5em; don't know why this offset works*/ // margin-left: -2.5em; // color: red; // float: right; //} //p.line3 > .verseNumber{ // /* margin-left: -1.5em; don't know why this offset works*/ // margin-left: -3.5em; // color: red; // float: right; //} // Private sChapterNumber As String // Private sPsalmsChapterNumber As String //' Private sPsalmString As String // Private sFontTitleCenteredChapterSize As String // Private sSpacingTitleCenteredChapterInterline As String // Private sSpacingTitleCenteredChapterMarginTop As String // Private sSpacingTitleCenteredChapterMarginBottom As String // Private sVerseFormatBold As String // Private sVerseFormatRaised As String // Private sVerseFirstInChapterDisplay As String // Private sSingleChapterBookHideChapterNum As String sw.WriteLine("/***********************************/"); sw.WriteLine("/********** Section heads **********/"); sw.WriteLine("/***********************************/"); sw.WriteLine(); sw.WriteLine(Constants.vbTab + "/***********************************/"); sw.WriteLine(Constants.vbTab + "/*********** section head normal ***/"); sw.WriteLine(Constants.vbTab + "/***********************************/"); sw.WriteLine(); sw.WriteLine(".section {"); sw.WriteLine(); sw.WriteLine(Constants.vbTab + "text-align: " + getAlignmentCenter(sAlignTitleSection) + " ; "); if (sFontTitleMajorSectionStyle.Contains("bold")) { sw.WriteLine(Constants.vbTab + "font-weight: bold ;"); } else { sw.WriteLine(Constants.vbTab + "font-weight: normal ;"); } if (sFontTitleMajorSectionStyle.Contains("italic")) { sw.WriteLine(Constants.vbTab + "font-style: italic ;"); } else { sw.WriteLine(Constants.vbTab + "font-style: normal ;"); } sw.WriteLine(Constants.vbTab + "font-size: " + sFontTitleSectionSize + "pt ;"); sw.WriteLine(Constants.vbTab + "line-height: " + sSpacingTitleSectionInterline + "pt ;"); // important to maintain register sw.WriteLine(Constants.vbTab + "margin-top: " + sSpacingTitleSectionMarginTop + "pt ;"); // important to maintain register sw.WriteLine(Constants.vbTab + "margin-bottom: " + sSpacingTitleSectionMarginBottom + "pt ;"); // important to maintain register sw.WriteLine(Constants.vbTab + "}"); // closing marker for section head sw.WriteLine(); sw.WriteLine(); sw.WriteLine(".sectionWithParallelPassageFollowing {"); sw.WriteLine(); sw.WriteLine(Constants.vbTab + "text-align: " + getAlignmentCenter(sAlignTitleSection) + " ; "); if (sFontTitleMajorSectionStyle.Contains("bold")) { sw.WriteLine(Constants.vbTab + "font-weight: bold ;"); } else { sw.WriteLine(Constants.vbTab + "font-weight: normal ;"); } if (sFontTitleMajorSectionStyle.Contains("italic")) { sw.WriteLine(Constants.vbTab + "font-style: italic ;"); } else { sw.WriteLine(Constants.vbTab + "font-style: normal ;"); } sw.WriteLine(Constants.vbTab + "font-size: " + sFontTitleSectionSize + "pt ;"); sw.WriteLine(Constants.vbTab + "line-height: " + sSpacingTitleSectionInterline + "pt ;"); // important to maintain register sw.WriteLine(Constants.vbTab + "margin-top: " + sSpacingTitleSectionMarginTop + "pt ;"); // important to maintain register sw.WriteLine(Constants.vbTab + "margin-bottom: 0 ;"); // important to maintain register //sw.WriteLine(vbTab + "prince-bookmark-level: 3 ;") sw.WriteLine(Constants.vbTab + "}"); // closing marker for .sectionWithParallelPassageFollowing sw.WriteLine(); sw.WriteLine(Constants.vbTab + "/***********************************/"); sw.WriteLine(Constants.vbTab + "/*********** parallel passage ******/"); sw.WriteLine(Constants.vbTab + "/***********************************/"); sw.WriteLine(); sw.WriteLine(".parallelPassage {"); sw.WriteLine(); // looks like parallel passage and section are locked together sw.WriteLine(Constants.vbTab + "text-align: " + getAlignmentCenter(sAlignTitleSection) + " ; "); sw.WriteLine(Constants.vbTab + "font-style: " + s_r_cTypeface + " ;"); sw.WriteLine(Constants.vbTab + "font-size: " + s_r_cSize + "pt ;"); // sw.WriteLine(vbtab + "line-height: " + sSpacingInterline + "pt ;") ' important to maintain register sw.WriteLine(Constants.vbTab + "margin-top: " + sSpacingInterline + "pt ;"); sw.WriteLine(Constants.vbTab + "margin-bottom: 0 ;"); // important to maintain register sw.WriteLine(Constants.vbTab + "}"); // closing marker for parallel passage sw.WriteLine(); sw.WriteLine(); sw.WriteLine(".parallelPassageWithSectionHeadPreceding {"); sw.WriteLine(); // looks like parallel passage and section are locked together sw.WriteLine(Constants.vbTab + "text-align: " + getAlignmentCenter(sAlignTitleSection) + " ; "); sw.WriteLine(Constants.vbTab + "font-style: " + s_r_cTypeface + " ;"); sw.WriteLine(Constants.vbTab + "font-size: " + s_r_cSize + "pt ;"); // sw.WriteLine(vbtab + "line-height: " + sSpacingInterline + "pt ;") ' important to maintain register sw.WriteLine(Constants.vbTab + "margin-top: 0 ;"); // important to maintain register sw.WriteLine(Constants.vbTab + "margin-bottom: " + sSpacingTitleSectionMarginBottom + "pt ;"); // important to maintain register sw.WriteLine(Constants.vbTab + "}"); // closing marker for parallel passage sw.WriteLine(); sw.WriteLine(Constants.vbTab + "/***********************************/"); sw.WriteLine(Constants.vbTab + "/*********** paragraph *************/"); sw.WriteLine(Constants.vbTab + "/***********************************/"); sw.WriteLine(); sw.WriteLine("p {"); sw.WriteLine(); sw.WriteLine(Constants.vbTab + "text-align: " + getAlignmentJustify(sParJustify) + " ;"); sw.WriteLine(Constants.vbTab + "font-style: " + sFaceName + " ;"); sw.WriteLine(Constants.vbTab + "font-size: " + sFontSize + "pt ;"); sw.WriteLine(Constants.vbTab + "line-height: " + sSpacingInterline + "pt ;"); // important to maintain register sw.WriteLine(Constants.vbTab + "margin: 0 ;"); sw.WriteLine(Constants.vbTab + "page-break-inside: auto ;"); sw.WriteLine(Constants.vbTab + "}"); // closing marker for paragraph sw.WriteLine(); sw.WriteLine(); sw.WriteLine(".inscription {"); sw.WriteLine(); sw.WriteLine(Constants.vbTab + "font-variant: small-caps ;"); sw.WriteLine(Constants.vbTab + "text-align: center ;"); sw.WriteLine(Constants.vbTab + "text-indent: 0 ;"); sw.WriteLine(Constants.vbTab + "}"); // closing marker for inscription sw.WriteLine(); sw.WriteLine(Constants.vbTab + "/***********************************/"); sw.WriteLine(Constants.vbTab + "/*********** poetry *************/"); sw.WriteLine(Constants.vbTab + "/***********************************/"); sw.WriteLine(); sw.WriteLine(".line1 {"); // use all of the p styles above plus sw.WriteLine(); sw.WriteLine(Constants.vbTab + "text-indent: -3em ;"); sw.WriteLine(Constants.vbTab + "margin-left: 4em ;"); sw.WriteLine(Constants.vbTab + "page-break-inside: avoid ;"); sw.WriteLine(Constants.vbTab + "}"); // closing marker for line1 sw.WriteLine(); sw.WriteLine(); sw.WriteLine(".line2 {"); // use all of the p styles above plus sw.WriteLine(); sw.WriteLine(Constants.vbTab + "text-indent: -2em ;"); sw.WriteLine(Constants.vbTab + "margin-left: 4em ;"); sw.WriteLine(Constants.vbTab + "page-break-inside: avoid ;"); sw.WriteLine(Constants.vbTab + "}"); // closing marker for line1 sw.WriteLine(); sw.WriteLine(); sw.WriteLine(".line3 {"); // use all of the p styles above plus sw.WriteLine(); sw.WriteLine(Constants.vbTab + "text-indent: -1em ;"); sw.WriteLine(Constants.vbTab + "margin-left: 4em ;"); sw.WriteLine(Constants.vbTab + "page-break-inside: avoid ;"); sw.WriteLine(Constants.vbTab + "}"); // closing marker for line1 sw.WriteLine(); sw.WriteLine(); sw.WriteLine("/***********************************************************************************/"); sw.WriteLine("/******************************** end of CSS file **********************************/"); sw.WriteLine("/***********************************************************************************/"); sw.Close(); // FileOpen(filenum, Main.sGeneratedStylesheetFileName, OpenMode.Output, OpenAccess.Write) // ' FileOpen(filenum, test, OpenMode.Output, OpenAccess.Write) // WriteLine(filenum, "******************************** start of CSS file ********************************") // writeSettings() // FileClose(filenum) // ' If File.Exists(Main.sGeneratedStylesheetFileName) Then Main main = new Main(); main.enableGPSstylesheet(); main.enableGeneratedStylesheet(); } catch (Exception ex) { // MessageBox.Show("Error trying to write the CSS file." + Constants.vbCrLf + ex.Message, "Can not create file", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void calculateNumberOfLines() { Main.dMarginTopInPoints = NumericUpDownTopMarginInPoints.Value; Main.dMarginBottomInPoints = NumericUpDownBottomMarginInPoints.Value; if (Main.iNumberOfColumns > 1) { if (Main.dColumnGapInPoints < 3) { Main.dColumnGapInPoints = 3; } else { //skip } } else { Main.dColumnGapInPoints = 0; } NumericUpDownColumnGapInPoints.Value = Main.dColumnGapInPoints; Main.dColumnWidthInPoints = (Main.dPageWidthInPoints - (Main.dColumnGapInPoints + Main.dMarginLeftInPoints + Main.dMarginRightInPoints)) / Main.iNumberOfColumns; tbColumnWidthInPoints.Text = Main.dColumnWidthInPoints.ToString(); Main main = new Main(); main.writeIniFile(); }
private void calculateColumnWidthInPoints() { Main.iNumberOfColumns = (int)NumericUpDownNumberOfColumns.Value; Main.dColumnGapInPoints = NumericUpDownColumnGapInPoints.Value; if (NumericUpDownNumberOfColumns.Value < 2) { // if for some reason it thinks it is zero reset it to 1 Main.iNumberOfColumns = 1; Main.dColumnGapInPoints = 0; } else { if (Main.dColumnGapInPoints < 3) { Main.dColumnGapInPoints = 3; } else { //skip } } // Main.iNumberOfColumns = NumericUpDownNumberOfColumns.Value // Main.dColumnGapInPoints = NumericUpDownColumnGapInPoints.Value NumericUpDownNumberOfColumns.Value = Main.iNumberOfColumns; NumericUpDownColumnGapInPoints.Value = Main.dColumnGapInPoints; Main.dMarginLeftInPoints = NumericUpDownLeftMarginPoints.Value; Main.dMarginRightInPoints = NumericUpDownRightMarginInPoints.Value; // If Main.iNumberOfColumns > 1 Then // If Main.dColumnGapInPoints < 3 Then // Main.dColumnGapInPoints = 3 // Else // 'skip // End If // Else //Main.dColumnGapInPoints = 0 //End If //NumericUpDownColumnGapInPoints.Value = Main.dColumnGapInPoints int dMarginsAndGap =(int)(Main.dColumnGapInPoints + Main.dMarginLeftInPoints + Main.dMarginRightInPoints); Main.dColumnWidthInPoints = (Main.dPageWidthInPoints - dMarginsAndGap) / Main.iNumberOfColumns; tbColumnWidthInPoints.Text = Main.dColumnWidthInPoints.ToString(); Main main = new Main(); main.writeIniFile(); }
private void btnOK_Click(System.Object sender, System.EventArgs e) { // calculate and save line height and column width in points // Main.dColumnWidthInPoints = picture.convertUnitsToPoints(Me.lbInputUnits.SelectedItem, Me.tbColumnWidth.Text) // Main.sLineHeightInPoints = picture.convertUnitsToPoints(Me.lbLineHeightUnits.SelectedItem, Me.NumericUpDownLineHeight.Value) Main main = new Main(); main.writeIniFile(); this.Close(); }
private bool findTextInSourceAndInsertGraphic(string tmp) { try { Main main = new Main(); if (main.isSelectedTextUnique(Main.sSelectedText) == true) { // make sure that the text is on separate lines Main.makeTextCanonical(); // look at document line by line and find match string line = ""; string sText = ""; StreamReader sr = new StreamReader(Main.sDocumentFileName); while (!(sr.EndOfStream)) { line = sr.ReadLine(); // we have possibly reduced the text to just this on sCliptext if (line.Contains(Main.sCliptext)) { // found matching line // insert tracking sText = sText + insertGraphic(ref line); } else { sText = sText + line; } } sr.Close(); File.WriteAllText(Main.sDocumentFileName, sText); return true; } else { // skip as no unique match found return false; } //return "unknown"; } catch (Exception ex) { MessageBox.Show("Error, but will try to continue." + Constants.vbCrLf + ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Information); return false; } }
// Public Sub displayGraphicFilesInListBox() // Dim i As Integer = 0 // Dim filename As String // Try // For Each filename In Directory.GetFiles(Main.sGraphicsFolder) // If filename.Contains(".png") Or _ // filename.Contains(".jpg") Or _ // filename.Contains(".jpeg") Or _ // filename.Contains(".tiff") Then // lbGraphics.Items.Add(filename) // lbGraphics.Items.Add(getFileNameWithExtensionFromFullName(filename)) // ' arrayGraphicFileNames(i) = filename // i = i + 1 // End If // Next // lbGraphics.Show() // If Main.sSelectedPictureFileName = "#none#" Then // lbGraphics.SelectedIndex = 0 // Else // lbGraphics.SelectedItem = Main.sSelectedPictureFileName // End If // // Catch ex As Exception // ' missing file // End Try // End Sub private void btnInsertGraphicHere_Click(System.Object sender, System.EventArgs e) { // find out where we are atand insert graphic before paragraph this.Cursor = Cursors.WaitCursor; Main main = new Main(); main.getCliptext(); string sFoundText = Main.sCliptext; if (sFoundText == null) { // skip } else { if (findTextInSourceAndInsertGraphic(sFoundText) == true) { main.convertWithPrinceAndDisplayPDF(); } else { // skip } // create PDF and view it } // turn off the insert button btnInsertGraphicHere.Visible = false; btnOK.Visible = true; this.Cursor = Cursors.Default; this.Hide(); }