View constructor for InterlinView. Just to get something working, currently it is just a literal.
Inheritance: SIL.FieldWorks.Common.RootSites.FwBaseVc, IDisposable
Ejemplo n.º 1
0
		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		/// -----------------------------------------------------------------------------------
		protected override void Dispose(bool disposing)
		{
			//Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
			// Must not be run more than once.
			if (IsDisposed)
				return;

			base.Dispose(disposing);

			if (disposing)
			{
				//RightMouseClickedEvent -= new FwRightMouseClickEventHandler(InterlinDocChild_RightMouseClickedEvent);
				if (m_tryAWordSandbox != null)
				{
					if (!Controls.Contains(m_tryAWordSandbox))
						m_tryAWordSandbox.Dispose();
				}
				if (m_vc != null)
					m_vc.Dispose();
			}
			m_tryAWordSandbox = null;
			m_vc = null;
			m_wordform = null;
			m_msaHvoList = null;
			m_sWordForm = null;
		}
Ejemplo n.º 2
0
		protected InterlinearExporter(FdoCache cache, XmlWriter writer, ICmObject objRoot,
			InterlinLineChoices lineChoices, InterlinVc vc)
			: base(null, cache.MainCacheAccessor, objRoot.Hvo)
		{
			m_cache = cache;
			m_writer = writer;
			m_flidStTextTitle = m_cache.MetaDataCacheAccessor.GetFieldId("StText", "Title", false);
			m_flidStTextSource = m_cache.MetaDataCacheAccessor.GetFieldId("StText", "Source", false);
			m_vc = vc;
			SetTextTitleAndMetadata(objRoot as IStText);

			// Get morphtype information that we need later.  (plus stuff we don't...)  See LT-8288.
			IMoMorphType mmtStem;
			IMoMorphType mmtPrefix;
			IMoMorphType mmtSuffix;
			IMoMorphType mmtInfix;
			IMoMorphType mmtBoundStem;
			IMoMorphType mmtSimulfix;
			IMoMorphType mmtSuprafix;
			m_cache.ServiceLocator.GetInstance<IMoMorphTypeRepository>().GetMajorMorphTypes(
				out mmtStem, out mmtPrefix, out mmtSuffix, out mmtInfix,
				out mmtBoundStem, out m_mmtProclitic, out m_mmtEnclitic,
				out mmtSimulfix, out mmtSuprafix);

			m_wsManager = m_cache.ServiceLocator.WritingSystemManager;
			m_repoObj = m_cache.ServiceLocator.GetInstance<ICmObjectRepository>();
		}
Ejemplo n.º 3
0
		protected InterlinearExporter(FdoCache cache, XmlWriter writer, int hvoRoot, InterlinLineChoices lineChoices, InterlinVc vc, ITsString tssTextName, ITsString tssTextAbbreviation)
			: base(null, cache.MainCacheAccessor, hvoRoot)
		{
			m_cache = cache;
			m_writer = writer;
			ktagParaSegments = InterlinVc.ParaSegmentTag(cache);
			ktagSegmentForms = InterlinVc.SegmentFormsTag(cache);
			m_flidStringValue = CmBaseAnnotation.StringValuePropId(cache);
			m_lineChoices = lineChoices;
			m_defaultGlossVirtFlid = BaseVirtualHandler.GetInstalledHandlerTag(m_cache, "WfiMorphBundle", "DefaultSense");
			m_vc = vc;
			m_tssPendingTitle = tssTextName;
			m_tssTitleAbbreviation = tssTextAbbreviation;

			// Get morphtype information that we need later.  (plus stuff we don't...)  See LT-8288.
			IMoMorphType mmtStem;
			IMoMorphType mmtPrefix;
			IMoMorphType mmtSuffix;
			IMoMorphType mmtInfix;
			IMoMorphType mmtBoundStem;
			IMoMorphType mmtSimulfix;
			IMoMorphType mmtSuprafix;
			MoMorphType.GetMajorMorphTypes(cache, out mmtStem, out mmtPrefix, out mmtSuffix, out mmtInfix,
				out mmtBoundStem, out m_mmtProclitic, out m_mmtEnclitic, out mmtSimulfix, out mmtSuprafix);
		}
Ejemplo n.º 4
0
		public override void FixtureSetup()
		{
			CheckDisposed();
			base.FixtureSetup();

			m_textsDefn = new XmlDocument();
			m_exportedXml = new XmlDocument();

			InstallVirtuals(@"Language Explorer\Configuration\Main.xml",
				new string[] { "SIL.FieldWorks.FDO.", "SIL.FieldWorks.IText." });
			m_vc = new InterlinVc(Cache);
		}
