21 #pragma warning(disable:4244) // Conversion warnings
26 #include "config_auto.h"
45 #ifndef GRAPHICS_DISABLED
46 #define ASC_HEIGHT (2 * kBlnBaselineOffset + kBlnXHeight)
47 #define X_HEIGHT (kBlnBaselineOffset + kBlnXHeight)
48 #define BL_HEIGHT kBlnBaselineOffset
50 #define MAXSPACING 128
111 FILE *debug_window =
NULL;
130 "Editor image window name");
135 "Word bounding box colour");
137 "Blob bounding box colour");
139 "Correct text colour");
142 "Editor debug window name");
160 bln_word_window =
NULL;
173 if (bln_word_window ==
NULL) {
217 maxx, y_offset + scale_factor * DESC_HEIGHT);
219 maxx, y_offset + scale_factor * BL_HEIGHT);
221 maxx, y_offset + scale_factor * X_HEIGHT);
223 maxx, y_offset + scale_factor * ASC_HEIGHT);
241 if (strcmp(event->
parameter,
"true") == 0) { myval =
'T'; }
242 else if (strcmp(event->
parameter,
"false") == 0) { myval =
'F'; }
270 parent_menu = root_menu_item->
AddChild(
"DISPLAY");
289 parent_menu = root_menu_item->
AddChild(
"OTHER");
298 return root_menu_item;
315 image_win->
Image(pix_binary_, 0, 0);
337 current_page_res = page_res;
347 #ifndef GRAPHICS_DISABLED
385 image_win->
AddMessage(
"Pointing at(%d, %d)", event->
x, event->
y);
443 if (new_value[0] ==
'T')
450 if (new_value[0] ==
'T')
458 if (new_value[0] ==
'T')
465 if (new_value[0] ==
'T')
472 if (new_value[0] ==
'T')
479 if (new_value[0] ==
'T')
545 sprintf(msg,
"Unrecognised event " INT32FORMAT "(%s)",
546 cmd_event, new_value);
585 selection_box =
TBOX(down, up);
611 image_win->
AddMessage(
"Recogging selected words");
617 image_win->
AddMessage(
"Recogging selected blobs");
622 sprintf(msg,
"Mode %d not yet implemented",
mode);
657 msg_ptr += sprintf(msg_ptr,
"Pt:(%0.3f, %0.3f) ", x, y);
662 msg_ptr += sprintf(msg_ptr,
"BL(x)=%0.3f ",
665 if (word->word->bounding_box().contains(pt)) {
666 TBOX box = word->word->bounding_box();
667 msg_ptr += sprintf(msg_ptr,
"Wd(%d, %d)/(%d, %d) ",
670 C_BLOB_IT cblob_it(word->word->cblob_list());
671 for (cblob_it.mark_cycle_pt();
672 !cblob_it.cycled_list();
673 cblob_it.forward()) {
674 C_BLOB* cblob = cblob_it.data();
677 msg_ptr += sprintf(msg_ptr,
678 "CBlb(%d, %d)/(%d, %d) ",
708 #endif // GRAPHICS_DISABLED
710 #ifndef GRAPHICS_DISABLED
726 if (bln_word ==
NULL) {
734 1.0, 0.0
f, -1000.0
f, 1000.0
f);
757 int length = box_word->
length();
760 for (
int i = 0; i < length; ++i) {
762 switch (color_mode) {
800 image_win->
Pen(color);
816 editor_image_word_bb_color));
822 for (c_it.mark_cycle_pt(); !c_it.cycled_list(); c_it.forward())
823 c_it.data()->bounding_box().plot(image_win);
824 displayed_something =
TRUE;
829 word->
plot(image_win);
830 displayed_something =
TRUE;
837 tword->
plot(image_win);
839 displayed_something =
TRUE;
853 if (blamer_bundle ==
NULL) {
863 best_choice_str =
"NULL";
867 text += best_choice_str;
878 word_height = word_bb.
height();
879 int text_height = 0.50 * word_height;
880 if (text_height > 20) text_height = 20;
881 image_win->
TextAttributes(
"Arial", text_height,
false,
false,
false);
882 shift = (word_height < word_bb.
width()) ? 0.25 * word_height : 0.0
f;
883 image_win->
Text(word_bb.
left() + shift,
886 image_win->
Text(word_bb.
left() + shift,
887 word_bb.
bottom() + 0.25 * word_height - text_height,
891 displayed_something =
TRUE;
894 if (!displayed_something)
898 editor_image_word_bb_color));
901 #endif // GRAPHICS_DISABLED
919 tprintf(
"Current blamer debug: %s\n",
925 #ifndef GRAPHICS_DISABLED
942 #endif // GRAPHICS_DISABLED