Exemple #1
0
        private ListView MakeList(string listId, string label)
        {
            ListView list = new ListView();

            list.View        = View.List;
            list.Name        = label;
            list.Dock        = System.Windows.Forms.DockStyle.Top;
            list.MultiSelect = false;


            XCore.List xlist = new XCore.List(null);             //(listNode);
            UIListDisplayProperties display = new UIListDisplayProperties(xlist);

            display.PropertyName = listId;
            m_mediator.SendMessage("Display" + listId, null, ref display);

            foreach (ListItem item in xlist)
            {
                ListViewItem x = list.Items.Add(item.label);
                x.Tag = new StringPropertyChoice(m_mediator, item.parameterNode, null, null);
            }

            list.SelectedIndexChanged += new EventHandler(OnSelectedIndexChanged);

            return(list);
        }
Exemple #2
0
        /// <summary>
        /// enable this list of items iff the corresponding check box is checked.
        /// </summary>
        public bool OnDisplayListVowels(object parameters, ref UIListDisplayProperties display)
        {
            CheckDisposed();

            if (cbModifyVowelList.Checked)
            {
                display.List.Add("AA", "AA", "", null);
                display.List.Add("OO", "OO", "", null);
            }
            return(true);           //we handled this, no need to ask anyone else.
        }
Exemple #3
0
        protected void PopulateFromList()
        {
            /// Just before this group is displayed, allow the group's contents to be modified by colleagues
            //if this is a list-populated group.

            //first, we get the list as it is in the XML configuration file
            XmlNode listNode = m_configurationNode.OwnerDocument.SelectSingleNode("//list[@id='" + this.ListId + "']");

            StringTable stringTbl = null;

            if (m_mediator != null && m_mediator.HasStringTable)
            {
                stringTbl = m_mediator.StringTbl;
            }
            XCore.List list = new XCore.List(listNode, stringTbl);

            UIListDisplayProperties display = new UIListDisplayProperties(list);

            display.PropertyName = this.PropertyName;
            string wsSet = XmlUtils.GetOptionalAttributeValue(m_configurationNode, "wsSet");

            m_mediator.SendMessage("Display" + this.ListId, wsSet, ref display);

            PropertyName = display.PropertyName;

            foreach (ListItem item in list)
            {
                if (item is SeparatorItem)
                {
                    Add(new SeparatorChoice(null, null, null, null));
                }
                else
                {
                    Add(new ListPropertyChoice(m_mediator, item, m_adapter, this));
                }
            }

            // select the first one if none is selected
            if (
                (!m_mediator.PropertyTable.PropertyExists(this.PropertyName, this.PropertyTableGroup)) &&               // there isn't a value alread (from depersisting)
                (this.Count > 0))
            {
                //ListPropertyChoice first = (ListPropertyChoice)this[0];
                //				first.OnClick(this, null);
            }
        }
Exemple #4
0
		private ListView MakeList(string listId, string label)
		{
			ListView list= new ListView();
			list. View = View.List;
			list.Name = label;
			list.Dock = System.Windows.Forms.DockStyle.Top;
			list.MultiSelect = false;


			XCore.List xlist = new XCore.List(null); //(listNode);
			UIListDisplayProperties display =new UIListDisplayProperties(xlist);
			display.PropertyName= listId;
			m_mediator.SendMessage("Display"+listId, null, ref display);

			foreach (ListItem item in xlist)
			{
				ListViewItem x =list.Items.Add(item.label);
				x.Tag = new StringPropertyChoice(m_mediator, item.parameterNode, null, null);
			}

			list.SelectedIndexChanged+=new EventHandler(OnSelectedIndexChanged);

			return list;
		}
		/// <summary>
		/// This is called when XCore wants to display something that relies on the list with the
		/// id "ReversalIndexList"
		/// </summary>
		/// <param name="parameter"></param>
		/// <param name="display"></param>
		/// <returns></returns>
		public bool OnDisplayReversalIndexList(object parameter, ref UIListDisplayProperties display)
		{
			CheckDisposed();

			display.List.Clear();
			var cache = (FdoCache) m_mediator.PropertyTable.GetValue("cache");
			// List all existing reversal indexes.  (LT-4479, as amended)
			//IReversalIndex riOwner = this.IReversalIndex;
			foreach (IReversalIndex ri in cache.LanguageProject.LexDbOA.ReversalIndexesOC)
			{
				display.List.Add(ri.ShortName, ri.Guid.ToString(), null, null);
			}
			display.List.Sort();
			return true; // We handled this, no need to ask anyone else.
		}