Ejemplo n.º 5
0
		public static InterlinearExporter Create(string mode, FdoCache cache, XmlWriter writer, ICmObject objRoot,
			InterlinLineChoices lineChoices, InterlinVc vc)
		{
			if (mode != null && mode.ToLowerInvariant() == "elan")
			{
				return new InterlinearExporterForElan(cache, writer, objRoot, lineChoices, vc);
			}
			else
			{
				return new InterlinearExporter(cache, writer, objRoot, lineChoices, vc);
			}
		}
Ejemplo n.º 6
0
		public InterlinearExportDialog(Mediator mediator, ICmObject objRoot, InterlinVc vc, IBookImporter bookImporter)
			: base(mediator)
		{
			m_objRoot = objRoot;
			m_vc = vc;
			m_bookImporter = bookImporter;

			m_helpTopic = "khtpExportInterlinear";
			columnHeader1.Text = ITextStrings.ksFormat;
			columnHeader2.Text = ITextStrings.ksExtension;
			Text = ITextStrings.ksExportInterlinear;
			OnLaunchFilterScrScriptureSectionsDialog += LaunchFilterTextsDialog;
		}
Ejemplo n.º 7
0
		public static InterlinearExporter Create(string mode, FdoCache cache, XmlWriter writer, int hvoRoot,
			InterlinLineChoices lineChoices, InterlinVc vc, ITsString tssTextName, ITsString tssTextAbbreviation)
		{
			if (mode != null && mode.ToLowerInvariant() == "elan")
			{
				return new InterlinearExporterForElan(cache, writer, hvoRoot, lineChoices, vc, tssTextName,
													  tssTextAbbreviation);
			}
			else
			{
				return new InterlinearExporter(cache, writer, hvoRoot, lineChoices, vc, tssTextName, tssTextAbbreviation);
			}
		}
Ejemplo n.º 8
0
		public InterlinearExportDialog(Mediator mediator, int hvoRoot, InterlinVc vc, List<int> scrHvos)
			: base(mediator)
		{
			m_hvoRoot = hvoRoot;
			m_vc = vc;
			m_scrHvos = scrHvos;

			m_helpTopic = "khtpExportInterlinear";
			columnHeader1.Text = ITextStrings.ksFormat;
			columnHeader2.Text = ITextStrings.ksExtension;
			GetTextProps();
			Text = ITextStrings.ksExportInterlinear;
			if (MiscUtils.IsTEInstalled)
				OnLaunchFilterScrScriptureSectionsDialog += new EventHandler(LaunchFilterScrScriptureSectionsDialog);
		}
Ejemplo n.º 9
0
		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		/// -----------------------------------------------------------------------------------
		protected override void Dispose(bool disposing)
		{
			//Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
			// Must not be run more than once.
			if (IsDisposed)
				return;

			if (disposing)
			{
				if (m_oneAnalSandbox != null)
				{
					m_oneAnalSandbox.SizeChanged -= HandleSandboxSizeChanged;
				}
			}

			base.Dispose(disposing);

			if (disposing)
			{
				if (m_oneAnalSandbox != null)
				{
					m_oneAnalSandbox.Dispose();
				}
				if (m_vc != null)
					m_vc.Dispose();
			}
			m_oneAnalSandbox = null;
			m_vc = null;
			m_configurationNode = null;
			m_wordform = null;
			m_wfiAnalysis = null;
		}
Ejemplo n.º 10
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Executes in two distinct scenarios.
		///
		/// 1. If disposing is true, the method has been called directly
		/// or indirectly by a user's code via the Dispose method.
		/// Both managed and unmanaged resources can be disposed.
		///
		/// 2. If disposing is false, the method has been called by the
		/// runtime from inside the finalizer and you should not reference (access)
		/// other managed objects, as they already have been garbage collected.
		/// Only unmanaged resources can be disposed.
		/// </summary>
		/// <param name="disposing"></param>
		/// <remarks>
		/// If any exceptions are thrown, that is fine.
		/// If the method is being done in a finalizer, it will be ignored.
		/// If it is thrown by client code calling Dispose,
		/// it needs to be handled by fixing the bug.
		///
		/// If subclasses override this method, they should call the base implementation.
		/// </remarks>
		/// ------------------------------------------------------------------------------------
		protected override void Dispose(bool disposing)
		{
			//Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
			// Must not be run more than once.
			if (IsDisposed)
				return;

			if (disposing)
			{
				// Dispose managed resources here.
				if (m_vc != null)
					m_vc.Dispose();
				if (m_writer != null)
					m_writer.Close();
				if (m_stream != null)
					m_stream.Close();
			}

			// Dispose unmanaged resources here, whether disposing is true or false.
			m_vc = null;
			m_textsDefn = null;
			m_text1 = null;
			m_exportedXml = null;
			m_writer = null;
			m_exporter = null;
			m_choices = null;
			m_stream = null;

			base.Dispose(disposing);
		}
