Наследование: SIL.FieldWorks.Common.RootSites.RootSite, IVwNotifyChange
Пример #1
0
		/// <summary>
		/// Constructor.
		/// </summary>
		/// <param name="xnSpec"></param>
		/// <param name="fakeFlid"></param>
		/// <param name="stringTable"></param>
		/// <param name="xbv"></param>
		public XmlRDEBrowseViewVc(XmlNode xnSpec, int fakeFlid, StringTable stringTable, XmlBrowseViewBase xbv)
			: base(xnSpec, fakeFlid, stringTable, xbv)
		{
			// set the border color
			BorderColor = SystemColors.ControlDark;

			// Check for the special editable row attributes.
			// this one is independently optional so we can handle it separately.
			m_sEditRowMergeMethod = XmlUtils.GetAttributeValue(xnSpec, "editRowMergeMethod", null);
			XmlAttribute xa = xnSpec.Attributes["editRowModelClass"];
			if (xa != null && xa.Value.Length != 0)
			{
				m_sEditRowModelClass = xa.Value;
				xa = xnSpec.Attributes["editRowSaveMethod"];
				if (xa != null && xa.Value.Length != 0)
				{
					m_sEditRowSaveMethod = xa.Value;
					xa = xnSpec.Attributes["editRowAssembly"];
					if (xa != null && xa.Value.Length != 0)
					{
						m_sEditRowAssembly = xa.Value;
						xa = xnSpec.Attributes["editRowClass"];
						if (xa != null && xa.Value.Length != 0)
						{
							m_sEditRowClass = xa.Value;
						}
						else
						{
							// Should we complain to the user?  Die horribly? ...
							m_sEditRowModelClass = null;
							m_sEditRowSaveMethod = null;
							m_sEditRowAssembly = null;
							Debug.WriteLine("editRowModelClass, editRowSaveMethod, and " +
								"editRowAssembly are set, but editRowClass is not!?");
						}
					}
					else
					{
						// Should we complain to the user?  Die horribly? ...
						m_sEditRowModelClass = null;
						m_sEditRowSaveMethod = null;
						Debug.WriteLine("editRowModelClass and editRowSaveMethod are set, " +
							"but editRowAssembly is not!?");
					}
				}
				else
				{
					// Should we complain to the user?  Die horribly? ...
					m_sEditRowModelClass = null;
					Debug.WriteLine("editRowModelClass is set, but editRowSaveMethod is not!?");
				}
			}

			InstallVirtualHandlersForColumns();

			// For RDE use, we want total RTL user experience (see LT-5127).
			Cache = m_xbv.Cache;
			m_fShowColumnsRTL = IsWsRTL(m_cache.DefaultVernWs);
		}
Пример #2
0
		/// <summary>
		/// Constructor.
		/// </summary>
		/// <param name="xnSpec"></param>
		/// <param name="fakeFlid"></param>
		/// <param name="stringTable"></param>
		/// <param name="xbv"></param>
		public XmlBrowseViewVc(XmlNode xnSpec, int fakeFlid, StringTable stringTable, XmlBrowseViewBase xbv)
			: base(xnSpec, fakeFlid, stringTable, xbv)
		{
		}
Пример #3
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);
		}
