Example #1
0
		/// <summary>
		/// Construct one, using the "part ref" element (caller) that
		/// invoked the "slice" node that specified this editor.
		/// </summary>
		/// <param name="caller"></param>
		/// <param name="node"></param>
		public SummarySlice(ICmObject obj, XmlNode caller, XmlNode node, StringTable stringTbl)
			: base()
		{
			string paramType = XmlUtils.GetOptionalAttributeValue(node.ParentNode, "paramType");
			if (paramType == "LiteralString")
			{
				// Instead of the parameter being a layout name, it is literal text which will be
				// the whole contents of the slice, with standard properties.
				string text = XmlUtils.GetManditoryAttributeValue(caller, "label");
				if (stringTbl != null)
					text = stringTbl.LocalizeAttributeValue(text);
				m_view = new LiteralLabelView(text, this);
				m_fLiteralString = true;
			}
			else
			{
				string layout = XmlUtils.GetOptionalAttributeValue(caller, "param");
				if (layout == null)
					layout = XmlUtils.GetManditoryAttributeValue(node, "layout");
				m_view = new SummaryXmlView(obj.Hvo, layout, stringTbl, this);
			}
			UserControl mainControl = new UserControl();
			m_view.Dock = DockStyle.Left;
			m_view.LayoutSizeChanged += new EventHandler(m_view_LayoutSizeChanged);
			mainControl.Height = m_view.Height;
			Control = mainControl;

			m_commandControl = new SummaryCommandControl(this);
			m_commandControl.Dock = DockStyle.Fill;
			m_commandControl.Visible = XmlUtils.GetOptionalBooleanAttributeValue(caller, "commandVisible", false);
			mainControl.Controls.Add(m_commandControl);
			mainControl.Dock = DockStyle.Fill;
			mainControl.Controls.Add(m_view);
		}
Example #2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// normal constructor.
		/// </summary>
		/// <param name="cache">The cache.</param>
		/// <param name="layoutName">Name of the layout.</param>
		/// <param name="colSpec">The col spec.</param>
		/// <param name="stringTbl">The string TBL.</param>
		/// ------------------------------------------------------------------------------------
		public LayoutFinder(FdoCache cache, string layoutName, XmlNode colSpec, StringTable stringTbl)
		{
			m_layoutName = layoutName;
			m_colSpec = colSpec;
			m_stringTbl = stringTbl;
			Cache = cache;
		}
		public InflAffixTemplateControl(FdoCache cache, int hvoRoot, XmlNode xnSpec, StringTable stringTable)
			: base(hvoRoot, XmlUtils.GetAttributeValue(xnSpec, "layout"), stringTable, true)
		{
			m_xnSpec = xnSpec["deParams"];
			Cache = cache;
			m_template = Cache.ServiceLocator.GetInstance<IMoInflAffixTemplateRepository>().GetObject(m_hvoRoot);
		}
