Пример #1
1
		/// <summary>
		/// Get protected and user-stored dictionary configurations to load into the dialog.
		/// Tests will override this to load the manager in their own fashion.
		/// </summary>
		private void LoadDataFromInventory(XmlNode current)
		{
			// Tuples are <uniqueCode, dispName, IsProtected>
			var configList = new List<Tuple<string, string, bool>>();

			// put them in configList and feed them into the Manager's dictionary.
			foreach (var xnView in m_originalViewConfigNodes)
			{
				var sLabel = XmlUtils.GetManditoryAttributeValue(xnView, "label");
				var sLayout = XmlUtils.GetManditoryAttributeValue(xnView, "layout");
				var fProtected = !sLayout.Contains(Inventory.kcMarkLayoutCopy);
				configList.Add(new Tuple<string, string, bool>(sLayout, sLabel, fProtected));
			}

			LoadInternalDictionary(configList);

			var sLayoutCurrent = XmlUtils.GetManditoryAttributeValue(current, "layout");
			m_originalView = sLayoutCurrent;
			m_currentView = m_originalView;

			if (m_configList.Count == 0)
				return;

			// Now set up the actual dialog's contents
			RefreshView();
		}
Пример #2
0
		public PossibilityAutoComplete(FdoCache cache, Mediator mediator, ICmPossibilityList list, Control control,
			string displayNameProperty, string displayWs)
		{
			m_cache = cache;
			m_mediator = mediator;
			m_control = control;
			m_displayNameProperty = displayNameProperty;
			m_displayWs = displayWs;

			m_listBox = new ComboListBox {DropDownStyle = ComboBoxStyle.DropDownList, ActivateOnShow = false};
			m_listBox.SelectedIndexChanged += HandleSelectedIndexChanged;
			m_listBox.SameItemSelected += HandleSameItemSelected;
			m_listBox.StyleSheet = FontHeightAdjuster.StyleSheetFromMediator(mediator);
			m_listBox.WritingSystemFactory = cache.WritingSystemFactory;
			m_searcher = new StringSearcher<ICmPossibility>(SearchType.Prefix, cache.ServiceLocator.WritingSystemManager);
			m_possibilities = new List<ICmPossibility>();
			var stack = new Stack<ICmPossibility>(list.PossibilitiesOS);
			while (stack.Count > 0)
			{
				ICmPossibility poss = stack.Pop();
				m_possibilities.Add(poss);
				foreach (ICmPossibility child in poss.SubPossibilitiesOS)
					stack.Push(child);
			}

			m_control.KeyDown += HandleKeyDown;
			m_control.KeyPress += HandleKeyPress;
		}
