1 // Updating the main window’s morpheme collection view
2 // Copyright © 2009 The University of Chicago
3 #include "linguisticamainwindow.h"
5 #include "MiniLexicon.h"
7 #include "TreeViewItem.h"
8 #include "GUIclasses.h"
10 #include "DescriptionLength.h"
11 #include "DLHistory.h"
12 #include "SignatureCollection.h"
13 #include "TemplateCollection.h"
14 #include "BiphoneCollection.h"
15 #include "SuffixCollection.h"
16 #include "PrefixCollection.h"
17 #include "PhoneCollection.h"
18 #include "StemCollection.h"
19 #include "WordCollection.h"
20 #include "POSCollection.h"
22 class LxPoSCollection
;
23 class GUIWordCollection
;
25 void LinguisticaMainWindow::updateCollectionViewSlot()
27 if (m_docType
== TOKENS_REQUESTED
) {
28 emit
tokensRequestedSignal();
29 } else if (CMiniLexicon
* mini
= m_lexicon
->GetMiniLexicon(
30 m_lexicon
->GetActiveMiniIndex())) {
34 ->ListDisplay(m_collectionView
,
35 m_lexicon
->GetOutFilter(),
40 ->ListDisplay(m_collectionView
,
41 m_lexicon
->GetOutFilter(),
45 mini
->GetStems()->ListDisplay(m_collectionView
,
46 m_lexicon
->GetOutFilter());
49 if (CPrefixCollection
* prefixes
= mini
->GetPrefixes())
50 prefixes
->ListDisplay(m_collectionView
,
51 m_lexicon
->GetOutFilter(),
55 if (CSuffixCollection
* suffixes
= mini
->GetSuffixes())
56 suffixes
->ListDisplay(m_collectionView
,
57 m_lexicon
->GetOutFilter(),
62 if (CPhoneCollection
* phones
= mini
->GetWords()->GetPhones())
63 phones
->ListDisplay(m_collectionView
,
67 if (CBiphoneCollection
* biphones
=
68 mini
->GetWords()->GetPhones()
70 biphones
->ListDisplay(m_collectionView
);
73 if (CPhoneCollection
* phones
=
74 mini
->GetWords()->GetPhones_Tier2())
75 phones
->ListDisplay(m_collectionView
,
79 if (CBiphoneCollection
* biphones
=
80 mini
->GetWords()->GetPhones_Tier2()
82 biphones
->ListDisplay(m_collectionView
);
84 case PHONES_Tier1_Skeleton
:
85 if (CPhoneCollection
* phones
=
87 ->GetPhones_Tier1_Skeleton())
88 phones
->ListDisplay(m_collectionView
,
91 case BIPHONES_Tier1_Skeleton
:
92 if (CBiphoneCollection
* biphones
=
94 ->GetPhones_Tier1_Skeleton()
96 biphones
->ListDisplay(m_collectionView
);
100 ->ListDisplay(m_collectionView
,
101 m_lexicon
->GetOutFilter());
105 mini
->GetPOS()->ListDisplay(m_collectionView
);
108 Q_ASSERT(m_lexicon
->GetFSA());
109 m_lexicon
->GetFSA()->FSAListDisplay(m_collectionView
,
110 m_lexicon
->GetOutFilter(),
114 mini
->GetWords()->GetReverseTrie()
115 ->ListDisplay(m_collectionView
,
117 m_lexicon
->GetOutFilter(),
121 mini
->GetWords()->GetTrie()
122 ->ListDisplay(m_collectionView
,
124 m_lexicon
->GetOutFilter());
126 case TOKENS_REQUESTED
:
128 emit
tokensRequestedSignal();
130 case DESCRIPTION_LENGTH
:
131 if (mini
->GetDescriptionLength() == 0)
132 mini
->CalculateDescriptionLength();
133 if (CDescriptionLength
* dl
=
134 mini
->GetDescriptionLength())
135 dl
->DescriptionLengthListDisplay(m_collectionView
);
136 // XXX. add a section for CLexicon
143 if (m_lexicon
!= 0) {
146 m_lexicon
->CorpusWordListDisplay(
148 m_lexicon
->GetOutFilter(),
151 case ANALYZED_CORPUS_WORDS
:
152 m_lexicon
->CorpusWordListDisplay(
154 m_lexicon
->GetOutFilter(),
157 case ALL_WORDS
: // is this ever used? Jan 2010
158 m_lexicon
->WordListDisplay(
162 case ALL_ANALYZED_WORDS
:
163 m_lexicon
->WordListDisplay(
168 m_lexicon
->StemListDisplay(m_collectionView
);
171 m_lexicon
->PrefixListDisplay(m_collectionView
);
173 case ALL_PREFIX_SIGNATURES
:
174 m_lexicon
->SignatureListDisplay(
179 m_lexicon
->SuffixListDisplay(m_collectionView
);
181 case ALL_SUFFIX_SIGNATURES
:
182 m_lexicon
->SignatureListDisplay(
187 m_lexicon
->CompoundListDisplay(
189 m_lexicon
->GetOutFilter(),
193 m_lexicon
->LinkerListDisplay(
195 m_lexicon
->GetOutFilter());
197 case COMPOUND_COMPONENTS
:
198 m_lexicon
->CompoundComponentListDisplay(
201 case TOKENS_REQUESTED
:
202 emit
tokensRequestedSignal();
204 case INITIALSTRINGEDITTEMPLATES
:
205 m_Words_InitialTemplates
->ListDisplay(
206 m_collectionView
, status_display());
208 case WORKINGSTRINGEDITTEMPLATES
:
209 m_Words_Templates
->ListDisplay(
210 m_collectionView
, status_display());
212 case DESCRIPTION_LENGTH_HISTORY
:
213 m_lexicon
->GetDLHistory()
214 ->DLHistoryListDisplay(m_collectionView
);
221 m_collectionView
->setFont(m_eastFont
);
224 void LinguisticaMainWindow::updateCollectionViewSlot(Q3ListViewItem
* item
)
229 CTreeViewItem
& it
= *static_cast<CTreeViewItem
*>(item
);
230 enum eDocumentType newDocType
= it
.GetState();
231 int newIndex
= it
.GetIndex();
233 if (newDocType
== MINI_LEXICON
) {
234 m_lexicon
->SetActiveMiniIndex(newIndex
);
235 updateTreeViewSlot();
239 if (newDocType
== m_docType
&&
240 newIndex
== m_lexicon
->GetActiveMiniIndex())
244 m_commandMini
= newIndex
;
245 m_docType
= newDocType
;
247 m_lexicon
->SetActiveMiniIndex(newIndex
);
248 updateCollectionViewSlot();