Example #4
0
        public override void FixtureSetup()
        {
            string partDirectory = Path.Combine(SIL.FieldWorks.Common.Utils.DirectoryFinder.FwSourceDirectory,
                                                @"common\controls\detailcontrols\detailcontrolstests");
            Dictionary <string, string[]> keyAttrs = new Dictionary <string, string[]>();

            keyAttrs["layout"] = new string[] { "class", "type", "name" };
            keyAttrs["group"]  = new string[] { "label" };
            keyAttrs["part"]   = new string[] { "ref" };

            string configurationDir = Path.Combine(SIL.FieldWorks.Common.Utils.DirectoryFinder.FWCodeDirectory,
                                                   @"Language Explorer\Configuration");

            m_stringTable = new SIL.Utils.StringTable(configurationDir);

            m_layouts = new Inventory(new string[] { partDirectory },
                                      "*Layouts.xml", "/LayoutInventory/*", keyAttrs);

            keyAttrs         = new Dictionary <string, string[]>();
            keyAttrs["part"] = new string[] { "id" };

            m_parts = new Inventory(new string[] { partDirectory },
                                    "*Parts.xml", "/PartInventory/bin/*", keyAttrs);

            m_cache = FdoCache.Create("TestLangProj");

            m_entry = new LexEntry();
            m_cache.LangProject.LexDbOA.EntriesOC.Add(m_entry);
            m_entry.CitationForm.VernacularDefaultWritingSystem = "rubbish";
            // We set both alternatives because currently the default part for Bibliography uses vernacular,
            // but I think this will probably get fixed. Anyway, this way the test is robust.
            m_entry.Bibliography.SetAnalysisDefaultWritingSystem("My rubbishy bibliography");
            m_entry.Bibliography.SetVernacularDefaultWritingSystem("My rubbishy bibliography");
        }
		/// <summary>
		/// We want the persistence provider, and the easiest way to get it is to get all
		/// this other stuff we don't need or use.
		/// </summary>
		/// <param name="cache"></param>
		/// <param name="editor"></param>
		/// <param name="flid"></param>
		/// <param name="node"></param>
		/// <param name="obj"></param>
		/// <param name="stringTbl"></param>
		/// <param name="persistenceProvider"></param>
		/// <param name="ws"></param>
		public PhEnvStrRepresentationSlice(FdoCache cache, string editor, int flid,
			System.Xml.XmlNode node, ICmObject obj, StringTable stringTbl,
			IPersistenceProvider persistenceProvider, int ws)
			: base(new StringRepSliceView(obj.Hvo), obj, StringRepSliceVc.Flid)
		{
			m_persistenceProvider = persistenceProvider;
		}
		/// <summary>
		/// Constructor for Morph Break Helper Context Menu
		/// </summary>
		/// <param name="textbox">the textbox to insert regex characters into</param>
		/// <param name="helpTopicProvider">usually IHelpTopicProvider.App</param>
		/// <param name="cache">cache</param>
		/// <param name="stringTable">stringTable</param>
		public MorphBreakHelperMenu(FwTextBox textbox, IHelpTopicProvider helpTopicProvider, FdoCache cache, StringTable stringTable)
			: base(textbox, helpTopicProvider)
		{
			m_cache = cache;
			m_stringTable = stringTable;
			Init();
		}
Example #7
0
 public StringTable(string baseDirectory)
 {
     m_parent = null;
     m_baseDirectory = baseDirectory;
     string sWs = System.Globalization.CultureInfo.CurrentUICulture.Name;
     Load(sWs);
 }
Example #8
0
		public override void FixtureSetup()
		{
			string partDirectory = Path.Combine(SIL.FieldWorks.Common.Utils.DirectoryFinder.FwSourceDirectory,
				@"common\controls\detailcontrols\detailcontrolstests");
			Dictionary<string, string[]> keyAttrs = new Dictionary<string, string[]>();
			keyAttrs["layout"] = new string[] {"class", "type", "name" };
			keyAttrs["group"] = new string[] {"label"};
			keyAttrs["part"] = new string[] {"ref"};

			string configurationDir = Path.Combine(SIL.FieldWorks.Common.Utils.DirectoryFinder.FWCodeDirectory,
				@"Language Explorer\Configuration");
			m_stringTable = new SIL.Utils.StringTable(configurationDir);

			m_layouts = new Inventory(new string[] {partDirectory},
				"*Layouts.xml", "/LayoutInventory/*", keyAttrs);

			keyAttrs = new Dictionary<string, string[]>();
			keyAttrs["part"] = new string[] {"id"};

			m_parts = new Inventory(new string[] {partDirectory},
				"*Parts.xml", "/PartInventory/bin/*", keyAttrs);

			m_cache = FdoCache.Create("TestLangProj");

			m_entry = new LexEntry();
			m_cache.LangProject.LexDbOA.EntriesOC.Add(m_entry);
			m_entry.CitationForm.VernacularDefaultWritingSystem = "rubbish";
			// We set both alternatives because currently the default part for Bibliography uses vernacular,
			// but I think this will probably get fixed. Anyway, this way the test is robust.
			m_entry.Bibliography.SetAnalysisDefaultWritingSystem("My rubbishy bibliography");
			m_entry.Bibliography.SetVernacularDefaultWritingSystem("My rubbishy bibliography");
		}
		public InflAffixTemplateControl(FdoCache cache, int hvoRoot, XmlNode xnSpec, StringTable stringTable)
			: base(hvoRoot, XmlUtils.GetAttributeValue(xnSpec, "layout"), stringTable, true)
		{
			m_xnSpec = xnSpec["deParams"];
			Cache = cache;
			m_template = new MoInflAffixTemplate(cache, m_hvoRoot);
		}
