public MultiLineControl(VerseControl ctrlVerse, StoryStageLogic storyStageLogic,
                                MultipleLineDataConverter aMLDC, Font font, List <string> astrTestors)
            : base(storyStageLogic)
        {
            InitializeComponent();

            tableLayoutPanel.SuspendLayout();
            SuspendLayout();

            System.Diagnostics.Debug.Assert(tableLayoutPanel.RowCount == 1, "otherwise, fix this assumption: RetellingsControl.cs.20");
            tableLayoutPanel.RemoveRow(1);              // remove the one default one we start with

            // finally populate the buttons on that tool strip
            System.Diagnostics.Debug.Assert(aMLDC.Count > 0);
            int nNumRows = 0;

            for (int i = 0; i < aMLDC.Count; i++)
            {
                StringTransfer strRowData = aMLDC[i];
                string         strUnsGui  = aMLDC.MemberIDs[i];
                System.Diagnostics.Debug.Assert(astrTestors.Contains(strUnsGui));
                int nTest = astrTestors.IndexOf(strUnsGui) + 1;
                InitRow(ctrlVerse, aMLDC.LabelTextFormat, font, strRowData, nTest, ref nNumRows);
            }

            tableLayoutPanel.ResumeLayout(false);
            ResumeLayout(false);
        }
Beispiel #2
0
 public TestQuestionData()
 {
     guid = Guid.NewGuid().ToString();
     QuestionVernacular      = new StringTransfer(null);
     QuestionNationalBT      = new StringTransfer(null);
     QuestionInternationalBT = new StringTransfer(null);
     Answers = new AnswersData();
 }
Beispiel #3
0
            public VerseString AddNewVerseString(StringTransfer strStringTransfer,
                                                 VerseData.ViewItemToInsureOn viewItemToInsureOn)
            {
                var vs = new VerseString(strStringTransfer, viewItemToInsureOn);

                Add(vs);
                return(vs);
            }
        protected void InitTextBox(VerseControl ctrlVerse, string strTbName,
                                   StringTransfer strTbText, ProjectSettings.LanguageInfo li, int nLayoutColumn)
        {
            CtrlTextBox tb = new CtrlTextBox(strTbName + CstrSuffixTextBox, ctrlVerse, this,
                                             strTbText, li, CstrTestQuestionsLabelFormat);

            tableLayoutPanel.Controls.Add(tb, nLayoutColumn, 1);
        }
        private void addNoteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            StringTransfer st = DoAddNote(null);

            if ((st != null) && (st.TextBox != null))
            {
                st.TextBox.Focus();
            }
        }
Beispiel #6
0
        public TestQuestionData(NewDataSet.TestQuestionRow theTestQuestionRow, NewDataSet projFile)
        {
            guid      = theTestQuestionRow.guid;
            IsVisible = theTestQuestionRow.visible;

            QuestionVernacular      = new StringTransfer((theTestQuestionRow.IsTQVernacularNull()) ? null : theTestQuestionRow.TQVernacular);
            QuestionNationalBT      = new StringTransfer((theTestQuestionRow.IsTQNationalBTNull()) ? null : theTestQuestionRow.TQNationalBT);
            QuestionInternationalBT = new StringTransfer((theTestQuestionRow.IsTQInternationalBTNull()) ? null : theTestQuestionRow.TQInternationalBT);
            Answers = new AnswersData(theTestQuestionRow, projFile);
        }
Beispiel #7
0
        protected void InitTextBox(VerseControl ctrlVerse, string strTbName, StringTransfer strTbText,
                                   ProjectSettings.LanguageInfo li, bool bDisableTabStop, int nLayoutColumn)
        {
            System.Diagnostics.Debug.Assert(!tableLayoutPanel.Controls.ContainsKey(strTbName + CstrSuffixTextBox), "otherwise, fix wrong assumption");
            CtrlTextBox tb = new CtrlTextBox(strTbName + CstrSuffixTextBox, ctrlVerse, this,
                                             strTbText, li, li.LangCode);

            tb.TabStop = !bDisableTabStop;
            tableLayoutPanel.Controls.Add(tb, nLayoutColumn, 1);
        }