Пример #3
0
		/// <summary>
		/// Set up the dlg in preparation to showing it.
		/// </summary>
		/// <param name="cache">FDO cache.</param>
		/// <param name="wp">Strings used for various items in this dialog.</param>
		public void SetDlgInfo(FdoCache cache, Mediator mediator, WindowParams wp, DummyCmObject mainObj, List<DummyCmObject> mergeCandidates,
			string guiControl, string helpTopic)
		{
			CheckDisposed();

			Debug.Assert(cache != null);

			m_mediator = mediator;
			m_cache = cache;
			m_mainObj = mainObj;
			m_tsf = cache.TsStrFactory;

			m_fwTextBoxBottomMsg.WritingSystemFactory = m_cache.WritingSystemFactory;
			m_fwTextBoxBottomMsg.WritingSystemCode = m_cache.WritingSystemFactory.UserWs;

			InitBrowseView(guiControl, mergeCandidates);

			Text = wp.m_title;
			label2.Text = wp.m_label;

			m_helpTopic = helpTopic;

			if(m_helpTopic != null && m_helpTopicProvider != null) // m_helpTopicProvider could be null for testing
			{
				helpProvider = new HelpProvider();
				helpProvider.HelpNamespace = m_helpTopicProvider.HelpFile;
				helpProvider.SetHelpKeyword(this, m_helpTopicProvider.GetHelpString(m_helpTopic));
				helpProvider.SetHelpNavigator(this, HelpNavigator.Topic);
			}

			MoveWindowToPreviousPosition();
		}
		protected override TreeNode MakeMenuItems(PopupTree popupTree, int hvoTarget)
		{
			int tagNamePOS = UseAbbr ?
				CmPossibilityTags.kflidAbbreviation :
				CmPossibilityTags.kflidName;


			List<HvoTreeNode> relevantPartsOfSpeech = new List<HvoTreeNode>();
			GatherPartsOfSpeech(Cache, List.Hvo, CmPossibilityListTags.kflidPossibilities,
				CmPossibilityTags.kflidSubPossibilities,
				PartOfSpeechTags.kflidInflectionClasses,
				tagNamePOS, WritingSystem,
				relevantPartsOfSpeech);
			relevantPartsOfSpeech.Sort();
			int tagNameClass = UseAbbr ?
				MoInflClassTags.kflidAbbreviation :
				MoInflClassTags.kflidName;
			TreeNode match = null;
			foreach(HvoTreeNode item in relevantPartsOfSpeech)
			{
				popupTree.Nodes.Add(item);
				TreeNode match1 = AddNodes(item.Nodes, item.Hvo,
					PartOfSpeechTags.kflidInflectionClasses,
					MoInflClassTags.kflidSubclasses,
					hvoTarget, tagNameClass);
				if (match1 != null)
					match = match1;
			}
			return match;
		}
		protected override TreeNode MakeMenuItems(PopupTree popupTree, int hvoTarget)
		{
			int tagNamePOS = UseAbbr ?
				(int)CmPossibility.CmPossibilityTags.kflidAbbreviation :
				(int)CmPossibility.CmPossibilityTags.kflidName;

			List<HvoTreeNode> relevantPartsOfSpeech = new List<HvoTreeNode>();
			InflectionClassPopupTreeManager.GatherPartsOfSpeech(Cache, List.Hvo,
				(int)CmPossibilityList.CmPossibilityListTags.kflidPossibilities,
				(int)CmPossibility.CmPossibilityTags.kflidSubPossibilities,
				(int)PartOfSpeech.PartOfSpeechTags.kflidInflectableFeats,
				tagNamePOS, WritingSystem,
				relevantPartsOfSpeech);
			relevantPartsOfSpeech.Sort();
			TreeNode match = null;
			foreach(HvoTreeNode item in relevantPartsOfSpeech)
			{
				popupTree.Nodes.Add(item);
				IPartOfSpeech pos = (IPartOfSpeech)PartOfSpeech.CreateFromDBObject(Cache, item.Hvo, false);
				foreach(IFsFeatStruc fs in pos.ReferenceFormsOC)
				{
					// Note: beware of using fs.ShortName. That can be
					// absolutely EMPTY (if the user has turned off the 'Show Abbreviation as its label'
					// field for both the feature category and value).
					// ChooserName shows the short name if it is non-empty, otherwise the long name.
					HvoTreeNode node = new HvoTreeNode(fs.ChooserNameTS, fs.Hvo);
					item.Nodes.Add(node);
					if (fs.Hvo == hvoTarget)
						match = node;
				}
				item.Nodes.Add(new HvoTreeNode(Cache.MakeUserTss(LexTextControls.ksChooseInflFeats), kMore));
			}
			return match;
		}
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="T:FixedOrphanFootnoteReportDlg"/> class.
		/// </summary>
		/// <param name="issues">List of styles that the user has modified.</param>
		/// <param name="projectName">Name of the project.</param>
		/// <param name="helpTopicProvider">context sensitive help</param>
		/// ------------------------------------------------------------------------------------
		public FixedOrphanFootnoteReportDlg(List<string> issues, string projectName,
			IHelpTopicProvider helpTopicProvider) :
			base(issues, projectName, helpTopicProvider)
		{
			InitializeComponent();
			RepeatTitleOnEveryPage = true;
			RepeatColumnHeaderOnEveryPage = false;
		}
