public void SubscribeToVerbEvents(VerbPanel vp) { vp.ShowParticipialFormsEvent += new VerbPanel.ShowParticipialForms (VerbPanel_ShowParticipialForms); }
} // ShowLexemes() protected void ShowLexemeDetails(LexemeDataPanel ldpSource) { CLexemeManaged lexeme = m_hashLexemes[ldpSource]; try { lexeme.eGenerateParadigm(); } catch (Exception ex) { string sMsg = "ShowLexemeDetails: "; // MainLib.ZalError err = new MainLib.ZalError(); // sMsg += err.LastError; sMsg += ex.Message; MessageBox.Show(sMsg, "Error", MessageBoxButtons.OK); return; } TabPage tabPageDetails = new TabPage(lexeme.sSourceForm()); ArrayList al = m_lexemeToTabs[lexeme]; al.Add(tabPageDetails); string grSt = lexeme.sGraphicStem(); if ((EM_PartOfSpeech.POS_NOUN == lexeme.ePartOfSpeech()) || (EM_PartOfSpeech.POS_PRONOUN == lexeme.ePartOfSpeech()) || (EM_PartOfSpeech.POS_NUM == lexeme.ePartOfSpeech())) { NounPanel np = new NounPanel(); tabPageDetails.Controls.Add(np); np.sLexName = grSt; CWordFormManaged wf = null; EM_ReturnCode eRet = (EM_ReturnCode)lexeme.eGetFirstWordForm(ref wf); do { if (EM_ReturnCode.H_NO_ERROR != eRet) { continue; } string sKey = m_hashCase[wf.eCase()]; sKey += (wf.eNumber() == EM_Number.NUM_SG) ? "Sg" : "Pl"; string sWordForm = wf.sWordForm(); MarkStress(ref sWordForm, wf); np.SetForm(sKey, sWordForm, wf.eStatus()); eRet = (EM_ReturnCode)lexeme.eGetNextWordForm(ref wf); } while (EM_ReturnCode.H_NO_ERROR == eRet); } if (EM_PartOfSpeech.POS_ADJ == lexeme.ePartOfSpeech() || EM_PartOfSpeech.POS_PRONOUN_ADJ == lexeme.ePartOfSpeech() || EM_PartOfSpeech.POS_NUM_ADJ == lexeme.ePartOfSpeech()) { AdjPanel ap = new AdjPanel(); tabPageDetails.Controls.Add(ap); CWordFormManaged wf = null; EM_ReturnCode eRet = (EM_ReturnCode)lexeme.eGetFirstWordForm(ref wf); do { if (CErrorCode.bError(eRet)) { continue; } string sKey = ""; if (EM_Subparadigm.SUBPARADIGM_LONG_ADJ == wf.eSubparadigm()) { if (EM_Number.NUM_SG == wf.eNumber()) { sKey = m_hashGender[wf.eGender()]; } sKey += m_hashCase[wf.eCase()]; sKey += (EM_Number.NUM_SG == wf.eNumber()) ? "Sg" : "Pl"; if (EM_Case.CASE_ACC == wf.eCase()) { if ((EM_Gender.GENDER_M == wf.eGender() && EM_Number.NUM_SG == wf.eNumber()) || (EM_Number.NUM_PL == wf.eNumber())) { sKey += (EM_Animacy.ANIM_YES == wf.eAnimacy()) ? "Anim" : "Inanim"; } } string sWordForm = wf.sWordForm(); MarkStress(ref sWordForm, wf); ap.SetForm(sKey, sWordForm, wf.eStatus()); } if (EM_Subparadigm.SUBPARADIGM_SHORT_ADJ == wf.eSubparadigm()) { sKey = "Short"; if (EM_Number.NUM_SG == wf.eNumber()) { sKey += m_hashGender[wf.eGender()]; } sKey += m_hashNumber[wf.eNumber()]; string sWordForm = wf.sWordForm(); MarkStress(ref sWordForm, wf); ap.SetForm(sKey, sWordForm, wf.eStatus()); } if (EM_Subparadigm.SUBPARADIGM_COMPARATIVE == wf.eSubparadigm()) { sKey = "Comparative"; string sWordForm = wf.sWordForm(); MarkStress(ref sWordForm, wf); ap.SetForm(sKey, sWordForm, wf.eStatus()); } eRet = (EM_ReturnCode)lexeme.eGetNextWordForm(ref wf); } while (EM_ReturnCode.H_NO_ERROR == eRet); } // if (MainLib.EM_PartOfSpeech.POS_ADJ == lexeme.ePartOfSpeech()) if (EM_PartOfSpeech.POS_VERB == lexeme.ePartOfSpeech()) { VerbPanel vp = new VerbPanel(lexeme); SubscribeToVerbEvents(vp); tabPageDetails.Controls.Add(vp); vp.sLexName = grSt; CWordFormManaged wf = null; EM_ReturnCode eRet = (EM_ReturnCode)lexeme.eGetFirstWordForm(ref wf); string sWordForm = wf.sWordForm(); do { if (CErrorCode.bError(eRet)) { continue; } EM_Subparadigm eSubparadigm = wf.eSubparadigm(); switch (eSubparadigm) { case EM_Subparadigm.SUBPARADIGM_PRESENT_TENSE: { string sKey = "Pres" + m_hashPerson[wf.ePerson()]; sKey += (wf.eNumber() == EM_Number.NUM_SG) ? "Sg" : "Pl"; MarkStress(ref sWordForm, wf); vp.SetForm(sKey, sWordForm, wf.eStatus()); break; } case EM_Subparadigm.SUBPARADIGM_PAST_TENSE: { string sKey = "Past"; if (EM_Number.NUM_SG == wf.eNumber()) { sKey += m_hashGender[wf.eGender()]; } sKey += (wf.eNumber() == EM_Number.NUM_SG) ? "Sg" : "Pl"; MarkStress(ref sWordForm, wf); vp.SetForm(sKey, sWordForm, wf.eStatus()); break; } case EM_Subparadigm.SUBPARADIGM_INFINITIVE: { string sKey = "Infinitive"; MarkStress(ref sWordForm, wf); vp.SetForm(sKey, sWordForm, wf.eStatus()); break; } case EM_Subparadigm.SUBPARADIGM_IMPERATIVE: { string sKey = "Imperative"; sKey += (wf.eNumber() == EM_Number.NUM_SG) ? "Sg" : "Pl"; MarkStress(ref sWordForm, wf); vp.SetForm(sKey, sWordForm, wf.eStatus()); break; } case EM_Subparadigm.SUBPARADIGM_PART_PRES_ACT: { string sKey = "PartPresActive"; if (wf.eNumber() == EM_Number.NUM_SG && wf.eGender() == EM_Gender.GENDER_M && wf.eCase() == EM_Case.CASE_NOM) { MarkStress(ref sWordForm, wf); vp.SetForm(sKey, sWordForm, wf.eStatus()); } break; } case EM_Subparadigm.SUBPARADIGM_PART_PAST_ACT: { string sKey = "PartPastActive"; if (wf.eNumber() == EM_Number.NUM_SG && wf.eGender() == EM_Gender.GENDER_M && wf.eCase() == EM_Case.CASE_NOM) { MarkStress(ref sWordForm, wf); vp.SetForm(sKey, sWordForm, wf.eStatus()); } break; } case EM_Subparadigm.SUBPARADIGM_ADVERBIAL_PRESENT: { MarkStress(ref sWordForm, wf); vp.SetForm("PresAdverbial", sWordForm, wf.eStatus()); break; } case EM_Subparadigm.SUBPARADIGM_ADVERBIAL_PAST: { MarkStress(ref sWordForm, wf); vp.SetForm("PastAdverbial", sWordForm, wf.eStatus()); break; } case EM_Subparadigm.SUBPARADIGM_PART_PRES_PASS_LONG: { string sKey = "PartPresPassive"; if (wf.eNumber() == EM_Number.NUM_SG && wf.eGender() == EM_Gender.GENDER_M && wf.eCase() == EM_Case.CASE_NOM) { MarkStress(ref sWordForm, wf); vp.SetForm(sKey, sWordForm, wf.eStatus()); } break; } case EM_Subparadigm.SUBPARADIGM_PART_PAST_PASS_LONG: { string sKey = "PartPastPassive"; if (wf.eNumber() == EM_Number.NUM_SG && wf.eGender() == EM_Gender.GENDER_M && wf.eCase() == EM_Case.CASE_NOM) { MarkStress(ref sWordForm, wf); vp.SetForm(sKey, sWordForm, wf.eStatus()); } break; } } // switch... eRet = (EM_ReturnCode)lexeme.eGetNextWordForm(ref wf); sWordForm = wf.sWordForm(); } while (EM_ReturnCode.H_NO_ERROR == eRet); } // if (EM_PartOfSpeech.POS_VERB == lexeme.ePartOfSpeech()) tabControl.Controls.Add(tabPageDetails); tabControl.SelectedTab = tabPageDetails; } // ShowLexemeDetails (...)
public void SubscribeToVerbEvents(VerbPanel vp) { vp.ShowParticipialFormsEvent += new VerbPanel.ShowParticipialForms(VerbPanel_ShowParticipialForms); }
protected void ShowLexemeDetails(LexemeDataPanel ldpSource) { CLexemeManaged lexeme = m_hashLexemes[ldpSource]; try { lexeme.eGenerateParadigm(); } catch (Exception ex) { string sMsg = "ShowLexemeDetails: "; // MainLib.ZalError err = new MainLib.ZalError(); // sMsg += err.LastError; sMsg += ex.Message; MessageBox.Show (sMsg, "Error", MessageBoxButtons.OK); return; } TabPage tabPageDetails = new TabPage(lexeme.sSourceForm()); ArrayList al = m_lexemeToTabs[lexeme]; al.Add (tabPageDetails); string grSt = lexeme.sGraphicStem(); if ((EM_PartOfSpeech.POS_NOUN == lexeme.ePartOfSpeech()) || (EM_PartOfSpeech.POS_PRONOUN == lexeme.ePartOfSpeech()) || (EM_PartOfSpeech.POS_NUM == lexeme.ePartOfSpeech())) { NounPanel np = new NounPanel(); tabPageDetails.Controls.Add(np); np.sLexName = grSt; CWordFormManaged wf = null; EM_ReturnCode eRet = (EM_ReturnCode)lexeme.eGetFirstWordForm(ref wf); do { if (EM_ReturnCode.H_NO_ERROR != eRet) { continue; } string sKey = m_hashCase[wf.eCase()]; sKey += (wf.eNumber() == EM_Number.NUM_SG) ? "Sg" : "Pl"; string sWordForm = wf.sWordForm(); MarkStress(ref sWordForm, wf); np.SetForm(sKey, sWordForm, wf.eStatus()); eRet = (EM_ReturnCode)lexeme.eGetNextWordForm(ref wf); } while (EM_ReturnCode.H_NO_ERROR == eRet); } if (EM_PartOfSpeech.POS_ADJ == lexeme.ePartOfSpeech() || EM_PartOfSpeech.POS_PRONOUN_ADJ == lexeme.ePartOfSpeech() || EM_PartOfSpeech.POS_NUM_ADJ == lexeme.ePartOfSpeech()) { AdjPanel ap = new AdjPanel(); tabPageDetails.Controls.Add(ap); CWordFormManaged wf = null; EM_ReturnCode eRet = (EM_ReturnCode)lexeme.eGetFirstWordForm(ref wf); do { if (CErrorCode.bError(eRet)) { continue; } string sKey = ""; if (EM_Subparadigm.SUBPARADIGM_LONG_ADJ == wf.eSubparadigm()) { if (EM_Number.NUM_SG == wf.eNumber()) { sKey = m_hashGender[wf.eGender()]; } sKey += m_hashCase[wf.eCase()]; sKey += (EM_Number.NUM_SG == wf.eNumber()) ? "Sg" : "Pl"; if (EM_Case.CASE_ACC == wf.eCase()) { if ((EM_Gender.GENDER_M == wf.eGender() && EM_Number.NUM_SG == wf.eNumber()) || (EM_Number.NUM_PL == wf.eNumber())) { sKey += (EM_Animacy.ANIM_YES == wf.eAnimacy()) ? "Anim" : "Inanim"; } } string sWordForm = wf.sWordForm(); MarkStress(ref sWordForm, wf); ap.SetForm(sKey, sWordForm, wf.eStatus()); } if (EM_Subparadigm.SUBPARADIGM_SHORT_ADJ == wf.eSubparadigm()) { sKey = "Short"; if (EM_Number.NUM_SG == wf.eNumber()) { sKey += m_hashGender[wf.eGender()]; } sKey += m_hashNumber[wf.eNumber()]; string sWordForm = wf.sWordForm(); MarkStress(ref sWordForm, wf); ap.SetForm(sKey, sWordForm, wf.eStatus()); } if (EM_Subparadigm.SUBPARADIGM_COMPARATIVE == wf.eSubparadigm()) { sKey = "Comparative"; string sWordForm = wf.sWordForm(); MarkStress(ref sWordForm, wf); ap.SetForm(sKey, sWordForm, wf.eStatus()); } eRet = (EM_ReturnCode)lexeme.eGetNextWordForm(ref wf); } while (EM_ReturnCode.H_NO_ERROR == eRet); } // if (MainLib.EM_PartOfSpeech.POS_ADJ == lexeme.ePartOfSpeech()) if (EM_PartOfSpeech.POS_VERB == lexeme.ePartOfSpeech()) { VerbPanel vp = new VerbPanel(lexeme); SubscribeToVerbEvents(vp); tabPageDetails.Controls.Add(vp); vp.sLexName = grSt; CWordFormManaged wf = null; EM_ReturnCode eRet = (EM_ReturnCode)lexeme.eGetFirstWordForm(ref wf); string sWordForm = wf.sWordForm(); do { if (CErrorCode.bError(eRet)) { continue; } EM_Subparadigm eSubparadigm = wf.eSubparadigm(); switch (eSubparadigm) { case EM_Subparadigm.SUBPARADIGM_PRESENT_TENSE: { string sKey = "Pres" + m_hashPerson[wf.ePerson()]; sKey += (wf.eNumber() == EM_Number.NUM_SG) ? "Sg" : "Pl"; MarkStress(ref sWordForm, wf); vp.SetForm(sKey, sWordForm, wf.eStatus()); break; } case EM_Subparadigm.SUBPARADIGM_PAST_TENSE: { string sKey = "Past"; if (EM_Number.NUM_SG == wf.eNumber()) { sKey += m_hashGender[wf.eGender()]; } sKey += (wf.eNumber() == EM_Number.NUM_SG) ? "Sg" : "Pl"; MarkStress(ref sWordForm, wf); vp.SetForm(sKey, sWordForm, wf.eStatus()); break; } case EM_Subparadigm.SUBPARADIGM_INFINITIVE: { string sKey = "Infinitive"; MarkStress(ref sWordForm, wf); vp.SetForm(sKey, sWordForm, wf.eStatus()); break; } case EM_Subparadigm.SUBPARADIGM_IMPERATIVE: { string sKey = "Imperative"; sKey += (wf.eNumber() == EM_Number.NUM_SG) ? "Sg" : "Pl"; MarkStress(ref sWordForm, wf); vp.SetForm(sKey, sWordForm, wf.eStatus()); break; } case EM_Subparadigm.SUBPARADIGM_PART_PRES_ACT: { string sKey = "PartPresActive"; if (wf.eNumber() == EM_Number.NUM_SG && wf.eGender() == EM_Gender.GENDER_M && wf.eCase() == EM_Case.CASE_NOM) { MarkStress(ref sWordForm, wf); vp.SetForm(sKey, sWordForm, wf.eStatus()); } break; } case EM_Subparadigm.SUBPARADIGM_PART_PAST_ACT: { string sKey = "PartPastActive"; if (wf.eNumber() == EM_Number.NUM_SG && wf.eGender() == EM_Gender.GENDER_M && wf.eCase() == EM_Case.CASE_NOM) { MarkStress(ref sWordForm, wf); vp.SetForm(sKey, sWordForm, wf.eStatus()); } break; } case EM_Subparadigm.SUBPARADIGM_ADVERBIAL_PRESENT: { MarkStress(ref sWordForm, wf); vp.SetForm("PresAdverbial", sWordForm, wf.eStatus()); break; } case EM_Subparadigm.SUBPARADIGM_ADVERBIAL_PAST: { MarkStress(ref sWordForm, wf); vp.SetForm("PastAdverbial", sWordForm, wf.eStatus()); break; } case EM_Subparadigm.SUBPARADIGM_PART_PRES_PASS_LONG: { string sKey = "PartPresPassive"; if (wf.eNumber() == EM_Number.NUM_SG && wf.eGender() == EM_Gender.GENDER_M && wf.eCase() == EM_Case.CASE_NOM) { MarkStress(ref sWordForm, wf); vp.SetForm(sKey, sWordForm, wf.eStatus()); } break; } case EM_Subparadigm.SUBPARADIGM_PART_PAST_PASS_LONG: { string sKey = "PartPastPassive"; if (wf.eNumber() == EM_Number.NUM_SG && wf.eGender() == EM_Gender.GENDER_M && wf.eCase() == EM_Case.CASE_NOM) { MarkStress(ref sWordForm, wf); vp.SetForm(sKey, sWordForm, wf.eStatus()); } break; } } // switch... eRet = (EM_ReturnCode)lexeme.eGetNextWordForm(ref wf); sWordForm = wf.sWordForm(); } while (EM_ReturnCode.H_NO_ERROR == eRet); } // if (EM_PartOfSpeech.POS_VERB == lexeme.ePartOfSpeech()) tabControl.Controls.Add(tabPageDetails); tabControl.SelectedTab = tabPageDetails; }