public TestingQuestionControl(StoryEditor theSE, VerseBtControl ctrlVerse,
                                      TestQuestionData aTQData, bool bShowHeader)
            : base(theSE.theCurrentStory.ProjStage)
        {
            _aTQData = aTQData;

            InitializeComponent();

            tableLayoutPanel.SuspendLayout();
            SuspendLayout();

            // clobber the base class table layout panel's configuration. We're 'column-oriented' instead
            // first add another row so that we have two rows (row(0)=label, row(1)=text)
            System.Diagnostics.Debug.Assert(tableLayoutPanel.RowCount == 1, "otherwise, adjust assumption here: TestingQuestionControl.cs.34");
            InsertRow(1);

            // remove all but the left-most (autosize) column, because we're going to add them back as equal sizes.
            while (tableLayoutPanel.ColumnCount > 1)
            {
                RemoveColumn(tableLayoutPanel.ColumnCount - 1);
            }

            // show the row label
            Label label = new Label
            {
                Anchor   = AnchorStyles.Left,
                AutoSize = true,
                Name     = CstrFieldNameTestQuestionsLabel,
                Text     = CstrTestQuestionsLabelFormat
            };

            tableLayoutPanel.Controls.Add(label, 0, 1);

            int nNumColumns = 1;

            // insert the vernacular representation of the testing question
            if (theSE.viewVernacularLangFieldMenuItem.Checked)
            {
                InsertColumn(nNumColumns);
                if (bShowHeader)
                {
                    InitColumnLabel(theSE.StoryProject.ProjSettings.Vernacular.LangName, nNumColumns);
                }
                _aTQData.QuestionVernacular.Transliterator = ctrlVerse.TransliteratorVernacular;
                InitTextBox(ctrlVerse, CstrFieldNameVernacular, _aTQData.QuestionVernacular,
                            theSE.StoryProject.ProjSettings.Vernacular, nNumColumns);
                nNumColumns++;
            }

            // the only time we show the National BT is if there's an "other" English BTr (who will
            //  do the EnglishBT from the NationalBT) OR there's no vernacular
            if (theSE.StoryProject.ProjSettings.NationalBT.HasData &&
                (theSE.StoryProject.TeamMembers.HasOutsideEnglishBTer ||
                 (theSE.viewNationalLangFieldMenuItem.Checked && !theSE.StoryProject.ProjSettings.Vernacular.HasData)))
            {
                InsertColumn(nNumColumns);
                if (bShowHeader)
                {
                    InitColumnLabel(theSE.StoryProject.ProjSettings.NationalBT.LangName, nNumColumns);
                }
                _aTQData.QuestionNationalBT.Transliterator = ctrlVerse.TransliteratorNationalBT;
                InitTextBox(ctrlVerse, CstrFieldNameNationalBt, _aTQData.QuestionNationalBT,
                            theSE.StoryProject.ProjSettings.NationalBT, nNumColumns);
                nNumColumns++;
            }

            if (theSE.viewEnglishBTFieldMenuItem.Checked &&
                (!theSE.StoryProject.TeamMembers.HasOutsideEnglishBTer ||
                 (StageLogic.MemberTypeWithEditToken !=
                  TeamMemberData.UserTypes.eProjectFacilitator) ||
                 (theSE.LoggedOnMember.MemberType != TeamMemberData.UserTypes.eProjectFacilitator)))
            {
                InsertColumn(nNumColumns);
                if (bShowHeader)
                {
                    InitColumnLabel(theSE.StoryProject.ProjSettings.InternationalBT.LangName, nNumColumns);
                }
                InitTextBox(ctrlVerse, CstrFieldNameVernacular, _aTQData.QuestionInternationalBT,
                            theSE.StoryProject.ProjSettings.InternationalBT, nNumColumns);
                nNumColumns++;
            }

            // add a row so we can display a multiple line control with the answers
            if ((_aTQData.Answers != null) && (_aTQData.Answers.Count > 0))
            {
                System.Diagnostics.Debug.Assert(theSE.theCurrentStory.CraftingInfo.Testors.Count >= _aTQData.Answers.Count);
                MultiLineControl aAnswersCtrl = new MultiLineControl(ctrlVerse, StageLogic,
                                                                     _aTQData.Answers, theSE.StoryProject.ProjSettings.InternationalBT.FontToUse,
                                                                     theSE.theCurrentStory.CraftingInfo.Testors);
                aAnswersCtrl.Name          = CstrFieldNameAnswers;
                aAnswersCtrl.ParentControl = this;

                const int nLayoutRow = 2;
                InsertRow(nLayoutRow);
                if (nNumColumns > 2)
                {
                    tableLayoutPanel.SetColumnSpan(aAnswersCtrl, nNumColumns - 1);
                }
                tableLayoutPanel.Controls.Add(aAnswersCtrl, 1, nLayoutRow);
                tableLayoutPanel.DumpTable();
            }

            tableLayoutPanel.ResumeLayout(false);
            ResumeLayout(false);
        }
