display/pgeditx.h File Reference

Go to the source code of this file.

Functions


Function Documentation

void extend_menu ( RADIO_MENU modes_menu,
INT16  modes_id_base,
NON_RADIO_MENU other_menu,
INT16  other_id_base 
)

Called by pgeditor to let you extend the command menu.

Parameters:
modes_menu handle for "MODES"
modes_id_base mode cmd ids offset
other_menu handle for "OTHER"
other_id_base mode cmd ids offset
Returns:
none
Items can be added to the "MODES" and "OTHER" menus. The modes_id_base and other_id_base parameters are required to offset your command event ids from those of pgeditor, and to let the pgeditor which commands are mode changes and which are unmoded commands. (Sorry if you think these offsets are a bit kludgy, the alternative would be to duplicate all the menu constructor modes within pgeditor so that the offsets could be hidden.)

Items for the "MODES" menu may only be simple menu items (just a name and id). Items for the "OTHER" menu can be editable parameters or boolean toggles. Refer to menu.h to see how to build different types.

Definition at line 216 of file tessedit.cpp.

References RADIO_MENU::add_child(), RECOG_PSEUDO, and RECOG_WERDS.

Referenced by build_menu().

00221                   {
00222   /* Example new mode */
00223 
00224   modes_menu->add_child (new RADIO_MENU_LEAF ("Recog Words",
00225     modes_id_base + RECOG_WERDS));
00226   modes_menu->add_child (new RADIO_MENU_LEAF ("Recog Blobs",
00227     modes_id_base + RECOG_PSEUDO));
00228 
00229   /* Example toggle
00230 
00231   other_menu->add_child(
00232     new TOGGLE_MENU_LEAF( "Action 2",              //Display string
00233             other_id_base + ACTION_2_CMD_EVENT, //offset command id
00234             FALSE ) );                    //Initial value
00235 
00236    Example text parm  (commented out)
00237 
00238     other_menu->add_child(
00239     new VARIABLE_MENU_LEAF( "Parm change",            //Display string
00240             other_id_base + ACTION_3_CMD_EVENT, //offset command id
00241             "default value" ) );          //default value string
00242   */
00243 }

void extend_moded_commands ( INT32  mode,
BOX  selection_box 
)

Called by pgeditor when the user is in one of the extended modes defined by extend_menu() and the user has selected an area in the image window.

Parameters:
mode current mode
selection_box area selected
Returns:
none

Definition at line 255 of file tessedit.cpp.

References command_window, current_block_list, INT32FORMAT, MAX_CHARS, COMMAND_WINDOW::msg(), process_selected_words(), recog_interactive(), RECOG_PSEUDO, recog_pseudo_word(), and RECOG_WERDS.

Referenced by process_image_event().

00258                             {
00259   char msg[MAX_CHARS + 1];
00260 
00261   switch (mode) {
00262     case RECOG_WERDS:
00263       command_window->msg ("Recogging selected words");
00264 
00265       /* This is how to apply a "word processor" function to each selected word */
00266 
00267       process_selected_words(current_block_list,
00268                              selection_box,
00269                              &recog_interactive);
00270       break;
00271     case RECOG_PSEUDO:
00272       command_window->msg ("Recogging selected blobs");
00273 
00274       /* This is how to apply a "word processor" function to each selected word */
00275 
00276       recog_pseudo_word(current_block_list, selection_box);
00277       break;
00278     default:
00279       sprintf (msg, "Unexpected extended mode " INT32FORMAT, mode);
00280       command_window->msg (msg);
00281   }
00282 }

void extend_unmoded_commands ( INT32  cmd_event,
char *  new_value 
)

Called by pgeditor() when user has selected one of the unmoded extended menu options.

Definition at line 289 of file tessedit.cpp.

References command_window, INT32FORMAT, MAX_CHARS, and COMMAND_WINDOW::msg().

Referenced by process_cmd_win_event().

00292                               {
00293   char msg[MAX_CHARS + 1];
00294 
00295   switch (cmd_event) {
00296     case ACTION_2_CMD_EVENT:     //a toggle event
00297       if (new_value[0] == 'T')
00298                                  //Display message
00299         command_window->msg ("Extended Action 2 ON!!");
00300       else
00301         command_window->msg ("Extended Action 2 OFF!!");
00302       break;
00303     default:
00304       sprintf (msg, "Unrecognised extended command " INT32FORMAT " (%s)",
00305         cmd_event, new_value);
00306       command_window->msg (msg);
00307       break;
00308   }
00309 }


Generated on Wed Feb 28 19:49:23 2007 for Tesseract by  doxygen 1.5.1