public SetInt ( int hvo, int tag, int n ) : void | ||
hvo | int | |
tag | int | |
n | int | |
return | void |
private bool SetDlgInfoPrivate(Mediator mediator, XmlNode configurationParameters) { using (new WaitCursor(this)) { m_mediator = mediator; m_btnRefresh.Image = ResourceHelper.RefreshIcon; m_rbDiscardAnalyses.Checked = m_mediator.PropertyTable.GetBoolProperty("RemoveAnalyses", true); m_rbKeepAnalyses.Checked = !m_rbDiscardAnalyses.Checked; m_rbDiscardAnalyses.Click += m_rbDiscardAnalyses_Click; m_rbKeepAnalyses.Click += m_rbDiscardAnalyses_Click; m_cbUpdateLexicon.Checked = m_mediator.PropertyTable.GetBoolProperty("UpdateLexiconIfPossible", true); m_cbCopyAnalyses.Checked = m_mediator.PropertyTable.GetBoolProperty("CopyAnalysesToNewSpelling", true); m_cbCopyAnalyses.Click += m_cbCopyAnalyses_Click; m_cbMaintainCase.Checked = m_mediator.PropertyTable.GetBoolProperty("MaintainCaseOnChangeSpelling", true); m_cbMaintainCase.Click += m_cbMaintainCase_Click; m_cache = (FdoCache)m_mediator.PropertyTable.GetValue("cache"); // We need to use the 'best vern' ws, // since that is what is showing in the Words-Analyses detail edit control. // Access to this respeller dlg is currently (Jan. 2008) only via a context menu in the detail edit pane. // The user may be showing multiple wordform WSes in the left hand browse view, // but we have no way of knowing if the user thinks one of those alternatives is wrong without asking. m_vernWs = WritingSystemServices.ActualWs(m_cache, WritingSystemServices.kwsFirstVern, m_srcwfiWordform.Hvo, WfiWordformTags.kflidForm); // Bail out if no vernacular writing system was found (see LT-8892). Debug.Assert(m_vernWs != 0); if (m_vernWs == 0) return false; // Bail out, rather than run into a null reference exception. // (Should fix LT-7666.) var vernForm = m_srcwfiWordform.Form.get_String(m_vernWs); if (vernForm == null || vernForm.Length == 0) return false; m_cbNewSpelling.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor; m_cbNewSpelling.WritingSystemCode = m_vernWs; m_cbNewSpelling.StyleSheet = FontHeightAdjuster.StyleSheetFromMediator(m_mediator); Debug.Assert(m_cbNewSpelling.StyleSheet != null); // if it is we get a HUGE default font (and can't get the correct size) if (m_cbNewSpelling.WritingSystemFactory.get_EngineOrNull(m_vernWs).RightToLeftScript) { m_cbNewSpelling.RightToLeft = RightToLeft.Yes; } m_cbNewSpelling.Tss = vernForm; m_cbNewSpelling.AdjustForStyleSheet(this, null, m_cbNewSpelling.StyleSheet); if (!Application.RenderWithVisualStyles) m_cbNewSpelling.Padding = new Padding(1, 2, 1, 1); SetSuggestions(); m_btnApply.Enabled = false; m_cbNewSpelling.TextChanged += m_dstWordform_TextChanged; // Setup source browse view. var toolNode = configurationParameters.SelectSingleNode("controls/control[@id='srcSentences']/parameters"); m_srcClerk = RecordClerkFactory.CreateClerk(m_mediator, toolNode, true); m_srcClerk.OwningObject = m_srcwfiWordform; m_sourceSentences.Init(m_mediator, toolNode); m_sourceSentences.CheckBoxChanged += sentences_CheckBoxChanged; m_specialSda = m_sourceSentences.BrowseViewer.SpecialCache; m_moreMinSize = Size; m_moreMinSize.Height -= m_sourceSentences.Height / 2; m_lessMinSize = m_moreMinSize; m_lessMinSize.Height -= m_optionsPanel.Height; AdjustHeightAndMinSize(Height - m_optionsPanel.Height, m_lessMinSize); m_optionsPanel.Visible = false; m_btnMore.Image = ResourceHelper.MoreButtonDoubleArrowIcon; m_btnMore.Click += btnMore_Click; m_sMoreButtonText = m_btnMore.Text; m_optionsPanel.Paint += m_optionsPanel_Paint; m_btnPreviewClear.Click += m_btnPreviewClear_Click; var specialMdc = m_specialSda.MetaDataCache; int fakeFlid = specialMdc.GetFieldId2(WfiWordformTags.kClassId, "Occurrences", false); int[] concordanceItems = m_specialSda.VecProp(m_srcwfiWordform.Hvo, fakeFlid); // (Re)set selected state in cache, so default behavior of checked is used. foreach (var concId in concordanceItems) { m_specialSda.SetInt(concId, m_sourceSentences.BrowseViewer.PreviewEnabledTag, 1); m_specialSda.SetInt(concId, XMLViewsDataCache.ktagItemSelected, 1); } // We initially check everything. var segmentRepos = m_cache.ServiceLocator.GetInstance<ISegmentRepository>(); foreach (var hvo in m_sourceSentences.BrowseViewer.AllItems) m_enabledItems.Add(hvo); // no good...code in MakeRoot of XmlBrowseView happens later and overrides. Control with // selectionType attr in Xml configuration. //m_sourceSentences.BrowseViewer.SelectedRowHighlighting = XmlBrowseViewBase.SelectionHighlighting.none; m_lblExplainText = m_lblExplainDisabled.Text; // We only reload the list when refresh is pressed. m_srcClerk.ListLoadingSuppressed = true; CheckForOtherOccurrences(); SetEnabledState(); } return true; }
private void tvSource_AfterSelect(object sender, TreeViewEventArgs e) { using (new WaitCursor(this, true)) { // Swap out the browse view. if (m_currentBrowseView != null) { // Get rid of old one. m_currentBrowseView.Hide(); m_pnlConcBrowseHolder.Controls.Remove(m_currentBrowseView); m_currentBrowseView.Dispose(); m_currentBrowseView = null; } XmlNode configurationNode; RecordClerk clerk; var selObj = (IAnalysis)tvSource.SelectedNode.Tag; switch (selObj.ClassID) { default: throw new InvalidOperationException("Class not recognized."); case WfiWordformTags.kClassId: configurationNode = m_configurationNodes[WfiWordformTags.kClassId]; clerk = m_recordClerks[WfiWordformTags.kClassId]; break; case WfiAnalysisTags.kClassId: configurationNode = m_configurationNodes[WfiAnalysisTags.kClassId]; clerk = m_recordClerks[WfiAnalysisTags.kClassId]; break; case WfiGlossTags.kClassId: configurationNode = m_configurationNodes[WfiGlossTags.kClassId]; clerk = m_recordClerks[WfiGlossTags.kClassId]; break; } clerk.OwningObject = selObj; m_currentBrowseView = new RecordBrowseView(); m_currentBrowseView.Init(m_mediator, configurationNode); // Ensure that the list gets updated whenever it's reloaded. See LT-8661. var sPropName = clerk.Id + "_AlwaysRecomputeVirtualOnReloadList"; m_mediator.PropertyTable.SetProperty(sPropName, true, false); m_mediator.PropertyTable.SetPropertyPersistence(sPropName, false); m_currentBrowseView.Dock = DockStyle.Fill; m_pnlConcBrowseHolder.Controls.Add(m_currentBrowseView); m_currentBrowseView.CheckBoxChanged += m_currentBrowseView_CheckBoxChanged; m_currentBrowseView.BrowseViewer.SelectionChanged += BrowseViewer_SelectionChanged; m_currentBrowseView.BrowseViewer.FilterChanged += BrowseViewer_FilterChanged; SetRecordStatus(); m_specialSda = m_currentBrowseView.BrowseViewer.SpecialCache; var specialMdc = m_specialSda.MetaDataCache; int[] concordanceItems; switch (selObj.ClassID) { default: throw new InvalidOperationException("Class not recognized."); case WfiWordformTags.kClassId: m_currentSourceFakeFlid = specialMdc.GetFieldId2(WfiWordformTags.kClassId, "ExactOccurrences", false); concordanceItems = m_specialSda.VecProp(selObj.Hvo, m_currentSourceFakeFlid); break; case WfiAnalysisTags.kClassId: m_currentSourceFakeFlid = specialMdc.GetFieldId2(WfiAnalysisTags.kClassId, "ExactOccurrences", false); concordanceItems = m_specialSda.VecProp(selObj.Hvo, m_currentSourceFakeFlid); break; case WfiGlossTags.kClassId: m_currentSourceFakeFlid = specialMdc.GetFieldId2(WfiGlossTags.kClassId, "ExactOccurrences", false); concordanceItems = m_specialSda.VecProp(selObj.Hvo, m_currentSourceFakeFlid); break; } // (Re)set selected state in cache, so default behavior of checked is used. foreach (var concId in concordanceItems) m_specialSda.SetInt(concId, XMLViewsDataCache.ktagItemSelected, 1); // Set the initial value for the filtering status. var sFilterMsg = m_mediator.PropertyTable.GetStringProperty("DialogFilterStatus", String.Empty); if (sFilterMsg != null) sFilterMsg = sFilterMsg.Trim(); SetFilterStatus(!String.IsNullOrEmpty(sFilterMsg)); CheckAssignBtnEnabling(); } }