Ejemplo n.º 11
0
		protected internal InterlinearExporterForElan(FdoCache cache, XmlWriter writer, int hvoRoot, InterlinLineChoices lineChoices, InterlinVc vc, ITsString tssTextName, ITsString tssTextAbbreviation)
			: base(cache, writer, hvoRoot, lineChoices, vc, tssTextName, tssTextAbbreviation)
		{
			kPunctuationAnnType = CmAnnotationDefn.Punctuation(cache).Hvo;
		}
Ejemplo n.º 12
0
			public DisplayWordBundleMethod(IVwEnv vwenv1, AnalysisOccurrence analysisOccurrence, InterlinVc owner)
				: this(vwenv1, analysisOccurrence.Analysis.Hvo, owner)
			{
				m_analysisOccurrence = analysisOccurrence;
			}
Ejemplo n.º 13
0
			private DisplayWordBundleMethod(IVwEnv vwenv1, int hvoWordBundleAnalysis, InterlinVc owner)
			{
				m_vwenv = vwenv1;
				m_hvoWordBundleAnalysis = hvoWordBundleAnalysis;
				m_this = owner;
				m_cache = m_this.m_cache;
				m_choices = m_this.LineChoices;
			}
Ejemplo n.º 14
0
		internal static bool TryGetLexGlossWithInflTypeTss(ILexEntry possibleVariant, ILexSense sense, InterlinLineSpec spec, InterlinLineChoices lineChoices, int vernWsContext, ILexEntryInflType inflType, out ITsString result)
		{
			FdoCache cache = possibleVariant.Cache;
			using (var vcLexGlossFrag = new InterlinVc(cache))
			{
				vcLexGlossFrag.LineChoices = lineChoices;
				vcLexGlossFrag.PreferredVernWs = vernWsContext;


				result = null;
				var collector = new TsStringCollectorEnv(null, vcLexGlossFrag.Cache.MainCacheAccessor,
														 possibleVariant.Hvo)
									{
										RequestAppendSpaceForFirstWordInNewParagraph = false
									};
				if (vcLexGlossFrag.DisplayLexGlossWithInflType(collector, possibleVariant, sense, spec, inflType))
				{
					result = collector.Result;
					return true;
				}
				return false;
			}
		}
Ejemplo n.º 15
0
		protected internal InterlinearExporterForElan(FdoCache cache, XmlWriter writer, ICmObject objRoot,
			InterlinLineChoices lineChoices, InterlinVc vc)
			: base(cache, writer, objRoot, lineChoices, vc)
		{
		}
Ejemplo n.º 16
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Make the root box.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public override void MakeRoot()
		{
			CheckDisposed();

			if (m_fdoCache == null || DesignMode)
				return;

			m_rootb = VwRootBoxClass.Create();
			m_rootb.SetSite(this);

			m_vc = new InterlinVc(m_fdoCache);
			// Theory has it that the slices that have 'true' in this attribute will allow the sandbox to be used.
			// We'll see how the theory goes, when I get to the point of wanting to see the sandbox.
			m_vc.ShowMorphBundles = true;
			m_vc.ShowDefaultSense = true;

			m_vc.LineChoices = new EditableInterlinLineChoices(m_fdoCache.LanguageProject, WritingSystemServices.kwsFirstVern,
				m_fdoCache.DefaultAnalWs);
			m_vc.LineChoices.Add(InterlinLineChoices.kflidWord); // 1
			m_vc.LineChoices.Add(InterlinLineChoices.kflidMorphemes); // 2
			m_vc.LineChoices.Add(InterlinLineChoices.kflidLexEntries); //3
			m_vc.LineChoices.Add(InterlinLineChoices.kflidLexGloss); //4
			m_vc.LineChoices.Add(InterlinLineChoices.kflidLexPos); //5

			m_rootb.DataAccess = m_fdoCache.MainCacheAccessor;
			FixWs(); // AFTER setting DA!

			if (m_wordform != null)
				m_rootb.SetRootObject(m_wordform.Hvo, m_vc, m_kfragSingleInterlinearAnalysisWithLabels, m_styleSheet);

			base.MakeRoot();

			SetSandboxSize(); // in case we already have a current annotation.
			SetBackgroundColor();
			m_fRootMade = true;
		}
