public int ChangeVersification(int bbbcccvvv, IScrVers otherVersification) { VerseRef vRef = new VerseRef(bbbcccvvv, (ScrVers)otherVersification); ChangeVersification(ref vRef); return(vRef.BBBCCCVVV); }
/// ----------------------------------------------------------------------------------- /// <summary> /// Initializes a new instance of the <see cref="ScrPassageDropDown"/> class. /// </summary> /// <param name="owner"></param> /// <param name="fBooksOnly">If true, show only books without chapter and verse</param> /// <param name="versification">The current versification to use</param> /// ----------------------------------------------------------------------------------- public ScrPassageDropDown(Control owner, bool fBooksOnly, IScrVers versification) { SnapToDefaultButton = false; CVButtonPreferredWidth = 30; BookButtonPreferredWidth = 100; ButtonHeight = 18; m_versification = versification; InitializeComponent(); InitializeButtons(); AttachedControl = owner; m_fBooksOnly = fBooksOnly; // Get reference from the main control m_scRef = ScrPassageControl.ScReference; LoadBooksButtons(); int initialBook = ScrPassageControl.ScReference.Book; // Verify that the book displayed in the text box portion of the scripture // passage control is valid. If it is, then find what button it corresponds to // and make that button current. if (ScrPassageControl.MulScrBooks.IsBookValid(initialBook) && Controls.Count > 0) { foreach (ScrDropDownButton button in m_buttons) { if (button.BCVValue == initialBook) { m_currButton = button.Index; button.State = ButtonState.Pushed; break; } } } }
public TxlMasterQuestionPreProcessorForm(IScrVers englishVersification) { InitializeComponent(); m_masterVersification = englishVersification; m_sfmSourceLabelText = lblSource.Text; SetDefaultSfmSourceFile(); txtXmlQuestionFile.Text = Path.Combine(@"c:\Projects\Transcelerator\Transcelerator", TxlCore.kQuestionsFilename); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="T:ScrReferenceFilterDlg"/> class. /// </summary> /// ------------------------------------------------------------------------------------ internal ScrReferenceFilterDlg(IScrVers versification, BCVRef initialFromRef, BCVRef initialToRef, int[] canonicalBookIds) { InitializeComponent(); scrPsgFrom.Initialize(new BCVRef(initialFromRef), versification, canonicalBookIds); scrPsgTo.Initialize(new BCVRef(initialToRef), versification, canonicalBookIds); m_firstAvailableRef = new BCVRef(canonicalBookIds[0], 1, 1); m_lastAvailableRef = new BCVRef(canonicalBookIds.Last(), 1, 1); m_lastAvailableRef.Chapter = versification.GetLastChapter(m_lastAvailableRef.Book); m_lastAvailableRef.Verse = versification.GetLastVerse(m_lastAvailableRef.Book, m_lastAvailableRef.Chapter); if (initialFromRef == m_firstAvailableRef && initialToRef == m_lastAvailableRef) { btnClearFilter.Enabled = false; } }
/// ------------------------------------------------------------------------------------ public TestScrVers() { m_vers = MockRepository.GenerateMock<IScrVers>(); m_vers.Stub(v => v.GetLastChapter(1)).Return(50); m_vers.Stub(v => v.GetLastVerse(1, 1)).Return(31); m_vers.Stub(v => v.GetLastVerse(1, 2)).Return(25); m_vers.Stub(v => v.GetLastChapter(5)).Return(34); m_vers.Stub(v => v.GetLastVerse(5, 1)).Return(46); m_vers.Stub(v => v.GetLastVerse(5, 17)).Return(20); m_vers.Stub(v => v.GetLastChapter(6)).Return(24); m_vers.Stub(v => v.GetLastVerse(6, 1)).Return(18); m_vers.Stub(v => v.GetLastChapter(7)).Return(21); m_vers.Stub(v => v.GetLastVerse(7, 21)).Return(25); m_vers.Stub(v => v.GetLastChapter(57)).Return(1); m_vers.Stub(v => v.GetLastVerse(57, 1)).Return(25); m_vers.Stub(v => v.GetLastChapter(59)).Return(5); m_vers.Stub(v => v.GetLastVerse(59, 1)).Return(27); m_vers.Stub(v => v.GetLastChapter(66)).Return(22); m_vers.Stub(v => v.GetLastVerse(66, 1)).Return(20); }
/// ------------------------------------------------------------------------------------ public TestScrVers() { m_vers = MockRepository.GenerateMock <IScrVers>(); m_vers.Stub(v => v.GetLastChapter(1)).Return(50); m_vers.Stub(v => v.GetLastVerse(1, 1)).Return(31); m_vers.Stub(v => v.GetLastVerse(1, 2)).Return(25); m_vers.Stub(v => v.GetLastChapter(5)).Return(34); m_vers.Stub(v => v.GetLastVerse(5, 1)).Return(46); m_vers.Stub(v => v.GetLastVerse(5, 17)).Return(20); m_vers.Stub(v => v.GetLastChapter(6)).Return(24); m_vers.Stub(v => v.GetLastVerse(6, 1)).Return(18); m_vers.Stub(v => v.GetLastChapter(7)).Return(21); m_vers.Stub(v => v.GetLastVerse(7, 21)).Return(25); m_vers.Stub(v => v.GetLastChapter(57)).Return(1); m_vers.Stub(v => v.GetLastVerse(57, 1)).Return(25); m_vers.Stub(v => v.GetLastChapter(59)).Return(5); m_vers.Stub(v => v.GetLastVerse(59, 1)).Return(27); m_vers.Stub(v => v.GetLastChapter(66)).Return(22); m_vers.Stub(v => v.GetLastVerse(66, 1)).Return(20); }
public void TestSetup() { m_versification = new TestScrVers(); m_ctrlOwner = new Form(); m_scp = new DummyScrPassageControl(); m_scp.Initialize(new BCVRef(01001001), m_versification); m_filteredScp = new DummyScrPassageControl(); m_filteredScp.Initialize(new BCVRef(01001001), m_versification, new[] { 57, 59, 65 }); m_ctrlOwner.Controls.Add(m_scp); m_ctrlOwner.Controls.Add(m_filteredScp); m_ctrlOwner.CreateControl(); if (m_scp.DropDownWindow != null) { m_scp.DropDownWindow.Close(); } if (m_filteredScp.DropDownWindow != null) { m_filteredScp.DropDownWindow.Close(); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initialization following the default constructor, with constrained set of books to /// display. /// </summary> /// <param name="reference">Initial reference</param> /// <param name="versification">The versification to use if scrProj is not set.</param> /// <param name="availableBooks">Array of canonical book IDs to include</param> /// ------------------------------------------------------------------------------------ public void Initialize(BCVRef reference, IScrVers versification, int[] availableBooks) { m_versification = versification; m_availableBookIds = null; if (availableBooks != null) { Array.Sort(availableBooks); m_availableBookIds = availableBooks.Distinct().ToList(); InitializeBookLabels(); } else BookLabels = m_mulScrBooks.BookLabels; if (reference != null && !reference.IsEmpty) ScReference = reference; else if (m_bookLabels != null && m_bookLabels.Length > 0) ScReference = new BCVRef(m_bookLabels[0].BookNum, 1, 1); else ScReference = BCVRef.Empty; Reference = m_mulScrBooks.GetRefString(ScReference); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initialization following the default constructor. /// </summary> /// <param name="reference">Initial reference</param> /// <param name="versification">The versification to use if scrProj is not set.</param> /// ------------------------------------------------------------------------------------ public void Initialize(BCVRef reference, IScrVers versification) { Initialize(reference, versification, null); }
public int ChangeVersification(int reference, IScrVers scrVersSource) { return(this.Equals(scrVersSource) ? reference : m_host.ChangeVersification(reference, scrVersSource.Name, Name)); }
internal static int MakeStandardFormatQuestions(StreamReader reader, StreamWriter writer, IScrVers vers) { int problemsFound = 0; MultilingScrBooks multilingScrBooks = new MultilingScrBooks(); Regex regexChapterBreak = new Regex(@"\" + s_kSectionHead + @" (?<bookAndChapter>.+ \d+)", RegexOptions.Compiled); Regex regexAnswer = new Regex(@"\" + s_kAnswerMarker + @" .+", RegexOptions.Compiled); Regex regexQuestion = new Regex(@"\d+\. +(?<question>.+[?.])( (?<versesCovered>\(\d+(-\d+)?\)))?", RegexOptions.Compiled); string sVersesCoveredByQuestion = null; string sLine; while ((sLine = reader.ReadLine()) != null) { sLine = sLine.Replace(" ", " ").Trim(); if (sLine.Length == 0 || sLine.StartsWith("Back to top")) { continue; } Match match = regexChapterBreak.Match(sLine); if (match.Success) { string sBookAndChapter = match.Result("${bookAndChapter}"); BCVRef reference = multilingScrBooks.ParseRefString(sBookAndChapter + ":1"); int lastVerse = vers.GetLastVerse(reference.Book, reference.Chapter); sLine += ":1-" + lastVerse; writer.WriteLine(); writer.WriteLine(sLine); writer.WriteLine(s_kDetailsMarker + " Details"); writer.WriteLine(s_kRefMarker + " " + reference + "-" + lastVerse); continue; } match = regexAnswer.Match(sLine); if (match.Success) { writer.WriteLine(match + (string.IsNullOrEmpty(sVersesCoveredByQuestion) ? "" : " " + sVersesCoveredByQuestion)); continue; } sVersesCoveredByQuestion = null; match = regexQuestion.Match(sLine); if (match.Success) { string sQuestion = match.Result("${question}"); writer.WriteLine(s_kQuestionMarker + " " + sQuestion); sVersesCoveredByQuestion = match.Result("${versesCovered}"); } else { writer.WriteLine("PROBLEM: " + sLine); problemsFound++; } } return(problemsFound); }
/// -------------------------------------------------------------------------------- /// <summary> /// Initializes a new object /// </summary> /// <param name="owner">The owner.</param> /// <param name="versification">The current versification to use when creating /// instances of BCVRef</param> /// -------------------------------------------------------------------------------- public DummyScrPassageDropDown(ScrPassageControl owner, IScrVers versification) : base(owner, false, versification) { }
/// ------------------------------------------------------------------------------------ /// <summary> /// Determines if the reference is valid for the given versification. /// </summary> /// ------------------------------------------------------------------------------------ public virtual bool IsValidInVersification(IScrVers versification) { return Valid && (versification.GetLastChapter(Book) >= Chapter && versification.GetLastVerse(Book, Chapter) >= Verse); }
public int ChangeVersification(int reference, IScrVers scrVersSource) { return m_vers.ChangeVersification(reference, scrVersSource); }
public void TestSetup() { m_versification = new TestScrVers(); m_ctrlOwner = new Form(); m_scp = new DummyScrPassageControl(); m_scp.Initialize(new BCVRef(01001001), m_versification); m_filteredScp = new DummyScrPassageControl(); m_filteredScp.Initialize(new BCVRef(01001001), m_versification, new[] { 57, 59, 65 }); m_ctrlOwner.Controls.Add(m_scp); m_ctrlOwner.Controls.Add(m_filteredScp); m_ctrlOwner.CreateControl(); if (m_scp.DropDownWindow != null) m_scp.DropDownWindow.Close(); if (m_filteredScp.DropDownWindow != null) m_filteredScp.DropDownWindow.Close(); }
public int ChangeVersification(int reference, IScrVers scrVersSource) { return(m_vers.ChangeVersification(reference, scrVersSource)); }