Exemple #6
0
		private void AddWritingSystemList(UIListDisplayProperties display,
			FdoReferenceSequence<ILgWritingSystem> list)
		{
			foreach (ILgWritingSystem ws in list)
			{
				display.List.Add(ws.ShortName, ws.Hvo.ToString(), null, null);
			}
		}
Exemple #7
0
		private bool FillListAreaList(UIListDisplayProperties display)
		{
			var customLists = GetListOfOwnerlessLists();
			var fcustomChanged = customLists.Count != m_ccustomLists;
			// Since we're in the 'Lists' area, don't bother refreshing this
			// list, unless the number of Custom lists has changed. This happens
			// whenever someone adds one.
			if (display.List.Count > 0 && !fcustomChanged)
				return true;

			// We can get here in the following cases:
			// Case 1: display.List is empty and m_ctotalLists == 0
			//       Load 'windowConfiguration' with all Custom lists,
			//       Update both list counts,
			//       Load 'display' with ALL lists.
			// Case 2: display.List is empty, but m_ctotalLists > 0
			//       We MAY have a recent Custom list addition to add.
			//       If 'fcustomChanged', load the new Custom list into 'windowConfiguration',
			//          and update both list counts,
			//       Load 'display' with ALL lists.
			// Case 3: display.List is loaded, but we have a recent Custom list addition to add.
			//       Load the new Custom list into 'windowConfiguration',
			//       Update both list counts,
			//       Only update 'display' with new Custom list.
			// N.B. This may need changing if we allow the user to DELETE Custom lists someday.
			var windowConfiguration = (XmlNode)m_mediator.PropertyTable.GetValue("WindowConfiguration");
			UpdateWinConfig(fcustomChanged, customLists, windowConfiguration);

			// Now update 'display'
			StringTable tbl = null;
			FdoCache cache = null;
			ICmPossibilityListRepository possRepo = null;
			if (m_mediator != null && m_mediator.HasStringTable)
				tbl = m_mediator.StringTbl;
			if (m_mediator != null)
				 cache = (FdoCache)m_mediator.PropertyTable.GetValue("cache");
			if (cache != null)
				possRepo = cache.ServiceLocator.GetInstance<ICmPossibilityListRepository>();
			if (display.List.Count > 0)
			{
				var node = windowConfiguration.SelectSingleNode(GetListToolsXPath()).LastChild;
				if (node != null)
					AddToolNodeToDisplay(possRepo, cache, display, tbl, node);
			}
			else
			{
				var nodes = windowConfiguration.SelectNodes(GetToolXPath("lists"));
				if (nodes != null)
					foreach (XmlNode node in nodes)
					{
						if ((!FwUtils.IsTEInstalled) && XmlUtils.GetOptionalBooleanAttributeValue(node, "bteOnly", false))
							continue;
						AddToolNodeToDisplay(possRepo, cache, display, tbl, node);
					}
			}
			return true;
		}
Exemple #8
0
		private bool FillList(UIListDisplayProperties display, string areaId)
		{
			// Don't bother refreshing this list.
			if (display.List.Count > 0)
				return true;
			var windowConfiguration = (XmlNode)m_mediator.PropertyTable.GetValue("WindowConfiguration");
			StringTable tbl = null;
			if (m_mediator != null && m_mediator.HasStringTable)
				tbl = m_mediator.StringTbl;
			XmlNodeList nodes = windowConfiguration.SelectNodes(GetToolXPath(areaId));
			if (nodes != null)
			{
				foreach (XmlNode node in nodes)
				{
					string label = XmlUtils.GetLocalizedAttributeValue(tbl, node, "label", "???");
					string value = XmlUtils.GetAttributeValue(node, "value", "???");
					string imageName = XmlUtils.GetAttributeValue(node, "icon"); //can be null
					XmlNode controlElement = node.SelectSingleNode("control");
					display.List.Add(label, value, imageName, controlElement);
				}
			}
			return true;
		}
Exemple #9
0
		public bool OnDisplayTextToolsList(object parameters, ref UIListDisplayProperties display)
		{
			CheckDisposed();

			return FillList(display, "textsWords");
		}
