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 mini
->GetFSA()->FSAListDisplay(m_collectionView
,
109 m_lexicon
->GetOutFilter(),
113 mini
->GetWords()->GetReverseTrie()
114 ->ListDisplay(m_collectionView
,
116 m_lexicon
->GetOutFilter(),
120 mini
->GetWords()->GetTrie()
121 ->ListDisplay(m_collectionView
,
123 m_lexicon
->GetOutFilter());
125 case TOKENS_REQUESTED
:
127 emit
tokensRequestedSignal();
129 case DESCRIPTION_LENGTH
:
130 if (mini
->GetDescriptionLength() == 0)
131 mini
->CalculateDescriptionLength();
132 if (CDescriptionLength
* dl
=
133 mini
->GetDescriptionLength())
134 dl
->DescriptionLengthListDisplay(m_collectionView
);
135 // XXX. add a section for CLexicon
142 if (m_lexicon
!= 0) {
145 m_lexicon
->CorpusWordListDisplay(
147 m_lexicon
->GetOutFilter(),
150 case ANALYZED_CORPUS_WORDS
:
151 m_lexicon
->CorpusWordListDisplay(
153 m_lexicon
->GetOutFilter(),
156 case ALL_WORDS
: // is this ever used? Jan 2010
157 m_lexicon
->WordListDisplay(
161 case ALL_ANALYZED_WORDS
:
162 m_lexicon
->WordListDisplay(
167 m_lexicon
->StemListDisplay(m_collectionView
);
170 m_lexicon
->PrefixListDisplay(m_collectionView
);
172 case ALL_PREFIX_SIGNATURES
:
173 m_lexicon
->SignatureListDisplay(
178 m_lexicon
->SuffixListDisplay(m_collectionView
);
180 case ALL_SUFFIX_SIGNATURES
:
181 m_lexicon
->SignatureListDisplay(
186 m_lexicon
->CompoundListDisplay(
188 m_lexicon
->GetOutFilter(),
192 m_lexicon
->LinkerListDisplay(
194 m_lexicon
->GetOutFilter());
196 case COMPOUND_COMPONENTS
:
197 m_lexicon
->CompoundComponentListDisplay(
200 case TOKENS_REQUESTED
:
201 emit
tokensRequestedSignal();
203 case INITIALSTRINGEDITTEMPLATES
:
204 m_Words_InitialTemplates
->ListDisplay(
205 m_collectionView
, status_display());
207 case WORKINGSTRINGEDITTEMPLATES
:
208 m_Words_Templates
->ListDisplay(
209 m_collectionView
, status_display());
211 case DESCRIPTION_LENGTH_HISTORY
:
212 m_lexicon
->GetDLHistory()
213 ->DLHistoryListDisplay(m_collectionView
);
220 m_collectionView
->setFont(m_eastFont
);
223 void LinguisticaMainWindow::updateCollectionViewSlot(Q3ListViewItem
* item
)
228 CTreeViewItem
& it
= *static_cast<CTreeViewItem
*>(item
);
229 enum eDocumentType newDocType
= it
.GetState();
230 int newIndex
= it
.GetIndex();
232 if (newDocType
== MINI_LEXICON
) {
233 m_lexicon
->SetActiveMiniIndex(newIndex
);
234 updateTreeViewSlot();
238 if (newDocType
== m_docType
&&
239 newIndex
== m_lexicon
->GetActiveMiniIndex())
243 m_commandMini
= newIndex
;
244 m_docType
= newDocType
;
246 m_lexicon
->SetActiveMiniIndex(newIndex
);
247 updateCollectionViewSlot();