Example #10
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);
		}
Example #11
0
		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="AtomicReferenceSlice"/> class.
		/// </summary>
		/// -----------------------------------------------------------------------------------
		public AtomicReferenceSlice(FdoCache cache, ICmObject obj, int flid,
			XmlNode configurationNode, IPersistenceProvider persistenceProvider,
			Mediator mediator, StringTable stringTbl)
			: base(cache, obj, flid, configurationNode, persistenceProvider, mediator, stringTbl)
		{
			m_sda = m_cache.MainCacheAccessor;
			m_sda.AddNotification(this);
		}
		/// <summary>
		/// Constructor invoked via the editor="customWithParams" slice XML configuration
		/// </summary>
		/// <param name="cache"></param>
		/// <param name="editor"></param>
		/// <param name="flid"></param>
		/// <param name="node"></param>
		/// <param name="obj"></param>
		/// <param name="stringTbl"></param>
		/// <param name="persistenceProvider"></param>
		/// <param name="ws"></param>
		public BasicIPASymbolSlice(FdoCache cache, string editor, int flid,
						System.Xml.XmlNode node, ICmObject obj, StringTable stringTbl,
						IPersistenceProvider persistenceProvider, int ws)
			: base(obj, flid, ws)
		{
			var phoneme = (IPhPhoneme)m_obj;
			phoneme.BasicIPASymbolChanged += UpdatePhoneme;
		}
		/// <summary>
		/// Make one. Everything interesting happens when it is given a root object, however.
		/// </summary>
		/// <param name="cache"></param>
		/// <param name="hvoAnalysis"></param>
		/// <param name="configurationNode"></param>
		/// <param name="stringTable"></param>
		public AnalysisInterlinearRS(FdoCache cache, int hvoAnalysis,
			XmlNode configurationNode, StringTable stringTable) : base(cache)
		{
			m_configurationNode = configurationNode;
			m_hvoWfiAnalysis = hvoAnalysis;
			m_wordform = (WfiWordform)CmObject.CreateFromDBObject(m_fdoCache, m_fdoCache.GetOwnerOfObject(m_hvoWfiAnalysis), false);
			//			RightMouseClickedEvent += new FwRightMouseClickEventHandler(InterlinDocChild_RightMouseClickedEvent);
		}
#pragma warning restore 0414

		public ReversalIndexEntryFormSlice(FdoCache cache, string editor, int flid, XmlNode node,
			ICmObject obj, StringTable stringTbl, IPersistenceProvider persistenceProvider, int ws)
			: base(obj, flid, WritingSystemServices.kwsAllReversalIndex, 0, false, true, true)
		{
			m_configNode = node;
			m_stringTbl = stringTbl;
			m_persistProvider = persistenceProvider;
		}
		public PhoneEnvReferenceSlice(FdoCache cache, ICmObject obj, int flid,
			XmlNode configurationNode, IPersistenceProvider persistenceProvider,
			Mediator mediator, StringTable stringTbl)
			: base(cache, obj, flid,configurationNode, persistenceProvider, mediator, stringTbl)
		{
			Debug.Assert(obj is MoAffixAllomorph || obj is MoStemAllomorph);
			m_persistenceProvider = persistenceProvider;
		}
Example #16
0
		private SIL.Utils.StringTable m_stringTable;  // for "LabelAbbreviations"

		#region Fixture Setup and Teardown
		internal static StringTable GenerateStringTable()
		{
			string configurationDir = Path.Combine(FwDirectoryFinder.CodeDirectory,
				@"Language Explorer/Configuration");
			var stringTable = new SIL.Utils.StringTable(configurationDir);

			return stringTable;
		}
