* This routine prompts the user with Prompt and waits * for the user to enter something in the debug window. * @param Prompt prompt to print while waiting for input from window * @param adaptive_on * @param pretrained_on * @param shape_id * @return Character entered in the debug window. * @note Globals: none * @note Exceptions: none * @note History: Thu Mar 21 16:55:13 1991, DSJ, Created.
| 1389 | * @note History: Thu Mar 21 16:55:13 1991, DSJ, Created. |
| 1390 | */ |
| 1391 | CLASS_ID Classify::GetClassToDebug(const char *Prompt, bool* adaptive_on, |
| 1392 | bool* pretrained_on, int* shape_id) { |
| 1393 | tprintf("%s\n", Prompt); |
| 1394 | SVEvent* ev; |
| 1395 | SVEventType ev_type; |
| 1396 | int unichar_id = INVALID_UNICHAR_ID; |
| 1397 | // Wait until a click or popup event. |
| 1398 | do { |
| 1399 | ev = IntMatchWindow->AwaitEvent(SVET_ANY); |
| 1400 | ev_type = ev->type; |
| 1401 | if (ev_type == SVET_POPUP) { |
| 1402 | if (ev->command_id == IDA_SHAPE_INDEX) { |
| 1403 | if (shape_table_ != NULL) { |
| 1404 | *shape_id = atoi(ev->parameter); |
| 1405 | *adaptive_on = false; |
| 1406 | *pretrained_on = true; |
| 1407 | if (*shape_id >= 0 && *shape_id < shape_table_->NumShapes()) { |
| 1408 | int font_id; |
| 1409 | shape_table_->GetFirstUnicharAndFont(*shape_id, &unichar_id, |
| 1410 | &font_id); |
| 1411 | tprintf("Shape %d, first unichar=%d, font=%d\n", |
| 1412 | *shape_id, unichar_id, font_id); |
| 1413 | return unichar_id; |
| 1414 | } |
| 1415 | tprintf("Shape index '%s' not found in shape table\n", ev->parameter); |
| 1416 | } else { |
| 1417 | tprintf("No shape table loaded!\n"); |
| 1418 | } |
| 1419 | } else { |
| 1420 | if (unicharset.contains_unichar(ev->parameter)) { |
| 1421 | unichar_id = unicharset.unichar_to_id(ev->parameter); |
| 1422 | if (ev->command_id == IDA_ADAPTIVE) { |
| 1423 | *adaptive_on = true; |
| 1424 | *pretrained_on = false; |
| 1425 | *shape_id = -1; |
| 1426 | } else if (ev->command_id == IDA_STATIC) { |
| 1427 | *adaptive_on = false; |
| 1428 | *pretrained_on = true; |
| 1429 | } else { |
| 1430 | *adaptive_on = true; |
| 1431 | *pretrained_on = true; |
| 1432 | } |
| 1433 | if (ev->command_id == IDA_ADAPTIVE || shape_table_ == NULL) { |
| 1434 | *shape_id = -1; |
| 1435 | return unichar_id; |
| 1436 | } |
| 1437 | for (int s = 0; s < shape_table_->NumShapes(); ++s) { |
| 1438 | if (shape_table_->GetShape(s).ContainsUnichar(unichar_id)) { |
| 1439 | tprintf("%s\n", shape_table_->DebugStr(s).string()); |
| 1440 | } |
| 1441 | } |
| 1442 | } else { |
| 1443 | tprintf("Char class '%s' not found in unicharset", |
| 1444 | ev->parameter); |
| 1445 | } |
| 1446 | } |
| 1447 | } |
| 1448 | delete ev; |
nothing calls this directly
no test coverage detected