internal int AddWidgets(LexEntry entry, int insertAtRow) { DetailList.SuspendLayout(); Debug.Assert(DetailList.RowCount == 0); Debug.Assert(DetailList.ColumnCount == 3); Debug.Assert(DetailList.RowStyles.Count == 0); FirstRow = 0; int rowCount = 0; Field field = ActiveViewTemplate.GetField(Field.FieldNames.EntryLexicalForm.ToString()); if (field != null && field.GetDoShow(entry.LexicalForm, ShowNormallyHiddenFields)) { Control formControl = MakeBoundControl(entry.LexicalForm, field); DetailList.AddWidgetRow(StringCatalog.Get(field.DisplayName), true, formControl, insertAtRow, false); insertAtRow = DetailList.GetRow(formControl); ++rowCount; } rowCount += AddCustomFields(entry, insertAtRow + rowCount); var rowCountBeforeSenses = rowCount; LastRow = insertAtRow + rowCount; foreach (var lexSense in entry.Senses) { var layouter = new LexSenseLayouter( DetailList, rowCount, ActiveViewTemplate, RecordListManager, _serviceProvider, lexSense ) { ShowNormallyHiddenFields = ShowNormallyHiddenFields, Deletable = _sensesAreDeletable, ShowMinorMeaningLabel = ShowMinorMeaningLabel, ParentLayouter = this }; layouter.DeleteClicked += OnSenseDeleteClicked; rowCount += AddChildrenWidgets(layouter, lexSense, rowCount); ChildLayouts.Add(layouter); } //see: WS-1120 Add option to limit "add meanings" task to the ones that have a semantic domain //also: WS-639 ([email protected]) In Add meanings, don't show extra meaning slots just because a sense was created for the semantic domain var ghostingRule = ActiveViewTemplate.GetGhostingRuleForField(LexEntry.WellKnownProperties.Sense); if (rowCountBeforeSenses == rowCount || ghostingRule.ShowGhost) { AddSenseGhost(entry, rowCount); rowCount++; } DetailList.ResumeLayout(false); return(rowCount); }
private void AddExampleSentenceGhost(LexSense sense, int insertAtRow) { DetailList.SuspendLayout(); var exampleLayouter = new LexExampleSentenceLayouter(DetailList, insertAtRow, ActiveViewTemplate, _serviceProvider, null) { ParentLayouter = this }; exampleLayouter.AddGhost(null, sense.ExampleSentences, insertAtRow); ChildLayouts.Add(exampleLayouter); DetailList.ResumeLayout(false); }
private void AddSenseGhost(LexEntry entry, int row) { var layouter = new LexSenseLayouter( DetailList, row, ActiveViewTemplate, RecordListManager, _serviceProvider, null ) { ParentLayouter = this }; layouter.AddGhost(null, entry.Senses, true, row); layouter.Deletable = false; layouter.DeleteClicked += OnSenseDeleteClicked; ChildLayouts.Add(layouter); }
internal override int AddWidgets(PalasoDataObject wsdo, int insertAtRow) { LexSense sense = (LexSense)wsdo; FirstRow = insertAtRow; int rowCount = 0; DetailList.SuspendLayout(); try { #if GlossMeaning Field field = ActiveViewTemplate.GetField(Field.FieldNames.SenseGloss.ToString()); if (field != null && field.GetDoShow(sense.Gloss, this.ShowNormallyHiddenFields)) { Control meaningControl = MakeBoundControl(sense.Gloss, field); #else Field field = ActiveViewTemplate.GetField(LexSense.WellKnownProperties.Definition); if (field != null && field.GetDoShow(sense.Definition, ShowNormallyHiddenFields)) { Control meaningControl = MakeBoundControl(sense.Definition, field); #endif //NB: http://jira.palaso.org/issues/browse/WS-33937 describes how this makes it hard to change this in English (but not other languages) string label = StringCatalog.Get("~Meaning"); LexEntry entry = sense.Parent as LexEntry; if (entry != null) // && entry.Senses.Count > 1) { label += " " + (entry.Senses.IndexOf(sense) + 1); } DetailList.AddWidgetRow(label, true, meaningControl, insertAtRow, false); rowCount++; } rowCount += AddCustomFields(sense, insertAtRow + rowCount); foreach (var lexExampleSentence in sense.ExampleSentences) { var exampleLayouter = new LexExampleSentenceLayouter(DetailList, rowCount, ActiveViewTemplate, _serviceProvider, lexExampleSentence) { ShowNormallyHiddenFields = ShowNormallyHiddenFields, Deletable = false, ParentLayouter = this }; rowCount += AddChildrenWidgets(exampleLayouter, lexExampleSentence, insertAtRow + rowCount); ChildLayouts.Add(exampleLayouter); } //add a ghost for another example if we don't have one or we're in the "show all" mode //removed because of its effect on the Add Examples task, where //we'd like to be able to add more than one //if (ShowNormallyHiddenFields || sense.ExampleSentences.Count == 0) { AddExampleSentenceGhost(sense, insertAtRow + rowCount); rowCount++; } LastRow = insertAtRow + rowCount - 1; // want index of last row owned, not a limit FixDeleteButtonPosition(); } catch (ConfigurationException e) { ErrorReport.NotifyUserOfProblem(e.Message); } DetailList.ResumeLayout(false); return(rowCount); }