⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dialogs.cpp

📁 Ocr source code. provides an Ocr engine that works in C++ language.
💻 CPP
📖 第 1 页 / 共 3 页
字号:
/* dialogs.cpp : code for the dialogs * Author: Maxie D. Schmidt (created 5/21/2006) */#include "dialogs.h"/////// cfg_dialog:cfg_dialog::cfg_dialog(program_mode_t mode) :      pro_label("Profile:"), prodir_label("Profile Dir:"),     savedir_label("Save Dir:"), scandir_label("Scan Dir:"),      logdir_label("Log Dir:"), logfile_label("Log File:"),     pro_browse("Browse..."),      prodir_browse("Browse..."), savedir_browse("Browse..."),      scandir_browse("Browse..."), logdir_browse("Browse..."),      logfile_browse("Browse..."),     ZI_PR0_PG_label("Zero Instance p(not gridcell|letter) Probability"),     ZI_PR1_PG_label("Zero Instance p(gridcell|letter) Probability"),     ZI_PR0_PGC_label("Zero Instance p(gridcell) Probability"),     ZI_PR1_PGC_label("Zero Instance p(not gridcell) Probability"),     PRSF_label("Probability Scaling Factor"),      p_dialog_matches_label("Number of Letter Matches Displayed in Parse Dialog"),     ignore_edges_top_label("Scan Ignore Edges Number of Pixels (top)"),     ignore_edges_bottom_label("Scan Ignore Edges Number of Pixels (bottom)"),     ignore_edges_left_label("Scan Ignore Edges Number of Pixels (left)"),     ignore_edges_right_label("Scan Ignore Edges Number of Pixels (right)"),     space_int_padding_label("Space Interval Padding"),     lineh_int_padding_label("Line Height Interval Padding"),     rgb_int_titlelabel("Black Pixel Tolerance Interval:"),      rgb_int_R_label("R"), rgb_int_G_label("G"), rgb_int_B_label("B"),     rgb_int_r_tolabel(" to "), rgb_int_g_tolabel(" to "),      rgb_int_b_tolabel(" to "), gsx_label("Grid Size X"),      gsy_label("Grid Size Y"), gcx_label("Grid Cell Size X"),      gcy_label("Grid Cell Size Y"), interpx_label("Image Intersect Pixels"),      spaceint_label("Space Interval"), linehint_label("Line Height Interval"),      spaceint_tolabel(" to "), linehint_tolabel(" to "), close_button("Close") {     set_title("Configuration Options");     get_vbox()->set_spacing(10);          prog_mode = mode;          // signal handlers:     pro_browse.signal_clicked().connect(sigc::mem_fun(*this,                                        &cfg_dialog::on_cfg_profile_browse));     prodir_browse.signal_clicked().connect(sigc::mem_fun(*this,                                        &cfg_dialog::on_cfg_profile_dir_browse));     savedir_browse.signal_clicked().connect(sigc::mem_fun(*this,                                        &cfg_dialog::on_cfg_save_dir_browse));     scandir_browse.signal_clicked().connect(sigc::mem_fun(*this,                                        &cfg_dialog::on_cfg_scan_dir_browse));     logdir_browse.signal_clicked().connect(sigc::mem_fun(*this,                                        &cfg_dialog::on_cfg_log_dir_browse));     logfile_browse.signal_clicked().connect(sigc::mem_fun(*this,                                        &cfg_dialog::on_cfg_log_file_browse));     /////// config:     pro_text.set_text(cfg_profile);     pro_text.set_width_chars(CFG_ENTRY_SIZE);     prodir_text.set_text(cfg_profile_dir);     prodir_text.set_width_chars(CFG_ENTRY_SIZE);     savedir_text.set_text(cfg_save_dir);     savedir_text.set_width_chars(CFG_ENTRY_SIZE);     scandir_text.set_text(cfg_scan_dir);     scandir_text.set_width_chars(CFG_ENTRY_SIZE);     logdir_text.set_text(cfg_log_dir);     logdir_text.set_width_chars(CFG_ENTRY_SIZE);     logfile_text.set_text(cfg_log_file);     logfile_text.set_width_chars(CFG_ENTRY_SIZE);               pro_label_hbox.pack_start(pro_label, Gtk::PACK_SHRINK);     pro_vbox.pack_start(pro_label_hbox, Gtk::PACK_SHRINK);     pro_hbox.pack_start(pro_text, Gtk::PACK_SHRINK);     pro_hbox.pack_start(pro_browse, Gtk::PACK_SHRINK);     pro_vbox.pack_start(pro_hbox, Gtk::PACK_SHRINK);          prodir_label_hbox.pack_start(prodir_label, Gtk::PACK_SHRINK);     prodir_vbox.pack_start(prodir_label_hbox, Gtk::PACK_SHRINK);     prodir_hbox.pack_start(prodir_text, Gtk::PACK_SHRINK);     prodir_hbox.pack_start(prodir_browse, Gtk::PACK_SHRINK);     prodir_vbox.pack_start(prodir_hbox, Gtk::PACK_SHRINK);          savedir_label_hbox.pack_start(savedir_label, Gtk::PACK_SHRINK);     savedir_vbox.pack_start(savedir_label_hbox, Gtk::PACK_SHRINK);     savedir_hbox.pack_start(savedir_text, Gtk::PACK_SHRINK);     savedir_hbox.pack_start(savedir_browse, Gtk::PACK_SHRINK);     savedir_vbox.pack_start(savedir_hbox, Gtk::PACK_SHRINK);     scandir_label_hbox.pack_start(scandir_label, Gtk::PACK_SHRINK);     scandir_vbox.pack_start(scandir_label_hbox, Gtk::PACK_SHRINK);     scandir_hbox.pack_start(scandir_text, Gtk::PACK_SHRINK);     scandir_hbox.pack_start(scandir_browse, Gtk::PACK_SHRINK);     scandir_vbox.pack_start(scandir_hbox, Gtk::PACK_SHRINK);       logdir_label_hbox.pack_start(logdir_label, Gtk::PACK_SHRINK);     logdir_vbox.pack_start(logdir_label_hbox, Gtk::PACK_SHRINK);     logdir_hbox.pack_start(logdir_text, Gtk::PACK_SHRINK);     logdir_hbox.pack_start(logdir_browse, Gtk::PACK_SHRINK);     logdir_vbox.pack_start(logdir_hbox, Gtk::PACK_SHRINK);        logfile_label_hbox.pack_start(logfile_label, Gtk::PACK_SHRINK);     logfile_vbox.pack_start(logfile_label_hbox, Gtk::PACK_SHRINK);     logfile_hbox.pack_start(logfile_text, Gtk::PACK_SHRINK);     logfile_hbox.pack_start(logfile_browse, Gtk::PACK_SHRINK);     logfile_vbox.pack_start(logfile_hbox, Gtk::PACK_SHRINK);       cfg_frame_vbox.pack_start(pro_vbox);     cfg_frame_vbox.pack_start(prodir_vbox);     cfg_frame_vbox.pack_start(savedir_vbox);     cfg_frame_vbox.pack_start(scandir_vbox);     cfg_frame_vbox.pack_start(logdir_vbox);     cfg_frame_vbox.pack_start(logfile_vbox);     cfg_frame.set_label("General Config");     cfg_frame.add(cfg_frame_vbox);          /////// parsing config:     ZI_PR0_PG_text.set_text(double_to_string(ZERO_INST_PR0_PGIVEN));     ZI_PR0_PG_text.set_width_chars(PARSING_ENTRY_SIZE);     ZI_PR1_PG_text.set_text(double_to_string(ZERO_INST_PR1_PGIVEN));     ZI_PR1_PG_text.set_width_chars(PARSING_ENTRY_SIZE);     ZI_PR0_PGC_text.set_text(double_to_string(ZERO_INST_PR0_PGC));     ZI_PR0_PGC_text.set_width_chars(PARSING_ENTRY_SIZE);     ZI_PR1_PGC_text.set_text(double_to_string(ZERO_INST_PR0_PGC));     ZI_PR1_PGC_text.set_width_chars(PARSING_ENTRY_SIZE);     PRSF_text.set_text(double_to_string(PR_SCALING_FACTOR));     PRSF_text.set_width_chars(PARSING_ENTRY_SIZE);     ignore_edges_top_text.set_text(int_to_string(scan_ignore_edges_top));     ignore_edges_top_text.set_width_chars(PARSING_ENTRY_SIZE);     ignore_edges_bottom_text.set_text(int_to_string(scan_ignore_edges_bottom));     ignore_edges_bottom_text.set_width_chars(PARSING_ENTRY_SIZE);     ignore_edges_left_text.set_text(int_to_string(scan_ignore_edges_left));     ignore_edges_left_text.set_width_chars(PARSING_ENTRY_SIZE);     ignore_edges_right_text.set_text(int_to_string(scan_ignore_edges_right));     ignore_edges_right_text.set_width_chars(PARSING_ENTRY_SIZE);     p_dialog_matches_text.set_text(int_to_string(parse_dialog_num_matches));     p_dialog_matches_text.set_width_chars(PARSING_ENTRY_SIZE);     space_int_padding_text.set_text(int_to_string(space_int_padding));     space_int_padding_text.set_width_chars(PARSING_ENTRY_SIZE);     lineh_int_padding_text.set_text(int_to_string(line_height_int_padding));     lineh_int_padding_text.set_width_chars(PARSING_ENTRY_SIZE);          ZI_PR1_PG_hbox.set_spacing(5);     ZI_PR1_PG_hbox.pack_start(ZI_PR1_PG_text, Gtk::PACK_SHRINK);     ZI_PR1_PG_hbox.pack_start(ZI_PR1_PG_label, Gtk::PACK_SHRINK);     ZI_PR1_PG_vbox.pack_start(ZI_PR1_PG_hbox, Gtk::PACK_SHRINK);           ZI_PR0_PG_hbox.set_spacing(5);     ZI_PR0_PG_hbox.pack_start(ZI_PR0_PG_text, Gtk::PACK_SHRINK);     ZI_PR0_PG_hbox.pack_start(ZI_PR0_PG_label, Gtk::PACK_SHRINK);     ZI_PR0_PG_vbox.pack_start(ZI_PR0_PG_hbox, Gtk::PACK_SHRINK);           ZI_PR1_PGC_hbox.set_spacing(5);     ZI_PR1_PGC_hbox.pack_start(ZI_PR1_PGC_text, Gtk::PACK_SHRINK);     ZI_PR1_PGC_hbox.pack_start(ZI_PR1_PGC_label, Gtk::PACK_SHRINK);     ZI_PR1_PGC_vbox.pack_start(ZI_PR1_PGC_hbox, Gtk::PACK_SHRINK);           ZI_PR0_PGC_hbox.set_spacing(5);     ZI_PR0_PGC_hbox.pack_start(ZI_PR0_PGC_text, Gtk::PACK_SHRINK);     ZI_PR0_PGC_hbox.pack_start(ZI_PR0_PGC_label, Gtk::PACK_SHRINK);     ZI_PR0_PGC_vbox.pack_start(ZI_PR0_PGC_hbox, Gtk::PACK_SHRINK);           PRSF_hbox.set_spacing(5);     PRSF_hbox.pack_start(PRSF_text, Gtk::PACK_SHRINK);     PRSF_hbox.pack_start(PRSF_label, Gtk::PACK_SHRINK);     PRSF_vbox.pack_start(PRSF_hbox, Gtk::PACK_SHRINK);      ignore_edges_top_hbox.set_spacing(5);     ignore_edges_top_hbox.pack_start(ignore_edges_top_text, Gtk::PACK_SHRINK);     ignore_edges_top_hbox.pack_start(ignore_edges_top_label, Gtk::PACK_SHRINK);     ignore_edges_top_vbox.pack_start(ignore_edges_top_hbox, Gtk::PACK_SHRINK);          ignore_edges_bottom_hbox.set_spacing(5);     ignore_edges_bottom_hbox.pack_start(ignore_edges_bottom_text,                                                              Gtk::PACK_SHRINK);     ignore_edges_bottom_hbox.pack_start(ignore_edges_bottom_label,                                                              Gtk::PACK_SHRINK);     ignore_edges_bottom_vbox.pack_start(ignore_edges_bottom_hbox,                                                              Gtk::PACK_SHRINK);     ignore_edges_left_hbox.set_spacing(5);     ignore_edges_left_hbox.pack_start(ignore_edges_left_text,                                                             Gtk::PACK_SHRINK);     ignore_edges_left_hbox.pack_start(ignore_edges_left_label,                                                              Gtk::PACK_SHRINK);     ignore_edges_left_vbox.pack_start(ignore_edges_left_hbox,                                                              Gtk::PACK_SHRINK);       ignore_edges_right_hbox.set_spacing(5);     ignore_edges_right_hbox.pack_start(ignore_edges_right_text,                                                              Gtk::PACK_SHRINK);     ignore_edges_right_hbox.pack_start(ignore_edges_right_label,                                                              Gtk::PACK_SHRINK);     ignore_edges_right_vbox.pack_start(ignore_edges_right_hbox,                                                              Gtk::PACK_SHRINK);       p_dialog_matches_hbox.set_spacing(5);     p_dialog_matches_hbox.pack_start(p_dialog_matches_text, Gtk::PACK_SHRINK);     p_dialog_matches_hbox.pack_start(p_dialog_matches_label, Gtk::PACK_SHRINK);     p_dialog_matches_vbox.pack_start(p_dialog_matches_hbox, Gtk::PACK_SHRINK);           space_int_padding_hbox.set_spacing(5);     space_int_padding_hbox.pack_start(space_int_padding_text,                                                              Gtk::PACK_SHRINK);     space_int_padding_hbox.pack_start(space_int_padding_label,                                                              Gtk::PACK_SHRINK);     space_int_padding_vbox.pack_start(space_int_padding_hbox,Gtk::PACK_SHRINK);          lineh_int_padding_hbox.set_spacing(5);     lineh_int_padding_hbox.pack_start(lineh_int_padding_text,                                                              Gtk::PACK_SHRINK);     lineh_int_padding_hbox.pack_start(lineh_int_padding_label,                                                              Gtk::PACK_SHRINK);     lineh_int_padding_vbox.pack_start(lineh_int_padding_hbox,                                                             Gtk::PACK_SHRINK);               parsing_frame_vbox.pack_start(ZI_PR1_PG_vbox, Gtk::PACK_SHRINK);     parsing_frame_vbox.pack_start(ZI_PR0_PG_vbox, Gtk::PACK_SHRINK);     parsing_frame_vbox.pack_start(ZI_PR1_PGC_vbox, Gtk::PACK_SHRINK);     parsing_frame_vbox.pack_start(ZI_PR0_PGC_vbox, Gtk::PACK_SHRINK);     parsing_frame_vbox.pack_start(PRSF_vbox, Gtk::PACK_SHRINK);     parsing_frame_vbox.pack_start(ignore_edges_top_vbox, Gtk::PACK_SHRINK);     parsing_frame_vbox.pack_start(ignore_edges_bottom_vbox, Gtk::PACK_SHRINK);     parsing_frame_vbox.pack_start(ignore_edges_left_vbox, Gtk::PACK_SHRINK);     parsing_frame_vbox.pack_start(ignore_edges_right_vbox, Gtk::PACK_SHRINK);     parsing_frame_vbox.pack_start(p_dialog_matches_vbox, Gtk::PACK_SHRINK);     parsing_frame_vbox.pack_start(space_int_padding_vbox, Gtk::PACK_SHRINK);     parsing_frame_vbox.pack_start(lineh_int_padding_vbox, Gtk::PACK_SHRINK);     parsing_frame.set_label("Parsing Config");     parsing_frame.add(parsing_frame_vbox);          // misc config:     rgb_int_vbox.set_spacing(5);     rgb_int_r_hbox.set_spacing(5);     rgb_int_g_hbox.set_spacing(5);     rgb_int_b_hbox.set_spacing(5);     rgb_int_r_lower_entry.set_text(int_to_string(grid_rgb_int.Rl));     rgb_int_r_upper_entry.set_text(int_to_string(grid_rgb_int.Ru));     rgb_int_g_lower_entry.set_text(int_to_string(grid_rgb_int.Gl));     rgb_int_g_upper_entry.set_text(int_to_string(grid_rgb_int.Gu));     rgb_int_b_lower_entry.set_text(int_to_string(grid_rgb_int.Bl));     rgb_int_b_upper_entry.set_text(int_to_string(grid_rgb_int.Bu));     rgb_int_r_lower_entry.set_width_chars(INTERVAL_ENTRY_SIZE);     rgb_int_r_upper_entry.set_width_chars(INTERVAL_ENTRY_SIZE);     rgb_int_g_lower_entry.set_width_chars(INTERVAL_ENTRY_SIZE);     rgb_int_g_upper_entry.set_width_chars(INTERVAL_ENTRY_SIZE);     rgb_int_b_lower_entry.set_width_chars(INTERVAL_ENTRY_SIZE);     rgb_int_b_upper_entry.set_width_chars(INTERVAL_ENTRY_SIZE);     rgb_int_titlelabel_hbox.pack_start(rgb_int_titlelabel, Gtk::PACK_SHRINK);     rgb_int_vbox.pack_start(rgb_int_titlelabel_hbox, Gtk::PACK_SHRINK);     rgb_int_r_hbox.pack_start(rgb_int_r_lower_entry, Gtk::PACK_SHRINK);     rgb_int_r_hbox.pack_start(rgb_int_r_tolabel, Gtk::PACK_SHRINK);     rgb_int_r_hbox.pack_start(rgb_int_r_upper_entry, Gtk::PACK_SHRINK);     rgb_int_r_hbox.pack_start(rgb_int_R_label, Gtk::PACK_SHRINK);     rgb_int_vbox.pack_start(rgb_int_r_hbox, Gtk::PACK_SHRINK);          rgb_int_g_hbox.pack_start(rgb_int_g_lower_entry, Gtk::PACK_SHRINK);     rgb_int_g_hbox.pack_start(rgb_int_g_tolabel, Gtk::PACK_SHRINK);     rgb_int_g_hbox.pack_start(rgb_int_g_upper_entry, Gtk::PACK_SHRINK);     rgb_int_g_hbox.pack_start(rgb_int_G_label, Gtk::PACK_SHRINK);     rgb_int_vbox.pack_start(rgb_int_g_hbox, Gtk::PACK_SHRINK);          rgb_int_b_hbox.pack_start(rgb_int_b_lower_entry, Gtk::PACK_SHRINK);     rgb_int_b_hbox.pack_start(rgb_int_b_tolabel, Gtk::PACK_SHRINK);     rgb_int_b_hbox.pack_start(rgb_int_b_upper_entry, Gtk::PACK_SHRINK);     rgb_int_b_hbox.pack_start(rgb_int_B_label, Gtk::PACK_SHRINK);     rgb_int_vbox.pack_start(rgb_int_b_hbox, Gtk::PACK_SHRINK);     misc_frame.set_label("Misc Config");     misc_frame.add(rgb_int_vbox);     // training config:     trcfg_vbox.set_spacing(5);     gsx_hbox.set_spacing(5);     gsy_hbox.set_spacing(5);     gcx_hbox.set_spacing(5);     gcy_hbox.set_spacing(5);     interpx_hbox.set_spacing(5);     spaceint_hbox.set_spacing(5);     linehint_hbox.set_spacing(5);     gsx_entry.set_text(int_to_string(trcfg_grid_size_x));     gsy_entry.set_text(int_to_string(trcfg_grid_size_y));     gcx_entry.set_text(int_to_string(trcfg_gridcell_size_x));     gcy_entry.set_text(int_to_string(trcfg_gridcell_size_y));     interpx_entry.set_text(int_to_string(trcfg_intersect_px));     spaceint_lower_entry.set_text(int_to_string(trcfg_space_int.lower));     spaceint_upper_entry.set_text(int_to_string(trcfg_space_int.upper));     linehint_lower_entry.set_text(int_to_string(trcfg_line_height_int.lower));     linehint_upper_entry.set_text(int_to_string(trcfg_line_height_int.upper));     gsx_entry.set_width_chars(TRCFG_ENTRY_SIZE);     gsy_entry.set_width_chars(TRCFG_ENTRY_SIZE);     gcx_entry.set_width_chars(TRCFG_ENTRY_SIZE);     gcy_entry.set_width_chars(TRCFG_ENTRY_SIZE);     interpx_entry.set_width_chars(TRCFG_ENTRY_SIZE);     spaceint_lower_entry.set_width_chars(INTERVAL_ENTRY_SIZE);     spaceint_upper_entry.set_width_chars(INTERVAL_ENTRY_SIZE);     linehint_lower_entry.set_width_chars(INTERVAL_ENTRY_SIZE);     linehint_upper_entry.set_width_chars(INTERVAL_ENTRY_SIZE);     gsx_hbox.pack_start(gsx_entry, Gtk::PACK_SHRINK);     gsx_hbox.pack_start(gsx_label, Gtk::PACK_SHRINK);     trcfg_vbox.pack_start(gsx_hbox, Gtk::PACK_SHRINK);          gsy_hbox.pack_start(gsy_entry, Gtk::PACK_SHRINK);     gsy_hbox.pack_start(gsy_label, Gtk::PACK_SHRINK);     trcfg_vbox.pack_start(gsy_hbox, Gtk::PACK_SHRINK);     gcx_hbox.pack_start(gcx_entry, Gtk::PACK_SHRINK);     gcx_hbox.pack_start(gcx_label, Gtk::PACK_SHRINK);     trcfg_vbox.pack_start(gcx_hbox, Gtk::PACK_SHRINK);     gcy_hbox.pack_start(gcy_entry, Gtk::PACK_SHRINK);     gcy_hbox.pack_start(gcy_label, Gtk::PACK_SHRINK);     trcfg_vbox.pack_start(gcy_hbox, Gtk::PACK_SHRINK);     interpx_hbox.pack_start(interpx_entry, Gtk::PACK_SHRINK);     interpx_hbox.pack_start(interpx_label, Gtk::PACK_SHRINK);     trcfg_vbox.pack_start(interpx_hbox, Gtk::PACK_SHRINK);     spaceint_hbox.pack_start(spaceint_lower_entry, Gtk::PACK_SHRINK);     spaceint_hbox.pack_start(spaceint_tolabel, Gtk::PACK_SHRINK);     spaceint_hbox.pack_start(spaceint_upper_entry, Gtk::PACK_SHRINK);     spaceint_hbox.pack_start(spaceint_label, Gtk::PACK_SHRINK);     trcfg_vbox.pack_start(spaceint_hbox, Gtk::PACK_SHRINK);         linehint_hbox.pack_start(linehint_lower_entry, Gtk::PACK_SHRINK);     linehint_hbox.pack_start(linehint_tolabel, Gtk::PACK_SHRINK);     linehint_hbox.pack_start(linehint_upper_entry, Gtk::PACK_SHRINK);     linehint_hbox.pack_start(linehint_label, Gtk::PACK_SHRINK);     trcfg_vbox.pack_start(linehint_hbox, Gtk::PACK_SHRINK);     training_frame.set_label("Training Config");     training_frame.add(trcfg_vbox);          // pack the frames into boxes:     mainl_vbox.set_spacing(5);     mainr_vbox.set_spacing(5);     mainl_vbox.pack_start(cfg_frame, Gtk::PACK_SHRINK);     mainl_vbox.pack_start(misc_frame, Gtk::PACK_SHRINK);     mainr_vbox.pack_start(parsing_frame, Gtk::PACK_SHRINK);     mainr_vbox.pack_start(training_frame, Gtk::PACK_SHRINK);     main_hbox.set_spacing(10);     main_hbox.pack_start(mainl_vbox, Gtk::PACK_SHRINK);     main_hbox.pack_end(mainr_vbox, Gtk::PACK_SHRINK);     get_vbox()->pack_start(main_hbox, Gtk::PACK_SHRINK);          // close button:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -