Esempio 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;

			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
				if (m_view != null && !Controls.Contains(m_view))
					m_view.Dispose();
				if (m_detailView != null && !Controls.Contains(m_detailView))
					m_detailView.Dispose();
			}
			m_sel = null;
			m_cache = null;
			m_view = null;
			m_detailView = null;
			if (m_cdaTemp != null)
			{
				m_cdaTemp.ClearAllData();
				Marshal.ReleaseComObject(m_cdaTemp);
				m_cdaTemp = null;
			}

			base.Dispose( disposing );
		}
Esempio n. 2
0
		private void m_view_SelChanged(object sender, EventArgs e)
		{
			bool fEnable = m_view.GotRangeSelection;
			m_btnCopy.Enabled = fEnable;
			m_btnInsert.Enabled = fEnable;
			m_btnLookup.Enabled = fEnable;
			// Todo: create or update XmlView of selected word if any.
			LexEntryUi leui = GetSelWord();
			if (leui == null)
				return;
			if (m_detailView == null)
			{
				// Give the detailView the bottom 1/3 of the available height.
				this.SuspendLayout();
				int totalHeight = m_view.Height;
				m_view.Height = totalHeight * 2 / 3;
				m_detailView = MakeSummaryView(leui.Object.Hvo, m_cache, m_styleSheet);
				m_detailView.Left = m_view.Left;
				m_detailView.Width = m_view.Width;
				m_detailView.Top = m_view.Bottom + 5;
				m_detailView.Height = totalHeight / 3;
				m_detailView.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
				m_detailView.EditingHelper.DefaultCursor = Cursors.Arrow;
				this.Controls.Add(m_detailView);
				this.ResumeLayout();
				// JohnT: I'm not sure why this is needed here and not
				// elsewhere, but without it, the root box somehow never
				// receives an OnSizeChanged call and never actually
				// constructs.
				m_detailView.RootBox.Reconstruct();
			}
			else
			{
				m_detailView.RootObjectHvo = leui.Object.Hvo;
			}
		}
		private ISilDataAccess m_decoratedSda; // typically a ConcSda, understands the segment property of the fake HVO.

		internal void Init(Mediator mediator, XmlNode xnBrowseViewControlParameters, XmlView pubView, ISilDataAccess sda)
		{
			m_previewPane = pubView;
			m_decoratedSda = sda;
			base.Init(mediator, xnBrowseViewControlParameters);
		}
Esempio n. 4
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Create a view with a single LexEntry object.
		/// </summary>
		/// <param name="hvoEntry"></param>
		/// <param name="cache"></param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		public static XmlView MakeSummaryView(int hvoEntry, FdoCache cache, IVwStylesheet styleSheet)
		{
			XmlView xv = new XmlView(hvoEntry, "publishStem", null, false);
			xv.LoadFlexLayouts = true;
			xv.Cache = cache;
			xv.StyleSheet = styleSheet;
			return xv;
		}
Esempio n. 5
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Create a view with a single LexEntry object.
		/// </summary>
		/// <param name="hvoEntry"></param>
		/// <param name="cache"></param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		public static XmlView MakeSummaryView(int hvoEntry, FdoCache cache, IVwStylesheet styleSheet, Mediator mediator)
		{
			XmlView xv = new XmlView(hvoEntry, "publishStem", null, false);
			xv.Cache = cache;
			xv.StyleSheet = styleSheet;
			xv.Mediator = mediator;
			return xv;
		}
		private void AddConfigurableControls()
		{
			// Load the controls.

			// 1. Initialize the preview pane (lower pane)
			m_previewPane = new XmlView(0, "publicationNew", null, false);
			m_previewPane.Cache = m_cache;
			m_previewPane.StyleSheet = FontHeightAdjuster.StyleSheetFromMediator(m_mediator);

			BasicPaneBarContainer pbc = new BasicPaneBarContainer();
			pbc.Init(m_mediator, m_previewPane);
			pbc.Dock = DockStyle.Fill;
			pbc.PaneBar.Text = LexEdStrings.ksFindExampleSentenceDlgPreviewPaneTitle;
			panel2.Controls.Add(pbc);
			if (m_previewPane.RootBox == null)
				m_previewPane.MakeRoot();

			// 2. load the browse view. (upper pane)
			XmlNode xnBrowseViewControlParameters = this.BrowseViewControlParameters;

			// First create our Clerk, since we can't set it's OwningObject via the configuration/mediator/PropertyTable info.
			m_clerk = RecordClerkFactory.CreateClerk(m_mediator, xnBrowseViewControlParameters, true);
			m_clerk.OwningObject = m_owningSense;

			m_rbv = DynamicLoader.CreateObject(xnBrowseViewControlParameters.ParentNode.SelectSingleNode("dynamicloaderinfo")) as ConcOccurrenceBrowseView;
			m_rbv.Init(m_mediator, xnBrowseViewControlParameters, m_previewPane, m_clerk.VirtualListPublisher);
			m_rbv.CheckBoxChanged += new CheckBoxChangedEventHandler(m_rbv_CheckBoxChanged);
			// add it to our controls.
			BasicPaneBarContainer pbc1 = new BasicPaneBarContainer();
			pbc1.Init(m_mediator, m_rbv);
			pbc1.BorderStyle = BorderStyle.FixedSingle;
			pbc1.Dock = DockStyle.Fill;
			pbc1.PaneBar.Text = LexEdStrings.ksFindExampleSentenceDlgBrowseViewPaneTitle;
			panel1.Controls.Add(pbc1);

			CheckAddBtnEnabling();
		}