Exemple #10
0
		public bool OnDisplayLexicalToolsList(object parameters, ref UIListDisplayProperties display)
		{
			CheckDisposed();

			return FillList(display, "lexicon");
		}
		/// <summary>
		/// Populate the writing system options for the slice.
		/// </summary>
		/// <param name="parameter">The parameter.</param>
		/// <param name="display">The display.</param>
		/// <returns></returns>
		public bool OnDisplayWritingSystemOptionsForSlice(object parameter, ref UIListDisplayProperties display)
		{
			CheckDisposed();
			display.List.Clear();
			Mediator.PropertyTable.SetProperty(display.PropertyName, GetVisibleWSSPropertyValue(), false);
			AddWritingSystemListWithIcuLocales(display, WritingSystemOptionsForDisplay);
			return true;//we handled this, no need to ask anyone else.
		}
Exemple #12
0
		/// <summary>
		/// Populate the list of layout views for the second dictionary titlebar menu.
		/// </summary>
		/// <param name="parameter">The parameter.</param>
		/// <param name="display">The display.</param>
		/// <returns></returns>
		public bool OnDisplayLayouts(object parameter, ref UIListDisplayProperties display)
		{
			var layoutList = GatherBuiltInAndUserLayouts();
			foreach (var view in layoutList)
			{
				display.List.Add(view.Item1, view.Item2, null, null, true);
			}
			return true;
		}
Exemple #13
0
		/// <summary>
		/// Populate the list of publications for the first dictionary titlebar menu.
		/// </summary>
		/// <param name="parameter">The parameter.</param>
		/// <param name="display">The display.</param>
		/// <returns></returns>
		public bool OnDisplayPublications(object parameter, ref UIListDisplayProperties display)
		{
			foreach (var pub in Cache.LangProject.LexDbOA.PublicationTypesOA.PossibilitiesOS)
			{
				var name = pub.Name.UserDefaultWritingSystem.Text;
				display.List.Add(name, name, null, null, true);
			}
			return true;
		}
Exemple #14
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Fill in the list of style names.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected virtual void FillInStylesComboList(UIListDisplayProperties display, IVwStylesheet stylesheet)
		{
		}
Exemple #15
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Called when XCore wants to display something that relies on the list with the id "CombinedStylesList"
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public bool OnDisplayCombinedStylesList(object parameter, ref UIListDisplayProperties display)
		{
			CheckDisposed();
			if (!Focused || m_rootb == null)
				return false;
			IVwStylesheet stylesheet = m_rootb.Stylesheet;
			if (stylesheet == null)
				return false;
			FillInStylesComboList(display, stylesheet);
			return true;
		}
Exemple #16
0
        protected void PopulateFromList()
        {
            /// Just before this group is displayed, allow the group's contents to be modified by colleagues
            //if this is a list-populated group.

            //first, we get the list as it is in the XML configuration file
            XmlNode listNode = m_configurationNode.OwnerDocument.SelectSingleNode("//list[@id='"+this.ListId+"']");

            StringTable stringTbl = null;
            if (m_mediator != null && m_mediator.HasStringTable)
                stringTbl = m_mediator.StringTbl;
            XCore.List list = new XCore.List(listNode, stringTbl);

            UIListDisplayProperties display =new UIListDisplayProperties(list);
            display.PropertyName= this.PropertyName;
            string wsSet = XmlUtils.GetOptionalAttributeValue(m_configurationNode, "wsSet");
            m_mediator.SendMessage("Display"+this.ListId, wsSet, ref display);

            PropertyName = display.PropertyName;

            foreach (ListItem item in list)
            {
                Add(new ListPropertyChoice(m_mediator, item,m_adapter , this));
            }

            // select the first one if none is selected
            if(
                (!m_mediator.PropertyTable.PropertyExists(this.PropertyName, this.PropertyTableGroup))	// there isn't a value alread (from depersisting)
                && (this.Count>0))
            {
                //ListPropertyChoice first = (ListPropertyChoice)this[0];
                //				first.OnClick(this, null);
            }
        }
