ShowHomographNumber() public method

True to display homograph numbers in the default headword method used as the header of an entry in the dictionary and in the program UI. Note that we can only show them in cross-refs if we show them in the main headword. (One reason for this is the design of the dialog, which does not allow to specify before/after if we choose 'hide'.)
public ShowHomographNumber ( HeadwordVariant hv ) : bool
hv HeadwordVariant
return bool
		protected string m_helpTopic = ""; // Default help topic ID


		public void SetupDialog(HomographConfiguration hc, FdoCache cache, FwStyleSheet stylesheet, IApp app,
			IHelpTopicProvider helpTopicProvider)
		{
			SetHelpTopic("khtpConfigureHomograph"); // Default help topic ID
			m_helpProvider = new HelpProvider();
			m_helpProvider.SetHelpNavigator(this, HelpNavigator.Topic);
			m_helpProvider.SetShowHelp(this, true);

			m_cache = cache;
			m_stylesheet = stylesheet;
			m_app = app;
			m_helpTopicProvider = helpTopicProvider;
			if (m_helpTopicProvider != null)
			{
				m_helpProvider.HelpNamespace = m_helpTopicProvider.HelpFile;
				SetHelpButtonEnabled();
			}

			if (hc.ShowHomographNumber(HomographConfiguration.HeadwordVariant.Main))
			{
				m_radioHide.Checked = false;
				m_radioBefore.Checked = hc.HomographNumberBefore;
				m_radioAfter.Checked = !hc.HomographNumberBefore;
				m_chkShowSenseNumInDict.Checked = hc.ShowSenseNumberRef;
				m_chkShowSenseNumInReversal.Checked = hc.ShowSenseNumberReversal;
			}
			else
			{
				m_radioHide.Checked = true;
				m_radioBefore.Checked = false;
				m_radioAfter.Checked = false;
				m_chkShowSenseNumInDict.Checked = false;
				m_chkShowSenseNumInReversal.Checked = false;
			}
			m_chkShowHomographNumInDict.Checked =
				hc.ShowHomographNumber(HomographConfiguration.HeadwordVariant.DictionaryCrossRef);
			m_chkShowHomographNumInReversal.Checked =
				hc.ShowHomographNumber(HomographConfiguration.HeadwordVariant.ReversalCrossRef);
			EnableControls();
		}
		public void PersistData()
		{
			var hc = new HomographConfiguration();
			Assert.That(hc.PersistData, Is.EqualTo(""));
			hc.HomographNumberBefore = true;
			hc.ShowSenseNumberRef = false;
			Assert.That(hc.PersistData, Is.EqualTo("before snRef "));
			var hc2 = new HomographConfiguration();
			hc2.PersistData = hc.PersistData;
			Assert.That(hc2.ShowSenseNumberRef, Is.False);
			Assert.That(hc2.HomographNumberBefore, Is.True);
			Assert.That(hc2.ShowSenseNumberReversal, Is.True);

			hc.SetShowHomographNumber(HomographConfiguration.HeadwordVariant.Main, false);
			hc2.PersistData = hc.PersistData;
			Assert.That(hc2.ShowHomographNumber(HomographConfiguration.HeadwordVariant.Main), Is.False);
			Assert.That(hc2.HomographNumberBefore, Is.False);

			hc.SetShowHomographNumber(HomographConfiguration.HeadwordVariant.Main, true);
			hc.SetShowHomographNumber(HomographConfiguration.HeadwordVariant.DictionaryCrossRef, false);
			hc2.PersistData = hc.PersistData;
			Assert.That(hc2.ShowHomographNumber(HomographConfiguration.HeadwordVariant.Main), Is.True);
			Assert.That(hc2.ShowHomographNumber(HomographConfiguration.HeadwordVariant.DictionaryCrossRef), Is.False);
			Assert.That(hc2.ShowHomographNumber(HomographConfiguration.HeadwordVariant.ReversalCrossRef), Is.True);

			hc.SetShowHomographNumber(HomographConfiguration.HeadwordVariant.ReversalCrossRef, false);
			hc2.PersistData = hc.PersistData;
			Assert.That(hc2.ShowHomographNumber(HomographConfiguration.HeadwordVariant.Main), Is.True);
			Assert.That(hc2.ShowHomographNumber(HomographConfiguration.HeadwordVariant.DictionaryCrossRef), Is.False);
			Assert.That(hc2.ShowHomographNumber(HomographConfiguration.HeadwordVariant.ReversalCrossRef), Is.False);

			hc.SetShowHomographNumber(HomographConfiguration.HeadwordVariant.DictionaryCrossRef, true);
			hc2.PersistData = hc.PersistData;
			Assert.That(hc2.ShowHomographNumber(HomographConfiguration.HeadwordVariant.Main), Is.True);
			Assert.That(hc2.ShowHomographNumber(HomographConfiguration.HeadwordVariant.DictionaryCrossRef), Is.True);
			Assert.That(hc2.ShowHomographNumber(HomographConfiguration.HeadwordVariant.ReversalCrossRef), Is.False);

			hc.ShowSenseNumberRef = true;
			hc.ShowSenseNumberReversal = false;
			hc2.PersistData = hc.PersistData;
			Assert.That(hc2.ShowSenseNumberRef, Is.True);
			Assert.That(hc2.ShowSenseNumberReversal, Is.False);
		}
Example #3
0
		private static void InsertHomographNumber(ITsIncStrBldr tisb, int nHomograph, HomographConfiguration hc,
			HomographConfiguration.HeadwordVariant hv)
		{
			if (nHomograph > 0 && hc.ShowHomographNumber(hv))
			{
				tisb.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, HomographConfiguration.ksHomographNumberStyle);
				tisb.Append(nHomograph.ToString());
				tisb.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, null);
			}
		}