コード例 #1
0
        private void LineFlowLayoutPanel_Scroll(object sender, ScrollEventArgs e)
        {
            // if we get a vertical scroll event, and the values are different (i.e.
            //  it's not at the first/last position) and if it's a large change (i.e.
            //  click in the middle of the scroll bar), then...
            if ((e.ScrollOrientation == ScrollOrientation.VerticalScroll) &&
                (e.NewValue != e.OldValue) &&
                ((e.Type == ScrollEventType.LargeDecrement) ||
                 (e.Type == ScrollEventType.LargeIncrement)))
            {
                bool bScrollDown = (e.NewValue > e.OldValue);

                Control ctrlNext;
                if (bScrollDown)
                {
                    ctrlNext = NextControlDown;
                }
                else
                {
                    ctrlNext = NextControlUp;
                }

                if (ctrlNext != null)
                {
                    ScrollControlIntoView(ctrlNext);
                }
            }

            VerseControl ctrlLastNegative = VerseControlJustAboveDisplayRectange;

            SetLineNumberLink(ctrlLastNegative);
        }
コード例 #2
0
        public AnchorControl(VerseControl ctrlVerse, StoryStageLogic storyStageLogic,
                             AnchorsData anAnchorsData, Font font)
            : base(storyStageLogic)
        {
            _ctrlVerse     = ctrlVerse;
            _myAnchorsData = anAnchorsData;
            _font          = font;
            InitializeComponent();

            tableLayoutPanel.SuspendLayout();
            SuspendLayout();

            tableLayoutPanel.Controls.Add(labelAnchor, 0, 0);
            tableLayoutPanel.Controls.Add(toolStripAnchors, 1, 0);

            // add the label and tool strip as a new row to the table layout panel
            // finally populate the buttons on that tool strip
            foreach (AnchorData anAnchorData in anAnchorsData)
            {
                ToolStripButton theAnchorButton = InitAnchorButton(toolStripAnchors, anAnchorData);

                if (anAnchorData.ExegeticalHelpNotes.Count > 0)
                {
                    InitExegeticalHelpsRow(ctrlVerse, theAnchorButton, anAnchorData.ExegeticalHelpNotes, ref m_nNumRows);
                }
            }

            tableLayoutPanel.ResumeLayout(false);
            ResumeLayout(false);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
 private void SetLineNumberLink(VerseControl ctrl)
 {
     if (ctrl != null)
     {
         LineNumberLink.Text = String.Format("Ln: {0}",
                                             ctrl.VerseNumber);
         LineNumberLink.Tag = ctrl.VerseNumber;
     }
 }
コード例 #7
0
 protected void InitExegeticalHelpsRow(VerseControl ctrlVerse,
                                       ToolStripButton theAnchorButton, ExegeticalHelpNotesData anExHelpsNoteData,
                                       ref int nNumRows)
 {
     foreach (ExegeticalHelpNoteData anExHelpNoteData in anExHelpsNoteData)
     {
         SetExegeticalHelpControls(ctrlVerse, theAnchorButton, _font, anExHelpNoteData.ExegeticalHelpNote, ref nNumRows);
     }
 }
コード例 #8
0
        public void DoMouseWheel(MouseEventArgs e)
        {
            // for some reason, the scroll wheel doesn't result in the _Scroll
            //  event being called...
            VerseControl ctrlLastNegative = VerseControlJustAboveDisplayRectange;

            SetLineNumberLink(ctrlLastNegative);

            base.OnMouseWheel(e);
        }
コード例 #9
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);
        }
コード例 #10
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;
 }
コード例 #11
0
        public ConsultNoteControl(VerseControl ctrlVerse, StoryStageLogic storyStageLogic, ConsultNotesDataConverter theCollection,
                                  ConsultNoteDataConverter aCNDC, TeamMemberData.UserTypes eLoggedOnMemberType)
            : base(storyStageLogic)
        {
            _myCNDC       = aCNDC;
            _myCollection = theCollection;

            m_nRoundNum = aCNDC.RoundNum;
            InitializeComponent();

            tableLayoutPanel.SuspendLayout();
            SuspendLayout();

            InsertColumn(2);

            labelRound.Text = CstrRoundLabel + m_nRoundNum.ToString();
            tableLayoutPanel.SetColumnSpan(labelRound, 2);
            tableLayoutPanel.Controls.Add(labelRound, 0, 0);
            tableLayoutPanel.Controls.Add(buttonDragDropHandle, 1, 0);

            System.Diagnostics.Debug.Assert(tableLayoutPanel.RowCount == 1, "otherwise, fix this assumption: ConsultNoteControl.cs.28");

            // finally populate the buttons on that tool strip
            theCollection.InsureExtraBox(aCNDC, eLoggedOnMemberType);
            int nNumRows = 1;

            foreach (CommInstance aCI in aCNDC)
            {
                if ((aCI.Direction == ConsultNoteDataConverter.CommunicationDirections.eConsultantToProjFac) ||
                    (aCI.Direction == ConsultNoteDataConverter.CommunicationDirections.eCoachToConsultant))
                {
                    InitRow(ctrlVerse, aCNDC.MentorLabel, aCI, aCNDC.CommentColor, aCNDC.ThrowIfWrongEditor,
                            aCNDC.MentorRequiredEditor, ref nNumRows);
                }
                else
                {
                    InitRow(ctrlVerse, aCNDC.MenteeLabel, aCI, aCNDC.ResponseColor, aCNDC.ThrowIfWrongEditor,
                            aCNDC.MenteeRequiredEditor, ref nNumRows);
                }
            }

            tableLayoutPanel.ResumeLayout(false);
            ResumeLayout(false);
        }
コード例 #12
0
        public override VerseControl GetControlAtVerseIndex(int nVerseIndex)
        {
            // this used to just be
            // return Controls[((nVerseIndex - 1)*2) + 1]
            // but some verses may be hidden and so it's not so straightforward
            // start at that index (going backwards) and make sure the verse index matches
            for (int i = Math.Min((((nVerseIndex - 1) * 2) + 1), Controls.Count - 2); i >= 0; i -= 2)
            {
                Control ctrl = Controls[i];
                System.Diagnostics.Debug.Assert(ctrl is VerseControl);
                VerseControl ctrlVerse = ctrl as VerseControl;
                if (ctrlVerse.VerseNumber == nVerseIndex)
                {
                    return(ctrlVerse);
                }
            }

            return(null);
        }
コード例 #13
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;
        }
コード例 #14
0
        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);
        }
コード例 #15
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);
        }