Esempio n. 7
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Create a view with multiple LexEntry objects.
		/// </summary>
		/// <param name="rghvoEntries"></param>
		/// <param name="cache"></param>
		/// <param name="styleSheet"></param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		private XmlView CreateSummaryView(List<int> rghvoEntries, FdoCache cache, IVwStylesheet styleSheet)
		{
			// Make a decorator to publish the list of entries as a fake property of the LexDb.
			int kflidEntriesFound = 8999950; // some arbitrary number not conflicting with real flids.
			var sda = new ObjectListPublisher(cache.DomainDataByFlid as ISilDataAccessManaged, kflidEntriesFound);
			int hvoRoot = RootHvo;
			sda.CacheVecProp(hvoRoot, rghvoEntries.ToArray());
			//TODO: Make this method return a GeckoBrowser control, and generate the content here.
			// The name of this property must match the property used by the publishFound layout.
			sda.SetOwningPropInfo(LexDbTags.kflidClass, "LexDb", "EntriesFound");

			// Make an XmlView which displays that object using the specified layout.
			XmlView xv = new XmlView(hvoRoot, "publishFound", null, false, sda);
			xv.Cache = cache;
			xv.Mediator = m_mediator;
			xv.StyleSheet = styleSheet;
			return xv;
		}
Esempio n. 8
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Common initialization shared by the constructors.
		/// </summary>
		/// <param name="tssForm">The TSS form.</param>
		/// <param name="helpProvider">The help provider.</param>
		/// <param name="helpFileKey">The help file key.</param>
		/// <param name="styleSheet">The stylesheet.</param>
		/// ------------------------------------------------------------------------------------
		private void Initialize(ITsString tssForm, IHelpTopicProvider helpProvider, string helpFileKey,
			IVwStylesheet styleSheet)
		{
			m_tssWf = tssForm;
			m_helpProvider = helpProvider;
//			m_vss = styleSheet;
			if (m_helpProvider == null)
			{
				btnHelp.Enabled = false;
			}
			else
			{
				m_helpFileKey = helpFileKey;
				this.helpProvider = new HelpProvider();
				this.helpProvider.HelpNamespace = FwDirectoryFinder.CodeDirectory + m_helpProvider.GetHelpString("UserHelpFile");
				this.helpProvider.SetHelpKeyword(this, m_helpProvider.GetHelpString(s_helpTopicKey));
				this.helpProvider.SetHelpNavigator(this, HelpNavigator.Topic);
			}
			m_xv = CreateSummaryView(m_rghvo, m_cache, styleSheet);
			m_xv.Dock = DockStyle.Top;	// panel1 is docked to the bottom.
			m_xv.TabStop = true;
			m_xv.TabIndex = 0;
			Controls.Add(m_xv);
			m_xv.Height = panel1.Location.Y - m_xv.Location.Y;
			m_xv.Width = this.Width - 15; // Changed from magic to more magic on 8/8/2014
			m_xv.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
			m_xv.EditingHelper.DefaultCursor = Cursors.Arrow;
			m_xv.EditingHelper.VwSelectionChanged += new EventHandler<VwSelectionArgs>(m_xv_VwSelectionChanged);
		}
Esempio n. 9
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Create a view with multiple LexEntry objects.
		/// </summary>
		/// <param name="rghvoEntries"></param>
		/// <param name="cache"></param>
		/// <param name="styleSheet"></param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		private XmlView CreateSummaryView(List<int> rghvoEntries, FdoCache cache, IVwStylesheet styleSheet)
		{
			IVwVirtualHandler vh = DummyVirtualHandler.InstallDummyHandler(cache.VwCacheDaAccessor,
				"LexDb", "EntriesFound", (int)FieldType.kcptReferenceSequence);
			m_flidDummy = vh.Tag;
			cache.VwCacheDaAccessor.CacheVecProp(cache.LangProject.LexDbOAHvo, m_flidDummy,
				rghvoEntries.ToArray(), rghvoEntries.Count);
			XmlView xv = new XmlView(cache.LangProject.LexDbOAHvo, "publishFound", null, false);
			xv.LoadFlexLayouts = true;
			xv.Cache = cache;
			xv.StyleSheet = styleSheet;
			return xv;
		}
Esempio n. 10
0
		internal void Init(Mediator mediator, XmlNode xnBrowseViewControlParameters, XmlView pubView)
		{
			m_previewPane = pubView;
			base.Init(mediator, xnBrowseViewControlParameters);
		}
Esempio n. 11
0
		public void StringPropIsMarked()
		{
			using (var view = new XmlView(m_hvoLexDb, "root", null, true, m_sda))
			{
				var vc = new XmlVc(null, "root", true, view, null, m_sda);
				vc.IdentifySource = true;
				vc.SetCache(Cache);
				vc.m_layouts = m_layouts;
				vc.DataAccess = m_sda;
				var testEnv = new MockEnv() {DataAccess = m_sda, OpenObject = m_hvoLexDb};
				vc.Display(testEnv, m_hvoLexDb, XmlVc.kRootFragId);
				VerifySourceIdentified(testEnv.EventHistory, m_hvoKick, kflidEntry_Form, m_wsVern, "Entry:basic:Headword:HeadwordL");
				VerifyLabel(testEnv.EventHistory, m_hvoKick, kflidEntry_Form, m_wsVern, 1, ")", "Entry:basic:Headword:HeadwordL");

				VerifyLabel(testEnv.EventHistory, m_hvoKick, kflidEntry_Form, m_wsVern, -3, "head(", "Entry:basic:Headword:HeadwordL");
				VerifySourceIdentified(testEnv.EventHistory, m_hvoKick, kflidEntry_Summary, "Entry:basic:Summary:Sum.");
			}
		}