示例#1
0
        /// <summary>
        /// Setup the sidebar/info. bar adapter. - from TeMainWnd.cs
        /// </summary>
        private void SetupSideBarInfoBar()
        {
            // Null when running tests.
            if (SIBAdapter == null)
            {
                return;
            }

            SIBAdapter.ItemImageListLarge      = TeResourceHelper.TeSideBarLargeImages;
            SIBAdapter.ItemImageListSmall      = TeResourceHelper.TeSideBarSmallImages;
            SIBAdapter.TabImageList            = TeResourceHelper.TeSideBarTabImages;
            SIBAdapter.LargeIconModeImageIndex = 4;
            SIBAdapter.SmallIconModeImageIndex = 5;

            string cfgMsg     = "SideBarConfigure";
            string cfgText    = TeResourceHelper.GetResourceString("kstidSideBarConfigureItem");
            string fmttooltip = TeResourceHelper.GetResourceString("kstidInfoBarButtonTooltipFormat");

            // Add the scripture tab.
            SBTabProperties tabProps = new SBTabProperties();

            tabProps.Name                       = kScrSBTabName;
            tabProps.Text                       = TeResourceHelper.GetResourceString("kstidScriptureTask");
            tabProps.Message                    = "SideBarTabClicked";
            tabProps.ConfigureMessage           = cfgMsg;
            tabProps.ConfigureMenuText          = cfgText;
            tabProps.InfoBarButtonToolTipFormat = fmttooltip;
            tabProps.ImageIndex                 = 0;
            SIBAdapter.AddTab(tabProps);

            // Add the back translation tab.
            tabProps                            = new SBTabProperties();
            tabProps.Name                       = kBTSBTabName;
            tabProps.Text                       = TeResourceHelper.GetResourceString("kstidBackTransTask");
            tabProps.Message                    = "SideBarTabClicked";
            tabProps.ConfigureMessage           = cfgMsg;
            tabProps.ConfigureMenuText          = cfgText;
            tabProps.InfoBarButtonToolTipFormat = fmttooltip;
            tabProps.ImageIndex                 = 1;
            SIBAdapter.AddTab(tabProps);

            // Add the checking tab.
            tabProps                            = new SBTabProperties();
            tabProps.Name                       = kChkSBTabName;
            tabProps.Text                       = TeResourceHelper.GetResourceString("kstidCheckingTask");
            tabProps.Message                    = "SideBarTabClicked";
            tabProps.ConfigureMessage           = cfgMsg;
            tabProps.ConfigureMenuText          = cfgText;
            tabProps.InfoBarButtonToolTipFormat = fmttooltip;
            tabProps.ImageIndex                 = 2;
            SIBAdapter.AddTab(tabProps);

            // Add the publications tab.
            tabProps                            = new SBTabProperties();
            tabProps.Name                       = kPubSBTabName;
            tabProps.Text                       = TeResourceHelper.GetResourceString("kstidPublicationsTask");
            tabProps.Message                    = "SideBarTabClicked";
            tabProps.ConfigureMessage           = cfgMsg;
            tabProps.ConfigureMenuText          = cfgText;
            tabProps.InfoBarButtonToolTipFormat = fmttooltip;
            tabProps.Enabled                    = false;
            tabProps.ImageIndex                 = 3;
            SIBAdapter.AddTab(tabProps);
        }