Пример #7
0
		public Control PopulateCtrlTabTargetCandidateList(List<Control> targetCandidates)
		{
			CheckDisposed();
			if (targetCandidates == null)
				throw new ArgumentNullException("targetCandidates");
			targetCandidates.Add(this);
			return ContainsFocus ? this : null;
		}
Пример #8
0
		/// <summary>
		/// return an array of all of the objects which should
		/// 1) be queried when looking for someone to deliver a message to
		/// 2) be potential recipients of a broadcast
		/// </summary>
		/// <returns></returns>
		public IxCoreColleague[] GetMessageTargets()
		{
			List<IxCoreColleague> colleagues = new List<IxCoreColleague>();
			colleagues.Add(this);
			// Add current FindComboFiller & UsedByFiller.
			// Those
			return colleagues.ToArray();
		}
Пример #9
0
		public Control PopulateCtrlTabTargetCandidateList(List<Control> targetCandidates)
		{
			if (targetCandidates == null)
				throw new ArgumentNullException("'targetCandidates' is null.");

			targetCandidates.Add(this);

			return ContainsFocus ? this : null;
		}
Пример #10
0
		/// <summary>
		/// Create the Manager for stored dictionary configurations.
		/// </summary>
		public DictionaryConfigManager(IDictConfigViewer viewer, List<XmlNode> configViews,
			XmlNode current)
		{
			m_viewer = viewer;
			m_originalViewConfigNodes = configViews;

			m_configList = new Dictionary<string, DictConfigItem>();
			m_fPersisted = false;

			LoadDataFromInventory(current);
		}
Пример #11
0
//		private decimal m_standardLeadingFactor;
		#endregion

		#region Constructor
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="T:TePageSetupDlg"/> class.
		/// </summary>
		/// <param name="pgLayout">The page layout.</param>
		/// <param name="scr">The Scripture object (which owns the publications).</param>
		/// <param name="publication">The publication.</param>
		/// <param name="division">The division. The NumberOfColumns in the division should be
		/// set before calling this dialog.</param>
		/// <param name="teMainWnd">TE main window (provides callbacks).</param>
		/// <param name="helpTopicProvider">The help topic provider.</param>
		/// <param name="app">The app.</param>
		/// <param name="fIsTrialPub">if set to <c>true</c> view from which this dialog
		/// was brought up is Trial Publication view.</param>
		/// <param name="pubPageSizes">The page sizes available for publication.</param>
		/// ------------------------------------------------------------------------------------
		public TePageSetupDlg(IPubPageLayout pgLayout, IScripture scr,
			IPublication publication, IPubDivision division, IPageSetupCallbacks teMainWnd,
			IHelpTopicProvider helpTopicProvider, IApp app, bool fIsTrialPub,
			List<PubPageInfo> pubPageSizes) :
			base(pgLayout, scr, publication, division, teMainWnd, helpTopicProvider,
				app, pubPageSizes)
		{
			m_fIsTrialPublication = fIsTrialPub;
//			if (!m_chkNonStdChoices.Checked) // following the standard
//				m_standardLeadingFactor = m_nudLineSpacing.Value / m_nudBaseCharSize.Value;
		}
Пример #12
0
        public InterestingTextList(PropertyTable propertyTable, ITextRepository repo,
			IStTextRepository stTextRepo, bool includeScripture)
        {
            m_textRepository = repo;
            m_propertyTable = propertyTable;
            m_stTextRepository = stTextRepo;
            CoreTexts = GetCoreTexts();
            m_scriptureTexts = GetScriptureTexts();
            IncludeScripture = includeScripture;
            GetCache();
        }