Example #17
0
        private SIL.Utils.StringTable m_stringTable;          // for "LabelAbbreviations"

        #region Fixture Setup and Teardown
        internal static StringTable GenerateStringTable()
        {
            string configurationDir = Path.Combine(DirectoryFinder.FWCodeDirectory,
                                                   @"Language Explorer/Configuration");
            var stringTable = new SIL.Utils.StringTable(configurationDir);

            return(stringTable);
        }
Example #18
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// normal constructor.
		/// </summary>
		/// <param name="cache">The cache.</param>
		/// <param name="layoutName">Name of the layout.</param>
		/// <param name="colSpec">The col spec.</param>
		/// <param name="stringTbl">The string TBL.</param>
		/// <param name="app">The application.</param>
		/// ------------------------------------------------------------------------------------
		public LayoutFinder(FdoCache cache, string layoutName, XmlNode colSpec,
			StringTable stringTbl, IApp app): this()
		{
			m_layoutName = layoutName;
			m_colSpec = colSpec;
			m_stringTbl = stringTbl;
			m_app = app;
			Cache = cache;
		}
Example #19
0
		/// <summary>
		///
		/// </summary>
		/// <param name="mdc"></param>
		/// <param name="tbl"></param>
		/// <param name="clsId"></param>
		/// <param name="titleStr">*{dstClass}* if couldn't find result.</param>
		/// <returns>true if we found an alternate form. false if titleStr is null or in *{ClassName}* format.</returns>
		public static bool TryFindPluralFormFromClassId(IFwMetaDataCache mdc, StringTable tbl, int clsId, out string titleStr)
		{
			titleStr = null;
			if (clsId != 0)
			{
				string className = mdc.GetClassName(clsId);
				return TryFindString(tbl, "AlternativeTitles", String.Format("{0}-Plural", className), out titleStr);
			}
			return false;
		}
				/// <summary>
		/// We want the persistence provider, and the easiest way to get it is to get all
		/// this other stuff we don't need or use.
		/// </summary>
		/// <param name="cache"></param>
		/// <param name="editor"></param>
		/// <param name="flid"></param>
		/// <param name="node"></param>
		/// <param name="obj"></param>
		/// <param name="stringTbl"></param>
		/// <param name="persistenceProvider"></param>
		/// <param name="ws"></param>
		public PhonologicalFeatureListDlgLauncherSlice(FdoCache cache, string editor, int flid,
			System.Xml.XmlNode node, ICmObject obj, StringTable stringTbl,
			IPersistenceProvider persistenceProvider, int ws)
				{
					m_obj = obj; // is PhPhoneme
					m_persistenceProvider = persistenceProvider;
					m_ws = ws;
					m_node = node;
					m_configurationNode = node;
				}
		/// <summary>
		/// Make one. Everything interesting happens when it is given a root object, however.
		/// </summary>
		/// <param name="cache"></param>
		/// <param name="analysis"></param>
		/// <param name="configurationNode"></param>
		/// <param name="stringTable"></param>
		public AnalysisInterlinearRs(FdoCache cache, IWfiAnalysis analysis,
			XmlNode configurationNode, StringTable stringTable) : base(cache)
		{
			if (analysis == null)
				throw new ArgumentNullException("analysis");
			if (configurationNode == null)
				throw new ArgumentNullException("configurationNode");

			m_configurationNode = configurationNode;
			m_wfiAnalysis = analysis;
			m_wordform = m_wfiAnalysis.Wordform;
			//			RightMouseClickedEvent += new FwRightMouseClickEventHandler(InterlinDocChild_RightMouseClickedEvent);
		}