示例#2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Initialize this dialog
        /// </summary>
        /// <param name="fParatextMapping"><c>true</c> if a Paratext mapping is being modified;
        /// <c>false</c> otherwise</param>
        /// <param name="mapping">Mapping object being modified</param>
        /// <param name="styleSheet">Stylesheet containing styles that will appear in the list
        /// </param>
        /// <param name="cache">The cache representing the DB connection</param>
        /// <param name="fBackTransDomainLocked">If <c>true</c>, won't allow the user to
        /// check or clear the BT checkbox. If the incoming mapping is for the back translation
        /// and has a domain of either Scripture or Footnote, these two domains remain
        /// enabled so the user can switch between them, but the Notes domain will be
        /// disabled. If the incoming mapping is not for the back translation, then
        /// this only affects the BT checkbox, not the domain options.
        /// </param>
        /// <param name="isAnnotationMapping">If <c>true</c>, forces this mapping to be in the
        /// Annotation domain.</param>
        /// <remarks>We separated this from the constructor so that we can create a mock object
        /// for testing purposes.</remarks>
        /// ------------------------------------------------------------------------------------
        public virtual void Initialize(bool fParatextMapping, ImportMappingInfo mapping,
                                       FwStyleSheet styleSheet, FdoCache cache, bool isAnnotationMapping,
                                       bool fBackTransDomainLocked)
        {
            CheckDisposed();

            m_fParatextMapping = fParatextMapping;
            m_cache            = cache;
            m_scr                        = cache.LangProject.TranslatedScriptureOA;
            m_mapping                    = mapping;
            m_StyleSheet                 = styleSheet;
            m_isAnnotationMapping        = isAnnotationMapping;
            m_fBackTransDomainLocked     = fBackTransDomainLocked;
            m_styleListHelper.StyleSheet = styleSheet as FwStyleSheet;

            //			// if there are items in the styles list and there is not one selected then
            //			// set the first item to be the selected item.
            //			if (lbStyles.SelectedIndex == -1 && lbStyles.Items.Count > 0)
            //				lbStyles.SelectedIndex = 0;

            // Fill in the list selector combo box with the filters for the style list
            // Also set the maximum style level for the style list helper before the
            // style list gets filled in.
            cboList.Items.Clear();
            cboList.Items.Add(TeResourceHelper.GetResourceString("kstidStyleFilterBasic"));
            cboList.Items.Add(TeResourceHelper.GetResourceString("kstidStyleFilterAllStyles"));
            cboList.Items.Add(TeResourceHelper.GetResourceString("kstidStyleFilterCustomList"));

            cboList.SelectedIndex = 1;
            // This code was not completely removed for the highly likely case that
            // it gets put back :)
//			switch (Options.ShowTheseStylesSetting)
//			{
//				case Options.ShowTheseStyles.Basic:
//					cboList.SelectedIndex = 0;
//					m_styleListHelper.MaxStyleLevel = 0;
//					break;
//				case Options.ShowTheseStyles.All:
//					cboList.SelectedIndex = 1;
//					m_styleListHelper.MaxStyleLevel = int.MaxValue;
//					break;
//				case Options.ShowTheseStyles.Custom:
//					cboList.SelectedIndex = 2;
//					m_styleListHelper.MaxStyleLevel = ToolsOptionsDialog.MaxStyleLevel;
//					break;
//			}

            chkBackTranslation.Checked = (mapping.Domain & MarkerDomain.BackTrans) != 0;

            // Check the appropriate button for the domain.  This will cause the
            // style list to be loaded correctly for the domain.
            switch (mapping.Domain & ~MarkerDomain.BackTrans)
            {
            case MarkerDomain.Footnote:
                rbtnFootnotes.Checked = true;
                break;

            case MarkerDomain.Note:
                rbtnNotes.Checked = true;
                break;

            default:
                rbtnScripture.Checked = true;
                break;
            }

            // select the style name and add the handler for style changes.  This needs
            // to be done after setting the domain since that causes the style list to
            // be loaded the first time.
            m_styleListHelper.SelectedStyleName = MappingToUiStylename(mapping);
            m_styleListHelper.StyleChosen      += new StyleChosenHandler(StyleChosen);

            // if the selected mapping is excluded, then check the box
            if (chkExclude.Checked != mapping.IsExcluded)
            {
                chkExclude.Checked = mapping.IsExcluded;
            }
            else
            {
                SetControlStatesBasedOnExcludeCheckBox(null, null);
            }

            cboWritingSys.Items.Clear();
            // Create a fake WS for the "Based on Context" item
            cboWritingSys.Items.Add(new NamedWritingSystem(
                                        TeResourceHelper.GetResourceString("kstidBasedOnContext"), null));
            string initialWritingSystem = string.Empty;

            // Iterate through the available writing systems and add them to the writing systems
            // combo box.
            foreach (NamedWritingSystem nws in cache.LangProject.GetActiveNamedWritingSystems())
            {
                cboWritingSys.Items.Add(nws);

                // If the mapping's ICULocale matches the current writing system's ICULocale,
                // save the string just added to the combo box so we can initialize the
                // combo box's value with it.
                if (mapping.IcuLocale == nws.IcuLocale)
                {
                    initialWritingSystem = nws.ToString();
                }
            }

            // Initialize the combo's value.
            cboWritingSys.SelectedIndex = (initialWritingSystem == string.Empty ?
                                           0 : cboWritingSys.FindString(initialWritingSystem));
        }