public override void FixtureSetup() { base.FixtureSetup(); m_sda = Cache.DomainDataByFlid; m_objectsToDispose = new DisposableObjectsSet<object>(); }
/// <summary> /// Select the word indicated by the text-wordform-in-context (twfic) annotation. /// This ignores the Sandbox! This is 'public' because it overrides a public method. /// </summary> /// <param name="hvoAnn"></param> public override void SelectAnnotation(int hvoAnn) { ISilDataAccess sda = Cache.MainCacheAccessor; // We should assert that ann is Twfic int twficType = CmAnnotationDefn.Twfic(Cache).Hvo; int annoType = sda.get_ObjectProp(hvoAnn, (int)CmAnnotation.CmAnnotationTags.kflidAnnotationType); Debug.Assert(annoType == twficType, "Given annotation type should be twfic(" + twficType + ") but was " + annoType + "."); // The following will select the Twfic, ... I hope! // Scroll to selection into view IVwSelection sel = SelectWficInIText(hvoAnn); if (sel == null) { return; } if (!this.Focused) { this.Focus(); } this.ScrollSelectionIntoView(sel, VwScrollSelOpts.kssoTop); Update(); }
private void GetItemsForMsaType(ISilDataAccess sda, ref List <int> results, int hvoMsa) { if (hvoMsa == 0) { return; } int kclsid = m_cache.ServiceLocator.GetInstance <ICmObjectRepository>().GetObject(hvoMsa).ClassID; switch (kclsid) { case MoStemMsaTags.kClassId: AddHvoPOStoResults(sda, results, hvoMsa, MoStemMsaTags.kflidPartOfSpeech); break; case MoInflAffMsaTags.kClassId: AddHvoPOStoResults(sda, results, hvoMsa, MoInflAffMsaTags.kflidPartOfSpeech); break; case MoDerivAffMsaTags.kClassId: AddHvoPOStoResults(sda, results, hvoMsa, MoDerivAffMsaTags.kflidFromPartOfSpeech); AddHvoPOStoResults(sda, results, hvoMsa, MoDerivAffMsaTags.kflidToPartOfSpeech); break; case MoUnclassifiedAffixMsaTags.kClassId: AddHvoPOStoResults(sda, results, hvoMsa, MoUnclassifiedAffixMsaTags.kflidPartOfSpeech); break; } }
/// <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 virtual void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (m_isDisposed) { return; } // m_sda COM object block removed due to crash in Finializer thread LT-6124 if (disposing) { if (m_sda != null) { m_sda.RemoveNotification(this); } if (m_cache.CreateModifyManager == this) { m_cache.CreateModifyManager = null; } } // Dispose unmanaged resources here, whether disposing is true or false. m_sda = null; m_cache = null; // ensures it can't be used again without crashing. m_mdc = null; m_recentMods = null; m_isDisposed = true; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Replace may be first call to reference this virtual property - need to make sure /// that property gets loaded into cache, but don't need to do any actual replace since /// cache code will handle that. /// </summary> /// <param name="hvo"></param> /// <param name="tag"></param> /// <param name="ihvoMin"></param> /// <param name="ihvoLim"></param> /// <param name="_rghvo"></param> /// <param name="chvo"></param> /// <param name="_sda"></param> /// ------------------------------------------------------------------------------------ public override void Replace(int hvo, int tag, int ihvoMin, int ihvoLim, int[] _rghvo, int chvo, ISilDataAccess _sda) { Debug.Assert(m_filteredBooks != null); if (ihvoMin == 0 && ihvoLim == m_filteredBooks.Count) { m_filteredBooks = new List <int>(_rghvo); } else if (ihvoMin == ihvoLim) { #if DEBUG foreach (int hvoToInsert in _rghvo) { Debug.Assert(!m_filteredBooks.Contains(hvoToInsert)); } #endif // Inserting entries into vector m_filteredBooks.InsertRange(ihvoMin, _rghvo); } else if (chvo == 0) { // Deleting entries from vector m_filteredBooks.RemoveRange(ihvoMin, ihvoLim - ihvoMin); } if (FilterChanged != null) { FilterChanged(this, EventArgs.Empty); } }
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; } }
public override void MakeRoot() { m_rootb = (IVwRootBox) new FwViews.VwRootBoxClass(); m_rootb.SetSite(this); int hvoRoot = 1; m_sda = (ISilDataAccess) new FwViews.VwCacheDaClass(); // Usually not here, but in some application global passed to each view. m_wsf = (ILgWritingSystemFactory) new FwLanguage.LgWritingSystemFactoryClass(); m_sda.set_WritingSystemFactory(m_wsf); m_rootb.set_DataAccess(m_sda); ITsStrFactory tsf = (ITsStrFactory) new FwKernelLib.TsStrFactoryClass(); ITsString tss = tsf.MakeString("Hello World! This is a view", m_wsf.get_UserWs()); IVwCacheDa cda = (IVwCacheDa)m_sda; cda.CacheStringProp(hvoRoot, ktagProp, tss); m_vVc = new HvVc(); m_rootb.SetRootObject(hvoRoot, m_vVc, kfrText, null); m_fRootboxMade = true; m_dxdLayoutWidth = -50000; // Don't try to draw until we get OnSize and do layout. }
/// <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; } if (disposing) { // Dispose managed resources here. if (m_sda != null) { m_sda.RemoveNotification(this); m_sda = null; } var arl = Control as AtomicReferenceLauncher; if (arl != null) { arl.ChoicesMade -= RefreshTree; arl.ViewSizeChanged -= OnViewSizeChanged; var view = (AtomicReferenceView)arl.MainControl; view.ViewSizeChanged -= OnViewSizeChanged; } } // Dispose unmanaged resources here, whether disposing is true or false. base.Dispose(disposing); }
/// <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 virtual void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (m_isDisposed) { return; } // m_sda COM object block removed due to crash in Finializer thread LT-6124 if (disposing) { // Dispose managed resources here. if (m_sda != null) { m_sda.RemoveNotification(this); } } m_cache = null; m_sda = null; // Dispose unmanaged resources here, whether disposing is true or false. m_isDisposed = true; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Print method /// </summary> /// ------------------------------------------------------------------------------------ public override void Print(PrintDocument pd) { CheckDisposed(); ISilDataAccess oldSda = null; bool fPrintSelection = (pd.PrinterSettings.PrintRange == PrintRange.Selection); if (fPrintSelection) { oldSda = RootBox.DataAccess; IVwSelection sel = RootBox.Selection; int clev = sel.CLevels(true); int hvoObj, tag, ihvoEnd, ihvoAnchor, cpropPrevious; IVwPropertyStore vps; sel.PropInfo(true, clev - 1, out hvoObj, out tag, out ihvoEnd, out cpropPrevious, out vps); clev = sel.CLevels(false); sel.PropInfo(false, clev - 1, out hvoObj, out tag, out ihvoAnchor, out cpropPrevious, out vps); int[] originalObjects = m_sdaSource.VecProp(m_hvoRoot, m_mainFlid); int ihvoMin = Math.Min(ihvoEnd, ihvoAnchor); int ihvoLim = Math.Max(ihvoEnd, ihvoAnchor) + 1; var selectedObjects = new int[ihvoLim - ihvoMin]; for (int i = 0; i < selectedObjects.Length; i++) { selectedObjects[i] = originalObjects[i + ihvoMin]; } RootBox.DataAccess = CachePrintDecorator(m_sdaSource, m_hvoRoot, m_mainFlid, selectedObjects); } base.Print(pd); if (fPrintSelection) { RootBox.DataAccess = oldSda; } }
/// <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 virtual void Dispose(bool disposing) { System.Diagnostics.Debug.WriteLineIf(!disposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** "); // Must not be run more than once. if (m_isDisposed) { return; } if (disposing) { // Dispose managed resources here. if (m_FdoToSda != null) { m_FdoToSda.Clear(); } if (m_SdaToFdo != null) { m_SdaToFdo.Clear(); } } // Dispose unmanaged resources here, whether disposing is true or false. Marshal.ReleaseComObject(m_sda); m_sda = null; m_cache = null; m_FdoToSda = null; m_SdaToFdo = null; m_coRepository = null; m_isDisposed = true; }
/// <summary> /// Clean up any resources being used. /// </summary> 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) { if (components != null) { components.Dispose(); } if (m_vc != null) { m_vc.Dispose(); } m_sda.RemoveNotification(this); } m_vc = null; m_fs = null; m_sda = null; }
/// <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; } if (disposing) { // Dispose managed resources here. if (m_fdoCache != null) { m_fdoCache.DisposeWithWSFactoryShutdown(); } } // Dispose unmanaged resources here, whether disposing is true or false. m_sda = null; m_da = null; m_fdoCache = null; base.Dispose(disposing); }
/// ------------------------------------------------------------------------------------ /// <summary> /// If a data update is actually in progress, we want to only complete edits and not /// notify the world of the prop changes yet (we'll store the info in a queue for /// broadcast later, in Dispose()). /// </summary> /// <param name="vwsel"></param> /// <param name="sda">Data access object (corresponds to a DB connection)</param> /// <returns>Return value from IVwSelection.Commit() or IVwSelection.CompleteEdits() /// </returns> /// ------------------------------------------------------------------------------------ public static bool Commit(IVwSelection vwsel, ISilDataAccess sda) { if (vwsel == null) { return(false); } UpdateSemaphore semaphore = null; if (s_UpdateSemaphores.ContainsKey(sda)) { semaphore = s_UpdateSemaphores[sda]; } if (semaphore == null || !semaphore.fDataUpdateInProgress) { return(vwsel.Commit()); } VwChangeInfo changeInfo; bool fRet = vwsel.CompleteEdits(out changeInfo); if (changeInfo.hvo != 0) { semaphore.changeInfoQueue.Enqueue(changeInfo); } return(fRet); }
protected virtual void MakeRootInternal() { // Setting this result too low can result in moving a cursor from an editable field // to a non-editable field (e.g. with Control-Right and Control-Left cursor // commands). Normally we could set this to only a few (e.g. 4). but in // Interlinearizer we may want to jump from one sentence annotation to the next over // several read-only paragraphs contained in a word bundle. Make sure that // procedures that use this limit do not move the cursor from an editable to a // non-editable field. m_rootb.MaxParasToScan = 2000; EnsureVc(); // We want to get notified when anything changes. m_sda = m_cache.MainCacheAccessor; m_sda.AddNotification(this); m_vc.ShowMorphBundles = m_propertyTable.GetBoolProperty("ShowMorphBundles", true); m_vc.LineChoices = LineChoices; m_vc.ShowDefaultSense = true; m_rootb.DataAccess = m_cache.MainCacheAccessor; m_rootb.SetRootObject(m_hvoRoot, m_vc, InterlinVc.kfragStText, m_styleSheet); m_objRepo = m_cache.ServiceLocator.GetInstance <ICmObjectRepository>(); }
public override void MakeRoot() { CheckDisposed(); base.MakeRoot(); if (m_fdoCache == null || DesignMode) { return; } m_PhoneEnvReferenceVc = new PhoneEnvReferenceVc(m_fdoCache); m_vwCache = VwUndoDaClass.Create(); m_silCache = (ISilDataAccess)m_vwCache; m_silCache.WritingSystemFactory = m_fdoCache.LanguageWritingSystemFactoryAccessor; IActionHandler handler = ActionHandlerClass.Create(); m_silCache.SetActionHandler(handler); // Populate m_vwCache with data. ResynchListToDatabase(); m_rootb = VwRootBoxClass.Create(); m_rootb.SetSite(this); m_rootb.DataAccess = m_silCache; m_rootb.SetRootObject(m_rootObj.Hvo, m_PhoneEnvReferenceVc, kFragEnvironments, null); m_heightView = m_rootb.Height; }
private ICmBaseAnnotation MakeSegment(IStTxtPara para, int beginOffset, int length) { ICmBaseAnnotation seg = CmBaseAnnotation.CreateUnownedCba(Cache); seg.BeginObjectRA = para; seg.BeginOffset = beginOffset; seg.EndOffset = beginOffset + length; seg.AnnotationTypeRAHvo = m_hvoSegDefn; ISilDataAccess sda = para.Cache.MainCacheAccessor; int[] segments; if (sda.get_IsPropInCache(para.Hvo, kflidSegments, (int)CellarModuleDefns.kcptReferenceSequence, 0)) { int[] segmentsT = Cache.GetVectorProperty(para.Hvo, kflidSegments, true); segments = new int[segmentsT.Length]; Array.Copy(segmentsT, segments, segmentsT.Length); segments[segments.Length - 1] = seg.Hvo; } else { segments = new int[] { seg.Hvo }; } para.Cache.VwCacheDaAccessor.CacheVecProp(seg.Hvo, kflidSegments, segments, segments.Length); return(seg); }
/// <summary> /// Get the Linked Files Root Directory value from the language project represented by the /// ISilDataAccess argument. /// </summary> protected string GetLinkedFilesRootDir(ISilDataAccess sda) { var linkedFilesRootDirID = sda.MetaDataCache.GetFieldId("LangProject", "LinkedFilesRootDir", false); int hvo = GetHvoOfProject(sda); return(sda.get_UnicodeProp(hvo, linkedFilesRootDirID)); }
/// <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; } if (disposing) { // Dispose managed resources here. if (m_shortnames != null) { m_shortnames.Clear(); } } // Dispose unmanaged resources here, whether disposing is true or false. kstrTaName = null; kstrSnName = null; m_virtualName = null; m_className = null; m_fieldName = null; m_sda = null; m_cache = null; m_shortnames = null; base.Dispose(disposing); }
public void Teardown() { if (m_wsf != null && Marshal.IsComObject(m_wsf)) { m_wsf.Shutdown(); Marshal.ReleaseComObject(m_wsf); } m_wsf = null; if (Marshal.IsComObject(m_cda)) { Marshal.ReleaseComObject(m_cda); } m_cda = null; if (Marshal.IsComObject(m_mdc)) { Marshal.ReleaseComObject(m_mdc); } m_mdc = null; if (Marshal.IsComObject(m_sda)) { Marshal.ReleaseComObject(m_sda); } m_sda = null; m_layoutInventory = null; m_columnList = null; m_layouts = null; m_partInventory = null; }
/// <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. if (m_cd != null) { m_cd.ClearAllData(); if (Marshal.IsComObject(m_cd)) { Marshal.ReleaseComObject(m_cd); } } } // Dispose unmanaged resources here, whether disposing is true or false. m_svc = null; m_sda = null; m_cd = null; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Clean up any resources being used. /// </summary> /// ------------------------------------------------------------------------------------ protected override void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed) { return; } if (disposing) { ShutDownTempWsFactory(); // Must happen before call to base. } base.Dispose(disposing); if (disposing) { if (m_CacheDa != null) { m_CacheDa.ClearAllData(); } } m_vc = null; m_DataAccess = null; m_wsf = null; if (m_CacheDa != null && Marshal.IsComObject(m_CacheDa)) { Marshal.ReleaseComObject(m_CacheDa); } m_CacheDa = null; }
/// <summary> /// Fake doing the change by setting the specified property to the appropriate value /// for each item in the list. Disable items that can't be set. /// </summary> /// <param name="itemsToChange"></param> /// <param name="ktagFakeFlid"></param> public void FakeDoit(Set <int> itemsToChange, int tagFakeFlid, int tagEnable, ProgressState state) { CheckDisposed(); IVwCacheDa cda = m_cache.VwCacheDaAccessor; ISilDataAccess sda = m_cache.MainCacheAccessor; ITsString tss = m_cache.MakeAnalysisTss(m_selectedLabel); // Build a Set of parts of speech that can take this class. Set <int> possiblePOS = GetPossiblePartsOfSpeech(); int i = 0; // Report progress 50 times or every 100 items, whichever is more (but no more than once per item!) int interval = Math.Min(100, Math.Max(itemsToChange.Count / 50, 1)); foreach (int hvo in itemsToChange) { i++; if (i % interval == 0) { state.PercentDone = i * 100 / itemsToChange.Count; state.Breath(); } bool fEnable = IsItemEligible(sda, hvo, possiblePOS); if (fEnable) { cda.CacheStringProp(hvo, tagFakeFlid, tss); } cda.CacheIntProp(hvo, tagEnable, (fEnable ? 1 : 0)); } }
public void Teardown() { if (Marshal.IsComObject(m_cda)) { Marshal.ReleaseComObject(m_cda); } m_cda = null; if (Marshal.IsComObject(m_mdc)) { Marshal.ReleaseComObject(m_mdc); } m_mdc = null; if (Marshal.IsComObject(m_sda)) { Marshal.ReleaseComObject(m_sda); } m_sda = null; m_layoutInventory = null; m_columnList = null; m_layouts = null; m_partInventory = null; m_wsManager = null; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Creates a new HFSetView /// </summary> /// <param name="sda">The ISilDataAccess for the view</param> /// <param name="vc">The view constructor used to create the view</param> /// <param name="hvoHeader">The id of the PubHeader used to get the Header/Footer /// information to display in the view</param> /// ------------------------------------------------------------------------------------ public HFSetView(ISilDataAccess sda, HeaderFooterVc vc, int hvoHeader) : base() { m_sda = sda; WritingSystemFactory = m_sda.WritingSystemFactory; m_vc = vc; m_hvoHeader = hvoHeader; }
/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose(bool disposing) { // Must not be run more than once. if (IsDisposed) { return; } base.Dispose(disposing); if (disposing) { if (components != null) { components.Dispose(); } var disposable = m_basicViewVc as IDisposable; if (disposable != null) { disposable.Dispose(); } } RequestedSelectionAtEndOfUow = null; Cache = null; m_basicViewVc = null; m_SelectionHelper = null; }
public SimpleDataParser(IFwMetaDataCache mdc, IVwCacheDa cda) { m_mdc = mdc; m_cda = cda; m_sda = cda as ISilDataAccess; m_wsf = m_sda.WritingSystemFactory; }
/// ------------------------------------------------------------------------------------ /// <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">true to release both managed and unmanaged resources; false /// to release only unmanaged resources.</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) { System.Diagnostics.Debug.WriteLineIf(!disposing, "****************** Missing Dispose() call for " + GetType().Name + " ******************"); // Must not be run more than once. if (IsDisposed) { return; } if (disposing) { // Dispose managed resources here. if (m_sda != null) { m_sda.RemoveNotification(this); } // m_innerFwTextBox is part of Controls collection and will be disposed there. } // Dispose unmanaged resources here, whether disposing is true or false. m_innerFwTextBox = null; m_sda = null; base.Dispose(disposing); }
public override void FixtureSetup() { base.FixtureSetup(); m_sda = Cache.DomainDataByFlid; m_objectsToDispose = new DisposableObjectsSet <object>(); }
/// ------------------------------------------------------------------------------------ /// <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">true to release both managed and unmanaged resources; false /// to release only unmanaged resources.</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_sda != null) { m_sda.RemoveNotification(this); } // m_innerFwTextBox is part of Controls collection and will be disposed there. } // Dispose unmanaged resources here, whether disposing is true or false. m_innerFwTextBox = null; m_sda = null; base.Dispose(disposing); }
/// <summary> /// Clear all text. If fReconstruct is true, also clears the display. /// </summary> public void Clear(bool fReconstruct) { CheckDisposed(); if (m_sda == null) { var cda = VwCacheDaClass.Create(); cda.TsStrFactory = TsStringUtils.TsStrFactory; m_sda = cda; if (WritingSystemFactory != null) { m_sda.WritingSystemFactory = WritingSystemFactory; } m_cd = cda; } else { m_hvoNextPara = khvoFirstPara; m_cd.CacheVecProp(m_hvoRoot, (int)SampleTags.ktagTextParas, new int[0], 0); if (fReconstruct) { RootBox.Reconstruct(); } } }
public SimpleDataParser(IFwMetaDataCache mdc, IVwCacheDa cda) { m_mdc = mdc; m_cda = cda; m_sda = (ISilDataAccess)cda; m_wsf = m_sda.WritingSystemFactory; }
/// <summary> /// Get the boolean or integer model property as a boolean. /// </summary> /// <returns> /// The regular boolean value for boolean properties. /// For int model properties: 'false' for a '0' int value, /// or 'true' for all other int values. /// </returns> public static bool GetBoolean(ISilDataAccess sda, int hvo, int tag) { if (sda == null) throw new ArgumentNullException("sda"); return (CellarPropertyType)sda.MetaDataCache.GetFieldType(tag) == CellarPropertyType.Boolean ? sda.get_BooleanProp(hvo, tag) : sda.get_IntProp(hvo, tag) != 0; }
/// ----------------------------------------------------------------------------------- /// <summary> /// Initializes a new instance of the <see cref="AtomicReferenceSlice"/> class. /// </summary> /// ----------------------------------------------------------------------------------- public AtomicReferenceSlice(FdoCache cache, ICmObject obj, int flid, XmlNode configurationNode, IPersistenceProvider persistenceProvider, Mediator mediator, StringTable stringTbl) : base(cache, obj, flid, configurationNode, persistenceProvider, mediator, stringTbl) { m_sda = m_cache.MainCacheAccessor; m_sda.AddNotification(this); }
public MaxStringWidthForChartColumn(ConstChartVc vc, IVwStylesheet stylesheet, ISilDataAccess sda, int hvoRoot, System.Drawing.Graphics graphics, int icolumn) : base(stylesheet, sda, hvoRoot, graphics, icolumn) { m_vc = vc; m_cLines = m_vc.LineChoices.Count; m_paraWidths = new int[m_cLines]; }
/// <summary> /// Create one. /// </summary> /// <param name="cache"></param> /// <param name="appGuid"></param> public SyncWatcher(FdoCache cache, Guid appGuid) { m_cache = cache; m_appGuid = appGuid; m_sda = m_cache.MainCacheAccessor; m_sda.AddNotification(this); }
public void TestSetup() { RegistryHelper.CompanyName = "SIL"; m_ISilDataAccess = VwCacheDaClass.Create(); ILgWritingSystemFactory wsf = new PalasoWritingSystemManager(); m_ISilDataAccess.WritingSystemFactory = wsf; m_IVwCacheDa = (IVwCacheDa)m_ISilDataAccess; }
/// <summary> /// Set the given boolean to either a boolean or integer model property. /// </summary> public static void SetValueFromBoolean(ISilDataAccess sda, int hvo, int tag, bool newValue) { if (sda == null) throw new ArgumentNullException("sda"); if ((CellarPropertyType)sda.MetaDataCache.GetFieldType(tag) == CellarPropertyType.Boolean) sda.SetBoolean(hvo, tag, newValue); else sda.SetInt(hvo, tag, newValue ? 1 : 0); }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// <param name="sda"></param> /// <param name="hvo"></param> /// <param name="vc"></param> /// <param name="frags"></param> /// <param name="styleSheet"></param> /// ------------------------------------------------------------------------------------ public PrintRootSite(ISilDataAccess sda, int hvo, IVwViewConstructor vc, int frags, IVwStylesheet styleSheet) { m_sda = sda; m_hvo = hvo; m_vc = vc; m_frags = frags; m_styleSheet = styleSheet; }
public InnerLabeledMultiStringControl(FdoCache cache, int wsMagic) { m_realCache = cache; m_sda = new TextBoxDataAccess { WritingSystemFactory = cache.WritingSystemFactory }; m_rgws = WritingSystemServices.GetWritingSystemList(cache, wsMagic, 0, false); AutoScroll = true; IsTextBox = true; // range selection not shown when not in focus }
internal int m_chvoDel; // On Do, Redo; #inserted on Undo. /// <summary> /// Make an instance and add it to the undo stack. Also, if it's the 'redo' action added after the /// actual changes (fForRedo is true), issue the propchanged at once to complete the original action. /// </summary> public static ExtraPropChangedAction AddAndInvokeIfRedo(IActionHandler actionHandler, ISilDataAccess sda, int hvo, int tag, int ihvo, int chvoIns, int chvoDel, bool fForRedo) { ExtraPropChangedAction action = new ExtraPropChangedAction(sda, hvo, tag, ihvo, chvoIns, chvoDel, fForRedo); actionHandler.AddAction(action); if (fForRedo) action.Redo(); return action; }
/// ------------------------------------------------------------------------------------ /// <summary> /// If a test overrides this, it should call this base implementation. /// </summary> /// ------------------------------------------------------------------------------------ public override void FixtureSetup() { base.FixtureSetup(); m_sda = Cache.DomainDataByFlid; m_entryFactory = Cache.ServiceLocator.GetInstance<ILexEntryFactory>(); m_senseFactory = Cache.ServiceLocator.GetInstance<ILexSenseFactory>(); m_possFact = Cache.ServiceLocator.GetInstance<ICmPossibilityFactory>(); m_possRepo = Cache.ServiceLocator.GetInstance<ICmPossibilityRepository>(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="T:FindReplaceCollectorEnvBase"/> class. /// </summary> /// <param name="vc">The view constructor.</param> /// <param name="sda">Date access to get prop values etc.</param> /// <param name="hvoRoot">The root object to display.</param> /// <param name="frag">The fragment.</param> /// <param name="vwPattern">The find/replace pattern.</param> /// <param name="searchKiller">Used to interrupt a find/replace</param> /// <remarks>If the base environment is not null, it is used for various things, /// such as obtaining 'outer object' information.</remarks> /// ------------------------------------------------------------------------------------ public FindReplaceCollectorEnvBase(IVwViewConstructor vc, ISilDataAccess sda, int hvoRoot, int frag, IVwPattern vwPattern, IVwSearchKiller searchKiller) : base(null, sda, hvoRoot) { m_vc = vc; m_frag = frag; m_Pattern = vwPattern; m_searchKiller = searchKiller; m_textSourceInit = VwMappedTxtSrcClass.Create(); }
public InnerLabeledMultiStringControl(FdoCache cache, List<IWritingSystem> wsList) { // Ctor for use with a non-standard list of wss (like available UI languages) m_realCache = cache; m_sda = new TextBoxDataAccess { WritingSystemFactory = cache.WritingSystemFactory }; m_rgws = wsList; AutoScroll = true; IsTextBox = true; // range selection not shown when not in focus }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializer /// </summary> /// <param name="cache">The instance of the DB connection representing the channel /// through which notifications come</param> /// <param name="tag">The property tag that the caller wants to be notified about /// </param> /// ------------------------------------------------------------------------------------ internal void Init(FdoCache cache, int tag) { m_cache = cache; if (cache.AddChangeWatcher(this)) { m_sda = m_cache.MainCacheAccessor; m_sda.AddNotification(this); // register this in the ISilDataAccess } m_Tag = tag; }
/// <summary> /// Create one and install it to work on a particular cache. /// </summary> /// <param name="cache"></param> public CreateModifyTimeManager(FdoCache cache) { m_cache = cache; Debug.Assert(cache.CreateModifyManager == null); cache.CreateModifyManager = this; m_sda = cache.MainCacheAccessor; m_sda.AddNotification(this); m_mdc = cache.MetaDataCacheAccessor; }
/// <summary> /// Make one. /// </summary> public ExtraPropChangedAction(ISilDataAccess sda, int hvo, int tag, int ihvo, int chvoIns, int chvoDel, bool fForRedo) { m_sda = sda; m_hvo = hvo; m_tag = tag; m_ihvo = ihvo; m_chvoIns = chvoIns; m_chvoDel = chvoDel; m_fForRedo = fForRedo; }
public void Init(Mediator mediator, IFsFeatStruc fs) { CheckDisposed(); m_fs = fs; m_fdoCache = (FdoCache)mediator.PropertyTable.GetValue("cache"); UpdateRootObject(); m_sda = m_fdoCache.MainCacheAccessor; m_sda.AddNotification(this); }
public void Init(Mediator mediator, XmlNode configurationParameters) { CheckDisposed(); m_mediator = mediator; m_cache = (FdoCache) m_mediator.PropertyTable.GetValue("cache"); mediator.AddColleague(this); m_sda = m_cache.MainCacheAccessor; m_sda.AddNotification(this); }
/// <summary> /// Make one that wraps the specified cache and passes items in the specified property of the specified root object. /// </summary> public FilterSdaDecorator(ISilDataAccess domainDataByFlid, int mainFlid, int hvoRoot) : base(domainDataByFlid) { m_mainFlid = mainFlid; m_hvoRoot = hvoRoot; int chvoReal = BaseSda.get_VecSize(m_hvoRoot, m_mainFlid); using (ArrayPtr arrayPtr = MarshalEx.ArrayToNative(chvoReal, typeof (int))) { BaseSda.VecProp(m_hvoRoot, m_mainFlid, chvoReal, out chvoReal, arrayPtr); m_validHvos = new Set<int>((int[])MarshalEx.NativeToArray(arrayPtr, chvoReal, typeof(int))); } }
/// ------------------------------------------------------------------------------------- /// <summary> /// Default constructor /// </summary> /// ------------------------------------------------------------------------------------- public BulletsPreview() { m_CacheDa = VwCacheDaClass.Create(); m_DataAccess = (ISilDataAccess)m_CacheDa; m_vc = new BulletsPreviewVc(); // So many things blow up so badly if we don't have one of these that I finally decided to just // make one, even though it won't always, perhaps not often, be the one we want. CreateTempWritingSystemFactory(); m_DataAccess.WritingSystemFactory = WritingSystemFactory; VScroll = false; // no vertical scroll bar visible. AutoScroll = false; // not even if the root box is bigger than the window. }
/// <summary> /// Get a Time property value coverted to a DateTime value. /// </summary> public static DateTime GetTimeProperty(ISilDataAccess sda, int hvo, int flid) { long silTime; try { silTime = sda.get_TimeProp(hvo, flid); return ConvertFromSilTime(silTime); } catch { return DateTime.MinValue; } }
/// <summary> /// Called when the slice is first created, but also when it is /// "reused" (e.g. refresh or new target object) /// </summary> /// <param name="parent"></param> public override void Install(DataTree parent) { CheckDisposed(); base.Install(parent); if (m_cb.Dock != DockStyle.Left) m_cb.Dock = System.Windows.Forms.DockStyle.Left; if (m_cb.Width != 20) m_cb.Width = 20; // was taking whole length of slice m_sda = Cache.DomainDataByFlid; m_sda.AddNotification(this); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Default Constructor /// </summary> /// ------------------------------------------------------------------------------------ public FwLabel() { m_innerFwTextBox = new InnerFwTextBox(); m_innerFwTextBox.ReadOnlyView = true; Padding = new Padding(1, 2, 1, 1); Controls.Add(m_innerFwTextBox); // This causes us to get a notification when the string gets changed, // so we can fire our TextChanged event. m_sda = m_innerFwTextBox.DataAccess; m_sda.AddNotification(this); m_innerFwTextBox.AdjustStringHeight = false; }
int m_cchPrevMorphemes; // Total length of morphemes before m_imorph. public MorphemeBreaker(CachePair caches, string input, int hvoSbWord, int wsVern, SandboxBase sandbox) { m_caches = caches; m_sda = caches.DataAccess; m_cda = (IVwCacheDa)m_sda; m_input = input; m_hvoSbWord = hvoSbWord; m_cOldMorphs = m_sda.get_VecSize(m_hvoSbWord, ktagSbWordMorphs); ITsStrFactory m_tsf = TsStrFactoryClass.Create(); m_wsVern = wsVern; m_types = m_caches.MainCache.ServiceLocator.GetInstance<IMoMorphTypeRepository>(); m_sandbox = sandbox; }
/// <summary> /// The method object's constructor. /// </summary> /// <param name="vc">The view constructor</param> /// <param name="vwenv">The view environment</param> /// <param name="hvo">A handle on the root object</param> /// <param name="flid">The field ID</param> /// <param name="frag">A code identifying the current part of the display</param> public XmlVcDisplayVec(XmlVc vc, IVwEnv vwenv, int hvo, int flid, int frag) { m_viewConstructor = vc; m_vwEnv = vwenv; m_hvo = hvo; m_flid = flid; m_frag = frag; m_cache = m_viewConstructor.Cache; m_sda = m_viewConstructor.DataAccess; if (vwenv.DataAccess != null) m_sda = vwenv.DataAccess; m_objRepo = m_cache.ServiceLocator.GetInstance<ICmObjectRepository>(); m_stringTable = m_viewConstructor.StringTbl; }
/// <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_vc = null; m_sda = null; // This comes from an FdoCache, so just turn loose of it. }
/// <summary> /// Constructor invoked via the editor="customWithParams" slice XML configuration /// </summary> /// <param name="cache"></param> /// <param name="editor"></param> /// <param name="flid"></param> /// <param name="node"></param> /// <param name="obj"></param> /// <param name="stringTbl"></param> /// <param name="persistenceProvider"></param> /// <param name="ws"></param> public BasicIPASymbolSlice(FdoCache cache, string editor, int flid, System.Xml.XmlNode node, ICmObject obj, StringTable stringTbl, IPersistenceProvider persistenceProvider, int ws) : base(obj.Hvo, flid, ws) { m_obj = obj; // is PhPhoneme //m_persistenceProvider = persistenceProvider; m_ws = ws; //m_node = node; m_configurationNode = node; m_sda = cache.MainCacheAccessor; m_sda.AddNotification(this); this.Disposed += new EventHandler(BasicIPASymbolSlice_Disposed); m_IPAMapperDocument = new XmlDocument(); string sIPAMapper = Path.Combine(DirectoryFinder.TemplateDirectory, PhPhoneme.ksBasicIPAInfoFile); m_IPAMapperDocument.Load(sIPAMapper); }
/// <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_sda != null) m_sda.RemoveNotification(this); } // Dispose unmanaged resources here, whether disposing is true or false. m_sda = null; base.Dispose(disposing); }