Пример #13
0
		private bool m_fOtherClicked;	// set true by btnOther_Click, caller should call OtherButtonClicked after dialog closes.
		#endregion

		#region Constructor/destructor
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Constructor for a single LexEntry object.
		/// </summary>
		/// <param name="leui">The lex entry ui.</param>
		/// <param name="tssForm">The TSS form.</param>
		/// <param name="helpProvider">The help provider.</param>
		/// <param name="helpFileKey">string key to get the help file name</param>
		/// <param name="styleSheet">The stylesheet.</param>
		/// ------------------------------------------------------------------------------------
		internal SummaryDialogForm(LexEntryUi leui, ITsString tssForm, IHelpTopicProvider helpProvider,
			string helpFileKey, IVwStylesheet styleSheet)
		{
			InitializeComponent();
			AccessibleName = GetType().Name;

			m_rghvo = new List<int>(1);
			m_rghvo.Add(leui.Object.Hvo);
			m_cache = leui.Object.Cache;
			m_mediator = leui.Mediator;
			Initialize(tssForm, helpProvider, helpFileKey, styleSheet);
		}
Пример #14
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Constructor for FwUpdateReportDlg
		/// </summary>
		/// <param name="itemsToReport">List of items to report in the list.</param>
		/// <param name="projectName">Name of the project.</param>
		/// <param name="helpTopicProvider">context sensitive help</param>
		/// ------------------------------------------------------------------------------------
		public FwUpdateReportDlg(List<string> itemsToReport, string projectName,
			IHelpTopicProvider helpTopicProvider) : this()
		{
			lblProjectName.Text = String.Format(lblProjectName.Text, projectName);

			m_helpTopicProvider = helpTopicProvider;

			// show list of names
			foreach (string item in itemsToReport)
				lvItems.Items.Add(item);

			TopMost = true;
		}
Пример #15
0
		/// <summary>
		/// Set up the dlg in preparation to showing it.
		/// </summary>
		/// <param name="cache">FDO cache.</param>
		/// <param name="wp">Strings used for various items in this dialog.</param>
		public void SetDlgInfo(FdoCache cache, Mediator mediator, WindowParams wp, DummyCmObject mainObj, List<DummyCmObject> mergeCandidates,
			string guiControl, string helpTopic)
		{
			CheckDisposed();

			Debug.Assert(cache != null);

			m_mediator = mediator;
			m_cache = cache;
			m_mainObj = mainObj;
			m_tsf = TsStrFactoryClass.Create();

			m_fwTextBoxBottomMsg.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor;
			m_fwTextBoxBottomMsg.WritingSystemCode = m_cache.LangProject.DefaultUserWritingSystem;

			InitBrowseView(guiControl, mergeCandidates);

			// Get location to the stored values, if any.
			object locWnd = m_mediator.PropertyTable.GetValue("mergeDlgLocation");
			// JohnT: this dialog can't be resized. So it doesn't make sense to
			// remember a size. If we do, we need to override OnLoad (as in SimpleListChooser)
			// to prevent the dialog growing every time at 120 dpi. But such an override
			// makes it too small to show all the controls at the default size.
			// It's better just to use the default size until it's resizeable for some reason.
			//m_mediator.PropertyTable.GetValue("msaCreatorDlgSize");
			// And when I do this, it works the first time, but later times the window is
			// too small and doesn't show all the controls. Give up on smart location for now.
			//object szWnd = this.Size;
			object szWnd = null; // suppresses the smart location stuff.
			if (locWnd != null && szWnd != null)
			{
				Rectangle rect = new Rectangle((Point)locWnd, (Size)szWnd);
				ScreenUtils.EnsureVisibleRect(ref rect);
				DesktopBounds = rect;
				StartPosition = FormStartPosition.Manual;
			}

			Text = wp.m_title;
			label2.Text = wp.m_label;

			m_helpTopic = helpTopic;

			if(m_helpTopic != null && FwApp.App != null) // FwApp.App could be null for testing
			{
				helpProvider = new System.Windows.Forms.HelpProvider();
				helpProvider.HelpNamespace = FwApp.App.HelpFile;
				helpProvider.SetHelpKeyword(this, FwApp.App.GetHelpString(m_helpTopic, 0));
				helpProvider.SetHelpNavigator(this, System.Windows.Forms.HelpNavigator.Topic);
			}
		}