Beispiel #8
0
        protected void InitSearchList(ref StorySearchIndex alstBoxesToSearch,
                                      out int nStoryIndex, out int nCtxBoxIndex, out int nCharIndex)
        {
            StringTransferSearchIndex ssidx = null;

            // if the index is empty, then load it...
            if (alstBoxesToSearch.Count == 0)
            {
                if (checkBoxAllStories.Checked)
                {
                    TheSE.TheCurrentStoriesSet.IndexSearch(FindProperties,
                                                           ref alstBoxesToSearch);
                }
                else
                {
                    ssidx = alstBoxesToSearch.GetNewStorySearchIndex(TheSE.theCurrentStory.Name);
                    TheSE.theCurrentStory.IndexSearch(FindProperties, ref ssidx);
                }
            }

            // this should be 'else' because if we requery the index, then this
            //  index is definitely bad
            else if ((LastStoryIndex != -1) && (LastCtxBoxIndex != -1) && (LastCharIndex != -1))
            {
                nStoryIndex  = LastStoryIndex;
                nCtxBoxIndex = LastCtxBoxIndex;
                nCharIndex   = LastCharIndex;
                return;
            }

            ssidx = ssidx ?? BoxesToSearch[TheSE.theCurrentStory.Name];

            // check to see if we have a starting place...
            if (CtrlTextBox._inTextBox != null)
            {
                for (int i = 0; i < ssidx.Count; i++)
                {
                    // start with the last text box selected... find it
                    StringTransfer boxToSearch = ssidx[i].StringTransfer;
                    if (boxToSearch.TextBox == CtrlTextBox._inTextBox)
                    {
                        nStoryIndex  = LastStoryIndex = BoxesToSearch.IndexOf(ssidx);
                        nCtxBoxIndex = LastCtxBoxIndex = i;
                        nCharIndex   = LastCharIndex =
                            CaptureNextStartingCharIndex(boxToSearch.TextBox);
                        return;
                    }
                }
            }

            // otherwise, just start at the 0th verse of *this* story
            nStoryIndex  = LastStoryIndex = BoxesToSearch.IndexOf(ssidx);
            nCtxBoxIndex = LastCtxBoxIndex = nCharIndex = LastCharIndex = 0;
        }
Beispiel #9
0
        public TestQuestionData(TestQuestionData rhs)
        {
            // the guid shouldn't be replicated
            guid = Guid.NewGuid().ToString();               // rhs.guid;

            IsVisible               = rhs.IsVisible;
            QuestionVernacular      = new StringTransfer(rhs.QuestionVernacular.ToString());
            QuestionNationalBT      = new StringTransfer(rhs.QuestionNationalBT.ToString());
            QuestionInternationalBT = new StringTransfer(rhs.QuestionInternationalBT.ToString());
            Answers = new AnswersData(rhs.Answers);
        }
Beispiel #10
0
 public VerseData()
 {
     guid                = Guid.NewGuid().ToString();
     VernacularText      = new StringTransfer(null);
     NationalBTText      = new StringTransfer(null);
     InternationalBTText = new StringTransfer(null);
     Anchors             = new AnchorsData();
     TestQuestions       = new TestQuestionsData();
     Retellings          = new RetellingsData();
     ConsultantNotes     = new ConsultantNotesData();
     CoachNotes          = new CoachNotesData();
 }
Beispiel #11
0
 public CtrlTextBox(string strName, VerseControl ctrlVerseParent, Font font,
                    ResizableControl ctrlParent, StringTransfer stData, string strLabel)
 {
     InitComponent();
     Name      = strName;
     Font      = font;
     _strLabel = strLabel;
     stData.SetAssociation(this);
     TextChanged += new EventHandler(ctrlParent.textBox_TextChanged);
     System.Diagnostics.Debug.Assert(ctrlParent.StageLogic != null);
     _stageLogic      = ctrlParent.StageLogic;
     _ctrlVerseParent = ctrlVerseParent;
 }
        void buttonDragDropHandle_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                return;
            }
            StringTransfer st = DoAddNote(null);

            if ((st != null) && (st.TextBox != null))
            {
                st.TextBox.Focus();
            }
        }
Beispiel #13
0
        public VerseData(VerseData rhs)
        {
            // the guid shouldn't be replicated
            guid         = Guid.NewGuid().ToString();       // rhs.guid;
            IsFirstVerse = rhs.IsFirstVerse;
            IsVisible    = rhs.IsVisible;

            VernacularText      = new StringTransfer(rhs.VernacularText.ToString());
            NationalBTText      = new StringTransfer(rhs.NationalBTText.ToString());
            InternationalBTText = new StringTransfer(rhs.InternationalBTText.ToString());
            Anchors             = new AnchorsData(rhs.Anchors);
            TestQuestions       = new TestQuestionsData(rhs.TestQuestions);
            Retellings          = new RetellingsData(rhs.Retellings);
            ConsultantNotes     = new ConsultantNotesData(rhs.ConsultantNotes);
            CoachNotes          = new CoachNotesData(rhs.CoachNotes);
        }