Ejemplo n.º 17
0
		internal FreeformAdder(int hvoType, RootSite site, bool fNeedReconstruct, InterlinVc vc) : base(site.Cache)
		{
			m_hvoType = hvoType;
			m_site = site;
			m_fNeedReconstruct = fNeedReconstruct;
			m_choices = vc.LineChoices;
			m_vc = vc;
		}
Ejemplo n.º 18
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Make the root box.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public override void MakeRoot()
		{
			CheckDisposed();

			if (m_fdoCache == null || DesignMode || m_wfiAnalysis == null)
				return;

			m_rootb = VwRootBoxClass.Create();
			m_rootb.SetSite(this);

			m_vc = new InterlinVc(m_fdoCache);
			// Theory has it that the slices that have 'true' in this attribute will allow the sandbox to be used.
			// We'll see how the theory goes, when I get to the point of wanting to see the sandbox.
			var isEditable = IsEditable;
			m_vc.ShowMorphBundles = true;
			m_vc.ShowDefaultSense = true;
			if ((m_wfiAnalysis.GetAgentOpinion(m_fdoCache.LanguageProject.DefaultParserAgent) == Opinions.approves)
				&& (m_wfiAnalysis.GetAgentOpinion(m_fdoCache.LanguageProject.DefaultUserAgent) != Opinions.approves))
			{
				m_vc.UsingGuess = true;
			}

			// JohnT: kwsVernInParagraph is rather weird here, where we don't have a paragraph, but it allows the
			// VC to deduce the WS of the wordform, not from the paragraph, but from the best vern WS of the wordform itself.
			if (isEditable)
				m_vc.LineChoices = new EditableInterlinLineChoices(m_fdoCache.LanguageProject, WritingSystemServices.kwsVernInParagraph,
					m_fdoCache.DefaultAnalWs);
			else
				m_vc.LineChoices = new InterlinLineChoices(m_fdoCache.LanguageProject, WritingSystemServices.kwsVernInParagraph,
					m_fdoCache.DefaultAnalWs);
			m_vc.LineChoices.Add(InterlinLineChoices.kflidMorphemes); // 1
			m_vc.LineChoices.Add(InterlinLineChoices.kflidLexEntries); //2
			m_vc.LineChoices.Add(InterlinLineChoices.kflidLexGloss); //3
			m_vc.LineChoices.Add(InterlinLineChoices.kflidLexPos); //4

			m_rootb.DataAccess = m_fdoCache.MainCacheAccessor;
			FixWs(); // AFTER setting DA!

			const int selectorId = InterlinVc.kfragSingleInterlinearAnalysisWithLabelsLeftAlign;
			m_rootb.SetRootObject(m_wfiAnalysis.Hvo, m_vc, selectorId, m_styleSheet);

			base.MakeRoot();

			if (!IsEditable)
				return;

			m_oneAnalSandbox = new OneAnalysisSandbox(m_fdoCache,
													  Mediator,
													  StyleSheet,
													  m_vc.LineChoices,
													  m_wfiAnalysis.Hvo)
								{
									Visible = false
								};
			Controls.Add(m_oneAnalSandbox);
			if (m_oneAnalSandbox.RootBox == null)
				m_oneAnalSandbox.MakeRoot();	// adding sandbox to Controls doesn't make rootbox.
			InitSandbox();
			m_oneAnalSandbox.SizeChanged += (HandleSandboxSizeChanged);
			if (m_fSliceIsCurrent)
				TurnOnSandbox();
		}
Ejemplo n.º 19
0
		/// <summary>
		/// Pull this out into a separate method so InterlinPrintChild can make an InterlinPrintVc.
		/// And so InterlinTaggingChild can make an InterlinTaggingVc.
		/// </summary>
		protected virtual void MakeVc()
		{
			m_vc = new InterlinVc(m_fdoCache);
		}