Пример #16
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="SaveVersionDialog"/> class.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public SaveVersionDialog(FdoCache cache, IHelpTopicProvider helpTopicProvider)
		{
			m_cache = cache;
			m_scr = m_cache.LangProject.TranslatedScriptureOA;
			m_helpTopicProvider = helpTopicProvider;

			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			if (m_cache == null)
				return;

			m_BooksToSave = new List<IScrBook>();
			m_treeView.BeginUpdate();

			List<TreeNode> otBooks = new List<TreeNode>();
			List<TreeNode> ntBooks = new List<TreeNode>();
			foreach (IScrBook book in m_scr.ScriptureBooksOS)
			{
				TreeNode node = new TreeNode(book.BestUIName);
				node.Tag = book;

				if (book.CanonicalNum < ScriptureTags.kiNtMin)
					otBooks.Add(node); // OT book
				else
					ntBooks.Add(node); // NT book
			}
			TreeNode bibleNode = new TreeNode(TeResourceHelper.GetResourceString("kstidBibleNode"));
			if (otBooks.Count > 0)
			{
				bibleNode.Nodes.Add(new TreeNode(TeResourceHelper.GetResourceString("kstidOtNode"),
					otBooks.ToArray()));
			}
			if (ntBooks.Count > 0)
			{
				bibleNode.Nodes.Add(new TreeNode(TeResourceHelper.GetResourceString("kstidNtNode"),
					ntBooks.ToArray()));
			}

			m_treeView.Nodes.Add(bibleNode);

			// REVIEW: once we have sections we probably don't want to expand below book level
			m_treeView.ExpandAll();
			m_treeView.EndUpdate();
			// update the ok button enabled state
			m_treeView_NodeCheckChanged(null, EventArgs.Empty);
		}
Пример #17
0
		protected override DummyCmObject GetMergeinfo(WindowParams wp, List<DummyCmObject> mergeCandidates, out string guiControl, out string helpTopic)
		{
			wp.m_title = FdoUiStrings.ksMergeReversalEntry;
			wp.m_label = FdoUiStrings.ksEntries;

			var rie = (IReversalIndexEntry) Object;
			var filteredHvos = new HashSet<int>(rie.AllOwnedObjects.Select(obj => obj.Hvo)) { rie.Hvo }; // exclude `rie` and all of its subentries
			var wsIndex = m_cache.ServiceLocator.WritingSystemManager.GetWsFromStr(rie.ReversalIndex.WritingSystem);
			mergeCandidates.AddRange(from rieInner in rie.ReversalIndex.AllEntries
									 where !filteredHvos.Contains(rieInner.Hvo)
									 select new DummyCmObject(rieInner.Hvo, rieInner.ShortName, wsIndex));
			guiControl = "MergeReversalEntryList";
			helpTopic = "khtpMergeReversalEntry";
			return new DummyCmObject(m_hvo, rie.ShortName, wsIndex);
		}
Пример #18
0
		public InterlinearExportDialog(Mediator mediator, int hvoRoot, InterlinVc vc, List<int> scrHvos)
			: base(mediator)
		{
			m_hvoRoot = hvoRoot;
			m_vc = vc;
			m_scrHvos = scrHvos;

			m_helpTopic = "khtpExportInterlinear";
			columnHeader1.Text = ITextStrings.ksFormat;
			columnHeader2.Text = ITextStrings.ksExtension;
			GetTextProps();
			Text = ITextStrings.ksExportInterlinear;
			if (MiscUtils.IsTEInstalled)
				OnLaunchFilterScrScriptureSectionsDialog += new EventHandler(LaunchFilterScrScriptureSectionsDialog);
		}
Пример #19
0
		public List<ListView> GetControlsFromChoice(ListPropertyChoice choice)
		{
			List<ListView> controls = new List<ListView>();
			if (choice.ParameterNode == null)
				return null;

			foreach(XmlNode panel in choice.ParameterNode.SelectNodes("panels/listPanel"))
			{
				string listId = XmlUtils.GetManditoryAttributeValue(panel, "listId");
				string label = XmlUtils.GetManditoryAttributeValue(panel, "label");

				ListView list = MakeList(listId, label);
				controls.Add(list);
			}
			return controls;
		}