Пример #4
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="T:XmlBrowseViewBaseVc"/> class.
		/// </summary>
		/// <param name="xnSpec">The xn spec.</param>
		/// <param name="fakeFlid">The fake flid.</param>
		/// <param name="stringTable">The string table.</param>
		/// <param name="xbv">The XBV.</param>
		/// ------------------------------------------------------------------------------------
		public XmlBrowseViewBaseVc(XmlNode xnSpec, int fakeFlid, StringTable stringTable, XmlBrowseViewBase xbv)
			: this(xbv.Cache, stringTable)
		{
			Debug.Assert(xnSpec != null);
			Debug.Assert(stringTable != null);
			Debug.Assert(xbv != null);

			m_xbv = xbv;
			m_xnSpec = xnSpec;

			// This column list is saved in BrowseViewer.UpdateColumnList
			string savedCols = m_xbv.Mediator.PropertyTable.GetStringProperty(ColListId, null, XCore.PropertyTable.SettingsGroup.LocalSettings);
			SortItemProvider = xbv.SortItemProvider;
			ComputePossibleColumns();
			XmlDocument doc = null;
			string target = null;
			if (savedCols != null && savedCols != "")
			{
				try
				{
					doc = new XmlDocument();
					doc.LoadXml(savedCols);
					int version = XmlUtils.GetOptionalIntegerValue(doc.DocumentElement, "version", 0);
					if (version != BrowseViewer.kBrowseViewVersion)
					{
						// If we can fix problems introduced by a new version, fix them here.
						// Otherwise throw up a dialog telling the user they are losing their settings.
						switch (version)
						{
							// Process changes made in P4 Changelist 29278
							case 12:
								target = "<column label=\"Headword\" sortmethod=\"FullSortKey\" ws=\"$ws=vernacular\" editable=\"false\" width=\"96000\"><span><properties><editable value=\"false\" /></properties><string field=\"MLHeadWord\" ws=\"vernacular\" /></span></column>";
								if (savedCols.IndexOf(target) > -1)
									savedCols = savedCols.Replace(target, "<column label=\"Headword\" sortmethod=\"FullSortKey\" ws=\"$ws=vernacular\" editable=\"false\" width=\"96000\" layout=\"EntryHeadwordForFindEntry\" />");
								target = "<column label=\"Lexeme Form\" visibility=\"menu\" common=\"true\" sortmethod=\"MorphSortKey\" ws=\"$ws=vernacular\" editable=\"false\"><span><properties><editable value=\"false\"/></properties><obj field=\"LexemeForm\" layout=\"empty\"><string field=\"Form\" ws=\"$ws=vernacular\"/></obj></span></column>";
								if (savedCols.IndexOf(target) > -1)
									savedCols = savedCols.Replace(target, "<column label=\"Lexeme Form\" visibility=\"menu\" common=\"true\" sortmethod=\"MorphSortKey\" ws=\"$ws=vernacular\" editable=\"false\" layout=\"LexemeFormForFindEntry\"/>");
								target = "<column label=\"Citation Form\" visibility=\"menu\" sortmethod=\"CitationFormSortKey\" ws=\"$ws=vernacular\" editable=\"false\"><span><properties><editable value=\"false\"/></properties><string field=\"CitationForm\" ws=\"$ws=vernacular\"/></span></column>";
								if (savedCols.IndexOf(target) > -1)
									savedCols = savedCols.Replace(target, "<column label=\"Citation Form\" visibility=\"menu\" sortmethod=\"CitationFormSortKey\" ws=\"$ws=vernacular\" editable=\"false\" layout=\"CitationFormForFindEntry\"/>");
								target = "<column label=\"Allomorphs\" editable=\"false\" width=\"96000\"><span><properties><editable value=\"false\"/></properties><seq field=\"AlternateForms\" layout=\"empty\" sep=\", \"><string field=\"Form\" ws=\"$ws=vernacular\"/></seq></span></column>";
								if (savedCols.IndexOf(target) > -1)
									savedCols = savedCols.Replace(target, "<column label=\"Allomorphs\" editable=\"false\" width=\"96000\" ws=\"$ws=vernacular\" layout=\"AllomorphsForFindEntry\"/>");
								target = "<column label=\"Glosses\" multipara=\"true\" editable=\"false\" width=\"96000\"><seq field=\"Senses\" layout=\"empty\"><para><properties><editable value=\"false\"/></properties><string field=\"Gloss\" ws=\"$ws=analysis\"/></para></seq></column>";
								if (savedCols.IndexOf(target) > -1)
									savedCols = savedCols.Replace(target, "<column label=\"Glosses\" editable=\"false\" width=\"96000\" ws=\"$ws=analysis\" layout=\"GlossesForFindEntry\"/>");
								savedCols = savedCols.Replace("root version=\"12\"", "root version=\"13\"");
								m_xbv.Mediator.PropertyTable.SetProperty(ColListId, savedCols);
								doc.LoadXml(savedCols);
								break;
							default:
								MessageBox.Show(null, XMLViewsStrings.ksInvalidSavedLayout, XMLViewsStrings.ksNote);
								doc = null;
								// Forget the old settings, so we don't keep complaining every time the program runs.
								// There doesn't seem to be any way to remove the property altogether, so at least, make it empty.
								m_xbv.Mediator.PropertyTable.SetProperty(ColListId, "", XCore.PropertyTable.SettingsGroup.LocalSettings);
								break;
						}
					}
				}
				catch(Exception)
				{
					// If anything is wrong with the saved data (e.g., an old version that doesn't
					// parse as XML), ignore it.
					doc = null;
				}
			}
			if (doc == null) // nothing saved, or saved info won't parse
			{
				// default: the columns that have 'width' specified.
				foreach(XmlNode node in m_possibleColumns)
				{
					if (XmlUtils.GetOptionalAttributeValue(node, "visibility", "always") == "always")
						m_columns.Add(node);
				}
			}
			else
			{
				foreach (XmlNode node in doc.DocumentElement.SelectNodes("//column"))
				{
					if (IsValidColumnSpec(node))
						m_columns.Add(node);
				}
			}
			m_fakeFlid = fakeFlid;
			SetupSelectColumn();

			// If we have an xbv, this needs to be set now, because the client view may use it
			// before setting the cache, which prevents the compute-on-demand from working.
			m_tagMe = FDO.MeVirtualHandler.InstallMe(xbv.Cache.VwCacheDaAccessor).Tag;
		}
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="XmlBrowseViewSelectionRestorer"/> class.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public XmlBrowseViewSelectionRestorer(XmlBrowseViewBase browseView) : base(browseView)
		{
		}
