internal static string ConstructUrlFromReference(StoryEditor theSE, string reference) { string strStoryName, strAnchor; int nLineNum; ParseReference(reference, out strStoryName, out nLineNum, out strAnchor); StoryData theStory = theSE.TheCurrentStoriesSet.GetStoryFromName(strStoryName); System.Diagnostics.Debug.Assert((theStory != null) && ((nLineNum - 1) < theStory.Verses.Count)); return(OneStoryUrlBuilder.Url( theSE.StoryProject.ProjSettings.ProjectName, theStory.guid, theStory.Verses[nLineNum - 1].guid, OneStoryUrlBuilder.FieldType.eAnchorFields, strAnchor, strAnchor)); }
public HtmlDisplayForm(StoryEditor theSE, StoryData storyData) { InitializeComponent(); htmlStoryBtControl.TheSE = theSE; htmlStoryBtControl.StoryData = storyData; htmlStoryBtControl.ViewItemsToInsureOn = VerseData.SetItemsToInsureOn( theSE.viewVernacularLangFieldMenuItem.Checked, theSE.viewNationalLangFieldMenuItem.Checked, theSE.viewEnglishBTFieldMenuItem.Checked, theSE.viewAnchorFieldMenuItem.Checked, theSE.viewStoryTestingQuestionFieldMenuItem.Checked, theSE.viewRetellingFieldMenuItem.Checked, theSE.viewConsultantNoteFieldMenuItem.Checked, theSE.viewCoachNotesFieldMenuItem.Checked, theSE.viewNetBibleMenuItem.Checked); htmlStoryBtControl.MembersData = theSE.StoryProject.TeamMembers; htmlStoryBtControl.LoggedOnMember = theSE.LoggedOnMember; htmlStoryBtControl.LoadDocument(); }
private void buttonMoveDown_Click(object sender, EventArgs e) { System.Diagnostics.Debug.Assert(dataGridViewPanorama.SelectedCells.Count < 2); // 1 or 0 (or I'm not understanding this properly if (dataGridViewPanorama.SelectedCells.Count != 1) { return; } int nSelectedColumnIndex = dataGridViewPanorama.SelectedCells[0].ColumnIndex; int nSelectedRowIndex = dataGridViewPanorama.SelectedCells[0].RowIndex; if (nSelectedRowIndex < dataGridViewPanorama.Rows.Count - 1) { StoryData theSDToMove = _stories[nSelectedRowIndex]; _stories.RemoveAt(nSelectedRowIndex); _stories.Insert(++nSelectedRowIndex, theSDToMove); InitGrid(); System.Diagnostics.Debug.Assert(nSelectedRowIndex < dataGridViewPanorama.Rows.Count); dataGridViewPanorama.Rows[nSelectedRowIndex].Cells[nSelectedColumnIndex].Selected = true; Modified = true; } }
public StageEditorForm(StoryProjectData storyProjectData, StoryData theCurrentStory) { InitializeComponent(); _storyProjectData = storyProjectData; _theCurrentStory = theCurrentStory; if (!storyProjectData.TeamMembers.HasOutsideEnglishBTer) { ColumnEnglishBackTranslator.Visible = false; } else { checkBoxOutsideEnglishBackTranslator.Checked = true; } if (!storyProjectData.TeamMembers.HasFirstPassMentor) { ColumnFirstPassMentor.Visible = false; } else { checkBoxFirstPassMentor.Checked = true; } if (storyProjectData.TeamMembers.HasIndependentConsultant) { ColumnConsultantInTraining.HeaderText = TeamMemberData.CstrIndependentConsultantDisplay; ColumnCoach.Visible = false; radioButtonIndependentConsultant.Checked = true; } else { radioButtonManageWithCoaching.Checked = true; } InitGrid(); }
/// <summary> /// Build by project by reference array of verse text for this term /// </summary> internal void ReadVerseText(Term myTerm, StoryProjectData theSPD, ProgressBar progressBarLoadingKeyTerms) { mapReferenceToVerseTextList = new Dictionary <string, List <string> >(); ArrayList vrefs = new ArrayList(); foreach (var vref in myTerm.VerseRefs()) { vrefs.Add(vref.BBBCCCVVVS()); } // List<VerseRef> vrefs = new List<VerseRef>(myTerm.VerseRefs()); // get the current stories only (not the obsolete ones) StoriesData theStories = theSPD[Properties.Resources.IDS_MainStoriesSet]; progressBarLoadingKeyTerms.Maximum = theStories.Count; progressBarLoadingKeyTerms.Value = 0; for (int nStoryNumber = 0; nStoryNumber < theStories.Count; nStoryNumber++) { StoryData aStory = theStories[nStoryNumber]; for (int nVerseNumber = 0; nVerseNumber < aStory.Verses.Count; nVerseNumber++) { VerseData aVerse = aStory.Verses[nVerseNumber]; for (int nAnchorNumber = 0; nAnchorNumber < aVerse.Anchors.Count; nAnchorNumber++) { AnchorData anAnchor = aVerse.Anchors[nAnchorNumber]; VerseRef theVerseRef = new VerseRef(anAnchor.AnchorAsVerseRef); int nIndex = vrefs.BinarySearch(theVerseRef.BBBCCCVVVS()); if (nIndex < 0) { continue; } string strVerseReference = String.Format("Story: '{0}' line: {1} anchor: {2}", aStory.Name, nVerseNumber + 1, anAnchor.JumpTarget); List <string> astrVerseText = new List <string>(projectVariablesList.Count); if (theSPD.ProjSettings.Vernacular.HasData) { astrVerseText.Add(aVerse.VernacularText.ToString()); } if (theSPD.ProjSettings.NationalBT.HasData) { astrVerseText.Add(aVerse.NationalBTText.ToString()); } if (theSPD.ProjSettings.InternationalBT.HasData) { astrVerseText.Add(aVerse.InternationalBTText.ToString()); } // keep track of this verse and it's reference if (!mapReferenceToVerseTextList.ContainsKey(strVerseReference)) { mapReferenceToVerseTextList.Add(strVerseReference, astrVerseText); } // we don't need to do any more anchors with this same line of the same story // so set the anchor # to the number of anchors so the next outer for loop // will think it's finished nAnchorNumber = aVerse.Anchors.Count; break; } } progressBarLoadingKeyTerms.Value++; } }
public StoryFrontMatterForm(StoryEditor theSE, StoryProjectData theStoryProjectData, StoryData theCurrentStory) { _theSE = theSE; _theStoryProjectData = theStoryProjectData; _theCurrentStory = theCurrentStory; InitializeComponent(); InitToolboxTextTip(theCurrentStory.CraftingInfo.ProjectFacilitatorMemberID, textBoxProjectFacilitator); InitToolboxTextTip(theCurrentStory.CraftingInfo.StoryCrafterMemberID, textBoxStoryCrafter); textBoxStoryPurpose.Text = theCurrentStory.CraftingInfo.StoryPurpose; textBoxResourcesUsed.Text = theCurrentStory.CraftingInfo.ResourcesUsed; InitToolboxTextTip(theCurrentStory.CraftingInfo.BackTranslatorMemberID, textBoxUnsBackTranslator); if (theCurrentStory.CraftingInfo.Testors.Count > 0) { InitToolboxTextTip(theCurrentStory.CraftingInfo.Testors[0], textBoxUnsTest1); buttonBrowseUnsTest2.Enabled = true; } else { buttonBrowseUnsTest2.Enabled = false; } if (theCurrentStory.CraftingInfo.Testors.Count > 1) { InitToolboxTextTip(theCurrentStory.CraftingInfo.Testors[1], textBoxUnsTest2); buttonBrowseUnsTest3.Enabled = true; } else { buttonBrowseUnsTest3.Enabled = false; } if (theCurrentStory.CraftingInfo.Testors.Count > 2) { InitToolboxTextTip(theCurrentStory.CraftingInfo.Testors[2], textBoxUnsTest3); } Text = String.Format("Story Information for '{0}'", theCurrentStory.Name); }
static void Main(string[] args) { string[] astrBt = File.ReadAllLines(CstrBtFile); CleanSfmFileContents(ref astrBt); string[] astrRet = File.ReadAllLines(CstrRetFile); CleanSfmFileContents(ref astrRet); string[] astrCon = File.ReadAllLines(CstrConFile); CleanSfmFileContents(ref astrCon); string[] astrCoa = File.ReadAllLines(CstrCoaFile); CleanSfmFileContents(ref astrCoa); OpenFileDialog dlg = new OpenFileDialog(); dlg.Title = "Browse for the existing version of the output file (so we can reuse the GUIDs)"; StoriesData theStories; bool bUsingStoryProject; if (dlg.ShowDialog() == DialogResult.OK) { StoryProject projFile = new StoryProject(); projFile.ReadXml(dlg.FileName); ProjectSettings projSettings = new ProjectSettings(Path.GetDirectoryName(dlg.FileName), Path.GetFileNameWithoutExtension(dlg.FileName)); theStories = new StoriesData(projFile, projSettings); // import the member ids so we keep their same guids foreach (TeamMemberData aTMD in theStories.TeamMembers.Values) { MemberGuid(theStories.TeamMembers, aTMD.Name, aTMD.MemberType); } bUsingStoryProject = true; } else { ProjectSettings projSettings = new ProjectSettings(Path.GetDirectoryName(CstrDefOutputFile), Path.GetFileNameWithoutExtension(CstrDefOutputFile)); theStories = new StoriesData(projSettings); bUsingStoryProject = false; } // skip down to the title of the first story (in each file) int nIndexBt = 0, nIndexRet = 0, nIndexCon = 0, nIndexCoa = 0; SkipTo(@"\t ", null, @"\t ", astrBt, ref nIndexBt); SkipTo(@"\t ", null, @"\t ", astrRet, ref nIndexRet); SkipTo(@"\t ", null, @"\t ", astrCon, ref nIndexCon); SkipTo(@"\t ", null, @"\t ", astrCoa, ref nIndexCoa); int nStoryNumber = 0; while (nIndexBt != -1) { System.Diagnostics.Debug.Assert( (astrBt[nIndexBt] == astrRet[nIndexRet]) && (astrBt[nIndexBt] == astrCon[nIndexCon]) && (astrBt[nIndexBt] == astrCoa[nIndexCoa]), "Fixup problem in data files: one file has an extra record"); string strStoryName = astrBt[nIndexBt].Substring(3); StoryData story; if (bUsingStoryProject) { story = theStories[nStoryNumber++]; } else { story = new StoryData(strStoryName, null); } Console.WriteLine("Story: " + strStoryName); // first process the 'story front matter (reason, testors, etc)' string strTestorGuid; DoStoryFrontMatter(theStories, story, astrBt, ref nIndexBt, bUsingStoryProject, out strTestorGuid); int nVerseNumber = 0; while (nIndexBt < astrBt.Length) { string strRef = astrBt[nIndexBt].Substring(4); Console.WriteLine(" ln: " + strRef); VerseData verse; if (bUsingStoryProject) { System.Diagnostics.Debug.Assert((nVerseNumber < story.Verses.Count), String.Format("Verse count not the same: this could be because some verse in chapter with '{0}' has no data for all files (so it wasn't ultimately added the first time thru)", strRef)); verse = story.Verses[nVerseNumber]; // clear out any data that doesn't have guids (so we don't add them again) verse.Anchors.Clear(); verse.TestQuestions.Clear(); // these have IDs, but they're member IDs which should get picked up correctly verse.Retellings.Clear(); // same here } else { verse = new VerseData(); } DoVerseData(verse, astrBt, strTestorGuid, ref nIndexBt); // now grab the retelling if (SkipTo(@"\ln ", strRef, @"\c ", astrRet, ref nIndexRet)) { DoRetellingData(astrRet, ref nIndexRet, verse, strTestorGuid); } // now grab the consultant notes if (SkipTo(@"\ln ", strRef, @"\c ", astrCon, ref nIndexCon)) { DoConsultData(astrCon, ref nIndexCon, bUsingStoryProject, verse.ConsultantNotes, @"\con", CstrConsultantsInitials, CastrConsultantMenteeSfms, ConsultNoteDataConverter.CommunicationDirections.eConsultantToCrafter, ConsultNoteDataConverter.CommunicationDirections.eCrafterToConsultant); } // now grab the coach notes if (SkipTo(@"\ln ", strRef, @"\c ", astrCoa, ref nIndexCoa)) { DoConsultData(astrCoa, ref nIndexCoa, bUsingStoryProject, verse.CoachNotes, @"\cch", CstrCoachsInitials, CastrCoachMenteeSfms, ConsultNoteDataConverter.CommunicationDirections.eCoachToConsultant, ConsultNoteDataConverter.CommunicationDirections.eConsultantToCoach); } if (verse.HasData) { if (bUsingStoryProject) { nVerseNumber++; } else { story.Verses.Add(verse); } } if ((nIndexBt >= astrBt.Length) || (astrBt[nIndexBt].Substring(0, 3) == @"\c ")) { // TODO: for others, we could do a special case if there's a second record with an earlier retelling // (but for K&D, those lines aren't likely to have any association with the current version of the story... if (nIndexBt < astrBt.Length) { System.Diagnostics.Debug.Assert( (astrBt[nIndexBt] == astrRet[nIndexRet]) && (astrBt[nIndexBt] == astrCon[nIndexCon]) && (astrBt[nIndexBt] == astrCoa[nIndexCoa]), "Fixup problem in data files: one file has an extra record"); } break; } } story.ProjStage.ProjectStage = StoryStageLogic.ProjectStages.eCoachReviewTest2Notes; if (!bUsingStoryProject) { theStories.Add(story); } SkipTo(@"\t ", null, @"\t ", astrBt, ref nIndexBt); SkipTo(@"\t ", null, @"\t ", astrRet, ref nIndexRet); SkipTo(@"\t ", null, @"\t ", astrCon, ref nIndexCon); SkipTo(@"\t ", null, @"\t ", astrCoa, ref nIndexCoa); } theStories.ProjSettings.Vernacular.LangName = CstrVernName; theStories.ProjSettings.Vernacular.LangCode = CstrVernCode; theStories.ProjSettings.Vernacular.FullStop = CstrVernFullStop; theStories.ProjSettings.NationalBT.LangName = CstrNatlName; theStories.ProjSettings.NationalBT.LangCode = CstrNatlCode; theStories.ProjSettings.NationalBT.FullStop = CstrNatlFullStop; theStories.ProjSettings.InternationalBT.LangName = CstrIntlName; theStories.ProjSettings.InternationalBT.LangCode = CstrIntlCode; SaveXElement(theStories.GetXml, theStories.ProjSettings.ProjectFileName); }
private static void DoStoryFrontMatter(StoriesData theStories, StoryData story, string[] astrBt, ref int nIndexBt, bool bUsingStoryProject, out string strTestorGuid) { strTestorGuid = null; string strMarker, strData; ParseLine(astrBt[++nIndexBt], out strMarker, out strData); while (strMarker != @"\ln") { if (strMarker == @"\co") // comment field { if (BeginsWith(strData, CstrReasonLable)) { string strStoryPurpose = strData.Substring(CstrReasonLable.Length).Trim(); if (String.IsNullOrEmpty(strStoryPurpose)) { strStoryPurpose = null; } if (bUsingStoryProject) { System.Diagnostics.Debug.Assert(story.CraftingInfo.StoryPurpose == strStoryPurpose); } else { story.CraftingInfo.StoryPurpose = strStoryPurpose; } } else if (BeginsWith(strData, CstrStoryCrafter)) { string strCrafterName = strData.Substring(CstrStoryCrafter.Length).Trim(); System.Diagnostics.Debug.Assert(!String.IsNullOrEmpty(strCrafterName)); string strCrafterGuid = MemberGuid(theStories.TeamMembers, strCrafterName, TeamMemberData.UserTypes.eCrafter); if (bUsingStoryProject) { if (String.IsNullOrEmpty(story.CraftingInfo.StoryCrafterMemberID) && !String.IsNullOrEmpty(strCrafterGuid)) { story.CraftingInfo.StoryCrafterMemberID = strCrafterGuid; } System.Diagnostics.Debug.Assert(story.CraftingInfo.StoryCrafterMemberID == strCrafterGuid); } else { story.CraftingInfo.StoryCrafterMemberID = strCrafterGuid; } } else if (BeginsWith(strData, CstrBackTranslator)) { string strBackTranslatorName = strData.Substring(CstrBackTranslator.Length).Trim(); string strBackTranslatorGuid = null; if (!String.IsNullOrEmpty(strBackTranslatorName)) { strBackTranslatorGuid = MemberGuid(theStories.TeamMembers, strBackTranslatorName, TeamMemberData.UserTypes.eUNS); } if (bUsingStoryProject) { System.Diagnostics.Debug.Assert(story.CraftingInfo.BackTranslatorMemberID == strBackTranslatorGuid); } else { story.CraftingInfo.BackTranslatorMemberID = strBackTranslatorGuid; } } else if (BeginsWith(strData, CstrTestor1)) { string strTestor1 = strData.Substring(CstrTestor1.Length).Trim(); if (!String.IsNullOrEmpty(strTestor1)) { strTestorGuid = MemberGuid(theStories.TeamMembers, strTestor1, TeamMemberData.UserTypes.eUNS); if (bUsingStoryProject) { System.Diagnostics.Debug.Assert(story.CraftingInfo.Testors[1] == strTestorGuid); } else { story.CraftingInfo.Testors.Add(1, strTestorGuid); } } } else if (BeginsWith(strData, CstrTestor2)) { string strTestor2 = strData.Substring(CstrTestor2.Length).Trim(); if (!String.IsNullOrEmpty(strTestor2)) { strTestorGuid = MemberGuid(theStories.TeamMembers, strTestor2, TeamMemberData.UserTypes.eUNS); if (bUsingStoryProject) { System.Diagnostics.Debug.Assert(story.CraftingInfo.Testors[2] == strTestorGuid); } else { story.CraftingInfo.Testors.Add(2, strTestorGuid); } } } } else if (strMarker == @"\c") // chapter field { break; } ParseLine(astrBt[++nIndexBt], out strMarker, out strData); } }