Exemplo n.º 2
0
        public StoryLineControl(StoryEditor aSE, VerseBtControl ctrlVerse, VerseData aVerseData)
            : base(aSE.theCurrentStory.ProjStage)
        {
            InitializeComponent();

            tableLayoutPanel.SuspendLayout();
            SuspendLayout();

            _aVerseData = aVerseData;

            // clobber the base class table layout panel's configuration. We're 'column-oriented' instead
            // first add another row so that we have two rows (row(0)=label, row(1)=text)
            System.Diagnostics.Debug.Assert(tableLayoutPanel.RowCount == 1, "otherwise, adjust assumption here: StoryLineControl.cs.30");
            InsertRow(1);

            // remove the columns, because we're going to add them back as equal sizes.
            while (tableLayoutPanel.ColumnCount > 0)
            {
                RemoveColumn(tableLayoutPanel.ColumnCount - 1);
            }

            int nNumColumns = 0;

            if (aSE.viewVernacularLangFieldMenuItem.Checked)
            {
                InsertColumn(nNumColumns);
                if (ctrlVerse.VerseNumber == 1)
                {
                    InitLabel(aSE.StoryProject.ProjSettings.Vernacular.LangName, nNumColumns);
                }

                // if we're in the one of the states where the user is entering in the
                //  national or international BT, then disable the Vernacular as a tab stop.
                bool bDisableTabStopVernacular =
                    ((aSE.theCurrentStory.ProjStage.ProjectStage == StoryStageLogic.ProjectStages.eProjFacTypeNationalBT) ||
                     (aSE.theCurrentStory.ProjStage.ProjectStage == StoryStageLogic.ProjectStages.eProjFacTypeInternationalBT) ||
                     (aSE.theCurrentStory.ProjStage.ProjectStage == StoryStageLogic.ProjectStages.eBackTranslatorTypeInternationalBT));

                _aVerseData.VernacularText.Transliterator = ctrlVerse.TransliteratorVernacular;
                InitTextBox(ctrlVerse, CstrFieldNameVernacular, _aVerseData.VernacularText,
                            aSE.StoryProject.ProjSettings.Vernacular, bDisableTabStopVernacular,
                            nNumColumns);
                nNumColumns++;
            }

            if (aSE.viewNationalLangFieldMenuItem.Checked)
            {
                InsertColumn(nNumColumns);
                if (ctrlVerse.VerseNumber == 1)
                {
                    InitLabel(aSE.StoryProject.ProjSettings.NationalBT.LangName, nNumColumns);
                }

                // if we're in the one of the states where the user is entering in the
                //  international BT, then disable the National BT as a tab stop.
                bool bDisableTabStopNationalBT =
                    ((aSE.theCurrentStory.ProjStage.ProjectStage == StoryStageLogic.ProjectStages.eProjFacTypeInternationalBT) ||
                     (aSE.theCurrentStory.ProjStage.ProjectStage == StoryStageLogic.ProjectStages.eBackTranslatorTypeInternationalBT));

                _aVerseData.NationalBTText.Transliterator = ctrlVerse.TransliteratorNationalBT;
                InitTextBox(ctrlVerse, CstrFieldNameNationalBt, _aVerseData.NationalBTText,
                            aSE.StoryProject.ProjSettings.NationalBT, bDisableTabStopNationalBT,
                            nNumColumns);

                nNumColumns++;
            }

            if (aSE.viewEnglishBTFieldMenuItem.Checked)
            {
                InsertColumn(nNumColumns);
                if (ctrlVerse.VerseNumber == 1)
                {
                    InitLabel(aSE.StoryProject.ProjSettings.InternationalBT.LangName, nNumColumns);
                }

                InitTextBox(ctrlVerse, CstrFieldNameInternationalBt, _aVerseData.InternationalBTText,
                            aSE.StoryProject.ProjSettings.InternationalBT, false, nNumColumns);
                nNumColumns++;
            }

            tableLayoutPanel.ResumeLayout(false);
            ResumeLayout(false);
        }