Beispiel #14
0
        /* was used by the ConNotes, which are now done differently
         * public CtrlTextBox(string strName, VerseControl ctrlVerseParent, ResizableControl ctrlParent, StringTransfer stData,
         *      ThrowIfNotCorrectEditor delegateRequiredEditorCheck, TeamMemberData.UserTypes eRequiredEditor)
         * {
         *      InitComponent();
         *      Font = new Font("Arial Unicode MS", 12);
         *      Name = strName;
         *      stData.SetAssociation(this);
         *      TextChanged += new EventHandler(ctrlParent.textBox_TextChanged);
         *      System.Diagnostics.Debug.Assert(ctrlParent.StageLogic != null);
         *      _stageLogic = ctrlParent.StageLogic;
         *      _ctrlVerseParent = ctrlVerseParent;
         *      _delegateRequiredEditorCheck = delegateRequiredEditorCheck; // call to check if the proper member is logged in!
         *      _eRequiredEditor = eRequiredEditor;
         * }
         */

        public CtrlTextBox(string strName, VerseControl ctrlVerseParent,
                           ResizableControl ctrlParent, StringTransfer stData,
                           ProjectSettings.LanguageInfo li, string strLabel)
        {
            InitComponent();
            Name      = strName;
            _strLabel = strLabel;
            Font      = li.FontToUse;
            ForeColor = li.FontColor;
            if (li.DoRtl)
            {
                RightToLeft = RightToLeft.Yes;
            }
            stData.SetAssociation(this);
            TextChanged += ctrlParent.textBox_TextChanged;
            System.Diagnostics.Debug.Assert(ctrlParent.StageLogic != null);
            _stageLogic      = ctrlParent.StageLogic;
            _ctrlVerseParent = ctrlVerseParent;
            _strKeyboardName = li.Keyboard;
        }
        protected void InitRow(VerseControl ctrlVerse, string strLabelTextFormat,
                               Font font, StringTransfer strRowData, int nTest, ref int nNumRows)
        {
            Label label = new Label
            {
                Anchor   = AnchorStyles.Left,
                AutoSize = true,
                Name     = strLabelTextFormat + nTest,
                Text     = String.Format(strLabelTextFormat, nTest)
            };

            CtrlTextBox tb = new CtrlTextBox(
                strLabelTextFormat + CstrSuffixTextBox + nTest, ctrlVerse, font, this, strRowData,
                label.Text);

            // add the label and tool strip as a new row to the table layout panel
            int nLayoutRow = nNumRows++;

            InsertRow(nLayoutRow);
            tableLayoutPanel.Controls.Add(label, 0, nLayoutRow);
            tableLayoutPanel.Controls.Add(tb, 1, nLayoutRow);
        }
Beispiel #16
0
        public VerseData(NewDataSet.verseRow theVerseRow, NewDataSet projFile)
        {
            guid = theVerseRow.guid;

            if (!theVerseRow.IsfirstNull())
            {
                IsFirstVerse = theVerseRow.first;
            }

            if (!theVerseRow.IsvisibleNull())
            {
                IsVisible = theVerseRow.visible;
            }

            VernacularText      = new StringTransfer((!theVerseRow.IsVernacularNull()) ? theVerseRow.Vernacular : null);
            NationalBTText      = new StringTransfer((!theVerseRow.IsNationalBTNull()) ? theVerseRow.NationalBT : null);
            InternationalBTText = new StringTransfer((!theVerseRow.IsInternationalBTNull()) ? theVerseRow.InternationalBT : null);

            Anchors         = new AnchorsData(theVerseRow, projFile);
            TestQuestions   = new TestQuestionsData(theVerseRow, projFile);
            Retellings      = new RetellingsData(theVerseRow, projFile);
            ConsultantNotes = new ConsultantNotesData(theVerseRow, projFile);
            CoachNotes      = new CoachNotesData(theVerseRow, projFile);
        }
