protected virtual BrowseViewer CreateBrowseViewer(XmlNode nodeSpec, int hvoRoot, int fakeFlid, FdoCache cache, Mediator mediator,
                                                   ISortItemProvider sortItemProvider, ISilDataAccessManaged sda)
 {
     return(new BrowseViewer(nodeSpec,
                             hvoRoot, fakeFlid,
                             cache, mediator, sortItemProvider, sda));
 }
		protected override BrowseViewer CreateBrowseViewer(XmlNode nodeSpec, int hvoRoot, int fakeFlid, FdoCache cache, Mediator mediator,
			ISortItemProvider sortItemProvider, ISilDataAccessManaged sda)
		{
			var viewer = new FdoUi.BrowseViewerPhonologicalFeatures(nodeSpec,
						 hvoRoot, fakeFlid,
						 cache, mediator, sortItemProvider, sda);
			return viewer;
		}
Example #3
0
        protected override BrowseViewer CreateBrowseViewer(XmlNode nodeSpec, int hvoRoot, int fakeFlid, FdoCache cache, Mediator mediator,
                                                           ISortItemProvider sortItemProvider, ISilDataAccessManaged sda)
        {
            var viewer = new FdoUi.BrowseViewerPhonologicalFeatures(nodeSpec,
                                                                    hvoRoot, fakeFlid,
                                                                    cache, mediator, sortItemProvider, sda);

            return(viewer);
        }
Example #4
0
        protected override BrowseViewer CreateBrowseViewer(XmlNode nodeSpec, int hvoRoot, int fakeFlid, FdoCache cache, Mediator mediator,
					ISortItemProvider sortItemProvider, ISilDataAccessManaged sda)
        {
            var viewer = new BrowseActiveViewer(nodeSpec,
                         hvoRoot, fakeFlid,
                         cache, mediator, sortItemProvider, sda);
            viewer.CheckBoxActiveChanged += OnCheckBoxActiveChanged;
            return viewer;
        }
        protected override BrowseViewer CreateBrowseViewer(XmlNode nodeSpec, int hvoRoot, int fakeFlid, FdoCache cache, Mediator mediator,
                                                           ISortItemProvider sortItemProvider, ISilDataAccessManaged sda)
        {
            var viewer = new BrowseActiveViewer(nodeSpec,
                                                hvoRoot, fakeFlid,
                                                cache, mediator, sortItemProvider, sda);

            viewer.CheckBoxActiveChanged += OnCheckBoxActiveChanged;
            return(viewer);
        }
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="T:BrowseViewer"/> class.
		/// The sortItemProvider is typically the RecordList that impelements sorting and
		/// filtering of the items we are displaying.
		/// The data access passed typically is a decorator for the one in the cache, adding
		/// the sorted, filtered list of objects accessed as property fakeFlid of hvoRoot.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public BrowseViewerPhonologicalFeatures(XmlNode nodeSpec, int hvoRoot, int fakeFlid,
			FdoCache cache, Mediator mediator, ISortItemProvider sortItemProvider, ISilDataAccessManaged sda)
			: base(nodeSpec, hvoRoot, fakeFlid, cache, mediator, sortItemProvider, sda)
		{ }