Exemple #17
0
        /// <summary>
        ///
        /// </summary>
        /// <remarks> see all comments in the other SendMessage() method, which apply here.</remarks>
        /// <param name="messageName"></param>
        /// <param name="parameter"></param>
        /// <param name="returnValue"></param>
        public void SendMessage(string messageName, object parameter,
			ref UIListDisplayProperties returnValue)
        {
            CheckDisposed();

            if (!ProcessMessages)
                return;

            Trace.WriteLineIf(showPendingMsgsSwitch.TraceVerbose,
                BuildDebugMsg("SendMessage2::Looking for listeners for Msg: " + messageName),
                showPendingMsgsSwitch.DisplayName);

            //NB: I could not figure out how to get this to find the method only if the method
            // includes a "ref" parameter, as is the case here, if I specified the types.
            //	Therefore, we supply "null" here.

            try
            {
                InvokeOnColleagues("On" + messageName,
                    null, // types see note above
                    new Object[] { parameter, returnValue },
                    true, false);
            }
            catch (DisposedInAnotherFrameException)
            {
                Debug.WriteLine("EXCEPTION: Caught case where the Mediator was disposed of while processing...");
            }
        }
		/// <summary>
		/// stores the list values in terms of icu locale
		/// </summary>
		/// <param name="display"></param>
		/// <param name="list"></param>
		private void AddWritingSystemListWithIcuLocales(UIListDisplayProperties display, IEnumerable<IWritingSystem> list)
		{
			string[] active = GetVisibleWSSPropertyValue().Split(',');
			foreach (var ws in list)
			{
				// generally enable all items, but if only one is checked that one is disabled;
				// it can't be turned off.
				bool enabled = (active.Length != 1 || ws.Id != active[0]);
				display.List.Add(ws.DisplayLabel, ws.Id, null, null, enabled);
			}
		}
Exemple #19
0
		public bool OnDisplayGrammarToolsList(object parameters, ref UIListDisplayProperties display)
		{
			CheckDisposed();

			return FillList(display, "grammar");
		}
Exemple #20
0
		/// <summary>
		/// enable this list of items iff the corresponding check box is checked.
		/// </summary>
		public bool OnDisplayListVowels(object parameters, ref  UIListDisplayProperties display)
		{
			CheckDisposed();

			if (cbModifyVowelList.Checked)
			{
				display.List.Add("AA", "AA", "", null);
				display.List.Add("OO", "OO", "", null);
			}
			return true;//we handled this, no need to ask anyone else.
		}
Exemple #21
0
		public bool OnDisplayNotebookToolsList(object parameters, ref UIListDisplayProperties display)
		{
			CheckDisposed();

			return FillList(display, "notebook");
		}
Exemple #22
0
        /// <summary>
        /// Called when XCore wants to display something that relies on the list with the id
        /// "CombinedStylesList".
        /// </summary>
        public bool OnDisplayCombinedStylesList(object parameter, ref UIListDisplayProperties display)
        {
            CheckDisposed();

            return false;
        }
Exemple #23
0
		public bool OnDisplayListsToolsList(object parameters, ref UIListDisplayProperties display)
		{
			CheckDisposed();

			if(FillListAreaList(display))
			{
				// By now the labels in this List are localized, so if we sort we get what
				// we want; a localized sorted list of lists [LT-9579]
				display.List.Sort();
				return true;
			}
			return false;
		}
Exemple #24
0
 private static void AddWritingSystemList(UIListDisplayProperties display, IEnumerable<IWritingSystem> list)
 {
     foreach (IWritingSystem ws in list)
     {
         display.List.Add(ws.DisplayLabel, ws.Handle.ToString(), null, null);
     }
 }
Exemple #25
0
		private static void AddToolNodeToDisplay(ICmPossibilityListRepository possRepo, FdoCache cache,
												 UIListDisplayProperties display, StringTable tbl, XmlNode node)
		{
			// Modified how this works, so it uses the current UI version of the PossibilityList Name,
			// if possible.
			var localizedLabel = FindMatchingPossibilityListUIName(node, possRepo, cache);
			if (localizedLabel == null)
				localizedLabel = XmlUtils.GetLocalizedAttributeValue(tbl, node, "label", "???");
			var value = XmlUtils.GetAttributeValue(node, "value", "???");
			var imageName = XmlUtils.GetAttributeValue(node, "icon"); //can be null
			var controlElement = node.SelectSingleNode("control");
			display.List.Add(localizedLabel, value, imageName, controlElement);
		}
Exemple #26
0
		/// <summary>
		/// this is called when XCore wants to display something that relies on the list with the id "FiltersList"
		/// </summary>
		/// <param name="parameters"></param>
		/// <param name="display"></param>
		/// <returns></returns>
		public bool OnDisplayFiltersList(object parameters, ref UIListDisplayProperties display)
		{
			CheckDisposed();

			//set the filters list property to the one that we are monitoring
			display.PropertyName = CurrentFilterPropertyTableId;

			display.List.Clear();
			// Add an item for clearing all filters.
			AddFilterChoice(new NoFilters(), display);
			if (m_filterProvider!= null)
			{
				foreach(RecordFilter filter in m_filterProvider.Filters)
				{
					AddFilterChoice(filter, display);
				}
			}
			return true;//we handled this, no need to ask anyone else.
		}
