/// <summary> /// Init the dialog with a simple context. /// </summary> /// <param name="cache"></param> /// <param name="mediator"></param> /// <param name="fs"></param> public void SetDlgInfo(FdoCache cache, XCore.Mediator mediator, IPhRegularRule rule, IPhSimpleContextNC ctxt) { CheckDisposed(); m_rule = rule; m_ctxt = ctxt; RestoreWindowPosition(mediator); m_cache = cache; m_valuesCombo.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor; m_valuesCombo.StyleSheet = FontHeightAdjuster.StyleSheetFromMediator(mediator); m_valuesCombo.WritingSystemCode = m_cache.DefaultUserWs; m_valuesCombo.Items.Add(MEStrings.ksFeatConstrAgree); m_valuesCombo.Items.Add(MEStrings.ksFeatConstrDisagree); m_valuesCombo.Items.Add(MEStrings.ks_DontCare_); List <int> hvos = new List <int>(); IPhNCFeatures natClass = m_ctxt.FeatureStructureRA as IPhNCFeatures; foreach (int hvo in m_cache.LangProject.PhFeatureSystemOA.FeaturesOC.HvoArray) { if (natClass.FeaturesOAHvo == 0 || natClass.FeaturesOA.FindClosedValue(hvo) == null) { hvos.Add(hvo); } } LoadPhonFeats(hvos); BuildInitialBrowseView(mediator, hvos); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Determine a stylesheet from a mediator. Currently this is done by looking for the main window /// and seeing whether it has a StyleSheet property that returns one. (We use reflection /// because the relevant classes are in DLLs we can't reference.) /// </summary> /// <param name="mediator"></param> /// <returns></returns> /// ------------------------------------------------------------------------------------ static public FwStyleSheet StyleSheetFromMediator(XCore.Mediator mediator) { if (mediator == null || mediator.PropertyTable == null) { return(null); } Form mainWindow = (Form)mediator.PropertyTable.GetValue("window"); PropertyInfo pi = null; if (mainWindow != null) { string areaChoice = mediator.PropertyTable.GetStringProperty("areaChoice", null); if (areaChoice != null && areaChoice.ToLowerInvariant() == "notebook") { pi = mainWindow.GetType().GetProperty("AnthroStyleSheet"); } if (pi == null) { pi = mainWindow.GetType().GetProperty("StyleSheet"); } } if (pi != null) { return(pi.GetValue(mainWindow, null) as FwStyleSheet); } else { return(mediator.PropertyTable.GetValue("FwStyleSheet") as FwStyleSheet); } }
/// <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) { if (m_helpProvider != null) { m_helpProvider.Dispose(); } } if (m_cache != null) { IVwCacheDa cda = m_cache.MainCacheAccessor as IVwCacheDa; cda.CacheVecProp(m_cache.LangProject.Hvo, m_fakeFlid, null, 0); cda = null; m_cache = null; } m_ctxt = null; m_mediator = null; m_bvList = null; m_valuesCombo = null; base.Dispose(disposing); }
public RegRuleFormulaVc(FdoCache cache, XCore.Mediator mediator) : base(cache, mediator) { ITsPropsBldr tpb = TsPropsBldrClass.Create(); tpb.SetIntPropValues((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 1000); tpb.SetIntPropValues((int)FwTextPropType.ktptBorderColor, (int)FwTextPropVar.ktpvDefault, (int)ColorUtil.ConvertColorToBGR(Color.Gray)); tpb.SetIntPropValues((int)FwTextPropType.ktptAlign, (int)FwTextPropVar.ktpvEnum, (int)FwTextAlign.ktalCenter); m_ctxtProps = tpb.GetTextProps(); tpb = TsPropsBldrClass.Create(); tpb.SetIntPropValues((int)FwTextPropType.ktptFontSize, (int)FwTextPropVar.ktpvMilliPoint, 20000); tpb.SetIntPropValues((int)FwTextPropType.ktptForeColor, (int)FwTextPropVar.ktpvDefault, (int)ColorUtil.ConvertColorToBGR(Color.Gray)); tpb.SetIntPropValues((int)FwTextPropType.ktptAlign, (int)FwTextPropVar.ktpvEnum, (int)FwTextAlign.ktalCenter); tpb.SetIntPropValues((int)FwTextPropType.ktptPadLeading, (int)FwTextPropVar.ktpvMilliPoint, 2000); tpb.SetIntPropValues((int)FwTextPropType.ktptPadTrailing, (int)FwTextPropVar.ktpvMilliPoint, 2000); tpb.SetStrPropValue((int)FwTextPropType.ktptFontFamily, "Arial"); tpb.SetIntPropValues((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvEnum, (int)TptEditable.ktptNotEditable); m_charProps = tpb.GetTextProps(); m_arrow = m_cache.MakeUserTss("\u2192"); m_slash = m_cache.MakeUserTss("/"); m_underscore = m_cache.MakeUserTss("__"); }
/// <summary> /// /// </summary> /// <param name="smallImages"></param> /// <param name="mediator"></param> /// <returns></returns> public void Init(ImageCollection smallImages, IUIMenuAdapter menuBarAdapter, Mediator mediator) { m_mediator = mediator; mediator.AddColleague(this); m_smallImages = smallImages; m_menuBarAdapter = menuBarAdapter; }
private void btnStyles_Click(object sender, System.EventArgs e) { XCore.Mediator med = null; LexImportWizard wiz = LexImportWizard.Wizard(); if (wiz != null) { med = wiz.Mediator; } if (med == null) { // See LT-9100 and LT-9266. Apparently this condition can happen. MessageBox.Show(LexTextControls.ksCannotSoTryAgain, LexTextControls.ksInternalProblem, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } med.SendMessage("FormatStyle", null); // The "styles" dialog can trigger a refresh, which disposes of the mediator on the // main window, creating a new one. See LT-7275. // The accessor gets a new one if the old one has been disposed. if (med.IsDisposed) { med = wiz.Mediator; } // We also need to re-initialize the combobox list, since the set of character // styles may have changed. InitializeStylesComboBox(); }
/// <summary> /// Clean up any resources being used. /// </summary> 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) { if (m_helpProvider != null) { m_helpProvider.Dispose(); } } m_cache = null; m_ctxt = null; m_mediator = null; m_bvList = null; m_valuesCombo = null; m_sda = null; base.Dispose(disposing); }
/// <summary> /// Init the dialog with a simple context. /// </summary> /// <param name="cache"></param> /// <param name="mediator"></param> /// <param name="fs"></param> public void SetDlgInfo(FdoCache cache, XCore.Mediator mediator, IPhRegularRule rule, IPhSimpleContextNC ctxt) { CheckDisposed(); m_rule = rule; m_ctxt = ctxt; Mediator = mediator; m_cache = cache; m_valuesCombo.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor; m_valuesCombo.StyleSheet = FontHeightAdjuster.StyleSheetFromMediator(mediator); m_valuesCombo.WritingSystemCode = m_cache.DefaultUserWs; m_valuesCombo.Items.Add(MEStrings.ksFeatConstrAgree); m_valuesCombo.Items.Add(MEStrings.ksFeatConstrDisagree); m_valuesCombo.Items.Add(MEStrings.ks_DontCare_); var feats = new HashSet <IFsFeatDefn>(); var natClass = m_ctxt.FeatureStructureRA as IPhNCFeatures; foreach (var feat in m_cache.LangProject.PhFeatureSystemOA.FeaturesOC) { if (natClass.FeaturesOA == null || natClass.FeaturesOA.GetValue(feat as IFsClosedFeature) == null) { feats.Add(feat); } } LoadPhonFeats(feats); BuildInitialBrowseView(mediator, feats); }
public RuleFormulaVc(FdoCache cache, XCore.Mediator mediator) { m_cache = cache; m_mediator = mediator; // use Doulos SIL because it supports the special characters that are needed for // multiline brackets ITsPropsBldr tpb = TsPropsBldrClass.Create(); tpb.SetStrPropValue((int)FwTextPropType.ktptFontFamily, "Charis SIL"); m_bracketProps = tpb.GetTextProps(); tpb = TsPropsBldrClass.Create(); tpb.SetIntPropValues((int)FwTextPropType.ktptMarginLeading, (int)FwTextPropVar.ktpvMilliPoint, PILE_MARGIN); tpb.SetIntPropValues((int)FwTextPropType.ktptMarginTrailing, (int)FwTextPropVar.ktpvMilliPoint, PILE_MARGIN); m_pileProps = tpb.GetTextProps(); m_empty = m_cache.MakeUserTss(""); m_infinity = m_cache.MakeUserTss("\u221e"); m_leftBracketUpHook = m_cache.MakeUserTss("\u23a1"); m_leftBracketExt = m_cache.MakeUserTss("\u23a2"); m_leftBracketLowHook = m_cache.MakeUserTss("\u23a3"); m_rightBracketUpHook = m_cache.MakeUserTss("\u23a4"); m_rightBracketExt = m_cache.MakeUserTss("\u23a5"); m_rightBracketLowHook = m_cache.MakeUserTss("\u23a6"); m_leftBracket = m_cache.MakeUserTss("["); m_rightBracket = m_cache.MakeUserTss("]"); m_questions = m_cache.MakeUserTss("???"); m_leftParen = m_cache.MakeUserTss("("); m_rightParen = m_cache.MakeUserTss(")"); m_x = m_cache.MakeUserTss("X"); m_zwSpace = m_cache.MakeUserTss("\u200b"); }
/// <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) { if (components != null) { components.Dispose(); } } m_cache = null; m_fs = null; m_mediator = null; m_cache = null; m_bvList = null; m_valuesCombo = null; base.Dispose(disposing); }
public void Initialize(ICmObject rootObj, int rootFlid, FdoCache cache, string displayNameProperty, XCore.Mediator mediator, string displayWs) { CheckDisposed(); m_displayWs = displayWs; base.Initialize(rootObj, rootFlid, cache, displayNameProperty, mediator); }
private void BuildInitialBrowseView(XCore.Mediator mediator) { XmlNode configurationParameters = (XmlNode)mediator.PropertyTable.GetValue("WindowConfiguration"); XmlNode toolNode = configurationParameters.SelectSingleNode( "controls/parameters/guicontrol[@id='PhonologicalFeaturesFlatList']/parameters"); m_listPanel.SuspendLayout(); m_fakeFlid = FdoCache.DummyFlid; IVwCacheDa cda = m_cache.MainCacheAccessor as IVwCacheDa; int[] featureHvos = m_cache.LangProject.PhFeatureSystemOA.FeaturesOC.HvoArray; cda.CacheVecProp(m_cache.LangProject.Hvo, m_fakeFlid, featureHvos, featureHvos.Length); m_bvList = new BrowseViewer(toolNode, m_cache.LangProject.Hvo, m_fakeFlid, m_cache, mediator, null); m_bvList.SelectionChanged += new FwSelectionChangedEventHandler(m_bvList_SelectionChanged); m_bvList.ScrollBar.ValueChanged += new EventHandler(ScrollBar_ValueChanged); m_bvList.Scroller.Scroll += new ScrollEventHandler(ScrollBar_Scroll); m_bvList.ColumnsChanged += new EventHandler(BrowseViewer_ColumnsChanged); m_bvList.Resize += new EventHandler(m_bvList_Resize); m_bvList.TabStop = true; m_bvList.StyleSheet = FontHeightAdjuster.StyleSheetFromMediator(mediator); m_bvList.Dock = DockStyle.Fill; m_bvList.BackColor = SystemColors.Window; m_listPanel.Controls.Add(m_bvList); m_listPanel.ResumeLayout(false); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="T:ChooserCommand"/> class. /// </summary> /// <param name="cache">The cache.</param> /// <param name="fCloseBeforeExecuting">if set to <c>true</c> [f close before executing].</param> /// <param name="sLabel">The s label.</param> /// <param name="mediator">The mediator.</param> /// ------------------------------------------------------------------------------------ public ChooserCommand(FdoCache cache, bool fCloseBeforeExecuting, string sLabel, XCore.Mediator mediator) { m_cache = cache; m_fShouldCloseBeforeExecuting = fCloseBeforeExecuting; m_sLabel = sLabel + " "; // Extra spaces are just a hack to keep the label from being truncated - I have no idea why it is being truncated m_mediator = mediator; }
public AddPrimaryLexemeChooserCommand(FdoCache cache, bool fCloseBeforeExecuting, string sLabel, XCore.Mediator mediator, ICmObject lexEntryRef, /* Why ICmObject? */ Form parentWindow) : base(cache, fCloseBeforeExecuting, sLabel, mediator) { m_lexEntryRef = lexEntryRef as ILexEntryRef; m_parentWindow = parentWindow; }
public override void Init(XCore.Mediator mediator, System.Xml.XmlNode viewConfiguration) { base.Init(mediator, viewConfiguration); XmlNode clerkConfiguration = ToolConfiguration.GetClerkNodeFromToolParamsNode(viewConfiguration); var subitemNames = XmlUtils.GetManditoryAttributeValue(clerkConfiguration, "field").Split('.'); SubitemFlid = Cache.MetaDataCacheAccessor.GetFieldId(subitemNames[0].Trim(), subitemNames[1].Trim(), true); }
public AffixRuleFormulaVc(FdoCache cache, XCore.Mediator mediator) : base(cache, mediator) { ITsPropsBldr tpb = TsPropsBldrClass.Create(); tpb.SetStrPropValue((int)FwTextPropType.ktptFontFamily, MiscUtils.StandardSansSerif); tpb.SetIntPropValues((int)FwTextPropType.ktptFontSize, (int)FwTextPropVar.ktpvMilliPoint, 10000); tpb.SetIntPropValues((int)FwTextPropType.ktptBorderColor, (int)FwTextPropVar.ktpvDefault, (int)ColorUtil.ConvertColorToBGR(Color.Gray)); tpb.SetIntPropValues((int)FwTextPropType.ktptForeColor, (int)FwTextPropVar.ktpvDefault, (int)ColorUtil.ConvertColorToBGR(Color.Gray)); tpb.SetIntPropValues((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvEnum, (int)TptEditable.ktptNotEditable); m_headerProps = tpb.GetTextProps(); tpb = TsPropsBldrClass.Create(); tpb.SetIntPropValues((int)FwTextPropType.ktptBold, (int)FwTextPropVar.ktpvEnum, (int)FwTextToggleVal.kttvForceOn); tpb.SetIntPropValues((int)FwTextPropType.ktptFontSize, (int)FwTextPropVar.ktpvMilliPoint, 24000); tpb.SetIntPropValues((int)FwTextPropType.ktptForeColor, (int)FwTextPropVar.ktpvDefault, (int)ColorUtil.ConvertColorToBGR(Color.Gray)); tpb.SetIntPropValues((int)FwTextPropType.ktptAlign, (int)FwTextPropVar.ktpvEnum, (int)FwTextAlign.ktalCenter); tpb.SetStrPropValue((int)FwTextPropType.ktptFontFamily, "Charis SIL"); tpb.SetIntPropValues((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvEnum, (int)TptEditable.ktptNotEditable); m_arrowProps = tpb.GetTextProps(); tpb = TsPropsBldrClass.Create(); tpb.SetIntPropValues((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 1000); tpb.SetIntPropValues((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 1000); tpb.SetIntPropValues((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 1000); tpb.SetIntPropValues((int)FwTextPropType.ktptBorderColor, (int)FwTextPropVar.ktpvDefault, (int)ColorUtil.ConvertColorToBGR(Color.Gray)); tpb.SetIntPropValues((int)FwTextPropType.ktptAlign, (int)FwTextPropVar.ktpvEnum, (int)FwTextAlign.ktalCenter); m_ctxtProps = tpb.GetTextProps(); tpb = TsPropsBldrClass.Create(); tpb.SetIntPropValues((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 1000); tpb.SetIntPropValues((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 1000); tpb.SetIntPropValues((int)FwTextPropType.ktptBorderColor, (int)FwTextPropVar.ktpvDefault, (int)ColorUtil.ConvertColorToBGR(Color.Gray)); tpb.SetIntPropValues((int)FwTextPropType.ktptAlign, (int)FwTextPropVar.ktpvEnum, (int)FwTextAlign.ktalCenter); tpb.SetIntPropValues((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvEnum, (int)TptEditable.ktptNotEditable); tpb.SetIntPropValues((int)FwTextPropType.ktptForeColor, (int)FwTextPropVar.ktpvDefault, (int)ColorUtil.ConvertColorToBGR(Color.Gray)); m_indexProps = tpb.GetTextProps(); tpb = TsPropsBldrClass.Create(); tpb.SetIntPropValues((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 1000); tpb.SetIntPropValues((int)FwTextPropType.ktptBorderColor, (int)FwTextPropVar.ktpvDefault, (int)ColorUtil.ConvertColorToBGR(Color.Gray)); m_resultProps = tpb.GetTextProps(); var tsf = m_cache.TsStrFactory; var userWs = m_cache.DefaultUserWs; m_inputStr = tsf.MakeString(MEStrings.ksAffixRuleInput, userWs); m_indexStr = tsf.MakeString(MEStrings.ksAffixRuleIndex, userWs); m_resultStr = tsf.MakeString(MEStrings.ksAffixRuleResult, userWs); m_doubleArrow = tsf.MakeString("\u21d2", userWs); m_space = tsf.MakeString(" ", userWs); }
protected RuleFormulaVcBase(FdoCache cache, XCore.Mediator mediator) : base(cache, mediator) { ITsStrFactory tsf = m_cache.TsStrFactory; int userWs = m_cache.DefaultUserWs; m_infinity = tsf.MakeString("\u221e", userWs); m_x = tsf.MakeString("X", userWs); }
public void Initialize(FdoCache cache, XCore.Mediator mediator, IPersistenceProvider persistenceProvider, string ruleName) { CheckDisposed(); m_cache = cache; m_mediator = mediator; m_persistenceProvider = persistenceProvider; m_ruleName = ruleName; }
public void SetDlgInfo(CmObjectUi obj, FdoCache cache, XCore.Mediator mediator) { CheckDisposed(); StringTable strings = mediator.StringTbl; m_cache = cache; IVwStylesheet stylesheet = FontHeightAdjuster.StyleSheetFromMediator(mediator); Debug.Assert(obj != null); Debug.Assert(obj.Object != null); Text = String.Format(FdoUiStrings.ksDeleteX, strings.GetString(obj.ClassName, "ClassNames")); // Set the s_helpTopic based on the window title and rearrange the buttons if neccesary switch (obj.ClassName) { case "WfiWordform": s_helpTopic = "khtpDeleteWordform"; break; } if (s_helpTopic != null) { buttonHelp.Visible = true; buttonHelp.Enabled = true; this.helpProvider = new System.Windows.Forms.HelpProvider(); this.helpProvider.HelpNamespace = FwApp.App.HelpFile; this.helpProvider.SetHelpKeyword(this, FwApp.App.GetHelpString(s_helpTopic, 0)); this.helpProvider.SetHelpNavigator(this, System.Windows.Forms.HelpNavigator.Topic); } else { m_deleteButton.Location = m_cancelButton.Location; m_cancelButton.Location = buttonHelp.Location; } //Use an FWTextBox so that strings of different writing systems will //be displayed with the correct stylesheet settings. m_descriptionBox3.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor; m_descriptionBox3.WritingSystemCode = m_cache.LangProject.DefaultUserWritingSystem; m_descriptionBox3.StyleSheet = stylesheet; ITsIncStrBldr tisb3 = TsIncStrBldrClass.Create(); tisb3.AppendTsString(obj.Object.DeletionTextTSS); m_descriptionBox3.Tss = tisb3.GetString(); m_descriptionBox4.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor; m_descriptionBox4.WritingSystemCode = m_cache.LangProject.DefaultUserWritingSystem; m_descriptionBox4.StyleSheet = stylesheet; ITsIncStrBldr tisb4 = TsIncStrBldrClass.Create(); tisb4.AppendTsString(m_cache.MakeUserTss(" ")); //this is the default for m_descriptionBox4 m_descriptionBox4.Tss = tisb4.GetString(); m_deleteButton.Enabled = obj.Object.CanDelete; label2.Visible = m_deleteButton.Enabled; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Constructor for multiple matching LexEntry objects. /// </summary> /// <param name="rghvo"></param> /// <param name="tssForm"></param> /// <param name="helpProvider"></param> /// <param name="helpFileKey"></param> /// <param name="styleSheet"></param> /// <param name="cache"></param> /// <param name="mediator"></param> /// ------------------------------------------------------------------------------------ public SummaryDialogForm(List <int> rghvo, ITsString tssForm, IHelpTopicProvider helpProvider, string helpFileKey, IVwStylesheet styleSheet, FdoCache cache, XCore.Mediator mediator) { InitializeComponent(); Debug.Assert(rghvo != null && rghvo.Count > 0); m_rghvo = rghvo; m_cache = cache; m_mediator = mediator; Initialize(tssForm, helpProvider, helpFileKey, styleSheet); }
/// <summary> /// Initialize. /// </summary> /// <param name="mediator"></param> /// <param name="configurationParameters"></param> public virtual void Init(Mediator mediator, XmlNode configurationParameters) { CheckDisposed(); m_mediator = mediator; base.m_configurationParameters = configurationParameters; mediator.AddColleague(this); string urlAttr = XmlUtils.GetManditoryAttributeValue(m_configurationParameters, "URL"); m_htmlControl.URL = GetInstallSubDirectory(urlAttr); }
private bool m_fShouldLink; // set true by btnLexicon_Click, caller should call LinkToLexicon after dialog closes. #endregion #region Constructor/destructor /// ------------------------------------------------------------------------------------ /// <summary> /// Constructor for a single LexEntry object. /// </summary> /// <param name="leui"></param> /// <param name="wf"></param> /// <param name="helpProvider"></param> /// <param name="helpFileKey">string key to get the help file name</param> /// ------------------------------------------------------------------------------------ public SummaryDialogForm(LexEntryUi leui, ITsString tssForm, IHelpTopicProvider helpProvider, string helpFileKey, IVwStylesheet styleSheet) { InitializeComponent(); m_rghvo = new List <int>(1); m_rghvo.Add(leui.Object.Hvo); m_cache = leui.Object.Cache; m_mediator = leui.Mediator; Initialize(tssForm, helpProvider, helpFileKey, styleSheet); }
public void SetDlgInfo(FdoCache cache, XCore.Mediator mediator) { CheckDisposed(); m_fs = null; RestoreWindowPosition(mediator); m_cache = cache; m_valuesCombo.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor; m_valuesCombo.StyleSheet = FontHeightAdjuster.StyleSheetFromMediator(mediator); LoadPhonFeats(null); BuildInitialBrowseView(mediator); }
public virtual void Initialize(FdoCache cache, IVwStylesheet stylesheet, XCore.Mediator mediator) { CheckDisposed(); m_cache = cache; m_stylesheet = stylesheet; // ILgWritingSystemFactory wsFact = cache.LanguageWritingSystemFactoryAccessor; // foreach (int ws in cache.LanguageEncodingIds) // m_fonts.Add(ws, new Font(wsFact.get_EngineOrNull(ws).DefaultSerif, 8.25F)); // TODO: Use the right size. // int UIWs = cache.DefaultUserWs; // if (m_fonts[UIWs] == null) // m_fonts.Add(UIWs, new Font(wsFact.get_EngineOrNull(UIWs).DefaultSerif, 8.25F)); // TODO: Use the right size. }
/// <summary> /// Init the dialog with an existing FS. /// </summary> /// <param name="cache"></param> /// <param name="mediator"></param> /// <param name="fs"></param> public void SetDlgInfo(FdoCache cache, XCore.Mediator mediator, IFsFeatStruc fs) { CheckDisposed(); m_fs = fs; m_owningFlid = fs.OwningFlid; m_hvoOwner = fs.OwnerHVO; RestoreWindowPosition(mediator); m_cache = cache; m_valuesCombo.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor; m_valuesCombo.StyleSheet = FontHeightAdjuster.StyleSheetFromMediator(mediator); LoadPhonFeats(fs); BuildInitialBrowseView(mediator); }
/// <summary> /// /// </summary> /// <param name="strings"></param> /// <param name="obj"></param> /// <param name="cache"></param> /// <param name="mediator"></param> /// <param name="tssNote">a second message, in addition to what's in obj.Object.DeletionTextTss</param> public void SetDlgInfo(CmObjectUi obj, FdoCache cache, XCore.Mediator mediator, ITsString tssNote) { CheckDisposed(); Debug.Assert(obj != null); Debug.Assert(obj.Object != null); //do not change the order of the following two lines of code //because m_descritiptionBox4.Tss is given a default value first. SetDlgInfo(obj, cache, mediator); ITsIncStrBldr tisb = TsIncStrBldrClass.Create(); tisb.AppendTsString(tssNote); m_descriptionBox4.Tss = tisb.GetString(); }
public override void Initialize(FdoCache cache, ICmObject obj, int flid, string fieldName, IPersistenceProvider persistProvider, XCore.Mediator mediator, string displayNameProperty, string displayWs) { CheckDisposed(); base.Initialize(cache, obj, flid, fieldName, persistProvider, mediator, displayNameProperty, displayWs); m_view.Init(mediator, obj.Hvo, this, new MetaRuleFormulaVc(cache, mediator), MetaRuleFormulaVc.kfragRule, cache.MainCacheAccessor); m_insertionControl.AddOption(new InsertOption(RuleInsertType.Phoneme), DisplayOption); m_insertionControl.AddOption(new InsertOption(RuleInsertType.NaturalClass), DisplayOption); m_insertionControl.AddOption(new InsertOption(RuleInsertType.Features), DisplayOption); m_insertionControl.AddOption(new InsertOption(RuleInsertType.WordBoundary), DisplayOption); m_insertionControl.AddOption(new InsertOption(RuleInsertType.MorphemeBoundary), DisplayOption); m_insertionControl.NoOptionsMessage = DisplayNoOptsMsg; }
public void Initialize(ICmObject rootObj, int rootFlid, FdoCache cache, string displayNameProperty, XCore.Mediator mediator) { CheckDisposed(); Debug.Assert(cache != null && m_fdoCache == null); m_displayNameProperty = displayNameProperty; m_fdoCache = cache; m_rootObj = rootObj; m_rootFlid = rootFlid; Mediator = mediator; if (m_rootb == null) { MakeRoot(); } }
public MetaRuleFormulaVc(FdoCache cache, XCore.Mediator mediator) : base(cache, mediator) { ITsPropsBldr tpb = TsPropsBldrClass.Create(); tpb.SetIntPropValues((int)FwTextPropType.ktptBorderColor, (int)FwTextPropVar.ktpvDefault, (int)ColorUtil.ConvertColorToBGR(Color.Gray)); tpb.SetIntPropValues((int)FwTextPropType.ktptAlign, (int)FwTextPropVar.ktpvEnum, (int)FwTextAlign.ktalCenter); m_inputCtxtProps = tpb.GetTextProps(); tpb = TsPropsBldrClass.Create(); tpb.SetIntPropValues((int)FwTextPropType.ktptBorderColor, (int)FwTextPropVar.ktpvDefault, (int)ColorUtil.ConvertColorToBGR(Color.Gray)); tpb.SetIntPropValues((int)FwTextPropType.ktptAlign, (int)FwTextPropVar.ktpvEnum, (int)FwTextAlign.ktalCenter); tpb.SetIntPropValues((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvEnum, (int)TptEditable.ktptNotEditable); tpb.SetIntPropValues((int)FwTextPropType.ktptForeColor, (int)FwTextPropVar.ktpvDefault, (int)ColorUtil.ConvertColorToBGR(Color.Gray)); m_resultCtxtProps = tpb.GetTextProps(); tpb = TsPropsBldrClass.Create(); tpb.SetStrPropValue((int)FwTextPropType.ktptFontFamily, MiscUtils.StandardSansSerif); tpb.SetIntPropValues((int)FwTextPropType.ktptFontSize, (int)FwTextPropVar.ktpvMilliPoint, 10000); tpb.SetIntPropValues((int)FwTextPropType.ktptBorderColor, (int)FwTextPropVar.ktpvDefault, (int)ColorUtil.ConvertColorToBGR(Color.Gray)); tpb.SetIntPropValues((int)FwTextPropType.ktptForeColor, (int)FwTextPropVar.ktpvDefault, (int)ColorUtil.ConvertColorToBGR(Color.Gray)); tpb.SetIntPropValues((int)FwTextPropType.ktptAlign, (int)FwTextPropVar.ktpvEnum, (int)FwTextAlign.ktalCenter); tpb.SetIntPropValues((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvEnum, (int)TptEditable.ktptNotEditable); m_colHeaderProps = tpb.GetTextProps(); tpb = TsPropsBldrClass.Create(); tpb.SetStrPropValue((int)FwTextPropType.ktptFontFamily, MiscUtils.StandardSansSerif); tpb.SetIntPropValues((int)FwTextPropType.ktptFontSize, (int)FwTextPropVar.ktpvMilliPoint, 10000); tpb.SetIntPropValues((int)FwTextPropType.ktptForeColor, (int)FwTextPropVar.ktpvDefault, (int)ColorUtil.ConvertColorToBGR(Color.Gray)); tpb.SetIntPropValues((int)FwTextPropType.ktptAlign, (int)FwTextPropVar.ktpvEnum, (int)FwTextAlign.ktalLeft); tpb.SetIntPropValues((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvEnum, (int)TptEditable.ktptNotEditable); m_rowHeaderProps = tpb.GetTextProps(); var tsf = m_cache.TsStrFactory; var userWs = m_cache.DefaultUserWs; m_inputStr = tsf.MakeString(MEStrings.ksMetaRuleInput, userWs); m_resultStr = tsf.MakeString(MEStrings.ksMetaRuleResult, userWs); m_leftEnvStr = tsf.MakeString(MEStrings.ksMetaRuleLeftEnv, userWs); m_rightEnvStr = tsf.MakeString(MEStrings.ksMetaRuleRightEnv, userWs); m_switchStr = tsf.MakeString(MEStrings.ksMetaRuleSwitch, userWs); }
public override void Initialize(FdoCache cache, ICmObject obj, int flid, string fieldName, IPersistenceProvider persistProvider, XCore.Mediator mediator, string displayNameProperty, string displayWs) { CheckDisposed(); base.Initialize(cache, obj, flid, fieldName, persistProvider, mediator, displayNameProperty, displayWs); m_view.Init(mediator, obj, this, new MetaRuleFormulaVc(cache, mediator), MetaRuleFormulaVc.kfragRule); m_insertionControl.Initialize(cache, mediator, persistProvider, Rule.Name.BestAnalysisAlternative.Text); m_insertionControl.AddOption(RuleInsertType.PHONEME, DisplayOption); m_insertionControl.AddOption(RuleInsertType.NATURAL_CLASS, DisplayOption); m_insertionControl.AddOption(RuleInsertType.FEATURES, DisplayOption); m_insertionControl.AddOption(RuleInsertType.WORD_BOUNDARY, DisplayOption); m_insertionControl.AddOption(RuleInsertType.MORPHEME_BOUNDARY, DisplayOption); m_insertionControl.NoOptionsMessage = DisplayNoOptsMsg; }
protected override void Dispose(bool disposing) { if (disposing) { if (m_locallyOwnedMediator && m_mediator != null && !m_mediator.IsDisposed) m_mediator.Dispose(); } // Calling Application.DoEvents here helps with FWC-16. It gives the SQLNCLI dll // time to clean up so that we can unload before we possibly load it again with the // next text fixture. Application.DoEvents(); base.Dispose(disposing); m_mediator = null; }
/// ----------------------------------------------------------------------------------- /// <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; if (disposing) { if (components != null) components.Dispose(); if (m_mediator != null) m_mediator.RemoveColleague(this); } m_mediator = null; base.Dispose(disposing); }
/// <summary> /// Access for outsiders who don't call InitializExtras. /// </summary> /// <param name="mediator"></param> /// <param name="sGuiControl"></param> public void ReplaceTreeView(XCore.Mediator mediator, string sGuiControl) { if (m_fFlatList) { if (m_mediator == null) m_mediator = mediator; ReplaceTreeView(sGuiControl); } }
public RuleFormulaVc(FdoCache cache, XCore.Mediator mediator) { Cache = cache; m_mediator = mediator; // use Doulos SIL because it supports the special characters that are needed for // multiline brackets ITsPropsBldr tpb = TsPropsBldrClass.Create(); tpb.SetStrPropValue((int)FwTextPropType.ktptFontFamily, "Charis SIL"); m_bracketProps = tpb.GetTextProps(); tpb = TsPropsBldrClass.Create(); tpb.SetIntPropValues((int)FwTextPropType.ktptMarginLeading, (int)FwTextPropVar.ktpvMilliPoint, PILE_MARGIN); tpb.SetIntPropValues((int)FwTextPropType.ktptMarginTrailing, (int)FwTextPropVar.ktpvMilliPoint, PILE_MARGIN); m_pileProps = tpb.GetTextProps(); var tsf = m_cache.TsStrFactory; var userWs = m_cache.DefaultUserWs; m_empty = tsf.MakeString("", userWs); m_infinity = tsf.MakeString("\u221e", userWs); m_leftBracketUpHook = tsf.MakeString("\u23a1", userWs); m_leftBracketExt = tsf.MakeString("\u23a2", userWs); m_leftBracketLowHook = tsf.MakeString("\u23a3", userWs); m_rightBracketUpHook = tsf.MakeString("\u23a4", userWs); m_rightBracketExt = tsf.MakeString("\u23a5", userWs); m_rightBracketLowHook = tsf.MakeString("\u23a6", userWs); m_leftBracket = tsf.MakeString("[", userWs); m_rightBracket = tsf.MakeString("]", userWs); m_questions = tsf.MakeString("???", userWs); m_leftParen = tsf.MakeString("(", userWs); m_rightParen = tsf.MakeString(")", userWs); m_x = tsf.MakeString("X", userWs); m_zwSpace = tsf.MakeString("\u200b", userWs); }
private bool m_fShouldLink; // set true by btnLexicon_Click, caller should call LinkToLexicon after dialog closes. #endregion #region Constructor/destructor /// ------------------------------------------------------------------------------------ /// <summary> /// Constructor for a single LexEntry object. /// </summary> /// <param name="leui"></param> /// <param name="wf"></param> /// <param name="helpProvider"></param> /// <param name="helpFileKey">string key to get the help file name</param> /// ------------------------------------------------------------------------------------ public SummaryDialogForm(LexEntryUi leui, ITsString tssForm, IHelpTopicProvider helpProvider, string helpFileKey, IVwStylesheet styleSheet) { InitializeComponent(); m_rghvo = new List<int>(1); m_rghvo.Add(leui.Object.Hvo); m_cache = leui.Object.Cache; m_mediator = leui.Mediator; Initialize(tssForm, helpProvider, helpFileKey, styleSheet); }
/// <summary> /// Initialize the behavior from an XML configuration node. /// </summary> /// <param name="configNode"></param> /// <param name="mediator"></param> public void InitializeExtras(XmlNode configNode, XCore.Mediator mediator) { CheckDisposed(); Debug.Assert(m_cache != null); m_mediator = mediator; int ws = m_cache.DefaultAnalWs; SetFontFromWritingSystem(ws, mediator); InitHelp(); // Give it another go now that we have a mediator string sGuiControl = null; if (configNode == null) return; XmlNode node = configNode.SelectSingleNode("chooserInfo"); if (node != null) { string sTextParam = XmlUtils.GetAttributeValue(node, "textparam", "owner").ToLower(); if (sTextParam != null) { // The default case ("owner") is handled by the caller setting TextParamHvo. if (sTextParam == "vernws") { ICmObject co = CmObject.CreateFromDBObject(m_cache, m_cache.DefaultVernWs); m_sTextParam = co.ShortName; } } string sFlid = XmlUtils.GetAttributeValue(node, "flidTextParam"); if (sFlid != null) { try { int flidTextParam = Int32.Parse(sFlid, CultureInfo.InvariantCulture); if (flidTextParam != 0) { ISilDataAccess sda = m_cache.MainCacheAccessor; m_hvoTextParam = sda.get_ObjectProp(m_hvoObject, flidTextParam); } } catch { // Ignore any badness here. } } StringTable tbl = null; if (m_mediator != null && m_mediator.HasStringTable) tbl = m_mediator.StringTbl; string sTitle = XmlUtils.GetAttributeValue(node, "title"); if (sTitle != null) Title = sTitle; string sText = XmlUtils.GetAttributeValue(node, "text"); if (sText != null) InstructionalText = sText; XmlNodeList linkNodes = node.SelectNodes("chooserLink"); Debug.Assert(linkNodes.Count <= 2); for (int i = linkNodes.Count - 1; i >= 0 ; --i) { string sType = XmlUtils.GetAttributeValue(linkNodes[i], "type", "goto").ToLower(); string sLabel = XmlUtils.GetLocalizedAttributeValue(tbl, linkNodes[i], "label", null); switch (sType) { case "goto": { string sTool = XmlUtils.GetAttributeValue(linkNodes[i], "tool"); if (sLabel != null && sTool != null) { AddLink(sLabel, LinkType.kGotoLink, FwLink.Create(sTool, m_guidLink, m_cache.ServerName, m_cache.DatabaseName)); } break; } case "dialog": { string sDialog = XmlUtils.GetAttributeValue(linkNodes[i], "dialog"); // TODO: make use of sDialog somehow to create a ChooserCommand object. // TODO: maybe even better, use a new SubDialog object that allows us // to call the specified dialog, then return to this dialog, adding // a newly created object to the list of chosen items (or making the // newly created object the chosen item). if (sLabel != null && sDialog != null) AddLink(sLabel, LinkType.kDialogLink, null); break; } case "simple": { string sTool = XmlUtils.GetAttributeValue(linkNodes[i], "tool"); if (sLabel != null && sTool != null) { AddSimpleLink(sLabel, sTool, linkNodes[i]); } break; } } } sGuiControl = XmlUtils.GetOptionalAttributeValue(node, "guicontrol"); } // Set the font for the tree view control based on the desired writing system. node = configNode.SelectSingleNode("deParams"); //int ws = m_cache.DefaultAnalWs; //SetFontFromWritingSystem(ws, mediator); //InitHelp(); // Give it another go now that we have a mediator // Replace the tree view control with a browse view control if it's both desirable // and feasible. if (m_fFlatList) ReplaceTreeView(sGuiControl); }
/// <summary> /// Initialize the control, creating the BrowseViewer among other things. /// </summary> /// <param name="cache"></param> /// <param name="stylesheet"></param> /// <param name="mediator"></param> public void Initialize(FdoCache cache, IVwStylesheet stylesheet, XCore.Mediator mediator, ICmObject owner) { CheckDisposed(); m_cache = cache; m_stylesheet = stylesheet; m_mediator = mediator; XmlNode xnWindow = (XmlNode)m_mediator.PropertyTable.GetValue("WindowConfiguration"); m_configNode = xnWindow.SelectSingleNode("controls/parameters/guicontrol[@id=\"matchingReversalEntries\"]/parameters"); m_vectorName = ToolConfiguration.GetIdOfTool(m_configNode); Clerk.ActivateUI(false); this.SuspendLayout(); CreateBrowseViewer(owner.Hvo); (Clerk as MatchingItemsRecordClerk).UpdateList(new int[0] { }); Clerk.OwningObject = owner; this.ResumeLayout(false); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Constructor for multiple matching LexEntry objects. /// </summary> /// <param name="rghvo"></param> /// <param name="tssForm"></param> /// <param name="helpProvider"></param> /// <param name="helpFileKey"></param> /// <param name="styleSheet"></param> /// <param name="cache"></param> /// <param name="mediator"></param> /// ------------------------------------------------------------------------------------ public SummaryDialogForm(List<int> rghvo, ITsString tssForm, IHelpTopicProvider helpProvider, string helpFileKey, IVwStylesheet styleSheet, FdoCache cache, XCore.Mediator mediator) { InitializeComponent(); Debug.Assert(rghvo != null && rghvo.Count > 0); m_rghvo = rghvo; m_cache = cache; m_mediator = mediator; Initialize(tssForm, helpProvider, helpFileKey, styleSheet); }
/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose(bool disposing) { // Must not be run more than once. if (IsDisposed) return; if (disposing) { } m_cache = null; m_mediator = null; m_persistenceProvider = null; m_options = null; m_ruleName = null; base.Dispose(disposing); }
protected override void Dispose(bool disposing) { if (IsDisposed) return; if (disposing) { } m_cache = null; m_mediator = null; if (m_bracketProps != null) { Marshal.ReleaseComObject(m_bracketProps); m_bracketProps = null; } if (m_empty != null) { Marshal.ReleaseComObject(m_empty); m_empty = null; } if (m_infinity != null) { Marshal.ReleaseComObject(m_infinity); m_infinity = null; } if (m_leftBracketUpHook != null) { Marshal.ReleaseComObject(m_leftBracketUpHook); m_leftBracketUpHook = null; } if (m_leftBracketExt != null) { Marshal.ReleaseComObject(m_leftBracketExt); m_leftBracketExt = null; } if (m_leftBracketLowHook != null) { Marshal.ReleaseComObject(m_leftBracketLowHook); m_leftBracketLowHook = null; } if (m_rightBracketUpHook != null) { Marshal.ReleaseComObject(m_rightBracketUpHook); m_rightBracketUpHook = null; } if (m_rightBracketExt != null) { Marshal.ReleaseComObject(m_rightBracketExt); m_rightBracketExt = null; } if (m_rightBracketLowHook != null) { Marshal.ReleaseComObject(m_rightBracketLowHook); m_rightBracketLowHook = null; } if (m_leftBracket != null) { Marshal.ReleaseComObject(m_leftBracket); m_leftBracket = null; } if (m_rightBracket != null) { Marshal.ReleaseComObject(m_rightBracket); m_rightBracket = null; } if (m_questions != null) { Marshal.ReleaseComObject(m_questions); m_questions = null; } if (m_leftParen != null) { Marshal.ReleaseComObject(m_leftParen); m_leftParen = null; } if (m_rightParen != null) { Marshal.ReleaseComObject(m_rightParen); m_rightParen = null; } if (m_x != null) { Marshal.ReleaseComObject(m_x); m_x = null; } if (m_zwSpace != null) { Marshal.ReleaseComObject(m_zwSpace); m_zwSpace = null; } base.Dispose(disposing); }
private void RestoreWindowPosition(XCore.Mediator mediator) { m_mediator = mediator; if (mediator != null) { // Reset window location. // Get location to the stored values, if any. object locWnd = m_mediator.PropertyTable.GetValue("phonFeatListDlgLocation"); object szWnd = m_mediator.PropertyTable.GetValue("phonFeatListDlgSize"); if (locWnd != null && szWnd != null) { Rectangle rect = new Rectangle((Point)locWnd, (Size)szWnd); ScreenUtils.EnsureVisibleRect(ref rect); DesktopBounds = rect; StartPosition = FormStartPosition.Manual; } } }
public AddCustomFieldDlg(XCore.Mediator mediator, int defaultClid) { // create member variables m_mediator = mediator; m_cache = (FDO.FdoCache)m_mediator.PropertyTable.GetValue("cache"); m_layouts = Inventory.GetInventory("layouts", m_cache.DatabaseName); m_customFields = new List<FDWrapper>(); InitializeComponent(); // form required method //lbCustomFields.Hide(); //listViewCustomFields.Hide(); //for now hide this control until I figure out //how to convert everything from lbCustomFields //to this control type. this.labelCustomFieldsList.Tag = this.labelCustomFieldsList.Text; // Localizes Tag! this.helpProvider = new System.Windows.Forms.HelpProvider(); this.helpProvider.HelpNamespace = FwApp.App.HelpFile; this.helpProvider.SetHelpKeyword(this, FwApp.App.GetHelpString(s_helpTopic, 0)); this.helpProvider.SetHelpNavigator(this, System.Windows.Forms.HelpNavigator.Topic); this.helpProvider.SetShowHelp(this, true); // Initialize array of setting controls m_settingControls = new Control[8] { lblName, CustomFieldName, lblDescription, rtbDescription, lblWritingSystems, cbWritingSystem, label1, cbCreateIn }; SetReadyToAddOrDelete(); //get the buttons in their initial proper state that //we want when we start up this dialog // this also calls EnableSettingsControlsNew(false); LoadDBCustomFields(); // get custom fields from DB // Initialize the Writing Systems combo box. This must be initialized before setting the // selected item in cbCreateIn. cbWritingSystem.Items.Add(new IdAndString(LangProject.kwsAnal, xWorksStrings.FirstAnalysisWs)); cbWritingSystem.Items.Add(new IdAndString(LangProject.kwsVern, xWorksStrings.FirstVernacularWs)); cbWritingSystem.Items.Add(new IdAndString(LangProject.kwsAnals, xWorksStrings.AllAnalysisWs)); cbWritingSystem.Items.Add(new IdAndString(LangProject.kwsVerns, xWorksStrings.AllVernacularWs)); cbWritingSystem.Items.Add(new IdAndString(LangProject.kwsAnalVerns, xWorksStrings.AllAnalysisVernacularWs)); cbWritingSystem.Items.Add(new IdAndString(LangProject.kwsVernAnals, xWorksStrings.AllVernacularAnalysisWs)); cbWritingSystem.SelectedIndex = 0; // initialize the 'Create in' combo box with the names and class id's cbCreateIn.Items.Add(m_entry); cbCreateIn.Items.Add(m_sense); cbCreateIn.Items.Add(m_exampleSent); cbCreateIn.Items.Add(m_allomorph); // Set the default item in the class combo box. (cf. LT-4404) switch (defaultClid) { case MoForm.kclsidMoForm: cbCreateIn.SelectedItem = m_allomorph; break; case LexExampleSentence.kclsidLexExampleSentence: cbCreateIn.SelectedItem = m_exampleSent; break; case LexSense.kclsidLexSense: cbCreateIn.SelectedItem = m_sense; break; case LexEntry.kclsidLexEntry: default: cbCreateIn.SelectedItem = m_entry; break; } UpdateCustomFieldsListView(); //load the items from m_customfields into the ListView buttonAdd.Select(); //if there is at least one existing Custom field then set the controls //to the settings it has. if (listViewCustomFields.Items.Count > 0) { m_NoCustomFields = false; listViewCustomFields.Items[0].Selected = true; } else //******** //I need to handle the situation where there are no custom fields in //existance yet. After discussion with Susanna we decided to open the dialog //with the CustomFieldName and Description controls disabled. { SetStateNoCustomFields(); m_fOpeningDialog = false; return; } //when opening the dialog we do not want to take any action //for events like TextChange or SelectedIndexChanged on controls //Once the this method is completed we can set this flag to false. m_fOpeningDialog = false; m_modifyingField = true; //Initially the state is to be modifying //the current field }
internal void GetNewMediator() { m_mediator = null; FwApp app = FwApp.App; if (app == null) return; Form wndActive = app.ActiveMainWindow; if (wndActive == null) return; PropertyInfo pi = wndActive.GetType().GetProperty("Mediator"); if (pi == null) return; m_mediator = pi.GetValue(wndActive, null) as XCore.Mediator; }
/// <summary> /// From IFwExtension /// </summary> /// <param name="cache"></param> /// <param name="mediator"></param> void IFwExtension.Init(FdoCache cache, XCore.Mediator mediator) { CheckDisposed(); m_wizard = this; m_cache = cache; m_mediator = mediator; m_dirtyInputFile = true; m_dirtyMapFile = true; m_hasShownIFMs = false; m_processedInputFile = m_processedMapFile = string.Empty; // no files processed yet m_autoImportFields = new Hashtable(); m_isPhaseInputFile = false; InitOutputFiles(); SetDatabaseNameIntoLabel(); // read in the Lex Import Fields m_LexFields = new Sfm2Xml.LexImportFields(); m_LexFields.ReadLexImportFields(m_sImportFields); // now read in any custom fields // m_CustomFields = new Sfm2Xml.LexImportFields(); bool customFieldsChanged = false; m_CustomFields = ReadCustomFieldsFromDB(out customFieldsChanged); // compare with map file before showing the UI and before the Import // set up default button states NextButtonEnabled = true; AcceptButton = null; btnModifyMappingLanguage.Enabled = false; btnModifyContentMapping.Enabled = false; string dictFileToImport = string.Empty; m_SettingsFileName.Items.Clear(); m_SettingsFileName.Items.Add(m_sMDFImportMap); if (GetLastImportFile(out dictFileToImport)) { FindFilesForDatabaseFile(dictFileToImport); m_DatabaseFileName.Text = dictFileToImport; HandleDBFileNameChanges(); } else { m_SaveAsFileName.Text = string.Empty; // empty if not found already } AllowQuickFinishButton(); // show it if it's valid // Copied from the previous LexImport dlg constructor (ImportLexicon.cs) // Ensure that we have the default encoding converter (to/from MS Windows Code Page // for Western European languages) SilEncConverters31.EncConverters encConv = new SilEncConverters31.EncConverters(); System.Collections.IDictionaryEnumerator de = encConv.GetEnumerator(); // REVIEW: SHOULD THIS NAME BE LOCALIZED? string sEncConvName = "Windows1252<>Unicode"; bool fMustCreateEncCnv = true; while (de.MoveNext()) { if ((string)de.Key != null && (string)de.Key == sEncConvName) { fMustCreateEncCnv = false; break; } } if (fMustCreateEncCnv) { try { encConv.AddConversionMap(sEncConvName, "1252", ECInterfaces.ConvType.Legacy_to_from_Unicode, "cp", "", "", ECInterfaces.ProcessTypeFlags.CodePageConversion); } catch (SilEncConverters31.ECException exception) { MessageBox.Show(exception.Message, LexTextControls.ksConvMapError, MessageBoxButtons.OK); } } ShowSaveButtonOrNot(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes the raw. /// </summary> /// <param name="mediator">The mediator.</param> /// <param name="sTitle">The s title.</param> /// <param name="sText">The s text.</param> /// <param name="sGotoLabel">The s goto label.</param> /// <param name="sTool">The s tool.</param> /// <param name="sWs">The s ws.</param> /// ------------------------------------------------------------------------------------ public void InitializeRaw(XCore.Mediator mediator, string sTitle, string sText, string sGotoLabel, string sTool, string sWs) { CheckDisposed(); Debug.Assert(m_cache != null); m_mediator = mediator; if (sTitle != null) Title = sTitle; if (sText != null) InstructionalText = sText; if (sGotoLabel != null && sTool != null) { AddLink(sGotoLabel, LinkType.kGotoLink, FwLink.Create(sTool, m_guidLink, m_cache.ServerName, m_cache.DatabaseName)); } int ws = m_cache.DefaultAnalWs; // Now that we're overriding the font for nodes that contain vernacular text, // it's best to let all the others default to the analysis language. //if (sWs != null) //{ // switch (sWs) // { // case "vernacular": // case "all vernacular": // case "vernacular analysis": // ws = m_cache.DefaultVernWs; // break; // case "analysis": // case "all analysis": // case "analysis vernacular": // ws = m_cache.DefaultAnalWs; // break; // } //} SetFontFromWritingSystem(ws, mediator); InitHelp(); // Give it another go now that we have a mediator }
/// <summary> /// Initialize the control, creating the BrowseViewer among other things. /// </summary> /// <param name="cache"></param> /// <param name="stylesheet"></param> /// <param name="mediator"></param> public override void Initialize(FdoCache cache, IVwStylesheet stylesheet, XCore.Mediator mediator) { CheckDisposed(); m_cache = cache; m_stylesheet = stylesheet; m_mediator = mediator; XmlNode xnWindow = (XmlNode)m_mediator.PropertyTable.GetValue("WindowConfiguration"); m_configNode = xnWindow.SelectSingleNode("controls/parameters/guicontrol[@id=\"matchingEntries\"]/parameters"); m_vectorName = ToolConfiguration.GetIdOfTool(m_configNode); Clerk.ActivateUI(false); this.SuspendLayout(); CreateBrowseViewer(); this.ResumeLayout(false); }
/// <summary> /// /// </summary> /// <param name="smallImages"></param> /// <param name="mediator"></param> /// <returns></returns> public void Init (IImageCollection smallImages, IUIMenuAdapter menuBarAdapter, Mediator mediator) { m_mediator = mediator; mediator.AddColleague(this); m_smallImages = smallImages; m_menuBarAdapter = menuBarAdapter; }
/// <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 ) { if(components != null) { components.Dispose(); } } m_cache = null; m_fs = null; m_mediator = null; m_cache = null; m_bvList = null; m_valuesCombo = null; base.Dispose( disposing ); }
/// <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) { if (m_helpProvider != null) m_helpProvider.Dispose(); } if (m_cache != null) { IVwCacheDa cda = m_cache.MainCacheAccessor as IVwCacheDa; cda.CacheVecProp(m_cache.LangProject.Hvo, m_fakeFlid, null, 0); cda = null; m_cache = null; } m_ctxt = null; m_mediator = null; m_bvList = null; m_valuesCombo = null; base.Dispose(disposing); }