Example #7
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Inits the specified node spec.
		/// </summary>
		/// <param name="nodeSpec">The node spec.</param>
		/// <param name="hvoRoot">The hvo root.</param>
		/// <param name="fakeFlid">The fake flid.</param>
		/// <param name="cache">The cache.</param>
		/// <param name="mediator">The mediator.</param>
		/// <param name="bv">The bv. Also used to set SortItemProvider</param>
		/// ------------------------------------------------------------------------------------
		public virtual void Init(XmlNode nodeSpec, int hvoRoot, int fakeFlid,
			FdoCache cache, Mediator mediator, BrowseViewer bv)
		{
			CheckDisposed();

			Debug.Assert((m_selectedIndex == -1), "Cannot set the index to less than zero before initializing.");
			Debug.Assert(m_nodeSpec == null || m_nodeSpec == nodeSpec, "XmlBrowseViewBase.Init: Mismatched configuration parameters.");

			m_hvoRoot = hvoRoot;
			m_fakeFlid = fakeFlid;
			if (m_nodeSpec == null)
				m_nodeSpec = nodeSpec;
			m_bv = bv;
			StringTbl = mediator.StringTbl;
			m_mediator = mediator;
			m_fdoCache = cache;
			m_sda = m_bv.SpecialCache;
			// This is usually done in MakeRoot, but we need it to exist right from the start
			// because right after we make this window we use info from the VC to help make
			// the column headers.
			if (bv != null)
				m_sortItemProvider = bv.SortItemProvider;
			m_xbvvc = Vc;
			string sDefaultCursor = XmlUtils.GetOptionalAttributeValue(nodeSpec,
				"defaultCursor", null);
			// Set a default cursor for a ReadOnly view, if none is given.
			if (sDefaultCursor == null && ReadOnlySelect)
				sDefaultCursor = "Arrow";
			if (sDefaultCursor != null)
			{
				switch (sDefaultCursor)
				{
					case "IBeam":
						EditingHelper.DefaultCursor = Cursors.IBeam;
						break;
					case "Hand":
						EditingHelper.DefaultCursor = Cursors.Hand;
						break;
					case "Arrow":
						EditingHelper.DefaultCursor = Cursors.Arrow;
						break;
					case "Cross":
						EditingHelper.DefaultCursor = Cursors.Cross;
						break;
				}
			}
		}
Example #8
0
		/// <summary>
		/// Return an item of the specified class that is indicated by a click at the specified position,
		/// but only if it is part of a different object also of that class.
		/// </summary>
		internal static ICmObject SubitemClicked(Point where, int clsid, SimpleRootSite view, FdoCache cache, ISortItemProvider sortItemProvider,
			IPreferedTargetAdjuster adjuster)
		{
			var sel = view.GetSelectionAtPoint(where, false);
			if (sel == null)
				return null;
			Rect rcPrimary = view.GetPrimarySelRect(sel);
			Rectangle selRect = new Rectangle(rcPrimary.left, rcPrimary.top, rcPrimary.right - rcPrimary.left, rcPrimary.bottom - rcPrimary.top);
			selRect.Inflate(8,2);
			if (!selRect.Contains(where))
				return null; // off somewhere in white space, tooltip is confusing
			var helper = SelectionHelper.Create(sel, view);
			var levels = helper.GetLevelInfo(SelectionHelper.SelLimitType.Anchor);
			ICmObject firstMatch = null;
			ICmObject lastMatch = null;
			foreach (var info in levels)
			{
				int hvo = info.hvo;
				if (!cache.ServiceLocator.IsValidObjectId(hvo))
					continue; // may be some invalid numbers in there
				var obj = cache.ServiceLocator.GetObject(hvo);
				var target = GetTarget(obj, clsid);
				if (target == null)
					continue; // nothing interesting at this level.
				lastMatch = target; // last one we've seen.
				if (firstMatch == null)
					firstMatch = target; // first one we've seen
			}
			firstMatch = adjuster.AdjustTarget(firstMatch);
			if (firstMatch == lastMatch)
				return null; // the only object we can find to jump to is the top-level one we clicked inside. A jump would go nowhere.
			if (sortItemProvider.IndexOf(firstMatch.Hvo) != -1)
				return firstMatch;  // it's a link to a top-level item in the list, we can jump
			// Enhance JohnT: we'd like to be able to jump to the parent entry, if target is a subentry.
			// That's tricky, because this is generic code, and finding the right object requires domain knowledge.
			// For now I'm putting a special case in. At some point we could move this into a helper that could be configured by XML.
			if(firstMatch is ILexSense)
			{
				firstMatch = ((ILexSense) firstMatch).Entry;
				if (sortItemProvider.IndexOf(firstMatch.Hvo) != -1)
					return firstMatch;  // it's a link to a top-level item in the list, we can jump
			}
			return null;
		}