Exemple #27
0
		/// <summary>
		/// this is called when XCore wants to display something that relies on the list with the id "WritingSystemList"
		/// </summary>
		/// <param name="parameters"></param>
		/// <param name="display"></param>
		/// <returns></returns>
		public bool OnDisplayWritingSystemList(object parameter, ref UIListDisplayProperties display)
		{
			CheckDisposed();

			display.List.Clear();
			FdoCache cache = (FdoCache) m_mediator.PropertyTable.GetValue("cache");
			string wsSet = parameter as string;
			WritingSystemSet setToUse = m_currentSet;
			if (wsSet != null)
			{
				// JohnT: This is a patch to fix LT-5059. The problem is that the WritingSystemList set
				// (with the pronunciation subset) is used in the Pronuciation field pull-down menu.
				// All other code that I can find currently does not specify it. Therefore, after this
				// menu is displayed once, m_currentSet is set to pronunciation and stays there.
				// It seems that we actually have no current use for any other subset, nor for remembering
				// the most recent one specified. However, in the interests of making the change minimal,
				// and in case there is some anticipated application of tracking the current set which
				// I am not aware of, I made a way for that one menu item to get the list it needs
				// without making a persistent change.
				string tempPrefix = "temp:";
				bool fTemp = wsSet.StartsWith(tempPrefix);
				if (fTemp)
				{
					setToUse = DecodeSetName(wsSet.Substring(tempPrefix.Length));
				}
				else
				{
					m_currentSet = setToUse = DecodeSetName(wsSet);
				}
			}
			switch (setToUse)
			{
				default:
					throw new NotImplementedException("That writing system set needs to be implemented");
				case WritingSystemSet.All:
					AddWritingSystemList(display,  cache.LangProject.GetAllNamedWritingSystems());
					break;
				case WritingSystemSet.AllCurrent:
					AddWritingSystemList(display,  cache.LangProject.GetActiveNamedWritingSystems());
					break;
				case WritingSystemSet.CurrentAnalysis:
					AddWritingSystemList(display,  cache.LangProject.CurAnalysisWssRS);
					break;
				case WritingSystemSet.CurrentVernacular:
					AddWritingSystemList(display,  cache.LangProject.CurVernWssRS);
					break;
				case WritingSystemSet.CurrentPronounciation:
					AddWritingSystemList(display, cache.LangProject.GetPronunciationWritingSystems());
					string sValue = CmObject.JoinIds(cache.LangProject.CurPronunWssRS.HvoArray, ",");
					m_mediator.PropertyTable.SetProperty("PronunciationWritingSystemHvos", sValue);
					break;
			}
			return true;//we handled this, no need to ask anyone else.
		}
Exemple #28
0
		private static void AddFilterChoice(RecordFilter filter, UIListDisplayProperties display)
		{
			string value = filter.id;
			string imageName = filter.imageName;
			// Since we are storing actual, instantiated filter objects, there's no point in also keeping
			// their configuration information separately. Any configuration information they had would
			// have already been sucked in when the filter was created.
			display.List.Add(filter.Name, value, imageName, null);
		}
Exemple #29
0
		private void AddWritingSystemList(UIListDisplayProperties display, Set<NamedWritingSystem> set)
		{
			List<NamedWritingSystem> list = new List<NamedWritingSystem>(set.ToArray()); // A Set doesn't know about sorting, so use a list.
			list.Sort();
			foreach(NamedWritingSystem ws in list)
			{
				display.List.Add(ws.Name, ws.Hvo.ToString(), null, null);
			}
		}
Exemple #30
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Fill in the list of style names.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected override void FillInStylesComboList(UIListDisplayProperties display, IVwStylesheet stylesheet)
		{
			display.List.Clear();
			string charImage = "CharStyle";
			string paraImage = "ParaStyle";
			int cStyles = stylesheet.CStyles;
			for (int i = 0; i < cStyles; ++i)
			{
				string name = stylesheet.get_NthStyleName(i);
				int hvo = stylesheet.get_NthStyle(i);
				int type = stylesheet.GetType(name);
				if (type == (int)StyleType.kstCharacter || IsSelectionInParagraph)
				{
					display.List.Add(name, name,
						type == (int)StyleType.kstCharacter ? charImage : paraImage,
						null);
				}
			}
			string nameDefault = StyleUtils.DefaultParaCharsStyleName;
			display.List.Add(nameDefault, nameDefault, charImage, null);
			display.List.Sort();
		}