Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Src/LexText/Interlinear/SandboxBase.ComboHandlers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2117,6 +2117,9 @@ internal void CreateNewEntry(bool fCreateNow, out ILexEntry le, out IMoForm allo
foreach (ITsString tss in entryComponents.GlossAlternatives.Skip(1))
dlg.SetInitialGloss(TsStringUtils.GetWsAtOffset(tss, 0), tss);
dlg.ChangeUseSimilarToCreateAllomorph();
// Save msa of the lexeme, which may be a novel root guess.
ILexSense lexSense = m_sandbox.GetMorphLexSense(m_hvoMorph);
dlg.SetMsa(lexSense?.MorphoSyntaxAnalysisRA);

if (fCreateNow)
{
Expand Down
12 changes: 12 additions & 0 deletions Src/LexText/Interlinear/SandboxBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1706,6 +1706,18 @@ private ITsString GetFullMorphForm(int hvoSbMorph)
return tsb.GetString();
}

/// <summary>
/// Get the lex sense associated with the given morpheme.
/// </summary>
/// <param name="hvoSbMorph"></param>
/// <returns></returns>
private ILexSense GetMorphLexSense(int hvoSbMorph)
{
var sbHvo = m_caches.DataAccess.get_ObjectProp(hvoSbMorph, ktagSbMorphGloss);
var realObject = Caches.RealObject(sbHvo);
return realObject as ILexSense;
}

private void CopyStringsToSecondary(IList<int> writingSystems, ISilDataAccess sdaMain, int hvoMain,
int flidMain, IVwCacheDa cda, int hvoSec, int flidSec)
{
Expand Down
60 changes: 60 additions & 0 deletions Src/LexText/LexTextControls/InsertEntryDlg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,16 @@ public IPartOfSpeech POS
{
CheckDisposed();
m_msaGroupBox.StemPOS = value;
// If the user changes the POS, then the inflection data may be invalid.
InflectionClass = null;
InflectionFeatures = null;
}
}

public IMoInflClass InflectionClass { get; set; }

public IFsFeatStruc InflectionFeatures { get; set; }

/// ------------------------------------------------------------------------------------
/// <summary>
/// Sets the mediator.
Expand Down Expand Up @@ -710,6 +717,58 @@ protected void SetDlgInfo(LcmCache cache, IMoMorphType morphType, int wsVern, Mo
}
}

public void SetMsa(IMoMorphSynAnalysis msa)
{
if (msa == null)
return;
switch (msa)
{
case IMoStemMsa stemMsa:
POS = stemMsa.PartOfSpeechRA;
InflectionClass = stemMsa.InflectionClassRA;
InflectionFeatures = stemMsa.MsFeaturesOA;
break;
case IMoDerivStepMsa derivStepMsa:
POS = derivStepMsa.PartOfSpeechRA;
InflectionClass = derivStepMsa.InflectionClassRA;
InflectionFeatures = derivStepMsa.MsFeaturesOA;
break;
case IMoInflAffMsa affixMsa:
POS = affixMsa.PartOfSpeechRA;
break;
}
}

/// <summary>
/// Set the msa of the lex sense of lexEntry to the saved msa values.
/// This is useful when a lexical entry is created from a novel root guess.
/// </summary>
/// <param name="lexEntry"></param>
private void SetEntryMsa(ILexEntry lexEntry)
{
ILexSense lexSense = lexEntry.SensesOS[0];
IMoMorphSynAnalysis msa = lexSense.MorphoSyntaxAnalysisRA;
switch (msa)
{
// POS is handled by m_msaGroupBox.
case IMoStemMsa stemMsa:
if (InflectionClass != null)
stemMsa.InflectionClassRA = InflectionClass;
if (InflectionFeatures != null)
stemMsa.MsFeaturesOA = InflectionFeatures;
break;
case IMoDerivStepMsa derivStepMsa:
if (InflectionClass != null)
derivStepMsa.InflectionClassRA = InflectionClass;
if (InflectionFeatures != null)
derivStepMsa.MsFeaturesOA = InflectionFeatures;
break;
case IMoInflAffMsa affixMsa:
break;
}
}


private LabeledMultiStringControl ReplaceTextBoxWithMultiStringBox(FwTextBox tb, int wsType,
IVwStylesheet stylesheet)
{
Expand Down Expand Up @@ -1404,6 +1463,7 @@ private ILexEntry CreateNewEntryInternal()
ler.ComplexEntryTypesRS.Add(m_complexType);
ler.RefType = LexEntryRefTags.krtComplexForm;
}
SetEntryMsa(newEntry);
return newEntry;
}

Expand Down
Loading