Ejemplo n.º 20
0
		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		/// -----------------------------------------------------------------------------------
		protected override void Dispose(bool disposing)
		{
			//Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
			// Must not be run more than once.
			if (IsDisposed)
				return;

			// Do this, before calling base.
			// m_sda COM object block removed due to crash in Finializer thread LT-6124

			if (disposing)
			{
				// Do this, before calling base.
				if (m_sda != null)
					m_sda.RemoveNotification(this);

				RightMouseClickedEvent -= new FwRightMouseClickEventHandler(InterlinDocChild_RightMouseClickedEvent);

				// make sure we're not visible, so we don't end up processing OnVisibleChanged
				// during base.Dispose();
				this.Visible = false;
				DisposeFtMonitor();
			}

			base.Dispose(disposing);

			if (disposing)
			{
				// This is actually harmful to do, because the InterlinDocChild does not yet know it is
				// Disposing, and tries to Layout when the Sandbox is removed from its child list,
				// and tries to recreate its handle and root box, and eventually crashes.
				// RandyR: I don't think it will be harmful in this new context.
				if (m_focusBoxController != null)
				{
					m_focusBoxController.Resize -= new EventHandler(m_focusBox_Resize);

					if (!Controls.Contains(FocusBox))
						FocusBox.Dispose();
				}

				if (m_vc != null)
					m_vc.Dispose();
			}
			m_sda = null;
			m_focusBoxController = null;
			m_vc = null;
		}
Ejemplo n.º 21
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Make the root box.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public override void MakeRoot()
		{
			CheckDisposed();

			if (m_fdoCache == null || DesignMode)
				return;

			m_rootb = VwRootBoxClass.Create();
			m_rootb.SetSite(this);

			m_vc = new InterlinVc(m_fdoCache);
			// Theory has it that the slices that have 'true' in this attribute will allow the sandbox to be used.
			// We'll see how the theory goes, when I get to the point of wanting to see the sandbox.
			bool isEditable = IsEditable;
			m_vc.ShowMorphBundles = true;
			m_vc.ShowDefaultSense = true;
			// JohnT: kwsVernInParagraph is rather weird here, where we don't have a paragraph, but it allows the
			// VC to deduce the WS of the wordform, not from the paragraph, but from the best vern WS of the wordform itself.
			if (isEditable)
				m_vc.LineChoices = new EditableInterlinLineChoices(LangProject.kwsVernInParagraph, m_fdoCache.DefaultAnalWs);
			else
				m_vc.LineChoices = new InterlinLineChoices(LangProject.kwsVernInParagraph, m_fdoCache.DefaultAnalWs);
			m_vc.LineChoices.Add(InterlinLineChoices.kflidMorphemes); // 1
			m_vc.LineChoices.Add(InterlinLineChoices.kflidLexEntries); //2
			m_vc.LineChoices.Add(InterlinLineChoices.kflidLexGloss); //3
			m_vc.LineChoices.Add(InterlinLineChoices.kflidLexPos); //4

			m_rootb.DataAccess = m_fdoCache.MainCacheAccessor;
			FixWs(); // AFTER setting DA!

			int selectorId = 100034; //Convert.ToInt32(XmlUtils.GetManditoryAttributeValue(m_configurationNode.SelectSingleNode("deParams"), "selector"));
			if (m_hvoWfiAnalysis != 0)
				m_rootb.SetRootObject(m_hvoWfiAnalysis, m_vc, selectorId, m_styleSheet);

			base.MakeRoot();

			if (IsEditable)
			{
				m_oneAnalSandbox = new OneAnalysisSandbox(m_fdoCache,
					Mediator,
					StyleSheet,
					m_vc.LineChoices,
					m_hvoWfiAnalysis);
				m_oneAnalSandbox.Visible = false;
				Controls.Add(m_oneAnalSandbox);
				if (m_oneAnalSandbox.RootBox == null)
					m_oneAnalSandbox.MakeRoot();	// adding sandbox to Controls doesn't make rootbox.
				m_tag = MeVirtualHandler.InstallMe(Cache.VwCacheDaAccessor).Tag;
				InitSandbox();
				m_oneAnalSandbox.SizeChanged += (HandleSandboxSizeChanged);
			}
		}
		internal MockInterlinDocForAnalyis(IStText testText)
		{
			Cache = testText.Cache;
			m_hvoRoot = testText.Hvo;
			m_testText = testText;
			m_vc = new InterlinVc(Cache);
			m_vc.RootSite = this;
		}
Ejemplo n.º 23
0
			public DisplayWordBundleMethod(IVwEnv vwenv1, int hvoWordBundleAnalysis, InterlinVc owner, int tagRF)
			{
				vwenv = vwenv1;
				m_hvoWordBundleAnalysis = hvoWordBundleAnalysis;
				m_this = owner;
				m_cache = m_this.m_cache;
				m_choices = m_this.LineChoices;
				tagRealForm = tagRF;
				m_hvoTwfic = m_this.CurrentTwficHvo;
				m_wsTwfic = m_this.CurrentTwficWs;
			}