Example #22
0
		/// <summary>
		/// looks up plural form alternative first for given flid, secondly for its destination class.
		/// </summary>
		/// <param name="mdc"></param>
		/// <param name="tbl"></param>
		/// <param name="owningFlid"></param>
		/// <param name="titleStr">*{dstClass}* if couldn't find result.</param>
		/// <returns>true if we found an alternate form. false if titleStr is null or in *{key}* format.</returns>
		public static bool TryFindPluralFormFromFlid(IFwMetaDataCache mdc, StringTable tbl, int owningFlid, out string titleStr)
		{
			// first see if we can find an expanded name for the name of a flid.
			string flidName = mdc.GetFieldName(owningFlid);
			if (!String.IsNullOrEmpty(flidName))
			{
				if (TryFindString(tbl, "AlternativeTitles", flidName, out titleStr))
					return true;
			}
			// secondly, see if we can find the plural form for the destination class.
			int dstClass = mdc.GetDstClsId(owningFlid);
			return TryFindPluralFormFromClassId(mdc, tbl, dstClass, out titleStr);
		}
Example #23
0
		/// <summary>
		/// looks up plural form alternative first for given flid, secondly for its destination class.
		/// </summary>
		/// <param name="cache"></param>
		/// <param name="tbl"></param>
		/// <param name="owningFlid"></param>
		/// <param name="titleStr">*{dstClass}* if couldn't find result.</param>
		/// <returns>true if we found an alternate form. false if titleStr is null or in *{key}* format.</returns>
		public static bool TryFindPluralFormFromFlid(FdoCache cache, StringTable tbl, uint owningFlid, out string titleStr)
		{
			titleStr = null;
			// first see if we can find an expanded name for the name of a flid.
			string flidName = cache.MetaDataCacheAccessor.GetFieldName(owningFlid);
			if (!String.IsNullOrEmpty(flidName))
			{
				if (TryFindString(tbl, "AlternativeTitles", flidName, out titleStr))
					return true;
			}
			// secondly, see if we can find the plural form for the destination class.
			uint dstClass = cache.GetDestinationClass(owningFlid);
			return TryFindPluralFormFromClassId(cache, tbl, dstClass, out titleStr);
		}
Example #24
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="obj">CmObject that is being displayed.</param>
 /// <param name="flid">The field identifier for the attribute we are displaying.</param>
 public EnumComboSlice(FdoCache cache, ICmObject obj, int flid, SIL.Utils.StringTable stringTable, XmlNode parameters)
     : base(new FwOverrideComboBox(), cache, obj, flid)
 {
     m_combo = (ComboBox)this.Control;
     m_combo.DropDownStyle = ComboBoxStyle.DropDownList;
     //note: no exception is thrown if it can't find it.
     m_combo.Font = new System.Drawing.Font("Arial Unicode MS", 10);
     m_combo.SelectedValueChanged += new EventHandler(this.SelectionChanged);
     m_combo.GotFocus             += new EventHandler(m_combo_GotFocus);
     StringTbl = stringTable;
     PopulateCombo(parameters);
     // We need to watch the cache for changes to our property.
     cache.MainCacheAccessor.AddNotification(this);
 }
Example #25
0
		/// <summary>
		/// The method object's constructor.
		/// </summary>
		/// <param name="vc">The view constructor</param>
		/// <param name="vwenv">The view environment</param>
		/// <param name="hvo">A handle on the root object</param>
		/// <param name="flid">The field ID</param>
		/// <param name="frag">A code identifying the current part of the display</param>
		public XmlVcDisplayVec(XmlVc vc, IVwEnv vwenv, int hvo, int flid, int frag)
		{
			m_viewConstructor = vc;
			m_vwEnv = vwenv;
			m_hvo = hvo;
			m_flid = flid;
			m_frag = frag;
			m_cache = m_viewConstructor.Cache;
			m_sda = m_viewConstructor.DataAccess;
			if (vwenv.DataAccess != null)
				m_sda = vwenv.DataAccess;
			m_objRepo = m_cache.ServiceLocator.GetInstance<ICmObjectRepository>();
			m_stringTable = m_viewConstructor.StringTbl;
		}