Пример #6
0
		public XmlBrowseViewBaseVc(XmlNode xnSpec, int fakeFlid, StringTable stringTable, XmlBrowseViewBase xbv)
			: this(xbv, stringTable)
		{
			Debug.Assert(xnSpec != null);
			Debug.Assert(stringTable != null);
			Debug.Assert(xbv != null);
			DataAccess = xbv.SpecialCache;

			m_xbv = xbv;
			m_xnSpec = xnSpec;

			// This column list is saved in BrowseViewer.UpdateColumnList
			string savedCols = m_xbv.Mediator.PropertyTable.GetStringProperty(ColListId, null, XCore.PropertyTable.SettingsGroup.LocalSettings);
			SortItemProvider = xbv.SortItemProvider;
			ComputePossibleColumns();
			XmlDocument doc = null;
			string target = null;
			if (savedCols != null && savedCols != "")
			{
				doc = GetSavedColumns(savedCols, m_xbv.Mediator, ColListId);
			}
			if (doc == null) // nothing saved, or saved info won't parse
			{
				// default: the columns that have 'width' specified.
				foreach(XmlNode node in m_possibleColumns)
				{
					if (XmlUtils.GetOptionalAttributeValue(node, "visibility", "always") == "always")
						m_columns.Add(node);
				}
			}
			else
			{
				foreach (XmlNode node in doc.DocumentElement.SelectNodes("//column"))
				{
					if (IsValidColumnSpec(node))
					m_columns.Add(node);
			}
			}
			m_fakeFlid = fakeFlid;
			SetupSelectColumn();
		}
Пример #7
0
		/// <summary>
		/// This contructor is used by SortMethodFinder to make a partly braindead VC.
		/// </summary>
		public XmlBrowseViewBaseVc(XmlBrowseViewBase xbv, StringTable table)
			: base(table)
		{

			Debug.Assert(xbv.Mediator.FeedbackInfoProvider != null, "No FeedbackInfoProvider");

			MApp = xbv.Mediator.FeedbackInfoProvider as IApp;
			XmlBrowseViewBaseVcInit(xbv.Cache, xbv.DataAccess, table);

		}