/// <summary> /// Analyze the StText indicated by hvoText. Return an array of ITsStrings /// representing the words of the text. Add to gni the information it /// needs about the occurrences of each word. /// </summary> public void Init() { // Get a data cache m_cache = FDO.FdoCache.Create("TestLangProj"); m_txt = new StText(m_cache, m_hvoText); BuildConcData(); this.mainControl = new MultiLevelConc(m_cache, m_alCharSummaries); this.SuspendLayout(); // // mainControl // this.mainControl.BackColor = System.Drawing.SystemColors.Window; this.mainControl.ForeColor = System.Drawing.SystemColors.WindowText; this.mainControl.Location = new System.Drawing.Point(16, 32); // Review JohnT: compute from container info? this.mainControl.Name = "ConcSampleSub"; this.mainControl.Dock = DockStyle.Fill; //this.mainControl.Size = new System.Drawing.Size(232, 192); // Review JohnT: compute from container info? this.mainControl.TabIndex = 0; // // Main window (after contained view, following model of HellowView; maybe so // we get an appropriate OnSize for the contained view when sizing the main one? // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(400, 400); this.Controls.Add(this.mainControl); this.Name = "ConcSample"; // Revie JohnT: what's the use of each of these? this.Text = "ConcSample"; this.ResumeLayout(false); }
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(); } } }
public ExportDialog(Mediator mediator) { m_mediator = mediator; m_cache = (FdoCache)mediator.PropertyTable.GetValue("cache"); // // Required for Windows Form Designer support // InitializeComponent(); m_helpTopic = "khtpExportLexicon"; this.helpProvider = new System.Windows.Forms.HelpProvider(); this.helpProvider.HelpNamespace = FwApp.App.HelpFile; this.helpProvider.SetHelpKeyword(this, FwApp.App.GetHelpString(m_helpTopic, 0)); this.helpProvider.SetHelpNavigator(this, System.Windows.Forms.HelpNavigator.Topic); // Determine whether we can support "configured" type export by trying to obtain // the XmlVc for an XmlDocView. Also obtain the database id and class id of the // root object. object objCurrentControl; objCurrentControl = m_mediator.PropertyTable.GetValue("currentContentControlObject", null); //XmlDocView docView = objCurrentControl as XmlDocView; //if (docView == null) //{ // XCore.MultiPane xmp = objCurrentControl as XCore.MultiPane; // if (xmp != null) // docView = xmp.FirstVisibleControl as XmlDocView; //} XmlDocView docView = FindXmlDocView(objCurrentControl as Control); if (docView != null) { m_seqView = docView.Controls[0] as XmlSeqView; } if (m_seqView != null) { m_xvc = m_seqView.Vc; } CmObject cmo = m_mediator.PropertyTable.GetValue("ActiveClerkSelectedObject", null) as CmObject; if (cmo != null) { m_hvoRootObj = cmo.OwnerHVO; if (m_hvoRootObj != 0) { m_clidRootObj = m_cache.GetClassOfObject(m_hvoRootObj); } } m_chkExportPictures.Checked = false; m_chkExportPictures.Visible = false; m_chkExportPictures.Enabled = false; m_fExportPicturesAndMedia = false; }
IList m_items; // of IConcSliceInfo #endregion public MultiLevelConc(FDO.FdoCache cache, IList items) { m_items = items; InitializeBasic(cache, false); InitializeComponentBasic(); // Can't add null controls to a parent control. //m_slices.AddRange(new Slice[items.Count]); // adds appropriate # nulls // // Temporary: until I figure how to be lazy, we have to make slices // // for all nodes. // for (int i = 0; i < items.Count; i++) // FieldAt(i); }
public LexImportWizardLanguage(FdoCache cache, Hashtable existingLangDesc) { // // Required for Windows Form Designer support // InitializeComponent(); m_existingLangDescriptors = existingLangDesc; // currently defined values m_wsInfo = new Hashtable(); m_cache = cache; m_LangDesc = m_wsName = m_encConverter = ""; m_AddUsage = true; // this is an "Add" use of the dlg by default m_LinguaLinksImport = false; // (Bev) this is an SFM import btnOK.Enabled = false; setupHelp(); }
public LexImportWizardLanguage(FdoCache cache) { // // Required for Windows Form Designer support // InitializeComponent(); m_existingLangDescriptors = new Hashtable(); // not necessary for LL import m_wsInfo = new Hashtable(); m_cache = cache; m_LangDesc = m_wsName = m_encConverter = ""; m_AddUsage = true; // this is an "Add" use of the dlg by default m_LinguaLinksImport = true; // (Bev) this is a LL import btnOK.Enabled = false; tbLangDesc.ReadOnly = true; // don't let them change the language name tbLangDesc.Enabled = false; setupHelp(); }
public void Init(Sfm2Xml.ClsInFieldMarker ifm, Hashtable uiLangsHT, FDO.FdoCache cache) { CheckDisposed(); if (ifm == null) { ifm = new Sfm2Xml.ClsInFieldMarker(); } m_inlineMarker = ifm; m_uiLangs = uiLangsHT; m_cache = cache; // ==================================================================== // Set the language descriptor combo box. This is a DropList so that // the entered text can't be different from the contents of the list. // If the user wants a new language descriptor they have to add one. cbLangDesc.Items.Add(NoChange); cbLangDesc.SelectedItem = NoChange; foreach (DictionaryEntry lang in m_uiLangs) { Sfm2Xml.LanguageInfoUI langInfo = lang.Value as Sfm2Xml.LanguageInfoUI; // make sure there is only one entry for each writing system (especially 'ignore') if (cbLangDesc.FindStringExact(langInfo.ToString()) < 0) { cbLangDesc.Items.Add(langInfo); if (langInfo.FwName == m_inlineMarker.Language) { cbLangDesc.SelectedItem = langInfo; } } } InitializeStylesComboBox(); HideOKBtn(); // see if it needs to be visible or not }
/// <summary> /// Return whether it is OK to move the objects indicated by odi to the specified destination. /// </summary> /// <param name="hvoDstOwner"></param> /// <param name="flidDst"></param> /// <param name="ihvoDstStart"></param> /// <param name="odi"></param> /// <returns></returns> public bool OkToMove(int hvoDstOwner, int flidDst, int ihvoDstStart, ObjectDragInfo odi) { CheckDisposed(); FDO.FdoCache cache = Slice.ContainingDataTree.Cache; if (flidDst == odi.FlidSrc) { // Verify that it is not a no-operation. if (hvoDstOwner == odi.HvoSrcOwner) { // Same property of same object. If it's a collection, disable. FieldType fieldType = cache.GetFieldType(flidDst); // We can't drag it to the position it's already at; that's no change. We also can't drag it // to the position one greater: that amounts to trying to place it after itself, which (after // removing it from before itself) amounts to a no-operation. if (fieldType == FieldType.kcptOwningSequence && ihvoDstStart != odi.IhvoSrcStart && ihvoDstStart != odi.IhvoSrcStart + 1) { // It's a sequence and the target and source positions are different, so we can do it. return(true); } } else { // Different objects; need to verify no circular ownership involved. for (int ihvo = odi.IhvoSrcStart; ihvo <= odi.IhvoSrcEnd; ihvo++) { int hvo = cache.GetVectorItem(odi.HvoSrcOwner, odi.FlidSrc, ihvo); // See if hvoDstOwner is owned by hvo int hvo2 = hvoDstOwner; // loop from hvo2 to root owner of hvo2. If hvo2 or any of its owners is hvo, // we have a problem. while (hvo2 != 0) { if (hvo == hvo2) { return(false); // circular ownership, can't drop. } hvo2 = cache.GetOwnerOfObject(hvo2); } } return(true); } } else { // Different property, check signature. IFwMetaDataCache mdc = cache.MetaDataCacheAccessor; uint luclid = mdc.GetDstClsId((uint)flidDst); for (int ihvo = odi.IhvoSrcStart; ihvo <= odi.IhvoSrcEnd; ihvo++) { int hvo = cache.GetVectorItem(odi.HvoSrcOwner, odi.FlidSrc, ihvo); uint cls = (uint)cache.GetClassOfObject(hvo); while (cls != 0 && cls != luclid) { cls = mdc.GetBaseClsId(cls); } if (cls == 0) { return(false); // wrong signature, can't drop. } } // All sigs OK, allow drop. return(true); } // If none of those cases is OK, can't do it. return(false); }
public void Init(Sfm2Xml.ClsInFieldMarker ifm, Hashtable uiLangsHT, FDO.FdoCache cache) { CheckDisposed(); if (ifm == null) ifm = new Sfm2Xml.ClsInFieldMarker(); m_inlineMarker = ifm; m_uiLangs = uiLangsHT; m_cache = cache; // ==================================================================== // Set the language descriptor combo box. This is a DropList so that // the entered text can't be different from the contents of the list. // If the user wants a new language descriptor they have to add one. cbLangDesc.Items.Add(NoChange); cbLangDesc.SelectedItem = NoChange; foreach (DictionaryEntry lang in m_uiLangs) { Sfm2Xml.LanguageInfoUI langInfo = lang.Value as Sfm2Xml.LanguageInfoUI; // make sure there is only one entry for each writing system (especially 'ignore') if (cbLangDesc.FindStringExact(langInfo.ToString()) < 0) { cbLangDesc.Items.Add(langInfo); if (langInfo.FwName == m_inlineMarker.Language) cbLangDesc.SelectedItem = langInfo; } } InitializeStylesComboBox(); HideOKBtn(); // see if it needs to be visible or not }
/// <summary> /// initialization for when you don't actually know what you want to show yet /// (and aren't going to use XML) /// </summary> /// <param name="cache"></param> /// <param name="fHasSplitter"></param> protected void InitializeBasic(FDO.FdoCache cache, bool fHasSplitter) { //in a normal user application, this auto menu handler will not be used. //instead, the client of this control will call SetContextMenuHandler() //with a customized handler. // m_autoHandler = new AutoDataTreeMenuHandler(this); // we never use auto anymore SetContextMenuHandler(new SliceShowMenuRequestHandler(m_autoHandler.GetSliceContextMenu)); // This has to be created before we start adding slices, so they can be put into it. // (Otherwise we would normally do this in initializeComponent.) m_fHasSplitter = fHasSplitter; m_mdc = cache.MetaDataCacheAccessor; m_cache = cache; }
/// <summary> /// Set up the submenu items for 'Create' and 'Insert' menus. /// </summary> protected void SetupContextMenu(Slice slice, SliceTreeNode sliceTreeNode) { // Get rid of old sub-menu items. m_mnuCreate.MenuItems.Clear(); m_helper = new ContextMenuHelper(sliceTreeNode); m_rgcpiCreateOptions = slice.Object.PropsAndClassesOwnedBy; // Fill in info about which object will be the new owner. for (int index = m_rgcpiCreateOptions.Count; --index >= 0;) { ClassAndPropInfo cpi = m_rgcpiCreateOptions[index]; cpi.hvoOwner = slice.Object.Hvo; } // Drop atomic property options if not empty for (int index = m_rgcpiCreateOptions.Count; --index >= 0;) { ClassAndPropInfo cpi = (ClassAndPropInfo)m_rgcpiCreateOptions[index]; if (cpi.fieldType == (int)FieldType.kcptOwningAtom) { FDO.FdoCache cache = slice.ContainingDataTree.Cache; if (cache.GetObjProperty(cpi.hvoOwner, (int)(cpi.flid)) != 0) { m_rgcpiCreateOptions.RemoveAt(index); } } } int iBefore = m_rgcpiCreateOptions.Count; GetCreateSiblingOptions(slice, m_rgcpiCreateOptions, true); bool fSeq = m_rgcpiCreateOptions.Count > iBefore && m_rgcpiCreateOptions[iBefore].fieldType == (int)FieldType.kcptOwningSequence; int iAfter = m_rgcpiCreateOptions.Count; if (fSeq) { // In a sequence we make another set of options to insert after the current item. GetCreateSiblingOptions(slice, m_rgcpiCreateOptions, false); } for (int index = 0; index < m_rgcpiCreateOptions.Count; index++) { ClassAndPropInfo cpi = (ClassAndPropInfo)m_rgcpiCreateOptions[index]; String format = DetailControlsStrings.ksNewItem; if (index >= iAfter) { format = DetailControlsStrings.ksNewItemAfter; // can't happen if not sequence } else if (index >= iBefore) { if (fSeq) { format = DetailControlsStrings.ksNewItemBefore; } else // sibling collection { format = DetailControlsStrings.ksNewItemWithin; } } m_mnuCreate.MenuItems.Add(new MenuItem( String.Format(format, new object[] { cpi.signatureClassName, cpi.fieldName }), new EventHandler(this.HandleCreateMenuItem))); } m_mnuCreate.Enabled = m_mnuCreate.MenuItems.Count > 0; m_helper.SetupDeleteMenu(m_mnuDelete); }
public ExportDialog(Mediator mediator) { m_mediator = mediator; m_cache = (FdoCache)mediator.PropertyTable.GetValue("cache"); // // Required for Windows Form Designer support // InitializeComponent(); m_helpTopic = "khtpExportLexicon"; this.helpProvider = new System.Windows.Forms.HelpProvider(); this.helpProvider.HelpNamespace = FwApp.App.HelpFile; this.helpProvider.SetHelpKeyword(this, FwApp.App.GetHelpString(m_helpTopic, 0)); this.helpProvider.SetHelpNavigator(this, System.Windows.Forms.HelpNavigator.Topic); // Determine whether we can support "configured" type export by trying to obtain // the XmlVc for an XmlDocView. Also obtain the database id and class id of the // root object. object objCurrentControl; objCurrentControl = m_mediator.PropertyTable.GetValue("currentContentControlObject", null); //XmlDocView docView = objCurrentControl as XmlDocView; //if (docView == null) //{ // XCore.MultiPane xmp = objCurrentControl as XCore.MultiPane; // if (xmp != null) // docView = xmp.FirstVisibleControl as XmlDocView; //} XmlDocView docView = FindXmlDocView(objCurrentControl as Control); if (docView != null) m_seqView = docView.Controls[0] as XmlSeqView; if (m_seqView != null) m_xvc = m_seqView.Vc; CmObject cmo = m_mediator.PropertyTable.GetValue("ActiveClerkSelectedObject", null) as CmObject; if (cmo != null) { m_hvoRootObj = cmo.OwnerHVO; if (m_hvoRootObj != 0) m_clidRootObj = m_cache.GetClassOfObject(m_hvoRootObj); } m_chkExportPictures.Checked = false; m_chkExportPictures.Visible = false; m_chkExportPictures.Enabled = false; m_fExportPicturesAndMedia = false; }
/// ----------------------------------------------------------------------------------- /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing"><c>true</c> to release both managed and unmanaged /// resources; <c>false</c> to release only unmanaged resources. /// </param> /// ----------------------------------------------------------------------------------- protected override void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed) return; // m_sda COM object block removed due to crash in Finializer thread LT-6124 if (disposing) { // Do this first, before setting m_fDisposing to true. if (m_sda != null) m_sda.RemoveNotification(this); m_fDisposing = true; // 'Disposing' isn't until we call base dispose. m_currentSlice = null; if (m_rch != null) { if (m_rch.HasRecordListUpdater) { m_rch.Fixup(false); // no need to refresh record list on shutdown. } else if (m_rch is IDisposable) { // It's fine to dispose it, after all, because m_rch has no other owner. (m_rch as IDisposable).Dispose(); } } if (m_tooltip != null) { m_tooltip.RemoveAll(); m_tooltip.Dispose(); } foreach (Slice slice in Controls) slice.ShowContextMenu -= new TreeNodeEventHandler(this.OnShowContextMenu); } m_sda = null; m_currentSlice = null; m_root = null; m_cache = null; m_mdc = null; m_autoCustomFieldNodesDocument = null; m_autoCustomFieldNodesDocRoot = null; m_rch = null; m_rootLayoutName = null; m_smallImages = null; // Client has to deal with it, since it gave it to us. // protected AutoDataTreeMenuHandler m_autoHandler; // No tusing this data member. m_layoutInventory = null; m_partInventory = null; m_sliceFilter = null; m_monitoredProps = null; m_stringTable = null; m_persistenceProvider = null; m_styleSheet = null; // We may have made it, or been given it. m_tooltip = null; m_mediator = null; m_rlu = null; base.Dispose(disposing); // This will call Dispose on each Slice. }
public void Init(MarkerPresenter.ContentMapping currentMarker, Hashtable uiLangsHT, FDO.FdoCache cache) { CheckDisposed(); m_uiLangs = uiLangsHT; m_cache = cache; // The following call is needed to 'correct' the current behavior of the FwOverrideComboBox control. // As the control is currently, it will not allow the space character to be passed to the base // control: which means it doesn't get into the edit box portion of the control. We want to allow // space characters in our data, so we're enabling it here. This seems like a bug in the control // design, but not knowing the history and it's use, we'll just make it work as we think it should // be for us here. cbFunction.AllowSpaceInEditBox = true; // handle processing for the custom fields (CFS) // - read the db and get the CFS // - remove CFS that are in the TV and not in the CFS list // - add CFS that are in the list and not in the TV // - handle the case where the current marker is a CF and it's no longer in the list (just throw for now) //ReadCustomFieldsFromDB(cache); bool customFieldsChanged = false; m_customFields = LexImportWizard.Wizard().ReadCustomFieldsFromDB(out customFieldsChanged); // Init will only be called the first time, so here we don't have to remove an nodes tvDestination.BeginUpdate(); foreach (TreeNode classNameNode in tvDestination.Nodes) { string className = classNameNode.Text.Trim(new char[] {'(', ')'}); if (m_customFields.FieldsForClass(className) == null) continue; foreach (Sfm2Xml.LexImportField field in m_customFields.FieldsForClass(className)) { TreeNode cnode = new TreeNode(field.UIName + " (Custom Field)"); cnode.Tag = field; classNameNode.Nodes.Add(cnode); } //tvDestination.Nodes.Add(tnode); } //tvDestination.ExpandAll(); tvDestination.EndUpdate(); // end of CFS processing // set the correct marker and number of times it is used m_lblMarker.Text = currentMarker.Marker; m_lblInstances.Text = String.Format(LexTextControls.ksXInstances, currentMarker.Count); if (currentMarker.AutoImport) { chkbxAutoField.Checked = true; tvDestination.Enabled = false; } // chkbxExclude.Checked = false; // tvDestination.Enabled = true; // find the node that has the tag.meaningid value the same as the currentmarker bool found = false; foreach (TreeNode classNode in tvDestination.Nodes) { if (currentMarker.ClsFieldDescription is Sfm2Xml.ClsCustomFieldDescription && currentMarker.DestinationClass != classNode.Text.Trim(new char[] {'(', ')'})) continue; foreach (TreeNode fieldNode in classNode.Nodes) { if ((fieldNode.Tag as Sfm2Xml.LexImportField).ID == currentMarker.FwId) { tvDestination.SelectedNode = fieldNode; found = true; break; } } if (found) break; } if (!found && tvDestination.Nodes.Count > 0) // make first entry topmost and visible tvDestination.Nodes[0].EnsureVisible(); // set the writing system combo box foreach (DictionaryEntry lang in m_uiLangs) { Sfm2Xml.LanguageInfoUI langInfo = lang.Value as Sfm2Xml.LanguageInfoUI; // make sure there is only one entry for each writing system (especially 'ignore') if (cbLangDesc.FindStringExact(langInfo.ToString()) < 0) { cbLangDesc.Items.Add(langInfo); if (langInfo.FwName == currentMarker.WritingSystem) cbLangDesc.SelectedItem = langInfo; } } if (cbLangDesc.SelectedIndex < 0) { // default to ignore if it's in the list int ignorePos = cbLangDesc.FindStringExact(MarkerPresenter.ContentMapping.Ignore()); if (ignorePos >= 0) cbLangDesc.SelectedIndex = ignorePos; else cbLangDesc.SelectedIndex = 0; // first item in list as fail safe } // add the func if it's present m_refFuncString = string.Empty; if (currentMarker.IsRefField) { m_refFuncString = currentMarker.RefField; cbFunction.Enabled = true; TreeNode node = tvDestination.SelectedNode; if (node != null) { Sfm2Xml.LexImportField field = node.Tag as Sfm2Xml.LexImportField; if (field != null) { FillLexicalRefTypesCombo(field); // walk the name to abbr list and select the name string name = m_refFuncString; foreach (DictionaryEntry de in m_htNameToAbbr) { NameWSandAbbr nwsa = (NameWSandAbbr)de.Value; //if (de.Value as string == name) if (nwsa.abbr == name) { //name = de.Key as string; name = nwsa.name; //.abbr; break; } } cbFunction.Text = name; } } } m_refFuncStringOrig = m_refFuncString; // save the initial value // set the exclude chkbox and select item from FW Destination if (currentMarker.Exclude)// currentMarker.IsLangIgnore || // currentMarker.DestinationField == MarkerPresenter.ContentMapping.Ignore() || { chkbxExclude.Checked = true; chkbxAutoField.Enabled = false; tvDestination.Enabled = false; EnableLangDesc(false); } rbAbbrName.Checked = true; if (currentMarker.IsAbbrvField) { // set the proper radio button if (currentMarker.ClsFieldDescription.IsAbbr) rbAbbrAbbr.Checked = true; } // LT-4722 // btnAddCustomField.Visible = false; }