28 #include "config_auto.h"
31 #define FIRST_COLOUR ScrollView::RED //< first rainbow colour
32 #define LAST_COLOUR ScrollView::AQUAMARINE //< last rainbow colour
33 #define CHILD_COLOUR ScrollView::BROWN //< colour of children
36 "Attempted to scale an edgestep format word";
50 : blanks(blank_count),
54 C_BLOB_IT start_it = blob_list;
55 C_BLOB_IT end_it = blob_list;
56 C_BLOB_IT rej_cblob_it = &rej_cblobs;
57 C_OUTLINE_IT c_outline_it;
58 inT16 inverted_vote = 0;
59 inT16 non_inverted_vote = 0;
62 while (!end_it.at_last())
64 cblobs.assign_to_sublist(&start_it, &end_it);
79 start_it.set_to_list(&cblobs);
82 for (start_it.mark_cycle_pt(); !start_it.cycled_list(); start_it.forward()) {
86 c_outline_it.set_to_list(start_it.data()->out_list());
88 for (c_outline_it.mark_cycle_pt();
89 !c_outline_it.cycled_list() && !reject_blob;
90 c_outline_it.forward()) {
91 reject_blob = c_outline_it.data()->flag(
COUT_INVERSE) != blob_inverted;
94 rej_cblob_it.add_after_then_move(start_it.extract());
103 flags.set_bit(
W_INVERSE, (inverted_vote > non_inverted_vote));
105 start_it.set_to_list(&cblobs);
106 if (start_it.empty())
108 for (start_it.mark_cycle_pt(); !start_it.cycled_list(); start_it.forward()) {
109 c_outline_it.set_to_list(start_it.data()->out_list());
111 rej_cblob_it.add_after_then_move(start_it.extract());
126 script_id_(clone->script_id_),
127 correct(clone->correct) {
128 C_BLOB_IT start_it = blob_list;
129 C_BLOB_IT end_it = blob_list;
131 while (!end_it.at_last ())
133 ((C_BLOB_LIST *) (&cblobs))->assign_to_sublist (&start_it, &end_it);
135 blanks = clone->blanks;
142 C_BLOB_LIST temp_blobs;
143 C_BLOB_IT temp_it(&temp_blobs);
144 temp_it.add_after_then_move(blob);
145 WERD* blob_word =
new WERD(&temp_blobs,
this);
166 C_BLOB_IT rej_cblob_it = &rej_cblobs;
168 for (rej_cblob_it.mark_cycle_pt(); !rej_cblob_it.cycled_list();
169 rej_cblob_it.forward()) {
170 box += rej_cblob_it.data()->bounding_box();
173 C_BLOB_IT it = &cblobs;
174 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
175 box += it.data()->bounding_box();
189 C_BLOB_IT cblob_it(&cblobs);
191 for (cblob_it.mark_cycle_pt(); !cblob_it.cycled_list(); cblob_it.forward())
192 cblob_it.data()->move(vec);
202 C_BLOB_IT blob_it(&cblobs);
203 C_BLOB_IT src_it(&other->cblobs);
204 C_BLOB_IT rej_cblob_it(&rej_cblobs);
205 C_BLOB_IT src_rej_it(&other->rej_cblobs);
207 while (!src_it.empty()) {
208 blob_it.add_to_end(src_it.extract());
211 while (!src_rej_it.empty()) {
212 rej_cblob_it.add_to_end(src_rej_it.extract());
213 src_rej_it.forward();
226 C_BLOB_IT c_blob_it(&cblobs);
231 c_blob_it.add_list_before(&c_blobs);
233 c_blob_it.move_to_last();
234 c_blob_it.add_list_after(&c_blobs);
236 if (!other->rej_cblobs.empty()) {
237 C_BLOB_IT rej_c_blob_it(&rej_cblobs);
238 C_BLOB_LIST new_rej_c_blobs;
242 rej_c_blob_it.add_list_before(&new_rej_c_blobs);
244 rej_c_blob_it.move_to_last();
245 rej_c_blob_it.add_list_after(&new_rej_c_blobs);
257 tprintf(
"Blanks= %d\n", blanks);
264 tprintf(
" W_NORMALIZED = %s\n",
266 tprintf(
" W_SCRIPT_HAS_XHEIGHT = %s\n",
268 tprintf(
" W_SCRIPT_IS_LATIN = %s\n",
275 tprintf(
"Rejected cblob count = %d\n", rej_cblobs.length());
276 tprintf(
"Script = %d\n", script_id_);
286 #ifndef GRAPHICS_DISABLED
288 C_BLOB_IT it = &cblobs;
289 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
290 it.data()->plot(window, colour, colour);
311 C_BLOB_IT it = &cblobs;
312 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
328 C_BLOB_IT it = &rej_cblobs;
329 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
333 #endif // GRAPHICS_DISABLED
345 new_word->blanks = blanks;
346 new_word->flags =
flags;
347 new_word->dummy = dummy;
348 new_word->correct = correct;
361 blanks = source.blanks;
362 flags = source.flags;
363 script_id_ = source.script_id_;
364 dummy = source.dummy;
365 correct = source.correct;
370 if (!rej_cblobs.empty())
403 C_BLOB_LIST* orphan_blobs) {
404 C_BLOB_LIST current_blob_list;
405 C_BLOB_IT werd_blobs_it(¤t_blob_list);
410 C_BLOB_LIST new_werd_blobs;
411 C_BLOB_IT new_blobs_it(&new_werd_blobs);
415 C_BLOB_LIST not_found_blobs;
416 C_BLOB_IT not_found_it(¬_found_blobs);
417 not_found_it.move_to_last();
419 werd_blobs_it.move_to_first();
420 for (werd_blobs_it.mark_cycle_pt(); !werd_blobs_it.cycled_list();
421 werd_blobs_it.forward()) {
422 C_BLOB* werd_blob = werd_blobs_it.extract();
428 C_BLOB_IT all_blobs_it(all_blobs);
429 for (all_blobs_it.mark_cycle_pt(); !all_blobs_it.cycled_list();
430 all_blobs_it.forward()) {
431 C_BLOB* a_blob = all_blobs_it.data();
436 tprintf(
"Bounding box couldn't be ascertained\n");
438 if (werd_blob_box.
contains(a_blob_box) ||
443 all_blobs_it.extract();
444 new_blobs_it.add_after_then_move(a_blob);
449 not_found_it.add_after_then_move(werd_blob);
457 not_found_it.move_to_first();
458 for (not_found_it.mark_cycle_pt(); !not_found_it.cycled_list();
459 not_found_it.forward()) {
460 C_BLOB* not_found = not_found_it.data();
462 C_BLOB_IT existing_blobs_it(new_blobs_it);
463 for (existing_blobs_it.mark_cycle_pt(); !existing_blobs_it.cycled_list();
464 existing_blobs_it.forward()) {
465 C_BLOB* a_blob = existing_blobs_it.data();
471 delete not_found_it.extract();
477 C_BLOB_IT orphan_blobs_it(orphan_blobs);
478 orphan_blobs_it.move_to_last();
479 orphan_blobs_it.add_list_after(¬_found_blobs);
484 if (!new_werd_blobs.empty()) {
485 new_werd =
new WERD(&new_werd_blobs,
this);
489 this_list_it.add_list_after(¬_found_blobs);