Пример #20
0
        private string m_helpTopicId = "khtpDictConfigManager"; // use as default?

        #endregion Fields

        #region Constructors

        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="T:DictionaryConfigMgrDlg"/> class.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public DictionaryConfigMgrDlg(Mediator mediator, string objType, List<XmlNode> configViews, XmlNode current)
        {
            InitializeComponent();

            m_mediator = mediator;
            m_presenter = new DictionaryConfigManager(this, configViews, current);
            m_objType = objType;

            // Make a help topic ID
            m_helpTopicId = generateChooserHelpTopicID(m_objType);

            m_helpProvider = new HelpProvider { HelpNamespace = m_mediator.HelpTopicProvider.HelpFile };
            m_helpProvider.SetHelpKeyword(this, m_mediator.HelpTopicProvider.GetHelpString(m_helpTopicId));
            m_helpProvider.SetHelpNavigator(this, HelpNavigator.Topic);
            m_helpProvider.SetShowHelp(this, true);
        }
		/// <summary>
		/// Traverse a tree of objects.
		///	Put the appropriate descendant identifiers into collector.
		/// </summary>
		/// <param name="cache">data access to retrieve info</param>
		/// <param name="rootHvo">starting object</param>
		/// <param name="rootFlid">the children of rootHvo are in this property.</param>
		/// <param name="subFlid">grandchildren and great...grandchildren are in this one</param>
		/// <param name="itemFlid">want children where this is non-empty in the collector</param>
		/// <param name="flidName">multistring prop to get name of item from</param>
		/// <param name="wsName">multistring writing system to get name of item from</param>
		/// <param name="collector">Add for each item an HvoTreeNode with the name and id of the item.</param>
		internal static void GatherPartsOfSpeech(FdoCache cache,
			int rootHvo, int rootFlid, int subFlid, int itemFlid, int flidName, int wsName, List<HvoTreeNode> collector)
		{
			ISilDataAccess sda = cache.MainCacheAccessor;
			int chvo = sda.get_VecSize(rootHvo, rootFlid);
			for (int ihvo = 0; ihvo < chvo; ihvo++)
			{
				int hvoItem = sda.get_VecItem(rootHvo, rootFlid, ihvo);
				if (sda.get_VecSize(hvoItem, itemFlid) > 0)
				{
					ITsString tssLabel = GetTssLabel(cache, hvoItem, flidName, wsName);
					collector.Add(new HvoTreeNode(tssLabel, hvoItem));
				}
				GatherPartsOfSpeech(cache, hvoItem, subFlid, subFlid, itemFlid, flidName, wsName, collector);
			}
		}
Пример #22
0
		static FLExBridgeListener()
		{
			OldLiftBridgeProjects = new List<string>();
			var repoMapFile = Path.Combine(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "LiftBridge"),
													 "LanguageProject_Repository_Map.xml");
			// look for old liftbridge repo info in path similar to C:\Users\<user>\AppData\Local\LiftBridge\LanguageProject_Repository_Map.xml
			if(File.Exists(repoMapFile))
			{
				var repoMapDoc = new XmlDocument();
				repoMapDoc.Load(repoMapFile);
				var mappingNodes = repoMapDoc.SelectNodes("//Mapping");
				if(mappingNodes != null)
				{
					foreach(XmlElement mappingNode in mappingNodes)
					{
						OldLiftBridgeProjects.Add(mappingNode.Attributes["projectguid"].Value);
					}
				}
			}
		}