Example #26
0
		/// <summary>
		/// Constructor invoked via the editor="customWithParams" slice XML configuration
		/// </summary>
		/// <param name="cache"></param>
		/// <param name="editor"></param>
		/// <param name="flid"></param>
		/// <param name="node"></param>
		/// <param name="obj"></param>
		/// <param name="stringTbl"></param>
		/// <param name="persistenceProvider"></param>
		/// <param name="ws"></param>
		public BasicIPASymbolSlice(FdoCache cache, string editor, int flid,
						System.Xml.XmlNode node, ICmObject obj, StringTable stringTbl,
						IPersistenceProvider persistenceProvider, int ws)
			: base(obj.Hvo, flid, ws)
		{
			m_obj = obj; // is PhPhoneme
			//m_persistenceProvider = persistenceProvider;
			m_ws = ws;
			//m_node = node;
			m_configurationNode = node;
			m_sda = cache.MainCacheAccessor;
			m_sda.AddNotification(this);
			this.Disposed += new EventHandler(BasicIPASymbolSlice_Disposed);
			m_IPAMapperDocument = new XmlDocument();
			string sIPAMapper = Path.Combine(DirectoryFinder.TemplateDirectory, PhPhoneme.ksBasicIPAInfoFile);
			m_IPAMapperDocument.Load(sIPAMapper);
		}
Example #27
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Setups this instance.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public override void FixtureSetup()
		{
			base.FixtureSetup();

			m_layouts = GenerateLayouts();
			m_parts = GenerateParts();
			m_stringTable = GenerateStringTable();

			NonUndoableUnitOfWorkHelper.Do(m_actionHandler, () =>
			{
				m_entry = Cache.ServiceLocator.GetInstance<ILexEntryFactory>().Create();
				m_entry.CitationForm.VernacularDefaultWritingSystem = TsStringUtils.MakeTss("rubbish", Cache.DefaultVernWs);
				// We set both alternatives because currently the default part for Bibliography uses vernacular,
				// but I think this will probably get fixed. Anyway, this way the test is robust.
				m_entry.Bibliography.SetAnalysisDefaultWritingSystem("My rubbishy bibliography");
				m_entry.Bibliography.SetVernacularDefaultWritingSystem("My rubbishy bibliography");
			});
		}
Example #28
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Setups this instance.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public override void FixtureSetup()
        {
            base.FixtureSetup();

            m_layouts     = GenerateLayouts();
            m_parts       = GenerateParts();
            m_stringTable = GenerateStringTable();

            NonUndoableUnitOfWorkHelper.Do(m_actionHandler, () =>
            {
                m_entry = Cache.ServiceLocator.GetInstance <ILexEntryFactory>().Create();
                m_entry.CitationForm.VernacularDefaultWritingSystem = TsStringUtils.MakeTss("rubbish", Cache.DefaultVernWs);
                // We set both alternatives because currently the default part for Bibliography uses vernacular,
                // but I think this will probably get fixed. Anyway, this way the test is robust.
                m_entry.Bibliography.SetAnalysisDefaultWritingSystem("My rubbishy bibliography");
                m_entry.Bibliography.SetVernacularDefaultWritingSystem("My rubbishy bibliography");
            });
        }
Example #29
0
		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="ReferenceSlice"/> class.
		/// </summary>
		/// -----------------------------------------------------------------------------------
		public ReferenceSlice(FdoCache cache, ICmObject obj, int flid,
			XmlNode configurationNode, IPersistenceProvider persistenceProvider,
			Mediator mediator, StringTable stringTbl)
			: base(null, cache, obj, flid)
		{
			ConfigurationNode = configurationNode;//todo: remove this when FieldSlice gets the node as part of its constructor
			// have chooser title use the same text as the label
			if (mediator != null && mediator.HasStringTable)
				m_fieldName = XmlUtils.GetLocalizedAttributeValue(mediator.StringTbl,
					configurationNode, "label", m_fieldName);
			else if (stringTbl != null)
				m_fieldName = XmlUtils.GetLocalizedAttributeValue(stringTbl,
					configurationNode, "label", m_fieldName);
			else
				m_fieldName = XmlUtils.GetOptionalAttributeValue(
					configurationNode, "label", m_fieldName);

			SetupControls(persistenceProvider, mediator, stringTbl);
		}