Example #9
0
			protected override BrowseViewer CreateBrowseViewer(XmlNode nodeSpec, int hvoRoot, int fakeFlid,
				FdoCache cache, Mediator mediator, ISortItemProvider sortItemProvider, ISilDataAccessManaged sda)
			{
				var app = (MockFwXApp)mediator.PropertyTable.GetValue("App");
				mediator.FeedbackInfoProvider = app;
				return new BrowseViewerForTests(nodeSpec, hvoRoot, fakeFlid, cache, mediator,
					sortItemProvider, sda);
			}
Example #10
0
			internal BrowseViewerForTests(XmlNode nodeSpec, int hvoRoot, int fakeFlid, FdoCache cache,
				Mediator mediator, ISortItemProvider sortItemProvider, ISilDataAccessManaged sdaRecordList)
				: base(nodeSpec, hvoRoot, fakeFlid, cache, mediator, sortItemProvider, sdaRecordList)
			{
				var mainWindow = (Form)mediator.PropertyTable.GetValue("window");
				m_wnd = mainWindow as MockFwXWindow;
				m_xbv.MakeRoot(); // needed to process OnRecordNavigation
			}
Example #11
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance of the <see cref="T:BrowseViewer"/> class.
 /// The sortItemProvider is typically the RecordList that impelements sorting and
 /// filtering of the items we are displaying.
 /// The data access passed typically is a decorator for the one in the cache, adding
 /// the sorted, filtered list of objects accessed as property fakeFlid of hvoRoot.
 /// </summary>
 /// ------------------------------------------------------------------------------------
 public BrowseViewerPhonologicalFeatures(XmlNode nodeSpec, int hvoRoot, int fakeFlid,
                                         LcmCache cache, Mediator mediator, PropertyTable propertyTable, ISortItemProvider sortItemProvider, ISilDataAccessManaged sda)
     : base(nodeSpec, hvoRoot, fakeFlid, cache, mediator, propertyTable, sortItemProvider, sda)
 {
 }
Example #12
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_columns != null)
					m_columns.Clear();
				if (m_possibleColumns != null)
					m_possibleColumns.Clear();
			}

			// Dispose unmanaged resources here, whether disposing is true or false.
			m_columns = null;
			m_possibleColumns = null;
			m_xbv = null;
			m_sortItemProvider = null;
			if (m_UncheckedCheckPic != null)
			{
				Marshal.ReleaseComObject(m_UncheckedCheckPic);
				m_UncheckedCheckPic = null;
			}
			if (m_CheckedCheckPic != null)
			{
				Marshal.ReleaseComObject(m_CheckedCheckPic);
				m_CheckedCheckPic = null;
			}
			if (m_DisabledCheckPic != null)
			{
				Marshal.ReleaseComObject(m_DisabledCheckPic);
				m_DisabledCheckPic = null;
			}
			if (m_PreviewArrowPic != null)
			{
				Marshal.ReleaseComObject(m_PreviewArrowPic);
				m_PreviewArrowPic = null;
			}
			if (m_PreviewRTLArrowPic != null)
			{
				Marshal.ReleaseComObject(m_PreviewRTLArrowPic);
				m_PreviewRTLArrowPic = null;
			}

			base.Dispose (disposing);
		}
Example #13
0
		protected virtual BrowseViewer CreateBrowseViewer(XmlNode nodeSpec, int hvoRoot, int fakeFlid, FdoCache cache, Mediator mediator,
			ISortItemProvider sortItemProvider)
		{
			return new BrowseViewer(nodeSpec,
						 hvoRoot, fakeFlid,
						 cache, mediator, sortItemProvider);
		}