/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="SimpleDraftViewWrapper"/> class. /// </summary> /// <param name="name">The name of the split grid</param> /// <param name="parent">The parent of the split wrapper (can be null). Will be replaced /// with real parent later.</param> /// <param name="cache">The cache.</param> /// <param name="styleSheet">The style sheet.</param> /// <param name="settingsRegKey">The settings reg key.</param> /// <param name="draftViewInfo">Information about the draft view.</param> /// <param name="draftStylebarInfo">Information about the draft stylebar.</param> /// <param name="footnoteViewInfo">Information about the footnote draft view.</param> /// <param name="footnoteStylebarInfo">Information about the footnote stylebar.</param> /// ------------------------------------------------------------------------------------ public SimpleDraftViewWrapper(string name, Control parent, FdoCache cache, IVwStylesheet styleSheet, RegistryKey settingsRegKey, object draftViewInfo, object draftStylebarInfo, object footnoteViewInfo, object footnoteStylebarInfo) : base(name, parent, cache, styleSheet, settingsRegKey, draftViewInfo, draftStylebarInfo, footnoteViewInfo, footnoteStylebarInfo, 2, 2) { }
/// <summary> /// Shows the new writing system properties dialog. /// </summary> /// <param name="owner">The owner.</param> /// <param name="cache">The cache.</param> /// <param name="wsManager">The ws manager.</param> /// <param name="wsContainer">The ws container.</param> /// <param name="helpTopicProvider">The help topic provider.</param> /// <param name="app">The app.</param> /// <param name="stylesheet">The stylesheet.</param> /// <param name="displayRelatedWss">if set to <c>true</c> related writing systems will be displayed.</param> /// <param name="defaultName">The default language name for the new writing system.</param> /// <param name="newWritingSystems">The new writing systems.</param> /// <returns></returns> public static bool ShowNewDialog(Form owner, FdoCache cache, IWritingSystemManager wsManager, IWritingSystemContainer wsContainer, IHelpTopicProvider helpTopicProvider, IApp app, IVwStylesheet stylesheet, bool displayRelatedWss, string defaultName, out IEnumerable<IWritingSystem> newWritingSystems) { newWritingSystems = null; LanguageSubtag languageSubtag; using (new WaitCursor(owner)) using (var dlg = new LanguageSelectionDlg(wsManager, helpTopicProvider)) { dlg.Text = FwCoreDlgs.kstidLanguageSelectionNewWsCaption; dlg.DefaultLanguageName = defaultName; if (dlg.ShowDialog(owner) != DialogResult.OK) return false; languageSubtag = dlg.LanguageSubtag; } using (new WaitCursor(owner)) using (var wsPropsDlg = new WritingSystemPropertiesDialog(cache, wsManager, wsContainer, helpTopicProvider, app, stylesheet)) { wsPropsDlg.SetupDialog(languageSubtag, displayRelatedWss); if (wsPropsDlg.ShowDialog(owner) == DialogResult.OK) { newWritingSystems = wsPropsDlg.NewWritingSystems; return true; } } return false; }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// <param name="disposing"></param> /// ------------------------------------------------------------------------------------ protected override void Dispose(bool disposing) { if (disposing) { if (m_groups != null) { foreach (RootSiteGroup group in m_groups) { group.Dispose(); } m_groups.Clear(); if (Parent != null && Parent is Form) { ((Form)Parent).Shown -= new EventHandler(OnShown); } // m_grid will be disposed from base class } } m_groups = null; m_grid = null; m_StyleSheet = null; m_cache = null; base.Dispose(disposing); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="T:SimpleMatchDlg"/> class. /// </summary> /// <param name="wsf">The WSF.</param> /// <param name="ws">The ws.</param> /// <param name="ss">The ss.</param> /// ------------------------------------------------------------------------------------ public SimpleMatchDlg(ILgWritingSystemFactory wsf, int ws, IVwStylesheet ss) { // // Required for Windows Form Designer support // InitializeComponent(); // We do this outside the designer-controlled code because it does funny things // to FwTextBoxes, owing to the need for a writing system factory, and some // properties it should not persist but I can't persuade it not to. this.m_textBox = new FwTextBox(); this.m_textBox.WritingSystemFactory = wsf; // set ASAP. this.m_textBox.WritingSystemCode = ws; this.m_textBox.StyleSheet = ss; // before setting text, otherwise it gets confused about height needed. this.m_textBox.Location = new System.Drawing.Point(8, 24); this.m_textBox.Name = "m_textBox"; this.m_textBox.Size = new System.Drawing.Size(450, 32); this.m_textBox.TabIndex = 0; this.m_textBox.Text = ""; this.Controls.Add(this.m_textBox); regexContextMenu = new RegexHelperMenu(m_textBox, FwApp.App); m_ivwpattern = VwPatternClass.Create(); helpProvider = new System.Windows.Forms.HelpProvider(); helpProvider.HelpNamespace = FwApp.App.HelpFile; helpProvider.SetHelpKeyword(this, FwApp.App.GetHelpString(s_helpTopic, 0)); helpProvider.SetHelpNavigator(this, System.Windows.Forms.HelpNavigator.Topic); }
public void Initialize(FdoCache cache, IHelpTopicProvider helpTopicProvider, IApp app, IVwStylesheet stylesheet, NotebookImportWiz.CharMapping charMapping) { m_cache = cache; m_helpTopicProvider = helpTopicProvider; m_app = app; m_stylesheet = stylesheet; if (charMapping == null) { m_tbBeginMkr.Text = String.Empty; m_tbEndMkr.Text = String.Empty; m_rbEndOfWord.Checked = false; m_rbEndOfField.Checked = true; FillWritingSystemCombo(null); FillStylesCombo(null); m_chkIgnore.Checked = false; } else { m_tbBeginMkr.Text = charMapping.BeginMarker; m_tbEndMkr.Text = charMapping.EndMarker; m_rbEndOfWord.Checked = charMapping.EndWithWord; m_rbEndOfField.Checked = !charMapping.EndWithWord; FillWritingSystemCombo(charMapping.DestinationWritingSystemId); FillStylesCombo(charMapping.DestinationStyle); m_chkIgnore.Checked = charMapping.IgnoreMarkerOnImport; } }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ public InternalFwMultiParaTextBox(IStText stText, IVwStylesheet styleSheet) { WritingSystemFactory = stText.Cache.WritingSystemFactory; CurrentWs = stText.Cache.ServiceLocator.WritingSystems.DefaultAnalysisWritingSystem.Handle; StyleSheet = styleSheet; AutoScroll = true; // Sandbox cache. var cda = VwCacheDaClass.Create(); cda.TsStrFactory = TsStringUtils.TsStrFactory; m_sda = cda; m_sda.WritingSystemFactory = WritingSystemFactory; m_sda.SetActionHandler(new SimpleActionHandler()); List <int> memHvos = new List <int>(); foreach (IStTxtPara para in stText.ParagraphsOS) { memHvos.Add(para.Hvo); m_sda.SetString(para.Hvo, StTxtParaTags.kflidContents, para.Contents); } // If no paragraphs were passed in, then create one to get the user started off. if (memHvos.Count == 0) { ITsString paraStr = TsStringUtils.EmptyString(CurrentWs); m_sda.SetString(kDummyParaHvo, StTxtParaTags.kflidContents, paraStr); memHvos.Add(kDummyParaHvo); } ((IVwCacheDa)m_sda).CacheVecProp(kMemTextHvo, StTextTags.kflidParagraphs, memHvos.ToArray(), memHvos.Count); }
/// <summary> /// Gets the font height of the specified writing system for the normal style. /// </summary> protected int GetFontHeight(int ws) { IVwStylesheet stylesheet = FontHeightAdjuster.StyleSheetFromPropertyTable(m_propertyTable); return(FontHeightAdjuster.GetFontHeightForStyle("Normal", stylesheet, ws, m_cache.LanguageWritingSystemFactoryAccessor)); }
/// <summary> /// Show a dialog to allow the user to select/unselect multiple writing systems /// at a time, whether or not to display them (if they don't have data) /// If they do have data, we show the fields anyhow. /// </summary> /// <param name="args"></param> /// <returns></returns> public bool OnDataTreeWritingSystemsConfigureDlg(object args) { CheckDisposed(); Set <int> wsSet = new Set <int>(HvosFromWss(WritingSystemOptionsForDisplay)); ObjectLabelCollection labels = new ObjectLabelCollection(m_cache, wsSet); ReloadWssToDisplayForPart(); List <int> wssToDisplay = HvosFromWss(WritingSystemsSelectedForDisplay); using (ReallySimpleListChooser chooser = new ReallySimpleListChooser(null, labels, "DataTreeWritingSystems", m_cache, wssToDisplay.ToArray(), false)) { chooser.ForbidNoItemChecked = true; IVwStylesheet stylesheet = (Control as LabeledMultiStringView).StyleSheet; chooser.SetFontForDialog(new int[] { Cache.DefaultVernWs, Cache.DefaultAnalWs }, stylesheet, Cache.LanguageWritingSystemFactoryAccessor); chooser.InitializeExtras(ConfigurationNode, Mediator); chooser.Text = String.Format(DetailControlsStrings.ksSliceConfigureWssDlgTitle, this.Label); chooser.InstructionalText = DetailControlsStrings.ksSliceConfigureWssDlgInstructionalText; if (chooser.ShowDialog() == DialogResult.OK) { PersistAndRedisplayWssToDisplayForPart(chooser.ChosenHvos); } } return(true); }
/// ------------------------------------------------------------ /// <summary> /// Assuming the selection can be expanded to a word and a corresponding LexEntry can /// be found, show the related words dialog with the words related to the selected one. /// </summary> /// <param name="cache">The cache.</param> /// <param name="owner">The owning window.</param> /// <param name="mediator">The mediator.</param> /// <param name="propertyTable"></param> /// <param name="helpProvider">The help provider.</param> /// <param name="helpFileKey">The help file key.</param> /// <param name="tssWf">The ITsString for the word form.</param> /// <param name="hideInsertButton"></param> /// ------------------------------------------------------------ // Currently only called from WCF (11/21/2013 - AP) public static void DisplayRelatedEntries(LcmCache cache, IWin32Window owner, Mediator mediator, PropertyTable propertyTable, IHelpTopicProvider helpProvider, string helpFileKey, ITsString tssWf, bool hideInsertButton) { if (tssWf == null || tssWf.Length == 0) { return; } using (LexEntryUi leui = FindEntryForWordform(cache, tssWf)) { // This doesn't work as well (unless we do a commit) because it may not see current typing. //LexEntryUi leui = LexEntryUi.FindEntryForWordform(cache, hvo, tag, ichMin, ichLim); if (leui == null) { RelatedWords.ShowNotInDictMessage(owner); return; } int hvoEntry = leui.Object.Hvo; int[] domains; int[] lexrels; IVwCacheDa cdaTemp; if (!RelatedWords.LoadDomainAndRelationInfo(cache, hvoEntry, out domains, out lexrels, out cdaTemp, owner)) { return; } IVwStylesheet styleSheet = GetStyleSheet(cache, propertyTable); using (RelatedWords rw = new RelatedWords(cache, null, hvoEntry, domains, lexrels, cdaTemp, styleSheet, mediator, hideInsertButton)) { rw.ShowDialog(owner); } } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="LexImportWizardLanguage"/> class. /// </summary> /// <param name="cache">The cache.</param> /// <param name="helpTopicProvider">The help topic provider.</param> /// <param name="app">The app.</param> /// ------------------------------------------------------------------------------------ public LexImportWizardLanguage(FdoCache cache, IHelpTopicProvider helpTopicProvider, IApp app, IVwStylesheet stylesheet) : this(cache, new Hashtable(), helpTopicProvider, app, stylesheet) { m_LinguaLinksImport = true; tbLangDesc.ReadOnly = true; // don't let them change the language name tbLangDesc.Enabled = false; }
private void m_btnStyles_Click(object sender, EventArgs e) { bool fRTL = m_cache.WritingSystemFactory.get_EngineOrNull(m_cache.DefaultUserWs).RightToLeftScript; using (var dlg = new FwStylesDlg(null, m_cache, m_stylesheet as FwStyleSheet, fRTL, m_cache.ServiceLocator.WritingSystems.AllWritingSystems.Any(ws => ws.RightToLeftScript), m_stylesheet.GetDefaultBasedOnStyleName(), 0, // customUserLevel m_app.MeasurementSystem, m_stylesheet.GetDefaultBasedOnStyleName(), String.Empty, 0, // hvoRootObject m_app, m_helpTopicProvider)) { dlg.ShowTEStyleTypes = false; dlg.CanSelectParagraphBackgroundColor = false; if (dlg.ShowDialog(this) == DialogResult.OK && ((dlg.ChangeType & StyleChangeType.DefChanged) > 0 || (dlg.ChangeType & StyleChangeType.Added) > 0 || (dlg.ChangeType & StyleChangeType.RenOrDel) > 0)) { m_app.Synchronize(SyncMsg.ksyncStyle); FwStyleSheet stylesheet = new FwStyleSheet(); stylesheet.Init(m_cache, m_cache.LangProject.Hvo, LangProjectTags.kflidStyles); m_stylesheet = stylesheet; } string stySel = null; if (m_cbStyle.SelectedItem != null) { stySel = m_cbStyle.SelectedItem.ToString(); } FillStylesCombo(stySel); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ public InternalFwMultiParaTextBox(IStText stText, IVwStylesheet styleSheet) { WritingSystemFactory = stText.Cache.LanguageWritingSystemFactoryAccessor; CurrentWs = stText.Cache.DefaultAnalWs; StyleSheet = styleSheet; AutoScroll = true; m_sda = VwCacheDaClass.Create() as ISilDataAccess; m_sda.WritingSystemFactory = WritingSystemFactory; List <int> memHvos = new List <int>(); foreach (IStTxtPara para in stText.ParagraphsOS) { memHvos.Add(para.Hvo); m_sda.SetString(para.Hvo, (int)StTxtPara.StTxtParaTags.kflidContents, para.Contents.UnderlyingTsString); } // If no paragraphs were passed in, then create one to get the user started off. if (memHvos.Count == 0) { ITsStrFactory strFact = TsStrFactoryClass.Create(); ITsString paraStr = strFact.MakeString(String.Empty, CurrentWs); m_sda.SetString(kDummyParaHvo, (int)StTxtPara.StTxtParaTags.kflidContents, paraStr); memHvos.Add(kDummyParaHvo); } ((IVwCacheDa)m_sda).CacheVecProp(kMemTextHvo, (int)StText.StTextTags.kflidParagraphs, memHvos.ToArray(), memHvos.Count); }
/// <summary> /// Gets the font height of the specified writing system for the normal style. /// </summary> /// <param name="ws">The ws.</param> /// <returns></returns> int GetFontHeight(int ws) { IVwStylesheet stylesheet = FontHeightAdjuster.StyleSheetFromMediator(m_mediator); return(FontHeightAdjuster.GetFontHeightForStyle("Normal", stylesheet, ws, m_cache.LanguageWritingSystemFactoryAccessor)); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="BookPropertiesDialog"/> class. /// </summary> /// <param name="book">the current book</param> /// <param name="stylesheet">The stylesheet.</param> /// ------------------------------------------------------------------------------------ public BookPropertiesDialog(IScrBook book, IVwStylesheet stylesheet) { m_currentBook = book; // TE-5663: make sure the book's name and abbreviation are updated if some were added book.Name.CopyAlternatives( ((ScrBookRef)book.Cache.ScriptureReferenceSystem.BooksOS[book.CanonicalNum - 1]).BookName, true); book.Abbrev.CopyAlternatives( ((ScrBookRef)book.Cache.ScriptureReferenceSystem.BooksOS[book.CanonicalNum - 1]).BookAbbrev, true); // // Required for Windows Form Designer support // InitializeComponent(); // Put the book name in the dialog caption Text = string.Format(Text, book.Name.UserDefaultWritingSystem); m_listBookInfo.Cache = book.Cache; m_listBookInfo.FieldsToDisplay.Add(new FwMultilingualPropView.ColumnInfo( (int)ScrBook.ScrBookTags.kflidName, TeResourceHelper.GetResourceString("kstidBookNameColHeader"), 60)); m_listBookInfo.FieldsToDisplay.Add(new FwMultilingualPropView.ColumnInfo( (int)ScrBook.ScrBookTags.kflidAbbrev, TeResourceHelper.GetResourceString("kstidBookAbbrevColHeader"), 40)); m_listBookInfo.RootObject = book.Hvo; foreach (int ws in book.Cache.LangProject.CurrentAnalysisAndVernWss) m_listBookInfo.WritingSystemsToDisplay.Add(ws); // Initialize the ID textbox. m_txtScrBookIdText.Text = m_currentBook.IdText; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="BookPropertiesDialog"/> class. /// </summary> /// <param name="book">the current book</param> /// <param name="stylesheet">The stylesheet.</param> /// ------------------------------------------------------------------------------------ public BookPropertiesDialog(IScrBook book, IVwStylesheet stylesheet) { m_currentBook = book; // TE-5663: make sure the book's name and abbreviation are updated if some were added book.Name.CopyAlternatives( ((ScrBookRef)book.Cache.ScriptureReferenceSystem.BooksOS[book.CanonicalNum - 1]).BookName, true); book.Abbrev.CopyAlternatives( ((ScrBookRef)book.Cache.ScriptureReferenceSystem.BooksOS[book.CanonicalNum - 1]).BookAbbrev, true); // // Required for Windows Form Designer support // InitializeComponent(); // Put the book name in the dialog caption Text = string.Format(Text, book.Name.UserDefaultWritingSystem); m_listBookInfo.Cache = book.Cache; m_listBookInfo.FieldsToDisplay.Add(new FwMultilingualPropView.ColumnInfo( (int)ScrBook.ScrBookTags.kflidName, TeResourceHelper.GetResourceString("kstidBookNameColHeader"), 60)); m_listBookInfo.FieldsToDisplay.Add(new FwMultilingualPropView.ColumnInfo( (int)ScrBook.ScrBookTags.kflidAbbrev, TeResourceHelper.GetResourceString("kstidBookAbbrevColHeader"), 40)); m_listBookInfo.RootObject = book.Hvo; foreach (int ws in book.Cache.LangProject.CurrentAnalysisAndVernWss) { m_listBookInfo.WritingSystemsToDisplay.Add(ws); } // Initialize the ID textbox. m_txtScrBookIdText.Text = m_currentBook.IdText; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="BookPropertiesDialog"/> class. /// </summary> /// <param name="book">the current book</param> /// <param name="stylesheet">The stylesheet.</param> /// <param name="helpTopicProvider">The help topic provider.</param> /// ------------------------------------------------------------------------------------ public BookPropertiesDialog(IScrBook book, IVwStylesheet stylesheet, IHelpTopicProvider helpTopicProvider) { m_currentBook = book; m_helpTopicProvider = helpTopicProvider; // TE-5663: make sure the book's name and abbreviation are updated if some were added IScrRefSystem scrRefSystem = book.Cache.ServiceLocator.GetInstance<IScrRefSystemRepository>().AllInstances().FirstOrDefault(); book.Name.MergeAlternatives(scrRefSystem.BooksOS[book.CanonicalNum - 1].BookName); book.Abbrev.MergeAlternatives(scrRefSystem.BooksOS[book.CanonicalNum - 1].BookAbbrev); // // Required for Windows Form Designer support // InitializeComponent(); // Put the book name in the dialog caption Text = string.Format(Text, book.Name.UserDefaultWritingSystem.Text); m_listBookInfo.Cache = book.Cache; m_listBookInfo.FieldsToDisplay.Add(new FwMultilingualPropView.ColumnInfo( ScrBookTags.kflidName, TeResourceHelper.GetResourceString("kstidBookNameColHeader"), 60)); m_listBookInfo.FieldsToDisplay.Add(new FwMultilingualPropView.ColumnInfo( ScrBookTags.kflidAbbrev, TeResourceHelper.GetResourceString("kstidBookAbbrevColHeader"), 40)); m_listBookInfo.RootObject = book.Hvo; foreach (IWritingSystem ws in book.Cache.ServiceLocator.WritingSystems.AllWritingSystems) m_listBookInfo.WritingSystemsToDisplay.Add(ws.Handle); // Initialize the ID textbox. m_txtScrBookIdText.Text = m_currentBook.IdText; }
private void SetStyleSheet(int hvo) { var text = hvo == 0 ? null : (IStText)Cache.ServiceLocator.GetObject(hvo); IVwStylesheet wantedStylesheet = m_styleSheet; if (text != null && ScriptureServices.ScriptureIsResponsibleFor(text)) { // Use the Scripture stylesheet if (m_teStylesheet == null) { m_flexStylesheet = m_styleSheet; // remember the default. var stylesheet = new FwStyleSheet(); stylesheet.Init(Cache, Cache.LangProject.TranslatedScriptureOA.Hvo, ScriptureTags.kflidStyles); m_teStylesheet = stylesheet; } wantedStylesheet = m_teStylesheet; } else if (m_flexStylesheet != null) { wantedStylesheet = m_flexStylesheet; } if (wantedStylesheet != m_styleSheet) { m_styleSheet = wantedStylesheet; // Todo: set up the comobo; set the main window one. } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Common initialization shared by the constructors. /// </summary> /// <param name="tssForm">The TSS form.</param> /// <param name="helpProvider">The help provider.</param> /// <param name="helpFileKey">The help file key.</param> /// <param name="styleSheet">The stylesheet.</param> /// ------------------------------------------------------------------------------------ private void Initialize(ITsString tssForm, IHelpTopicProvider helpProvider, string helpFileKey, IVwStylesheet styleSheet) { m_tssWf = tssForm; m_helpProvider = helpProvider; // m_vss = styleSheet; if (m_helpProvider == null) { btnHelp.Enabled = false; } else { m_helpFileKey = helpFileKey; this.helpProvider = new HelpProvider(); this.helpProvider.HelpNamespace = FwDirectoryFinder.CodeDirectory + m_helpProvider.GetHelpString("UserHelpFile"); this.helpProvider.SetHelpKeyword(this, m_helpProvider.GetHelpString(s_helpTopicKey)); this.helpProvider.SetHelpNavigator(this, HelpNavigator.Topic); } m_xv = CreateSummaryView(m_rghvo, m_cache, styleSheet); m_xv.Dock = DockStyle.Top; // panel1 is docked to the bottom. m_xv.TabStop = true; m_xv.TabIndex = 0; Controls.Add(m_xv); m_xv.Height = panel1.Location.Y - m_xv.Location.Y; m_xv.Width = this.Width - 15; // Changed from magic to more magic on 8/8/2014 m_xv.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; m_xv.EditingHelper.DefaultCursor = Cursors.Arrow; m_xv.EditingHelper.VwSelectionChanged += new EventHandler <VwSelectionArgs>(m_xv_VwSelectionChanged); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="DraftViewWrapper"/> class. /// </summary> /// <param name="name">The name of the split grid</param> /// <param name="parent">The parent of the split wrapper (can be null). Will be replaced /// with real parent later.</param> /// <param name="cache">The cache.</param> /// <param name="styleSheet">The style sheet.</param> /// <param name="settingsRegKey">The settings reg key.</param> /// <param name="draftView">The draft view.</param> /// <param name="stylebar">The stylebar.</param> /// <param name="footnoteDraftView">The footnote draft view.</param> /// <param name="footnoteStylebar">The footnote stylebar</param> /// ------------------------------------------------------------------------------------ public ViewWrapper(string name, Control parent, FdoCache cache, IVwStylesheet styleSheet, RegistryKey settingsRegKey, object draftView, object stylebar, object footnoteDraftView, object footnoteStylebar) : this(name, parent, cache, styleSheet, settingsRegKey, draftView, stylebar, footnoteDraftView, footnoteStylebar, 2, 2) { }
public void AddDefaultMappingIfNeeded_btNotFromTeStyle() { IVwStylesheet stylesheet = MockRepository.GenerateStrictMock <IVwStylesheet>(); ScrMappingList list = new ScrMappingList(MappingSet.Main, stylesheet, TestTeStylesPath); list.Add(new ImportMappingInfo(@"\h", null, false, MappingTargetType.TitleShort, MarkerDomain.Default, null, null)); list.AddDefaultMappingIfNeeded(@"\bth", ImportDomain.Main, true); list.Add(new ImportMappingInfo(@"\vt", null, false, MappingTargetType.DefaultParaChars, MarkerDomain.Default, null, null)); list.AddDefaultMappingIfNeeded(@"\btvt", ImportDomain.Main, true); Assert.AreEqual(4, list.Count); // Test that \bth maps automatically to the corresponding vernacular import property // in the Back-trans marker domain. ImportMappingInfo info = list[@"\bth"]; Assert.AreEqual(MarkerDomain.BackTrans, info.Domain); Assert.IsFalse(info.IsExcluded); Assert.AreEqual(MappingTargetType.TitleShort, info.MappingTarget); // Test that \btvt maps automatically to Default Paragraph Characters // in the Back-trans marker domain. info = list[@"\btvt"]; Assert.AreEqual(MarkerDomain.BackTrans, info.Domain); Assert.IsFalse(info.IsExcluded); Assert.AreEqual(MappingTargetType.DefaultParaChars, info.MappingTarget); }
/// <summary> /// Create and initialize the browse view, storing the data it will display. /// </summary> /// <param name="cache">The cache.</param> /// <param name="stylesheet">The stylesheet.</param> /// <param name="mediator">The mediator.</param> /// <param name="xnConfig">The config node.</param> /// <param name="objs">The objs.</param> public void Initialize(FdoCache cache, IVwStylesheet stylesheet, Mediator mediator, XmlNode xnConfig, IEnumerable<ICmObject> objs) { CheckDisposed(); m_cache = cache; m_stylesheet = stylesheet; m_mediator = mediator; m_configNode = xnConfig; SuspendLayout(); m_listPublisher = new ObjectListPublisher(cache.DomainDataByFlid as ISilDataAccessManaged, ObjectListFlid); StoreData(objs); m_bvList = new BrowseViewer(m_configNode, m_cache.LanguageProject.Hvo, ObjectListFlid, m_cache, m_mediator, null, m_listPublisher); m_bvList.Location = new Point(0, 0); m_bvList.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right; m_bvList.Name = "m_bvList"; m_bvList.Sorter = null; m_bvList.TabStop = true; m_bvList.StyleSheet = m_stylesheet; m_bvList.Dock = DockStyle.Fill; m_bvList.SelectionChanged += m_bvList_SelectionChanged; Controls.Add(m_bvList); ResumeLayout(false); }
/// <summary> /// Create and initialize the browse view, storing the data it will display. /// </summary> /// <param name="cache">The cache.</param> /// <param name="stylesheet">The stylesheet.</param> /// <param name="mediator">The mediator.</param> /// <param name="xnConfig">The config node.</param> /// <param name="objs">The objs.</param> public void Initialize(FdoCache cache, IVwStylesheet stylesheet, Mediator mediator, XmlNode xnConfig, IEnumerable <ICmObject> objs) { CheckDisposed(); m_cache = cache; m_stylesheet = stylesheet; m_mediator = mediator; m_configNode = xnConfig; SuspendLayout(); m_listPublisher = new ObjectListPublisher(cache.DomainDataByFlid as ISilDataAccessManaged, ObjectListFlid); StoreData(objs); m_bvList = new BrowseViewer(m_configNode, m_cache.LanguageProject.Hvo, ObjectListFlid, m_cache, m_mediator, null, m_listPublisher); m_bvList.Location = new Point(0, 0); m_bvList.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right; m_bvList.Name = "m_bvList"; m_bvList.Sorter = null; m_bvList.TabStop = true; m_bvList.StyleSheet = m_stylesheet; m_bvList.Dock = DockStyle.Fill; m_bvList.SelectionChanged += m_bvList_SelectionChanged; Controls.Add(m_bvList); ResumeLayout(false); }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// <param name="disposing"></param> /// ------------------------------------------------------------------------------------ protected override void Dispose(bool disposing) { System.Diagnostics.Debug.WriteLineIf(!disposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** "); if (disposing) { if (m_groups != null) { foreach (RootSiteGroup group in m_groups) { group.Dispose(); } m_groups.Clear(); if (Parent != null && Parent is Form) { ((Form)Parent).Shown -= new EventHandler(OnShown); } // m_grid will be disposed from base class } if (m_activeViewHelper != null) { m_activeViewHelper.Dispose(); } } m_groups = null; m_grid = null; m_StyleSheet = null; m_cache = null; m_activeViewHelper = null; base.Dispose(disposing); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Constructs a EmptyTePrintLayoutConfigurer to configure the main print layout /// </summary> /// <param name="cache">The cache.</param> /// <param name="styleSheet">The style sheet.</param> /// <param name="viewType">Type of the view.</param> /// ------------------------------------------------------------------------------------ public EmptyTePrintLayoutConfigurer(FdoCache cache, IVwStylesheet styleSheet, TeViewType viewType) { m_fdoCache = cache; m_styleSheet = styleSheet; m_viewType = viewType; }
/// <summary> /// Creates a ListViewItem for the given ICmObject /// </summary> /// <param name="semDom">A Semantic Domain</param> /// <param name="stylesheet"></param> /// <param name="createChecked"></param> /// <param name="displayUsage"></param> /// <returns></returns> public static ListViewItem CreateLabelListItem(ICmObject semDom, IVwStylesheet stylesheet, bool createChecked, bool displayUsage) { var semanticDomainItem = semDom as ICmSemanticDomain; if (semanticDomainItem == null) { return(new ListViewItem(DetailControlsStrings.ksSemanticDomainInvalid)); } var strbldr = new StringBuilder(semanticDomainItem.AbbrAndName); if (semanticDomainItem.OwningPossibility != null) { var parentName = semanticDomainItem.OwningPossibility.Name.BestAnalysisAlternative.Text; strbldr.AppendFormat(" [{0}]", parentName); } if (displayUsage) { var count = SenseReferenceCount(semanticDomainItem); if (count > 0) { strbldr.AppendFormat(" ({0})", count); } } var item = new ListViewItem(strbldr.ToString()) { Checked = createChecked, Tag = semanticDomainItem.Hvo }; var cache = semDom.Cache; item.Font = FontHeightAdjuster.GetFontForNormalStyle(cache.DefaultAnalWs, stylesheet, cache); return(item); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="BookPropertiesDialog"/> class. /// </summary> /// <param name="book">the current book</param> /// <param name="stylesheet">The stylesheet.</param> /// <param name="helpTopicProvider">The help topic provider.</param> /// ------------------------------------------------------------------------------------ public BookPropertiesDialog(IScrBook book, IVwStylesheet stylesheet, IHelpTopicProvider helpTopicProvider) { m_currentBook = book; m_helpTopicProvider = helpTopicProvider; // TE-5663: make sure the book's name and abbreviation are updated if some were added IScrRefSystem scrRefSystem = book.Cache.ServiceLocator.GetInstance <IScrRefSystemRepository>().AllInstances().FirstOrDefault(); book.Name.MergeAlternatives(scrRefSystem.BooksOS[book.CanonicalNum - 1].BookName); book.Abbrev.MergeAlternatives(scrRefSystem.BooksOS[book.CanonicalNum - 1].BookAbbrev); // // Required for Windows Form Designer support // InitializeComponent(); // Put the book name in the dialog caption Text = string.Format(Text, book.Name.UserDefaultWritingSystem.Text); m_listBookInfo.Cache = book.Cache; m_listBookInfo.FieldsToDisplay.Add(new FwMultilingualPropView.ColumnInfo( ScrBookTags.kflidName, TeResourceHelper.GetResourceString("kstidBookNameColHeader"), 60)); m_listBookInfo.FieldsToDisplay.Add(new FwMultilingualPropView.ColumnInfo( ScrBookTags.kflidAbbrev, TeResourceHelper.GetResourceString("kstidBookAbbrevColHeader"), 40)); m_listBookInfo.RootObject = book.Hvo; foreach (IWritingSystem ws in book.Cache.ServiceLocator.WritingSystems.AllWritingSystems) { m_listBookInfo.WritingSystemsToDisplay.Add(ws.Handle); } // Initialize the ID textbox. m_txtScrBookIdText.Text = m_currentBook.IdText; }
/// <summary> /// Create a new one. /// </summary> /// <param name="cache"></param> /// <param name="ss"></param> /// <param name="choices"></param> /// <param name="analysis"></param> /// <param name="mediator"></param> public TryAWordSandbox(FdoCache cache, Mediator mediator, IVwStylesheet ss, InterlinLineChoices choices, IAnalysis analysis) : base(cache, mediator, ss, choices) { SizeToContent = true; LoadForWordBundleAnalysis(analysis.Hvo); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Answer the spelling status of the indicated character in the string, unless it is an /// ORC, in which case, for each ORC we answer a different value (that is not any of the /// valid spelling statuses). /// Enhance JohnT: we don't want to consider embedded-picture ORCs to count as /// different; we may strip them out before we start checking the word. /// </summary> /// ------------------------------------------------------------------------------------ int SpellCheckProps(ITsString tss, int ich, IVwStylesheet styles) { // For our purposes here, ORC (0xfffc) is considered to have a different spelling status from everything else, // even from every other ORC in the string. This means we always offer to insert spaces adjacent to them. if (ich < tss.Length && tss.GetChars(ich, ich + 1)[0] == 0xfffc) { return(-50 - ich); } ITsTextProps props = tss.get_PropertiesAt(ich); string style = props.GetStrPropValue((int)FwTextPropType.ktptNamedStyle); int var, val; if (styles != null && !string.IsNullOrEmpty(style)) { ITsTextProps styleProps = styles.GetStyleRgch(style.Length, style); if (styleProps != null) { val = styleProps.GetIntPropValues((int)FwTextPropType.ktptSpellCheck, out var); if (var != -1) { return(val); // style overrides } } } val = props.GetIntPropValues((int)FwTextPropType.ktptSpellCheck, out var); if (var == -1) { return(0); // treat unspecified the same as default. } else { return(val); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="DraftViewWrapper"/> class. /// </summary> /// <param name="name">The name of the split grid</param> /// <param name="parent">The parent of the split wrapper (can be null). Will be replaced /// with real parent later.</param> /// <param name="cache">The cache.</param> /// <param name="styleSheet">The style sheet.</param> /// <param name="settingsRegKey">The settings reg key.</param> /// <param name="draftView">The Scripture draft view proxy.</param> /// <param name="stylebar">The Scripture stylebar proxy.</param> /// <param name="footnoteDraftView">The footnote draft view proxy.</param> /// <param name="footnoteStylebar">The footnote stylebar proxy</param> /// ------------------------------------------------------------------------------------ internal ViewWrapper(string name, Control parent, FdoCache cache, IVwStylesheet styleSheet, RegistryKey settingsRegKey, TeScrDraftViewProxy draftView, DraftStylebarProxy stylebar, TeFootnoteDraftViewProxy footnoteDraftView, DraftStylebarProxy footnoteStylebar) : this(name, parent, cache, styleSheet, settingsRegKey, draftView, stylebar, footnoteDraftView, footnoteStylebar, 2, 2) { }
/// <summary> /// Gets the character render properties for the given style name and writing system. /// </summary> /// <param name="styleName">The style name.</param> /// <param name="styleSheet">The stylesheet.</param> /// <param name="hvoWs">The HVO of the WS.</param> /// <param name="writingSystemFactory">The writing system factory.</param> /// <returns>The character render properties.</returns> public static LgCharRenderProps GetChrpForStyle(string styleName, IVwStylesheet styleSheet, int hvoWs, ILgWritingSystemFactory writingSystemFactory) { if (string.IsNullOrEmpty(writingSystemFactory.GetStrFromWs(hvoWs))) { try { throw new ArgumentException("This is a hard-to-reproduce scenario (TE-6891) where writing system (" + hvoWs + ") and factory are inconsistent. Call an expert (JohnT)"); } catch (ArgumentException e) { Logger.WriteError(e); Debug.Fail("This is a hard-to-reproduce scenario (TE-6891) where writing system and factory are inconsistent. Call an expert (JohnT) while you have this Assert active!"); hvoWs = writingSystemFactory.UserWs; } } IVwPropertyStore vwps = VwPropertyStoreClass.Create(); vwps.Stylesheet = styleSheet; vwps.WritingSystemFactory = writingSystemFactory; ITsPropsBldr ttpBldr = TsPropsBldrClass.Create(); ttpBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, styleName); ttpBldr.SetIntPropValues((int)FwTextPropType.ktptWs, 0, hvoWs); ITsTextProps ttp = ttpBldr.GetTextProps(); LgCharRenderProps chrps = vwps.get_ChrpFor(ttp); IWritingSystem ws = writingSystemFactory.get_EngineOrNull(hvoWs); ws.InterpretChrp(ref chrps); return(chrps); }
public void TestGetStyleRgch() { IVwStylesheet stylesheet = (IVwStylesheet) new TestFwStylesheet(); ITsPropsBldr propsBldr = TsPropsBldrClass.Create(); propsBldr.SetStrPropValue((int)FwTextStringProp.kstpFontFamily, "Times"); ITsTextProps props1 = propsBldr.GetTextProps(); propsBldr.SetIntPropValues((int)FwTextPropType.ktptForeColor, (int)FwTextPropVar.ktpvDefault, 256); ITsTextProps props2 = propsBldr.GetTextProps(); int hvoNewStyle1 = stylesheet.MakeNewStyle(); stylesheet.PutStyle("FirstStyle", "bla", hvoNewStyle1, 0, hvoNewStyle1, 0, false, false, props1); int hvoNewStyle2 = stylesheet.MakeNewStyle(); stylesheet.PutStyle("SecondStyle", "bla", hvoNewStyle2, 0, hvoNewStyle1, 0, false, false, props2); string sHowDifferent; bool fEqual = TsTextPropsHelper.PropsAreEqual(props2, stylesheet.GetStyleRgch(0, "SecondStyle"), out sHowDifferent); Assert.IsTrue(fEqual, sHowDifferent); fEqual = TsTextPropsHelper.PropsAreEqual(props1, stylesheet.GetStyleRgch(0, "FirstStyle"), out sHowDifferent); Assert.IsTrue(fEqual, sHowDifferent); }
public RelatedWords(FdoCache cache, IVwSelection sel, int hvoEntry, int[] domains, int[] lexrels, IVwCacheDa cdaTemp, IVwStylesheet styleSheet) { m_cache = cache; m_sel = sel; m_hvoEntry = hvoEntry; m_styleSheet = styleSheet; // // Required for Windows Form Designer support // InitializeComponent(); m_cdaTemp = cdaTemp; ISilDataAccess sda = m_cdaTemp as ISilDataAccess; sda.WritingSystemFactory = cache.MainCacheAccessor.WritingSystemFactory; SetupForEntry(domains, lexrels); m_view = new RelatedWordsView(m_hvoEntry, m_cdaTemp as ISilDataAccess, cache.DefaultUserWs); m_view.Width = this.Width - 20; m_view.Height = m_btnClose.Top - 20; m_view.Top = 10; m_view.Left = 10; m_view.Anchor = AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; m_view.BackColor = Color.FromKnownColor(KnownColor.Window); m_view.EditingHelper.DefaultCursor = Cursors.Arrow; m_view.SelChanged += new EventHandler(m_view_SelChanged); this.Controls.Add(m_view); }
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 a new one. /// </summary> /// <param name="cache"></param> /// <param name="ss"></param> /// <param name="choices"></param> /// <param name="hvoWordform"></param> /// <param name="mediator"></param> public TryAWordSandbox(FdoCache cache, Mediator mediator, IVwStylesheet ss, InterlinLineChoices choices, int hvoWordform) : base(cache, mediator, ss, choices) { SizeToContent = true; //RawWordform = word; base.LoadForWordBundleAnalysis(hvoWordform); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="SimpleDraftViewWrapper"/> class. /// </summary> /// <param name="name">The name of the split grid</param> /// <param name="parent">The parent of the split wrapper (can be null). Will be replaced /// with real parent later.</param> /// <param name="cache">The cache.</param> /// <param name="styleSheet">The style sheet.</param> /// <param name="settingsRegKey">The settings reg key.</param> /// <param name="draftViewInfo">The Scripture draft view proxy.</param> /// <param name="draftStylebarInfo">The Scripture draft stylebar proxy.</param> /// <param name="footnoteViewInfo">The footnote draft view proxy.</param> /// <param name="footnoteStylebarInfo">The footnote stylebar proxy.</param> /// ------------------------------------------------------------------------------------ internal SimpleDraftViewWrapper(string name, Control parent, FdoCache cache, IVwStylesheet styleSheet, RegistryKey settingsRegKey, TeScrDraftViewProxy draftViewInfo, DraftStylebarProxy draftStylebarInfo, TeFootnoteDraftViewProxy footnoteViewInfo, DraftStylebarProxy footnoteStylebarInfo) : base(name, parent, cache, styleSheet, settingsRegKey, draftViewInfo, draftStylebarInfo, footnoteViewInfo, footnoteStylebarInfo, 2, 2) { }
/// ------------------------------------------------------------------------------------ /// <summary> /// Constructs a TePrintLayoutConfig to configure the main print layout /// </summary> /// <param name="cache">The cache.</param> /// <param name="styleSheet">The style sheet.</param> /// <param name="publication">The publication.</param> /// <param name="viewType">Type of the view.</param> /// <param name="filterInstance">the book filter instance in effect</param> /// <param name="printDateTime">printing date and time</param> /// <param name="fIntroDivision">set to <c>true</c> for a division that displays book /// title and introduction material, <c>false</c> for a division that displays main /// scripture text.</param> /// <param name="hvoBook">The hvo of the book.</param> /// <param name="sharedStream">A layout stream used for footnotes which is shared across /// multiple divisions</param> /// <param name="ws">The writing system to use for the back translation</param> /// ------------------------------------------------------------------------------------ public TeBtPrintLayoutConfig(FdoCache cache, IVwStylesheet styleSheet, IPublication publication, TeViewType viewType, int filterInstance, DateTime printDateTime, bool fIntroDivision, int hvoBook, IVwLayoutStream sharedStream, int ws) : base(cache, styleSheet, publication, viewType, filterInstance, printDateTime, fIntroDivision, hvoBook, sharedStream, ws) { }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ public CheckingErrorCommentDlg(CheckingError error, IVwStylesheet stylesheet) : this() { System.Diagnostics.Debug.Assert(error != null); m_text = new FwMultiParaTextBox(error.ResolutionOA, stylesheet); m_text.Dock = DockStyle.Fill; pnlTextBox.Controls.Add(m_text); m_error = error; }
/// ------------------------------------------------------------------------------------- /// <summary> /// Make sure that all runs of the given ts string will fit within the given height. /// </summary> /// <param name="tss">(Potentially) unadjusted TsString -- may have some pre-existing /// adjustments, but if it does, we (probably) ignore those and recheck every run</param> /// <param name="dympMaxHeight">The maximum height (in millipoints) of the Ts String.</param> /// <param name="styleSheet"></param> /// <param name="writingSystemFactory"></param> /// ------------------------------------------------------------------------------------- public static ITsString GetAdjustedTsString(ITsString tss, int dympMaxHeight, IVwStylesheet styleSheet, ILgWritingSystemFactory writingSystemFactory) { if (dympMaxHeight == 0) return tss; ITsStrBldr bldr = null; int runCount = tss.RunCount; for (int irun = 0; irun < runCount; irun++) { ITsTextProps props = tss.get_Properties(irun); int var; int wsTmp = props.GetIntPropValues((int)FwTextPropType.ktptWs, out var); string styleName = props.GetStrPropValue((int)FwTextStringProp.kstpNamedStyle); int height; string name; float sizeInPoints; using (Font f = GetFontForStyle(styleName, styleSheet, wsTmp, writingSystemFactory)) { height = GetFontHeight(f); name = f.Name; sizeInPoints = f.SizeInPoints; } int curHeight = height; // incrementally reduce the size of the font until the text can fit while (curHeight > dympMaxHeight) { using (var f = new Font(name, sizeInPoints - 0.25f)) { curHeight = GetFontHeight(f); name = f.Name; sizeInPoints = f.SizeInPoints; } } if (curHeight != height) { // apply formatting to the problem run if (bldr == null) bldr = tss.GetBldr(); int iStart = tss.get_MinOfRun(irun); int iEnd = tss.get_LimOfRun(irun); bldr.SetIntPropValues(iStart, iEnd, (int)FwTextPropType.ktptFontSize, (int)FwTextPropVar.ktpvMilliPoint, (int)(sizeInPoints * 1000.0f)); } } if (bldr != null) return bldr.GetString(); else return tss; }
public FocusBoxController(Mediator mediator, IVwStylesheet stylesheet, InterlinLineChoices lineChoices) : this() { m_mediator = mediator; m_stylesheet = stylesheet; m_lineChoices = lineChoices; if (m_mediator != null) SetToolTips(); }
internal void Initialize(FdoCache cache, IHelpTopicProvider helpTopicProvider, IApp app, IVwStylesheet stylesheet, NotebookImportWiz.RnSfMarker rsfm) { m_cache = cache; m_helpTopicProvider = helpTopicProvider; m_btnAddWritingSystem.Initialize(cache, helpTopicProvider, app, stylesheet); NotebookImportWiz.InitializeWritingSystemCombo(rsfm.m_sto.m_wsId, cache, m_cbWritingSystem); }
/// ------------------------------------------------------------------------------------ /// <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; }
private void CustomListDlg_Load(object sender, EventArgs e) { if (m_mediator != null && m_mediator.HelpTopicProvider != null) InitializeHelpProvider(); m_stylesheet = FontHeightAdjuster.StyleSheetFromMediator(m_mediator); InitializeMultiStringControls(); InitializeDialogFields(); m_finSetup = false; }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ public CheckingErrorCommentDlg(CheckingError error, IVwStylesheet stylesheet, IHelpTopicProvider helpTopicHandler) : this() { System.Diagnostics.Debug.Assert(error != null); m_helpTopicProvider = helpTopicHandler; m_text = new FwMultiParaTextBox(error.MyNote.ResolutionOA, stylesheet); m_text.Dock = DockStyle.Fill; pnlTextBox.Controls.Add(m_text); m_error = error; }
/// <summary> /// Create a new one. /// </summary> /// <param name="cache"></param> /// <param name="ss"></param> /// <param name="choices"></param> /// <param name="mediator"></param> public Sandbox(FdoCache cache, Mediator mediator, IVwStylesheet ss, InterlinLineChoices choices, AnalysisOccurrence selected, FocusBoxController focusBox) : this(cache, mediator, ss, choices) { FocusBox = focusBox; m_interlinDoc = focusBox.InterlinDoc; m_occurrenceSelected = selected; // Finish initialization with occurrence context. LoadForWordBundleAnalysis(m_occurrenceSelected.Analysis.Hvo); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the DraftViewVc class /// </summary> /// <param name="target">target of the view (printer or draft)</param> /// <param name="filterInstance">Number used to make filters unique for each main /// window</param> /// <param name="styleSheet">Optional stylesheet. Null is okay if this view constructor /// promises never to try to display a back translation</param> /// <param name="displayInTable">True to display the paragraphs in a table layout, /// false otherwise</param> /// ------------------------------------------------------------------------------------ public DraftViewVc(LayoutViewTarget target, int filterInstance, IVwStylesheet styleSheet, bool displayInTable) : base(target, filterInstance) { m_UnfinishedPic = PrepareImage(TeResourceHelper.BackTranslationUnfinishedImage); m_FinishedPic = PrepareImage(TeResourceHelper.BackTranslationFinishedImage); m_CheckedPic = PrepareImage(TeResourceHelper.BackTranslationCheckedImage); m_stylesheet = styleSheet; m_fDisplayInTable = displayInTable; //m_fLazy = true; // This makes the paragraphs lazy. }
/// <summary> /// Create a new one. /// </summary> /// <param name="cache"></param> /// <param name="hvoAnalysis"></param> /// <param name="ss"></param> /// <param name="choices"></param> /// <param name="rawWordform"></param> /// <param name="fTreatAsSentenceInitial"></param> /// <param name="mediator"></param> /// <param name="parent"></param> public Sandbox(FdoCache cache, Mediator mediator, IVwStylesheet ss, InterlinLineChoices choices, int hvoAnnotation, InterlinDocChild interlinDoc) : base(cache, mediator, ss, choices) { m_interlinDoc = interlinDoc; m_hvoAnnotation = hvoAnnotation; // Finish initialization with twfic context. int hvoInstanceOf = Cache.GetObjProperty(m_hvoAnnotation, (int)CmBaseAnnotation.CmAnnotationTags.kflidInstanceOf); LoadForWordBundleAnalysis(hvoInstanceOf); }
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> /// Initializes a new instance of the <see cref="LexImportWizardCharMarkerDlg"/> class. /// </summary> /// <param name="helpTopicProvider">The help topic provider.</param> /// <param name="app">The app.</param> /// <param name="stylesheet">The stylesheet.</param> public LexImportWizardCharMarkerDlg(IHelpTopicProvider helpTopicProvider, IApp app, IVwStylesheet stylesheet) : this() { m_helpTopicProvider = helpTopicProvider; m_app = app; m_stylesheet = stylesheet; helpProvider = new HelpProvider(); helpProvider.HelpNamespace = m_helpTopicProvider.HelpFile; helpProvider.SetHelpNavigator(this, HelpNavigator.Topic); helpProvider.SetHelpKeyword(this, m_helpTopicProvider.GetHelpString(s_helpTopic)); helpProvider.SetShowHelp(this, true); }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ public FwMultiParaTextBox(IStText stText, IVwStylesheet styleSheet) { // Because a panel only allows single borders that are black, we'll // set it's border to none and manage the border ourselves. base.BorderStyle = BorderStyle.None; BorderStyle = (Application.RenderWithVisualStyles ? BorderStyle.FixedSingle : BorderStyle.Fixed3D); m_textBox = new InternalFwMultiParaTextBox(stText, styleSheet); m_textBox.Dock = DockStyle.Fill; Controls.Add(m_textBox); }
public void Initialize(IEnumerable<ObjectLabel> labels, IEnumerable<ICmObject> selectedItems) { m_semdomRepo = Cache.ServiceLocator.GetInstance<ICmSemanticDomainRepository>(); m_stylesheet = FontHeightAdjuster.StyleSheetFromMediator(Mediator); selectedDomainsList.Font = FontHeightAdjuster.GetFontForNormalStyle( Cache.DefaultAnalWs, m_stylesheet, Cache); m_selectedItems.UnionWith(selectedItems); UpdateDomainTreeAndListLabels(labels); searchTextBox.WritingSystemFactory = Cache.LanguageWritingSystemFactoryAccessor; searchTextBox.AdjustForStyleSheet(m_stylesheet); m_SearchTimer = new SearchTimer(this, 500, SearchSemanticDomains, new List<Control> {domainTree, domainList}); searchTextBox.TextChanged += OnSearchTextChanged; }
internal BtDraftSplitWrapper(string name, Control parent, FdoCache cache, IVwStylesheet styleSheet, RegistryKey settingsRegKey, TeScrDraftViewProxy draftView, DraftStylebarProxy stylebar, TeScrDraftViewProxy btDraftView, TeFootnoteDraftViewProxy footnoteDraftView, DraftStylebarProxy footnoteStylebar, TeFootnoteDraftViewProxy footnoteBtDraftView) : base(name, parent, cache, styleSheet, settingsRegKey, draftView, stylebar, footnoteDraftView, footnoteStylebar, 2, 3) { m_settingsRegKey = settingsRegKey; IRootSiteGroup group = GetGroup(kDraftRow, kDraftViewColumn); AddControl(group, kDraftRow, kBackTransColumn, btDraftView, true, !ChangeSides); group = GetGroup(kFootnoteRow, kDraftViewColumn); AddControl(group, kFootnoteRow, kBackTransColumn, footnoteBtDraftView, false, !ChangeSides); DataGridViewControlColumn frontTransColumn = GetColumn(kDraftViewColumn); frontTransColumn.FillWeight = 100; frontTransColumn.MaxPercentage = 0.9f; frontTransColumn.MinimumWidth = 60; frontTransColumn.IsCollapsible = false; frontTransColumn.Visible = true; DataGridViewControlColumn backTransColumn = GetColumn(kBackTransColumn); backTransColumn.FillWeight = 100; backTransColumn.MaxPercentage = 0.9f; backTransColumn.MinimumWidth = 60; backTransColumn.IsCollapsible = false; backTransColumn.Visible = true; // Now set up a persistence object for loading. This will be disposed automatically // when we dispose m_Container. m_Container = new FwContainer(); Persistence persistence = new Persistence(m_Container, this); persistence.LoadSettings += new Persistence.Settings(OnLoadSettings); // Retrieve the parent's Persistence service. We use that for saving rather then // our own because otherwise some things like the FDO cache might already be disposed // when we try to save the settings. if (parent.Site != null) { persistence = (Persistence)parent.Site.GetService(typeof(Persistence)); if (persistence != null) persistence.SaveSettings += new Persistence.Settings(OnSaveSettings); } m_leftPaneWeight = new RegistryFloatSetting(settingsRegKey, Name + "LeftPaneWeight", -1.0f); m_rightPaneWeight = new RegistryFloatSetting(settingsRegKey, Name + "RightPaneWeight", -1.0f); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="DraftViewWrapper"/> class. /// </summary> /// <param name="name">The name of the split grid</param> /// <param name="parent">The parent of the split wrapper (can be null). Will be replaced /// with real parent later.</param> /// <param name="cache">The cache.</param> /// <param name="styleSheet">The style sheet.</param> /// <param name="settingsRegKey">The settings reg key.</param> /// <param name="draftView">The draft view.</param> /// <param name="stylebar">The stylebar.</param> /// <param name="btDraftView">The bt draft view.</param> /// <param name="footnoteDraftView">The footnote draft view.</param> /// <param name="footnoteStylebar">The footnote stylebar</param> /// <param name="footnoteBtDraftView">The footnote bt draft view.</param> /// ------------------------------------------------------------------------------------ public BtDraftSplitWrapper(string name, Control parent, FdoCache cache, IVwStylesheet styleSheet, RegistryKey settingsRegKey, object draftView, object stylebar, object btDraftView, object footnoteDraftView, object footnoteStylebar, object footnoteBtDraftView) : base(name, parent, cache, styleSheet, settingsRegKey, draftView, stylebar, footnoteDraftView, footnoteStylebar, 2, 3) { IRootSiteGroup group = GetGroup(kDraftRow, kDraftViewColumn); AddControl(group, kDraftRow, kBackTransColumn, btDraftView, true, !ChangeSides); group = GetGroup(kFootnoteRow, kDraftViewColumn); AddControl(group, kFootnoteRow, kBackTransColumn, footnoteBtDraftView, false, !ChangeSides); DataGridViewControlColumn frontTransColumn = GetColumn(kDraftViewColumn); frontTransColumn.FillWeight = 100; frontTransColumn.MaxPercentage = 0.9f; frontTransColumn.MinimumWidth = 60; frontTransColumn.IsCollapsible = false; frontTransColumn.Visible = true; DataGridViewControlColumn backTransColumn = GetColumn(kBackTransColumn); backTransColumn.FillWeight = 100; backTransColumn.MaxPercentage = 0.9f; backTransColumn.MinimumWidth = 60; backTransColumn.IsCollapsible = false; backTransColumn.Visible = true; // Now set up a persistence object for loading. This will be disposed automatically // when we dispose m_Container. m_Container = new FwContainer(); Persistence persistence = new Persistence(m_Container, this); persistence.LoadSettings += new Persistence.Settings(OnLoadSettings); // we don't want to implement ISettings, so we set the default key path instead, // but we have to strip the HKCU\ of the name. persistence.DefaultKeyPath = settingsRegKey.Name.Substring(Registry.CurrentUser.Name.Length + 1); // Retrieve the parent's Persistence service. We use that for saving rather then // our own because otherwise some things like the FDO cache might already be disposed // when we try to save the settings. if (parent.Site != null) { persistence = (Persistence)parent.Site.GetService(typeof(Persistence)); if (persistence != null) persistence.SaveSettings += new Persistence.Settings(OnSaveSettings); } }
internal override void Init(Mediator mediator, XmlNode node) { base.Init(mediator, node); m_semDomRepo = m_cache.ServiceLocator.GetInstance<ICmSemanticDomainRepository>(); m_stylesheet = FontHeightAdjuster.StyleSheetFromMediator(m_mediator); var treeBarControl = GetTreeBarControl(mediator); SetupAndShowHeaderPanel(node, treeBarControl); m_searchTimer = new SearchTimer(treeBarControl, 500, HandleChangeInSearchText, new List<Control> { treeBarControl.TreeView, treeBarControl.ListView }); m_textSearch.TextChanged += m_searchTimer.OnSearchTextChanged; m_treeView = treeBarControl.TreeView; m_listView = treeBarControl.ListView; m_listView.HeaderStyle = ColumnHeaderStyle.None; // We don't want a secondary "Records" title bar }