Example #30
0
        int m_comboWidth;                       // computed width of m_combo

        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="cache"></param>
        /// <param name="obj">CmObject that is being displayed.</param>
        /// <param name="flid">The field identifier for the attribute we are displaying.</param>
        /// <param name="stringTable"></param>
        /// <param name="parameters"></param>
        public EnumComboSlice(FdoCache cache, ICmObject obj, int flid, SIL.Utils.StringTable stringTable, XmlNode parameters)
            : base(new FwOverrideComboBox(), cache, obj, flid)
        {
            m_combo = (ComboBox)this.Control;
            m_combo.DropDownStyle = ComboBoxStyle.DropDownList;
            //note: no exception is thrown if it can't find it.
            m_combo.Font = new System.Drawing.Font(MiscUtils.StandardSansSerif, 10);
            SetForeColor(parameters);
            m_combo.SelectedValueChanged += new EventHandler(this.SelectionChanged);
            m_combo.GotFocus             += new EventHandler(m_combo_GotFocus);
            m_combo.DropDownClosed       += new EventHandler(m_combo_DropDownClosed);
#if __MonoCS__  // FWNX-545
            m_combo.Parent.SizeChanged += new EventHandler(OnComboParentSizeChanged);
#endif
            StringTbl = stringTable;
            PopulateCombo(parameters);
            // We need to watch the cache for changes to our property.
            cache.DomainDataByFlid.AddNotification(this);
        }
Example #31
0
		public List(XmlNode configurationNode, StringTable stringTbl)
		{
			//it's not uncommon for this to be empty, if the list is being automatically generated by some
			//colleague in the system (e.g. AreaManager)
			if (configurationNode  == null)
				return;
			foreach(XmlNode node in configurationNode.SelectNodes("item"))
			{
				XmlNode parameterNode = null;
				if (node.ChildNodes.Count > 0)
					parameterNode = node.ChildNodes[0];
				Debug.Assert( node.ChildNodes.Count < 2, "Currently, only a single parameter node is allowed("+ configurationNode.OuterXml +")");
				Debug.Assert(XmlUtils.GetAttributeValue(node,"value") != null, "You must supply a value for every list item("+ configurationNode.OuterXml +")");
				string label = XmlUtils.GetLocalizedAttributeValue(stringTbl, node, "label", null);
				Add(label,
					XmlUtils.GetAttributeValue(node,"value"),
					XmlUtils.GetAttributeValue(node, "icon", "default"),
					parameterNode);
			}
		}
Example #32
0
		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="ReferenceCollectionSlice"/> class.
		/// </summary>
		/// -----------------------------------------------------------------------------------
		public ReferenceVectorSlice(FdoCache cache, ICmObject obj, int flid,
			XmlNode configurationNode, IPersistenceProvider persistenceProvider,
			Mediator mediator, StringTable stringTbl)
		: base(cache, obj, flid, configurationNode, persistenceProvider, mediator, stringTbl)
		{
		}
Example #33
0
		protected override void SetupControls(IPersistenceProvider persistenceProvider,
			Mediator mediator, StringTable stringTbl)
		{
			VectorReferenceLauncher vrl = new VectorReferenceLauncher();
			vrl.Initialize(m_cache, m_obj, m_flid, m_fieldName, persistenceProvider, mediator,
				DisplayNameProperty,
				BestWsName); // TODO: Get better default 'best ws'.
			vrl.ConfigurationNode = ConfigurationNode;
			this.Control = vrl;
			vrl.ViewSizeChanged += new FwViewSizeChangedEventHandler(this.OnViewSizeChanged);
			VectorReferenceView view = (VectorReferenceView)vrl.MainControl;
			view.ViewSizeChanged += new FwViewSizeChangedEventHandler(this.OnViewSizeChanged);
			// We don't want to be visible until later, since otherwise we get a temporary
			// display in the wrong place with the wrong size that serves only to annoy the
			// user.  See LT-1518 "The drawing of the DataTree for Lexicon/Advanced Edit draws
			// some initial invalid controls."  Becoming visible when we set the width and
			// height seems to delay things enough to avoid this visual clutter.
			vrl.Visible = false;
		}