Beispiel #17
0
        protected void InitRow(VerseControl ctrlVerse, string strRowLabel, StringTransfer strRowData, Color clrText,
                               CtrlTextBox.ThrowIfNotCorrectEditor delegateCheckEditor, TeamMemberData.UserTypes eReqEditor, ref int nNumRows)
        {
            int nLayoutRow = nNumRows++;

            Label label = new Label();

            label.Anchor   = AnchorStyles.Left;
            label.AutoSize = true;
            label.Name     = strRowLabel + nNumRows;
            label.Text     = strRowLabel;

            CtrlTextBox tb = new CtrlTextBox(
                strRowLabel + CstrSuffixTextBox + nNumRows,
                ctrlVerse, this, strRowData, delegateCheckEditor, eReqEditor);

            tb.ForeColor = clrText;

            // add the label and tool strip as a new row to the table layout panel
            InsertRow(nLayoutRow);
            tableLayoutPanel.Controls.Add(label, 0, nLayoutRow);
            tableLayoutPanel.SetColumnSpan(tb, 2);
            tableLayoutPanel.Controls.Add(tb, 1, nLayoutRow);
        }
        protected void SetExegeticalHelpControls(VerseControl ctrlVerse,
                                                 ToolStripButton theAnchorButton, Font font, StringTransfer strQuote, ref int nNumRows)
        {
            int nLayoutRow = nNumRows++;

            Label labelExegeticalHelp = new Label
            {
                Anchor   = AnchorStyles.Left,
                AutoSize = true,
                Name     = CstrFieldNameExegeticalHelpLabel + nLayoutRow.ToString(),
                Text     = "cn:"
            };

            CtrlTextBox tb = new CtrlTextBox(
                CstrFieldNameExegeticalHelp + nLayoutRow, ctrlVerse, font, this, strQuote,
                labelExegeticalHelp.Text);

            // add the label and tool strip as a new row to the table layout panel
            InsertRow(nLayoutRow);
            tableLayoutPanel.Controls.Add(labelExegeticalHelp, 0, nLayoutRow);
            tableLayoutPanel.Controls.Add(tb, 1, nLayoutRow);

            // add this row to the list of exe help lines added for this anchor button (so
            //  we can gracefully remove them if the anchor is deleted.
            List <TextBox> lstTBs;

            if (!_mapAnchorsToTextBoxes.TryGetValue(theAnchorButton, out lstTBs))
            {
                lstTBs = new List <TextBox>();
                _mapAnchorsToTextBoxes.Add(theAnchorButton, lstTBs);
            }

            lstTBs.Add(tb);
        }
 public ExegeticalHelpNoteData(ExegeticalHelpNoteData rhs)
 {
     ExegeticalHelpNote = new StringTransfer(rhs.ExegeticalHelpNote.ToString());
 }
 public ExegeticalHelpNoteData(string strInitialText)
 {
     ExegeticalHelpNote = new StringTransfer(strInitialText);
 }
 public ExegeticalHelpNoteData(NewDataSet.exegeticalHelpRow theExHelpNoteRow)
 {
     ExegeticalHelpNote = new StringTransfer(theExHelpNoteRow.exegeticalHelp_Column);
 }