Пример #23
0
		public bool OnMoveReversalPOS(object cmd)
		{
			FdoCache cache = Cache;
			var labels = new List<ObjectLabel>();
			foreach (IPartOfSpeech pos in MergeOrMoveCandidates)
			{
				if (!pos.SubPossibilitiesOS.Contains(POS))
				{
					labels.Add(ObjectLabel.CreateObjectLabelOnly(cache, pos, "ShortNameTSS", "best analysis"));
				}
			}
			using (SimpleListChooser dlg = new SimpleListChooser(cache, null, m_mediator.HelpTopicProvider, labels, null,
				LexEdStrings.ksCategoryToMoveTo, null))
			{
				dlg.SetHelpTopic("khtpChoose-CategoryToMoveTo");
				if (dlg.ShowDialog() == DialogResult.OK)
				{
					IPartOfSpeech currentPOS = POS;
					IPartOfSpeech newOwner = (IPartOfSpeech)dlg.ChosenOne.Object;
					UndoableUnitOfWorkHelper.Do(LexEdStrings.ksUndoMoveRevCategory,
						LexEdStrings.ksRedoMoveRevCategory, cache.ActionHandlerAccessor,
						() =>
							{
								newOwner.MoveIfNeeded(currentPOS); //important when an item is moved into it's own subcategory
								if (!newOwner.SubPossibilitiesOS.Contains(currentPOS)) //this is also prevented in the interface, but I'm paranoid
								{
									newOwner.SubPossibilitiesOS.Add(currentPOS);
								}
							});
					// Note: PropChanged should happen on the old owner and the new in the 'Add" method call.
					// Have to jump to a main PartOfSpeech, as RecordClerk doesn't know anything about subcategories.
					m_mediator.BroadcastMessageUntilHandled("JumpToRecord", newOwner.MainPossibility.Hvo);
				}
			}

			return true;
		}
Пример #24
0
		/// <summary>
		/// Initialize the dialog.
		/// </summary>
		public void SetValues(bool fHaveOCM, bool fHaveFRAME, List<string> rgsAnthroFiles,
			IHelpTopicProvider helpTopicProvider)
		{
			m_radioOCM.Enabled = fHaveOCM;
			m_radioFRAME.Enabled = fHaveFRAME;
			m_helpTopicProvider = helpTopicProvider;

			m_radioOther.Checked = false;
			if (rgsAnthroFiles.Count == 0)
			{
				m_radioOther.Enabled = false;
				m_radioOther.Visible = false;
				m_cbOther.Enabled = false;
				m_cbOther.Visible = false;
				var diff = m_btnOK.Location.Y - m_cbOther.Location.Y;
				Size = new Size(Width, Height - diff);
			}
			else
			{
				for (int i = 0; i < rgsAnthroFiles.Count; ++i)
					m_cbOther.Items.Add(rgsAnthroFiles[i]);
				m_cbOther.SelectedIndex = 0;
			}
		}
Пример #25
0
		/// <summary>
		/// This method assumes all of the Find and UsedBy items are included in the fcfList.
		/// </summary>
		/// <param name="mediator"></param>
		/// <param name="fcfList"></param>
		/// <param name="startingItem"></param>
		internal void SetupDlg(Mediator mediator, List<FindComboFillerBase> fcfList, FindComboFillerBase startingItem)
		{
			if (mediator == null)
				throw new ArgumentException("No Mediator.");
			if (fcfList == null)
				throw new ArgumentException("No items found.");
			if (fcfList.Count < 1)
				throw new ArgumentException("There has to be at least one item.");
			foreach (FindComboFillerBase fcf in fcfList)
			{
				if (fcf.List_UBF.Count == 0)
					throw new ArgumentException("No sub-items found.");
			}
			if (startingItem != null && !fcfList.Contains(startingItem))
				throw new ArgumentException("'startingItem' is not in the 'fcfList' list.");

			m_mediator = mediator;
			m_cbFind.BeginUpdate();
			m_cbFind.Items.Clear();
			m_cbFind.Items.AddRange(fcfList.ToArray());
			m_cbFind.EndUpdate();
			m_cbFind.SelectedItem = startingItem;
			m_mediator.BroadcastPendingItems();
		}
