158 {
159 const wxArrayString ls = wxSplit(text, '\n', '\0');
160 for (wxArrayString::const_iterator i = ls.begin(); i != ls.end(); ++i) {
161 wxString line = *i;
163
164 if (i != ls.begin()) {
165
167 }
168
169
170 if (widthMax < 0) {
172 continue;
173 }
174
175 for (bool newLine = false; !line.empty(); newLine = true) {
177
178 if (1 == line.length()) {
180 break;
181 }
182
183 wxArrayInt widths;
184 dc.GetPartialTextExtents(line, widths);
185
186 const size_t posEnd = std::lower_bound(widths.begin(), widths.end(), widthMax) - widths.begin();
187
188
189 if (posEnd == line.length()) {
191 break;
192 }
193
194
195 size_t lastSpace = posEnd;
196 while (lastSpace > 0) {
197 auto c = line[lastSpace];
198 if (c == ' ')
199 break;
200 if (c > 0x4E00) {
201 if (lastSpace != posEnd)
202 ++lastSpace;
203 break;
204 }
205 --lastSpace;
206 }
207 if (lastSpace == 0) {
208
209 lastSpace = posEnd;
210 }
211 if (lastSpace == 0) {
212
213 lastSpace = 1;
214 }
215
216
218
219
220 if (line[lastSpace] == ' ') ++lastSpace;
221 line = line.substr(lastSpace);
222
223 if (maxCount > 0 && ++
count == maxCount - 1) {
226 break;
227 }
228 }
229 }
230 }
static unsigned int count
Definition AuxiliaryDataViewModel.cpp:246
void DoOutputLine(const wxString &line)
Definition Label.cpp:244
virtual void OnNewLine()
Definition Label.cpp:240