Beispiel #22
0
        public void DoFindNext()
        {
            string strToSearchFor = UpdateComboBox(comboBoxFindWhat);

            if (String.IsNullOrEmpty(strToSearchFor))
            {
                MessageBox.Show(Properties.Resources.IDS_NoSearchString, Properties.Resources.IDS_Caption);
                return;
            }

            if (FindProperties.UseRegex)
            {
                regex = GetRegex(strToSearchFor);
            }
            else
            {
                regex = null;
            }

            int nLastStoryIndex, nLastCtxBoxIndex, nLastCharIndex;

            InitSearchList(ref BoxesToSearch, out nLastStoryIndex, out nLastCtxBoxIndex, out nLastCharIndex);

            CtrlTextBox ctbStopWhereWeStarted = null;
            int         nStoryIndex           = nLastStoryIndex;
            int         nCtxBoxIndex          = nLastCtxBoxIndex;

            while (nStoryIndex < BoxesToSearch.Count)
            {
                StringTransferSearchIndex stsi = BoxesToSearch[nStoryIndex];
                for (; nCtxBoxIndex < stsi.Count; nCtxBoxIndex++)
                {
                    StringTransfer stringTransfer = stsi[nCtxBoxIndex].StringTransfer;
                    if (!stringTransfer.HasData)
                    {
                        continue;
                    }

                    string strValue = stringTransfer.ToString();

                    // check to see if we're wrapped around and are starting
                    //  back at the beginning
                    // note: that it's possible that this stringTransfer
                    //  does not have a TextBox (e.g. if it isn't visible) OR
                    //  if its in the ConNotes panes (which are HTML thingys)
                    CtrlTextBox ctrlTextBox = stringTransfer.TextBox;

                    // get the index *after* the selected text (our starting index
                    //  of the search)
                    int nStartIndex = 0;
                    if (ctrlTextBox != null)
                    {
                        // if the length of the text in the text box is not the same
                        //  length as the text in the StringTransfer, then this
                        //  assumption is probably no good
                        System.Diagnostics.Debug.Assert(ctrlTextBox.TextLength == strValue.Length);

                        if (ctbStopWhereWeStarted == ctrlTextBox)
                        {
                            ShowNotFound();
                            return;
                        }

                        nStartIndex = nLastCharIndex;
                        if (nLastCharIndex != 0)
                        {
                            nLastCharIndex = 0;                             // only do that once
                            ctrlTextBox.Select(0, 0);                       // don't leave it selected
                        }
                    }

                    int nFoundIndex = -1, nLengthToSelect = 0;
                    if (regex != null)
                    {
                        Match match = regex.Match(strValue, nStartIndex);
                        if (match.Success)
                        {
                            nFoundIndex     = match.Index;
                            nLengthToSelect = match.Length;
                        }
                    }
                    else
                    {
                        nFoundIndex     = strValue.IndexOf(strToSearchFor, nStartIndex);
                        nLengthToSelect = strToSearchFor.Length;
                    }

                    if (nFoundIndex != -1)
                    {
                        // found a match!
                        VerseString vs = stsi[nCtxBoxIndex];
                        System.Diagnostics.Debug.Assert(vs.StringTransfer == stringTransfer);
                        TheSE.NavigateTo(stsi.StoryName,
                                         vs.ViewToInsureIsOn,
                                         false,
                                         stringTransfer.TextBox);

                        // The navigation process should make it visible as well.
                        if (stringTransfer.TextBox != null)
                        {
                            stringTransfer.TextBox.Select(nFoundIndex, nLengthToSelect);
                            LastCharIndex = CaptureNextStartingCharIndex(stringTransfer.TextBox);
                        }
                        else if (stringTransfer.HtmlConNoteCtrl != null)
                        {
                            stringTransfer.HtmlConNoteCtrl.SelectFoundText(stringTransfer.HtmlElementId, nFoundIndex,
                                                                           nLengthToSelect);
                            LastCharIndex = nFoundIndex + nLengthToSelect;
                        }

                        LastStoryIndex        = nStoryIndex;
                        LastCtxBoxIndex       = nCtxBoxIndex;
                        buttonReplace.Enabled = true;
                        return;
                    }
                }

                // if we've reached the end of the verses in *this* story...
                if (!FindProperties.SearchAll)
                {
                    // if we were already searching from the beginning...
                    if (nLastCtxBoxIndex == 0)
                    {
                        // ... then we couldn't find it
                        ShowNotFound();
                        return;
                    }

                    // otherwise, see if the user wants to start over from 0
                    if (MessageBox.Show(Properties.Resources.IDS_StartFromBeginning,
                                        Properties.Resources.IDS_Caption, MessageBoxButtons.YesNoCancel) == DialogResult.Yes)
                    {
                        nCtxBoxIndex = 0;

                        // have it stop where we started
                        ctbStopWhereWeStarted = CtrlTextBox._inTextBox ?? stsi[0].StringTransfer.TextBox;
                    }
                    else
                    {
                        return;                         // user said *don't* start over
                    }
                }

                // otherwise, we're supposed to search the next story as well.
                else
                {
                    nStoryIndex++;
                    nCtxBoxIndex = 0;
                }
            }

            // if we reach here, it's because we were searching all the stories
            //  and we reached the end and couldn't find it
            // if we were already searching from the beginning...
            if ((nLastStoryIndex == 0) && (nLastCtxBoxIndex == 0))
            {
                // ... then we couldn't find it
                ShowNotFound();
                return;
            }

            // otherwise, see if the user wants to start over from 0.0
            if (MessageBox.Show(Properties.Resources.IDS_StartFromBeginning,
                                Properties.Resources.IDS_Caption, MessageBoxButtons.YesNoCancel) == DialogResult.Yes)
            {
                LastStoryIndex = LastCtxBoxIndex = LastCharIndex = 0;
                DoFindNext();
            }
        }
Beispiel #23
0
 public VerseString(StringTransfer strStringTransfer,
                    VerseData.ViewItemToInsureOn viewItemToInsureOn)
 {
     StringTransfer   = strStringTransfer;
     ViewToInsureIsOn = viewItemToInsureOn;
 }