Example #34
0
		/// <summary>
		/// Initialize the dialog after creating it.
		/// </summary>
		/// <param name="configurationParameters"></param>
		/// <param name="cache"></param>
		/// <param name="styleSheet"></param>
		/// <param name="mainWindowDelegateCallbacks"></param>
		/// <param name="mediator"></param>
		public void SetConfigDlgInfo(XmlNode configurationParameters, FdoCache cache,
			FwStyleSheet styleSheet, IMainWindowDelegateCallbacks mainWindowDelegateCallbacks,
			Mediator mediator, string sLayoutPropertyName)
		{
			CheckDisposed();
			m_configurationParameters = configurationParameters;
			string labelKey = XmlUtils.GetAttributeValue(configurationParameters, "viewTypeLabelKey");
			if (!String.IsNullOrEmpty(labelKey))
			{
				string sLabel = xWorksStrings.ResourceManager.GetString(labelKey);
				if (!String.IsNullOrEmpty(sLabel))
					m_lblViewType.Text = sLabel;
			}
			m_cache = cache;
			m_mdc = m_cache.MetaDataCacheAccessor;
			m_styleSheet = styleSheet;
			m_callbacks = mainWindowDelegateCallbacks;
			m_mediator = mediator;
			m_sLayoutPropertyName = sLayoutPropertyName;
			if (m_mediator != null && m_mediator.HasStringTable)
				m_stringTbl = m_mediator.StringTbl;
			m_layouts = Inventory.GetInventory("layouts", cache.DatabaseName);
			m_parts = Inventory.GetInventory("parts", cache.DatabaseName);
			string configObjectName = XmlUtils.GetLocalizedAttributeValue(m_mediator.StringTbl,
				configurationParameters, "configureObjectName", "");
			this.Text = String.Format(this.Text, configObjectName);
			m_defaultRootLayoutName = XmlUtils.GetAttributeValue(configurationParameters, "layout");
			string sLayoutType = null;
			if (m_mediator != null && m_mediator.PropertyTable != null)
			{
				object objType = m_mediator.PropertyTable.GetValue(m_sLayoutPropertyName);
				if (objType != null)
					sLayoutType = (string)objType;
			}
			if (String.IsNullOrEmpty(sLayoutType))
				sLayoutType = m_defaultRootLayoutName;
			CreateComboAndTreeItems(sLayoutType);

			// Restore the location and size from last time we called this dialog.
			if (m_mediator != null && m_mediator.PropertyTable != null)
			{
				object locWnd = m_mediator.PropertyTable.GetValue("XmlDocConfigureDlg_Location");
				object szWnd = m_mediator.PropertyTable.GetValue("XmlDocConfigureDlg_Size");
				if (locWnd != null && szWnd != null)
				{
					Rectangle rect = new Rectangle((Point)locWnd, (Size)szWnd);
					ScreenUtils.EnsureVisibleRect(ref rect);
					DesktopBounds = rect;
					StartPosition = FormStartPosition.Manual;
				}
			}

			// Make a help topic ID
			m_helpTopicID = generateChooserHelpTopicID(configObjectName);

			// Load the list for the styles combo box.
			SetStylesList();
		}
		public PhonologicalFeatureListDlgLauncherSlice(FdoCache cache, ICmObject obj, int flid,
			System.Xml.XmlNode node, IPersistenceProvider persistenceProvider, Mediator mediator, StringTable stringTbl)
		{

		}
        public void FixtureInit()
        {
            string baseFolder = CreateTempTestFiles(typeof(Properties.Resources), "food");

            m_table = new StringTable(System.IO.Path.Combine(baseFolder, "fruit/citrus"));
        }