Exemple #1
0
        public void HandleCreateMenuItem(object sender, EventArgs ea)
        {
            Slice slice = m_dataEntryForm.CurrentSlice;

            if (slice != null)
            {
                ClassAndPropInfo cpi   = (ClassAndPropInfo)m_rgcpiCreateOptions[((MenuItem)sender).Index];
                FDO.FdoCache     cache = slice.ContainingDataTree.Cache;
                int hvoOwner           = cpi.hvoOwner;
                int ihvoPosition       = cpi.ihvoPosition;
                if (ihvoPosition == ClassAndPropInfo.kposNotSet && cpi.fieldType == (int)FieldType.kcptOwningSequence)
                {
                    // insert at end of sequence.
                    ihvoPosition = cache.GetVectorSize(hvoOwner, (int)cpi.flid);
                }                 // otherwise we already worked out the position or it doesn't matter
                // Note: ihvoPosition ignored if sequence or atomic.
                int hvoNew = cache.CreateObject((int)(cpi.signatureClsid), hvoOwner, (int)(cpi.flid), ihvoPosition);
                cache.MainCacheAccessor.PropChanged(null, (int)PropChangeType.kpctNotifyAll, hvoOwner, (int)(cpi.flid), ihvoPosition, 1, 0);
                m_helper = null;                 // allow old one to be garbage.
                if (hvoOwner == slice.Object.Hvo && slice.Expansion == DataTree.TreeItemState.ktisCollapsed)
                {
                    // We added something to the object of the current slice...almost certainly it
                    // will be something that will display under this node...if it is still collapsed,
                    // expand it to show the thing inserted.
                    slice.TreeNode.ToggleExpansion(slice.IndexInContainer);
                }
                Slice child = slice.ExpandSubItem(hvoNew);
                if (child != null)
                {
                    child.FocusSliceOrChild();
                }
            }
        }
Exemple #2
0
        private void MapFlidsInDumperAsNeeded(string fxtPath)
        {
            XmlDocument document = new XmlDocument();

            document.Load(fxtPath);
            XmlNode xnDoc      = document.SelectSingleNode(".//FxtDocumentDescription");
            string  sDataLabel = XmlUtils.GetAttributeValue(xnDoc, "dataLabel");

            // A more robust check for the type of fxt output and the clerk would be nice...
            if (sDataLabel.ToLowerInvariant() == "wordforms")
            {
                RecordClerk clerk = RecordClerk.FindClerk(m_mediator, "concordanceWords");
                if (clerk != null)
                {
                    int hvoWFI = m_cache.GetObjProperty(m_cache.LangProject.Hvo, (int)SIL.FieldWorks.FDO.LangProj.LangProject.LangProjectTags.kflidWordformInventory);
                    int cwfi   = m_cache.GetVectorSize(hvoWFI, (int)WordformInventory.WordformInventoryTags.kflidWordforms);
                    int cwfi2  = m_cache.GetVectorSize(clerk.OwningObject.Hvo, clerk.OwningFlid);
                    if (cwfi != cwfi2)
                    {
                        m_dumper.MapFlids((int)WordformInventory.WordformInventoryTags.kflidWordforms, clerk.OwningFlid);
                    }
                }
            }
        }