Пример #26
0
		/// <summary>
		/// Create and initialize the browse view, storing the data it will display.
		/// </summary>
		/// <param name="cache"></param>
		/// <param name="stylesheet"></param>
		/// <param name="mediator"></param>
		/// <param name="xnConfig"></param>
		/// <param name="rghvo"></param>
		public void Initialize(FdoCache cache, IVwStylesheet stylesheet, Mediator mediator,
			XmlNode xnConfig, List<int> rghvo)
		{
			CheckDisposed();
			m_cache = cache;
			m_stylesheet = stylesheet;
			m_mediator = mediator;
			m_configNode = xnConfig;
			this.SuspendLayout();
			m_flidFake = FdoCache.DummyFlid;
			StoreData(rghvo);
			m_bvList = new SIL.FieldWorks.Common.Controls.BrowseViewer(m_configNode,
				m_cache.LangProject.Hvo, m_flidFake, m_cache, m_mediator, null);
			m_bvList.Location = new Point(0, 0);
			m_bvList.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom |
				AnchorStyles.Right;
			m_bvList.Name = "m_bv";
			m_bvList.Sorter = null;
			m_bvList.TabStop = true;
			m_bvList.StyleSheet = m_stylesheet;
			m_bvList.Dock = DockStyle.Fill;
			this.Controls.Add(m_bvList);
			this.ResumeLayout(false);
		}
Пример #27
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)
		{
			// Must not be run more than once.
			if (IsDisposed)
				return;

			if (disposing)
			{
				// Dispose managed resources here.
				if (m_refs != null)
					m_refs.Clear();
				if (m_refTypesAvailable != null)
					m_refTypesAvailable.Clear();
				if (m_rgfReversedRefType != null)
					m_rgfReversedRefType.Clear();
			}

			// Dispose unmanaged resources here, whether disposing is true or false.
			m_refs = null;
			m_refTypesAvailable = null;
			m_rgfReversedRefType = null;

			base.Dispose(disposing);
		}
Пример #28
0
		private static void AddHvoPOStoResults(ISilDataAccess sda, List<int> results, int hvoMsa, int flidPos)
		{
			int hvoPOS;
			hvoPOS = sda.get_ObjectProp(hvoMsa, flidPos);
			if (hvoPOS != 0)
				results.Add(hvoPOS);
		}
Пример #29
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Get the possible message targets, i.e. the view(s) we are showing
		/// </summary>
		/// <returns>Message targets</returns>
		/// ------------------------------------------------------------------------------------
		public IxCoreColleague[] GetMessageTargets()
		{
			CheckDisposed();

			// return list of view windows with focused window being the first one
			List<IxCoreColleague> targets = new List<IxCoreColleague>();
			targets.Add(m_diffViewWrapper);
			targets.Add(this);
			return targets.ToArray();
		}
Пример #30
0
		private void GetItemsForMsaType(ISilDataAccess sda, ref List<int> results, int hvoMsa)
		{
			if (hvoMsa == 0)
				return;
			int kclsid = m_cache.GetClassOfObject(hvoMsa);
			switch (kclsid)
			{
				case MoStemMsa.kclsidMoStemMsa:
					AddHvoPOStoResults(sda, results, hvoMsa, (int)MoStemMsa.MoStemMsaTags.kflidPartOfSpeech);
					break;
				case MoInflAffMsa.kclsidMoInflAffMsa:
					AddHvoPOStoResults(sda, results, hvoMsa, (int)MoInflAffMsa.MoInflAffMsaTags.kflidPartOfSpeech);
					break;
				case MoDerivAffMsa.kclsidMoDerivAffMsa:
					AddHvoPOStoResults(sda, results, hvoMsa, (int)MoDerivAffMsa.MoDerivAffMsaTags.kflidFromPartOfSpeech);
					AddHvoPOStoResults(sda, results, hvoMsa, (int)MoDerivAffMsa.MoDerivAffMsaTags.kflidToPartOfSpeech);
					break;
				case MoUnclassifiedAffixMsa.kclsidMoUnclassifiedAffixMsa:
					AddHvoPOStoResults(sda, results, hvoMsa, (int)MoUnclassifiedAffixMsa.MoUnclassifiedAffixMsaTags.kflidPartOfSpeech);
					break;
			}
		}