public InfoPane(FdoCache cache, Mediator mediator, RecordClerk clerk) { // This call is required by the Windows.Forms Form Designer. InitializeComponent(); Initialize(cache, mediator, clerk); }
public InfoPane(FdoCache cache, Mediator mediator, RecordClerk clerk) { // This call is required by the Windows.Forms Form Designer. InitializeComponent(); m_cache = cache; m_mediator = mediator; InitializeInfoView(clerk); }
private void InitializeInfoView(RecordClerk clerk) { if (m_mediator == null) return; XmlNode xnWindow = (XmlNode)m_mediator.PropertyTable.GetValue("WindowConfiguration"); if (xnWindow == null) return; XmlNode xnControl = xnWindow.SelectSingleNode( "controls/parameters/guicontrol[@id=\"TextInformationPane\"]/control/parameters"); if (xnControl == null) return; m_xrev = new InterlinearTextsRecordEditView(); m_xrev.Clerk = clerk; m_xrev.Init(m_mediator, xnControl); m_xrev.Dock = DockStyle.Fill; this.Controls.Add(m_xrev); }
private void InitializeInfoView(RecordClerk clerk) { if (m_mediator == null) return; var xnWindow = (XmlNode)m_mediator.PropertyTable.GetValue("WindowConfiguration"); if (xnWindow == null) return; XmlNode xnControl = xnWindow.SelectSingleNode( "controls/parameters/guicontrol[@id=\"TextInformationPane\"]/control/parameters"); if (xnControl == null) return; var activeClerk = m_mediator.PropertyTable.GetValue("ActiveClerk") as RecordClerk; var toolChoice = m_mediator.PropertyTable.GetStringProperty("currentContentControl", null); if(m_xrev != null) { //when re-using the infoview we want to remove and dispose of the old recordeditview and //associated datatree. (LT-13216) Controls.Remove(m_xrev); m_xrev.Dispose(); } m_xrev = new InterlinearTextsRecordEditView(this); if (clerk.GetType().Name == "InterlinearTextsRecordClerk") { m_xrev.Clerk = clerk; } else { //We want to make sure that the following initialization line will initialize this //clerk if we haven't already set it. Without this assignment to null, the InfoPane //misbehaves in the Concordance view (it uses the filter from the InterlinearTexts view) m_xrev.Clerk = null; } m_xrev.Init(m_mediator, xnControl); // <-- This call will change the ActiveClerk DisplayCurrentRoot(); m_xrev.Dock = DockStyle.Fill; Controls.Add(m_xrev); // There are times when moving to the InfoPane causes the wrong ActiveClerk to be set. // See FWR-3390 (and InterlinearTextsRecordClerk.OnDisplayInsertInterlinText). var activeClerkNew = m_mediator.PropertyTable.GetValue("ActiveClerk") as RecordClerk; if (toolChoice != "interlinearEdit" && activeClerk != null && activeClerk != activeClerkNew) { m_mediator.PropertyTable.SetProperty("ActiveClerk", activeClerk); activeClerk.ActivateUI(true); } }
/// <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) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed) return; base.Dispose(disposing); if (disposing) { // Dispose managed resources here. if (m_vc != null) m_vc.Dispose(); } // Dispose unmanaged resources here, whether disposing is true or false. m_clerk = null; m_vc = null; m_configurationParameters = null; }
static public RecordClerk CreateClerk(Mediator mediator, XmlNode configurationNode, bool loadList) { /* <dynamicloaderinfo/> */ RecordClerk newClerk; XmlNode clerkNode = ToolConfiguration.GetClerkNodeFromToolParamsNode(configurationNode); Debug.Assert(clerkNode != null, "Could not find clerk."); XmlNode customClerkNode = clerkNode.SelectSingleNode("dynamicloaderinfo"); if (customClerkNode == null) newClerk = new RecordClerk(); else newClerk = (RecordClerk) DynamicLoader.CreateObject(customClerkNode); newClerk.Init(mediator, configurationNode); if (loadList) { // The clerk will have been created with list loading suppressed, but now we // want to really load it, all else being well. At least, stop suppressing it. newClerk.ListLoadingSuppressedNoSideEffects = false; newClerk.ReloadIfNeeded(); } return newClerk; }
protected override void DisposeUnmanagedResources() { m_clerk = null; m_waitCursor = null; }
public ListUpdateHelper(RecordClerk clerk, bool fWasAlreadySuppressed) { m_clerk = clerk; if (m_clerk != null) { m_fOriginalUpdatingList = m_clerk.m_list.UpdatingList; m_fOriginalListLoadingSuppressedState = fWasAlreadySuppressed; m_fOriginalSkipRecordNavigationState = m_clerk.m_skipShowRecord; m_fOriginalSuppressSaveOnChangeRecord = m_clerk.SuppressSaveOnChangeRecord; m_fOriginalLoadRequestedWhileSuppressed = m_clerk.RequestedLoadWhileSuppressed; // monitor whether ReloadList was requested during the life of this ListUpdateHelper m_clerk.m_list.RequestedLoadWhileSuppressed = false; m_originalUpdateHelper = m_clerk.UpdateHelper; // if we're already suppressing the list, we don't want to auto reload since // the one who is suppressing the list expects to be able to handle that later. // or if the parent clerk is suppressing, we should wait until the parent reloads. RecordClerk parentClerk = clerk.ParentClerk(); if (m_fOriginalListLoadingSuppressedState || parentClerk != null && parentClerk.ListLoadingSuppressed) { m_fTriggerPendingReloadOnDispose = false; } m_clerk.ListLoadingSuppressedNoSideEffects = true; m_clerk.UpdateHelper = this; } }
/// <summary> /// /// </summary> /// <param name="clerk">clerk we want to suspend reloading for. if null, we don't do anything.</param> public ListUpdateHelper(RecordClerk clerk) :this(clerk, clerk != null && clerk.ListLoadingSuppressed) { }
/// <summary> /// /// </summary> /// <param name="clerk"></param> /// <param name="options"></param> public ListUpdateHelper(RecordClerk clerk, ListUpdateHelperOptions options) : this(clerk, options.ParentForWaitCursor) { SkipShowRecord = options.SkipShowRecord; m_clerk.SuppressSaveOnChangeRecord = options.SuppressSaveOnChangeRecord; ClearBrowseListUntilReload = options.ClearBrowseListUntilReload; TriggerPendingReloadOnDispose = !options.SuspendPendingReloadOnDispose; m_clerk.m_list.UpdatingList = options.SuspendPropChangedDuringModification; }
static public RecordClerk CreateClerk(Mediator mediator, XmlNode configurationNode) { /* <dynamicloaderinfo/> */ RecordClerk newClerk = null; XmlNode clerkNode = ToolConfiguration.GetClerkNodeFromToolParamsNode(configurationNode); Debug.Assert(clerkNode != null, "Could not find clerk."); XmlNode customClerkNode = clerkNode.SelectSingleNode("dynamicloaderinfo"); if (customClerkNode == null) newClerk = new RecordClerk(); else newClerk = (RecordClerk)DynamicLoader.CreateObject(customClerkNode); newClerk.Init(mediator, configurationNode); return newClerk; }
/// <summary> /// Save the configuration parameters in case we want to use them locally. /// </summary> /// <param name="mediator"></param> /// <param name="configurationParameters"></param> public override void Init(Mediator mediator, System.Xml.XmlNode configurationParameters) { CheckDisposed(); base.Init (mediator, configurationParameters); m_configurationParameters = configurationParameters; m_clerk = ToolConfiguration.FindClerk(m_mediator, m_configurationParameters); m_styleSheet = FontHeightAdjuster.StyleSheetFromMediator(m_mediator); }
/// <summary> /// Initialize the pane with a Mediator and a RecordClerk. /// </summary> internal void Initialize(FdoCache cache, Mediator mediator, RecordClerk clerk) { m_cache = cache; m_mediator = mediator; InitializeInfoView(clerk); }
/// <summary> /// Save the configuration parameters in case we want to use them locally. /// </summary> /// <param name="mediator"></param> /// <param name="configurationParameters"></param> public override void Init(Mediator mediator, System.Xml.XmlNode configurationParameters) { CheckDisposed(); base.Init (mediator, configurationParameters); m_configurationParameters = configurationParameters; m_clerk = ToolConfiguration.FindClerk(m_mediator, m_configurationParameters); }
internal bool SetDlgInfo(Mediator mediator, XmlNode configurationParameters) { m_wfClerk = (RecordClerk)mediator.PropertyTable.GetValue("RecordClerk-concordanceWords"); m_wfClerk.SuppressSaveOnChangeRecord = true; // various things trigger change record and would prevent Undo m_srcwfiWordform = (IWfiWordform)m_wfClerk.CurrentObject; return SetDlgInfo1(mediator, configurationParameters); }
public ExportDialog(Mediator mediator) { m_mediator = mediator; m_cache = (FdoCache) mediator.PropertyTable.GetValue("cache"); // // Required for Windows Form Designer support // InitializeComponent(); AccessibleName = GetType().Name; // Figure out where to locate the dlg. object obj = SettingsKey.GetValue("InsertX"); if (obj != null) { var x = (int) obj; var y = (int) SettingsKey.GetValue("InsertY"); var width = (int) SettingsKey.GetValue("InsertWidth", Width); var height = (int) SettingsKey.GetValue("InsertHeight", Height); var rect = new Rectangle(x, y, width, height); ScreenUtils.EnsureVisibleRect(ref rect); DesktopBounds = rect; StartPosition = FormStartPosition.Manual; } m_helpTopic = "khtpExportLexicon"; helpProvider = new HelpProvider(); helpProvider.HelpNamespace = mediator.HelpTopicProvider.HelpFile; helpProvider.SetHelpKeyword(this, m_mediator.HelpTopicProvider.GetHelpString(m_helpTopic)); helpProvider.SetHelpNavigator(this, 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); InitFromMainControl(objCurrentControl); m_clerk = m_mediator.PropertyTable.GetValue("ActiveClerk", null) as RecordClerk; m_chkExportPictures.Checked = false; m_chkExportPictures.Visible = false; m_chkExportPictures.Enabled = false; m_fExportPicturesAndMedia = false; //Set m_chkShowInFolder to it's last state. var showInFolder = m_mediator.PropertyTable.GetStringProperty("ExportDlgShowInFolder", "true"); if (showInFolder.Equals("true")) m_chkShowInFolder.Checked = true; else m_chkShowInFolder.Checked = false; m_exportItems = new List<ListViewItem>(); }
/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { if (IsDisposed) return; if( disposing ) { if(components != null) { components.Dispose(); } ClearResetTimer(); } m_cache = null; m_cacheSearch = null; m_clerk = null; base.Dispose( disposing ); }
/// <summary> /// Make one. /// </summary> /// <param name="clerk"></param> /// <param name="shouldSaveOnChangeRecord"></param> public RecordNavigationInfo(RecordClerk clerk, bool suppressSaveOnChangeRecord, bool skipShowRecord) { m_clerk = clerk; m_hvoCurrentObj = m_clerk != null && m_clerk.CurrentObject != null ? m_clerk.CurrentObject.Hvo : 0; m_fSuppressSaveOnChangeRecord = suppressSaveOnChangeRecord; m_fSkipShowRecord = skipShowRecord; }
/// <summary> /// Make one. /// </summary> /// <param name="clerk">The clerk.</param> /// <param name="suppressSaveOnChangeRecord"></param> /// <param name="skipShowRecord"></param> /// <param name="suppressFocusChange"></param> public RecordNavigationInfo(RecordClerk clerk, bool suppressSaveOnChangeRecord, bool skipShowRecord, bool suppressFocusChange) { Clerk = clerk; HvoOfCurrentObjAtTimeOfNavigation = Clerk != null && Clerk.CurrentObjectHvo != 0 ? Clerk.CurrentObjectHvo : 0; SuppressSaveOnChangeRecord = suppressSaveOnChangeRecord; SkipShowRecord = skipShowRecord; SuppressFocusChange = suppressFocusChange; }
/// <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; base.Dispose(disposing); if (disposing) { // Dispose managed resources here. } // Dispose unmanaged resources here, whether disposing is true or false. m_clerk = null; m_vc = null; m_configurationParameters = null; }
/// <summary> /// /// </summary> /// <param name="clerk"></param> /// <param name="parentForWaitCursor">for wait cursor</param> public ListUpdateHelper(RecordClerk clerk, Control parentForWaitCursor) : this(clerk) { if (parentForWaitCursor != null) m_waitCursor = new WaitCursor(parentForWaitCursor); }
internal bool TryClerkProvidingRootObject(out RecordClerk clerkProvidingRootObject) { clerkProvidingRootObject = null; if (IsPrimaryClerk) return false; clerkProvidingRootObject = FindClerk(m_mediator, m_clerkProvidingRootObject); return clerkProvidingRootObject != null; }
private bool SetDlgInfo1(Mediator mediator, XmlNode configurationParameters) { using (new WaitCursor(this)) { m_mediator = mediator; m_configurationParameters = configurationParameters; m_btnRefresh.Image = SIL.FieldWorks.Resources.ResourceHelper.RefreshIcon; m_rbDiscardAnalyses.Checked = m_mediator.PropertyTable.GetBoolProperty("RemoveAnalyses", true); m_rbKeepAnalyses.Checked = !m_rbDiscardAnalyses.Checked; m_rbDiscardAnalyses.Click += new EventHandler(m_rbDiscardAnalyses_Click); m_rbKeepAnalyses.Click += new EventHandler(m_rbDiscardAnalyses_Click); m_cbUpdateLexicon.Checked = m_mediator.PropertyTable.GetBoolProperty("UpdateLexiconIfPossible", true); m_cbCopyAnalyses.Checked = m_mediator.PropertyTable.GetBoolProperty("CopyAnalysesToNewSpelling", true); m_cbCopyAnalyses.Click += new EventHandler(m_cbCopyAnalyses_Click); m_cbMaintainCase.Checked = m_mediator.PropertyTable.GetBoolProperty("MaintainCaseOnChangeSpelling", true); m_cbMaintainCase.Click += new EventHandler(m_cbMaintainCase_Click); m_cache = (FdoCache)m_mediator.PropertyTable.GetValue("cache"); m_cbNewSpelling.TextBox.MaxLength = m_cache.MaxFieldLength((int) WfiWordform.WfiWordformTags.kflidForm); if (m_cache.IsDummyObject(m_srcwfiWordform.Hvo)) { m_srcwfiWordform = (IWfiWordform)(m_cache.LangProject.WordformInventoryOA as WordformInventory).ConvertDummyToReal(WordformInventory.ConcordanceWordformsFlid(m_cache), m_srcwfiWordform.Hvo); // wfClerk now has the defunct dummy wf, so it needs to be updated to include the new real wf. if (m_wfClerk != null) m_wfClerk.UpdateList(true); } // 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 = m_cache.LangProject.ActualWs( LangProject.kwsFirstVern, m_srcwfiWordform.Hvo, (int)WfiWordform.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.) if (m_srcwfiWordform.Form.GetAlternativeTss(m_vernWs) == null || m_srcwfiWordform.Form.GetAlternativeTss(m_vernWs).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).RightToLeft) { m_cbNewSpelling.RightToLeft = RightToLeft.Yes; } m_cbNewSpelling.Tss = m_srcwfiWordform.Form.GetAlternativeTss(m_vernWs); 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 += new EventHandler(m_dstWordform_TextChanged); // Setup source browse view. XmlNode toolNode = configurationParameters.SelectSingleNode("controls/control[@id='srcSentences']/parameters"); m_srcClerk = RecordClerkFactory.CreateClerk(m_mediator, toolNode); m_srcClerk.OwningObject = m_srcwfiWordform; m_sourceSentences.Init(m_mediator, toolNode); m_sourceSentences.CheckBoxChanged += new CheckBoxChangedEventHandler(sentences_CheckBoxChanged); 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 += new EventHandler(btnMore_Click); m_sMoreButtonText = m_btnMore.Text; m_optionsPanel.Paint += new PaintEventHandler(m_optionsPanel_Paint); m_btnPreviewClear.Click += new EventHandler(m_btnPreviewClear_Click); // 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; // We initially check everything. m_enabledItems.AddRange(m_sourceSentences.BrowseViewer.AllItems); foreach (int hvoCba in m_enabledItems) { m_cache.VwCacheDaAccessor.CacheIntProp(hvoCba, m_sourceSentences.BrowseViewer.PreviewEnabledTag, 1); m_cache.VwCacheDaAccessor.CacheIntProp(hvoCba, XmlBrowseViewBaseVc.ktagItemSelected, 1); } CheckForOtherOccurrences(); SetEnabledState(); } return true; }
/// <summary> /// Tell the RecordClerk that it may now be the new master of the tree bar, if it is not a dependent clerk. /// Use DeactivatedGui to tell RecordClerk that it's not currently being used in a Gui. /// </summary> virtual public void ActivateUI(bool useRecordTreeBar) { m_fIsActiveInGui = true; CheckDisposed(); if (m_recordBarHandler != null) { IsControllingTheRecordTreeBar = true; if (useRecordTreeBar && s_lastClerkToLoadTreeBar != this)//optimization { s_lastClerkToLoadTreeBar = this; m_recordBarHandler.PopulateRecordBar(m_list); } } UpdateFilterStatusBarPanel(); UpdateSortStatusBarPanel(); }
private void SwitchToWordListConcordanceTool() { m_window.ActivateTool("wordListConcordance"); m_occurrencesList = RecordClerk.FindClerk(Mediator, "OccurrencesOfSelectedWordform"); m_wordList = RecordClerk.FindClerk(Mediator, "concordanceWords"); }