Index: image/svshowim.cpp =================================================================== --- image/svshowim.cpp (révision 685) +++ image/svshowim.cpp (révision 686) @@ -6,6 +6,7 @@ #include "config_auto.h" #endif +#ifndef GRAPHICS_DISABLED #include "allheaders.h" #include "svshowim.h" @@ -36,3 +37,6 @@ window->Image(pix, xpos, window->TranslateYCoordinate(yext) + ypos); pixDestroy(&pix); } + +#endif // GRAPHICS_DISABLED + Index: ccmain/pgedit.cpp =================================================================== --- ccmain/pgedit.cpp (révision 685) +++ ccmain/pgedit.cpp (révision 686) @@ -705,7 +705,9 @@ * Blank display of word then redisplay word according to current display mode * settings */ +#endif // GRAPHICS_DISABLED namespace tesseract { +#ifndef GRAPHICS_DISABLED BOOL8 Tesseract:: word_blank_and_set_display(BLOCK* block, ROW* row, WERD_RES* word_res) { word_res->word->bounding_box().plot(image_win, ScrollView::BLACK, @@ -896,6 +898,7 @@ editor_image_word_bb_color)); return TRUE; } +#endif // GRAPHICS_DISABLED /** * word_dumper() @@ -919,7 +922,7 @@ return TRUE; } - +#ifndef GRAPHICS_DISABLED /** * word_set_display() Word processor * @@ -936,7 +939,9 @@ word->set_display_flag(DF_BLAMER, word_display_mode.bit(DF_BLAMER)); return word_display(block, row, word_res); } +#endif // GRAPHICS_DISABLED + } // namespace tesseract -#endif // GRAPHICS_DISABLED + Index: ccmain/tesseractclass.h =================================================================== --- ccmain/tesseractclass.h (révision 685) +++ ccmain/tesseractclass.h (révision 686) @@ -31,6 +31,11 @@ #include "textord.h" #include "wordrec.h" +// Include automatically generated configuration file if running autoconf. +#ifdef HAVE_CONFIG_H +#include "config_auto.h" +#endif + class PAGE_RES; class PAGE_RES_IT; class BLOCK_LIST; @@ -408,7 +413,9 @@ //// pgedit.h ////////////////////////////////////////////////////////// SVMenuNode *build_menu_new(); + #ifndef GRAPHICS_DISABLED void pgeditor_main(int width, int height, PAGE_RES* page_res); + #endif // GRAPHICS_DISABLED void process_image_event( // action in image win const SVEvent &event); BOOL8 process_cmd_win_event( // UI command semantics @@ -424,7 +431,9 @@ BOOL8 word_bln_display(BLOCK* block, ROW* row, WERD_RES* word_res); BOOL8 word_blank_and_set_display(BLOCK* block, ROW* row, WERD_RES* word_res); BOOL8 word_set_display(BLOCK* block, ROW* row, WERD_RES* word_res); + //#ifndef GRAPHICS_DISABLED BOOL8 word_dumper(BLOCK* block, ROW* row, WERD_RES* word_res); + //#endif // GRAPHICS_DISABLED //// reject.h ////////////////////////////////////////////////////////// void make_reject_map( //make rej map for wd //detailed results WERD_RES *word, Index: ccstruct/blobs.cpp =================================================================== --- ccstruct/blobs.cpp (révision 685) +++ ccstruct/blobs.cpp (révision 686) @@ -221,6 +221,7 @@ void TESSLINE::plot(ScrollView* window, ScrollView::Color color, ScrollView::Color child_color) { + #ifndef GRAPHICS_DISABLED if (is_hole) window->Pen(child_color); else @@ -235,6 +236,7 @@ else window->DrawTo(pt->pos.x, pt->pos.y); } while (pt != loop); + #endif // GRAPHICS_DISABLED } // Iterate the given list of outlines, converting to TESSLINE by polygonal Index: ccstruct/werd.h =================================================================== --- ccstruct/werd.h (révision 685) +++ ccstruct/werd.h (révision 686) @@ -27,6 +27,11 @@ #include "blckerr.h" #include "stepblob.h" +// Include automatically generated configuration file if running autoconf. +#ifdef HAVE_CONFIG_H +#include "config_auto.h" +#endif + enum WERD_FLAGS { W_SEGMENTED, //< correctly segmented @@ -141,17 +146,21 @@ // tprintf word metadata (but not blob innards) void print(); + #ifndef GRAPHICS_DISABLED // plot word on window in a uniform colour void plot(ScrollView *window, ScrollView::Color colour); + #endif // GRAPHICS_DISABLED // Get the next color in the (looping) rainbow. static ScrollView::Color NextColor(ScrollView::Color colour); + #ifndef GRAPHICS_DISABLED // plot word on window in a rainbow of colours void plot(ScrollView *window); // plot rejected blobs in a rainbow of colours void plot_rej_blobs(ScrollView *window); + #endif // GRAPHICS_DISABLED private: uinT8 blanks; // no of blanks Index: ccstruct/werd.cpp =================================================================== --- ccstruct/werd.cpp (révision 685) +++ ccstruct/werd.cpp (révision 686) @@ -23,11 +23,6 @@ #include "linlsq.h" #include "werd.h" -// Include automatically generated configuration file if running autoconf. -#ifdef HAVE_CONFIG_H -#include "config_auto.h" -#endif - #define FIRST_COLOUR ScrollView::RED //< first rainbow colour #define LAST_COLOUR ScrollView::AQUAMARINE //< last rainbow colour #define CHILD_COLOUR ScrollView::BROWN //< colour of children @@ -291,11 +286,8 @@ } plot_rej_blobs(window); } -#endif +#endif // GRAPHICS_DISABLED - -#ifndef GRAPHICS_DISABLED - // Get the next color in the (looping) rainbow. ScrollView::Color WERD::NextColor(ScrollView::Color colour) { ScrollView::Color next = static_cast(colour + 1); @@ -304,6 +296,7 @@ return next; } +#ifndef GRAPHICS_DISABLED /** * WERD::plot * @@ -319,7 +312,6 @@ } plot_rej_blobs(window); } -#endif /** @@ -328,14 +320,14 @@ * Draw the WERD rejected blobs in window - ALWAYS GREY */ -#ifndef GRAPHICS_DISABLED + void WERD::plot_rej_blobs(ScrollView *window) { C_BLOB_IT it = &rej_cblobs; for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) { it.data()->plot(window, ScrollView::GREY, ScrollView::GREY); } } -#endif +#endif // GRAPHICS_DISABLED /** Index: ccstruct/statistc.h =================================================================== --- ccstruct/statistc.h (révision 685) +++ ccstruct/statistc.h (révision 686) @@ -108,6 +108,7 @@ // Prints summary stats only of the histogram. void print_summary() const; + #ifndef GRAPHICS_DISABLED // Draws the histogram as a series of rectangles. void plot(ScrollView* window, // window to draw in float xorigin, // origin of histo @@ -123,6 +124,8 @@ float xscale, // size of one unit float yscale, // size of one uint ScrollView::Color colour) const; // colour to draw in + #endif // GRAPHICS_DISABLED + private: inT32 rangemin_; // min of range // rangemax_ is not well named as it is really one past the max. Index: viewer/scrollview.h =================================================================== --- viewer/scrollview.h (révision 685) +++ viewer/scrollview.h (révision 686) @@ -36,6 +36,11 @@ #include +// Include automatically generated configuration file if running autoconf. +#ifdef HAVE_CONFIG_H +#include "config_auto.h" +#endif + class ScrollView; class SVNetwork; class SVMutex; Index: viewer/svpaint.cpp =================================================================== --- viewer/svpaint.cpp (révision 685) +++ viewer/svpaint.cpp (révision 686) @@ -11,12 +11,12 @@ // - A LMB click either draws point-to-point, point or text. // - A LMB dragging either draws a line, a rectangle or ellipse. - #include "scrollview.h" #include "svmnode.h" #include #include +#ifndef GRAPHICS_DISABLED // The current color values we use, initially white (== ScrollView::WHITE). int rgb[3] = { 255, 255, 255 }; @@ -218,3 +218,4 @@ if (argc > 1) { server_name = argv[1]; } else { server_name = "localhost"; } SVPaint svp(server_name); } +#endif // GRAPHICS_DISABLED Index: configure.ac =================================================================== --- configure.ac (révision 685) +++ configure.ac (révision 686) @@ -75,12 +75,13 @@ AC_MSG_CHECKING(--enable-graphics argument) AC_ARG_ENABLE([graphics], - [ --enable-graphics Enable graphics (ScrollView) (default).], + [AC_HELP_STRING([--enable-graphics],[enable graphics (ScrollView) (default)]) +AC_HELP_STRING([--disable-graphics],[disable graphics (ScrollView)])], [enable_graphics=$enableval], [enable_graphics="yes"]) AC_MSG_RESULT($enable_graphics) if test "$enable_graphics" = "no"; then - AC_DEFINE([DISABLE_GRAPHICS], [], [Disable graphics]) + AC_DEFINE([GRAPHICS_DISABLED], [], [Disable graphics]) fi # check whether to build embedded version @@ -97,10 +98,24 @@ AC_SUBST([AM_CPPFLAGS], [-DEMBEDDED]) fi +# check whether to build embedded version +AC_MSG_CHECKING(--enable-embedded argument) +AC_ARG_ENABLE([embedded], + [ --enable-embedded enable embedded build (default=no)], + [enable_embedded=$enableval], + [enable_embedded="no"]) +AC_MSG_RESULT($enable_embedded) +AM_CONDITIONAL([EMBEDDED], [test "$enable_embedded" = "yes"]) +if test "$enable_embedded" = "yes"; then + #AC_DEFINE([EMBEDDED], [], [Embedded Mode]) + AC_SUBST([AM_CXXFLAGS], [-DEMBEDDED]) + AC_SUBST([AM_CPPFLAGS], [-DEMBEDDED]) +fi + # check whether to build multiple libraries AC_MSG_CHECKING(--enable-multiple-libraries argument) AC_ARG_ENABLE([multiple-libraries], - [ --enable-multiple-libraries Enable multiple libraries.], + [AC_HELP_STRING([--enable-multiple-libraries],[enable multiple libraries (default=no)])], [enable_mlibs=$enableval], [enable_mlibs="no"]) AC_MSG_RESULT($enable_mlibs) Index: ccutil/scanutils.cpp =================================================================== --- ccutil/scanutils.cpp (révision 685) +++ ccutil/scanutils.cpp (révision 686) @@ -19,6 +19,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#ifdef EMBEDDED + #include #include #include Index: textord/tordmain.cpp =================================================================== --- textord/tordmain.cpp (révision 685) +++ textord/tordmain.cpp (révision 686) @@ -242,8 +242,11 @@ TO_BLOCK_IT block_it = blocks; // destination iterator TO_BLOCK *block; // created block + #ifndef GRAPHICS_DISABLED if (to_win != NULL) to_win->Clear(); + #endif // GRAPHICS_DISABLED + for (block_it.mark_cycle_pt(); !block_it.cycled_list(); block_it.forward()) { block = block_it.data(); @@ -258,7 +261,8 @@ tesseract::CCStruct::kXHeightFraction; block->line_size *= textord_min_linesize; block->max_blob_size = block->line_size * textord_excess_blobsize; -#ifndef GRAPHICS_DISABLED + + #ifndef GRAPHICS_DISABLED if (textord_show_blobs && testing_on) { if (to_win == NULL) create_to_win(page_tr); @@ -272,7 +276,7 @@ plot_box_list(to_win, &block->large_blobs, ScrollView::WHITE); plot_box_list(to_win, &block->blobs, ScrollView::WHITE); } -#endif + #endif // GRAPHICS_DISABLED } } Index: textord/colpartitionset.cpp =================================================================== --- textord/colpartitionset.cpp (révision 685) +++ textord/colpartitionset.cpp (révision 686) @@ -374,12 +374,14 @@ // Display the edges of the columns at the given y coords. void ColPartitionSet::DisplayColumnEdges(int y_bottom, int y_top, ScrollView* win) { + #ifndef GRAPHICS_DISABLED ColPartition_IT it(&parts_); for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) { ColPartition* part = it.data(); win->Line(part->LeftAtY(y_top), y_top, part->LeftAtY(y_bottom), y_bottom); win->Line(part->RightAtY(y_top), y_top, part->RightAtY(y_bottom), y_bottom); } + #endif // GRAPHICS_DISABLED } // Return the ColumnSpanningType that best explains the columns overlapped Index: textord/tabfind.cpp =================================================================== --- textord/tabfind.cpp (révision 685) +++ textord/tabfind.cpp (révision 686) @@ -460,8 +460,10 @@ BLOBNBOX_LIST* image_blobs, TO_BLOCK* block, int min_gutter_width, FCOORD* deskew, FCOORD* reskew) { + #ifndef GRAPHICS_DISABLED ScrollView* tab_win = FindInitialTabVectors(image_blobs, min_gutter_width, block); + #endif TabVector::MergeSimilarTabVectors(vertical_skew_, &vectors_, this); SortVectors(); CleanupTabs(); @@ -459,6 +459,7 @@ return false; // Skew angle is too large. part_grid->Deskew(*deskew); ApplyTabConstraints(); + #ifndef GRAPHICS_DISABLED if (textord_tabfind_show_finaltabs) { tab_win = MakeWindow(640, 50, "FinalTabs"); if (textord_debug_images) { @@ -470,6 +471,7 @@ } tab_win = DisplayTabVectors(tab_win); } + #endif // GRAPHICS_DISABLED return true; } @@ -597,6 +603,7 @@ left_tab_boxes_.sort(SortByBoxLeft); right_tab_boxes_.sort(SortRightToLeft); ScrollView* tab_win = NULL; + #ifndef GRAPHICS_DISABLED if (textord_tabfind_show_initialtabs) { tab_win = MakeWindow(0, 100, "InitialTabs"); tab_win->Pen(ScrollView::BLUE); @@ -606,6 +613,7 @@ DisplayBoxVector(right_tab_boxes_, tab_win); tab_win = DisplayTabs("Tabs", tab_win); } + #endif // GRAPHICS_DISABLED return tab_win; } @@ -857,6 +859,7 @@ // Set the aligned_text_ member of each blob, so text lines traces // get terminated where there is a change from text to image. ComputeBlobGoodness(); + #ifndef GRAPHICS_DISABLED if (tab_win != NULL) tab_win->Pen(ScrollView::WHITE); // Accumulate column sections into a STATS @@ -892,6 +892,7 @@ if (tab_win != NULL) { tab_win->Update(); } + #endif // Now make a list of column widths. ICOORDELT_IT w_it(&column_widths_); int total_col_count = col_widths.get_total(); Index: textord/colfind.cpp =================================================================== --- textord/colfind.cpp (révision 685) +++ textord/colfind.cpp (révision 686) @@ -304,11 +304,13 @@ // Recompute margins based on a local neighbourhood search. part_grid_.GridFindMargins(best_columns_); SetPartitionTypes(); + #ifndef GRAPHICS_DISABLED if (textord_tabfind_show_initial_partitions) { ScrollView* part_win = MakeWindow(100, 300, "InitialPartitions"); part_grid_.DisplayBoxes(part_win); DisplayTabVectors(part_win); } + #endif if (textord_tabfind_find_tables) { TableFinder table_finder; @@ -328,6 +330,8 @@ part_grid_.FindFigureCaptions(); part_grid_.RefinePartitionPartners(true); SmoothPartnerRuns(); + + #ifndef GRAPHICS_DISABLED if (textord_tabfind_show_partitions) { ScrollView* window = MakeWindow(400, 300, "Partitions"); if (textord_debug_images) @@ -424,6 +429,7 @@ delete window->AwaitEvent(SVET_DESTROY); } } + #endif // GRAPHICS_DISABLED part_grid_.AssertNoDuplicates(); // Ownership of the ColPartitions moves from part_sets_ to part_grid_ here, // and ownership of the BLOBNBOXes moves to the ColPartitions. @@ -442,6 +448,7 @@ DisplayBlocks(blocks); RotateAndReskewBlocks(input_is_rtl, to_blocks); int result = 0; + #ifndef GRAPHICS_DISABLED if (blocks_win_ != NULL) { bool waiting = false; do { @@ -460,6 +467,7 @@ delete event; } while (waiting); } + #endif // GRAPHICS_DISABLED return result; } Index: textord/tablefind.cpp =================================================================== --- textord/tablefind.cpp (révision 685) +++ textord/tablefind.cpp (révision 686) @@ -742,6 +742,7 @@ set_global_median_xheight(static_cast(xheight_stats.median() + 0.5)); set_global_median_blob_width(static_cast(width_stats.median() + 0.5)); set_global_median_ledding(static_cast(ledding_stats.median() + 0.5)); + #ifndef GRAPHICS_DISABLED if (textord_tablefind_show_stats) { const char* kWindowName = "X-height (R), X-width (G), and ledding (B)"; ScrollView* stats_win = MakeWindow(500, 10, kWindowName); @@ -749,6 +750,7 @@ width_stats.plot(stats_win, 10, 200, 2, 15, ScrollView::GREEN); ledding_stats.plot(stats_win, 10, 200, 2, 15, ScrollView::BLUE); } + #endif // GRAPHICS_DISABLED } void TableFinder::set_global_median_xheight(int xheight) { Index: textord/strokewidth.cpp =================================================================== --- textord/strokewidth.cpp (révision 685) +++ textord/strokewidth.cpp (révision 686) @@ -133,7 +133,9 @@ StrokeWidth::~StrokeWidth() { if (widths_win_ != NULL) { + #ifndef GRAPHICS_DISABLED delete widths_win_->AwaitEvent(SVET_DESTROY); + #endif // GRAPHICS_DISABLED if (textord_tabfind_only_strokewidths) exit(0); delete widths_win_; @@ -491,11 +491,13 @@ best_blob->set_leader_on_right(true); else best_blob->set_leader_on_left(true); + #ifndef GRAPHICS_DISABLED if (leaders_win_ != NULL) { leaders_win_->Pen(left_of_part ? ScrollView::RED : ScrollView::GREEN); const TBOX& blob_box = best_blob->bounding_box(); leaders_win_->Rectangle(blob_box.left(), blob_box.bottom(), blob_box.right(), blob_box.top()); } + #endif } } Index: textord/colpartition.cpp =================================================================== --- textord/colpartition.cpp (révision 685) +++ textord/colpartition.cpp (révision 686) @@ -1718,6 +1718,7 @@ return copy; } +#ifndef GRAPHICS_DISABLED // Provides a color for BBGrid to draw the rectangle. // Must be kept in sync with PolyBlockType. ScrollView::Color ColPartition::BoxColor() const { @@ -1725,6 +1726,7 @@ return BLOBNBOX::TextlineColor(blob_type_, flow_); return POLY_BLOCK::ColorForPolyBlockType(type_); } +#endif // GRAPHICS_DISABLED // Keep in sync with BlobRegionType. static char kBlobTypes[BRT_COUNT + 1] = "NHSRIUVT"; Index: api/baseapi.cpp =================================================================== --- api/baseapi.cpp (révision 685) +++ api/baseapi.cpp (révision 686) @@ -540,7 +540,9 @@ if (truth_cb_ != NULL) truth_cb_->Run(image_height_, page_res_); if (tesseract_->interactive_mode) { + #ifndef GRAPHICS_DISABLED tesseract_->pgeditor_main(rect_width_, rect_height_, page_res_); + #endif // The page_res is invalid after an interactive session, so cleanup // in a way that lets us continue to the next page without crashing. delete page_res_; Index: training/mftraining.cpp =================================================================== --- training/mftraining.cpp (révision 685) +++ training/mftraining.cpp (révision 686) @@ -107,6 +107,7 @@ /*---------------------------------------------------------------------------- Public Code -----------------------------------------------------------------------------*/ +#ifndef GRAPHICS_DISABLED void DisplayProtoList(const char* ch, LIST protolist) { void* window = c_create_window("Char samples", 50, 200, 520, 520, -130.0, 130.0, -130.0, 130.0); @@ -116,6 +117,7 @@ } c_make_current(window); } +#endif // GRAPHICS_DISABLED // Helper to run clustering on a single config. // Mostly copied from the old mftraining, but with renamed variables. @@ -306,8 +307,10 @@ // Merge. MergeInsignificantProtos(ProtoList, CharSample->Label, Clusterer, &Config); + #ifndef GRAPHICS_DISABLED if (strcmp(test_ch, CharSample->Label) == 0) DisplayProtoList(test_ch, ProtoList); + #endif ProtoList = RemoveInsignificantProtos(ProtoList, true, false, Clusterer->SampleSize); Index: classify/adaptmatch.cpp =================================================================== --- classify/adaptmatch.cpp (révision 685) +++ classify/adaptmatch.cpp (révision 686) @@ -228,6 +228,7 @@ // Clears the window and draws baselines. void Classify::RefreshDebugWindow(ScrollView **win, const char *msg, int y_offset, const TBOX &wbox) { + #ifndef GRAPHICS_DISABLED const int kSampleSpaceWidth = 500; if (*win == NULL) { *win = new ScrollView(msg, 100, y_offset, kSampleSpaceWidth * 2, 200, @@ -241,6 +242,7 @@ kSampleSpaceWidth, kBlnXHeight + kBlnBaselineOffset); (*win)->ZoomToRectangle(wbox.left(), wbox.top(), wbox.right(), wbox.bottom()); + #endif // GRAPHICS_DISABLED } // Learns the given word using its chopped_word, seam_array, denorm, @@ -276,6 +278,7 @@ int start_blob = 0; char prev_map_char = '0'; + #ifndef GRAPHICS_DISABLED if (classify_debug_character_fragments) { if (learn_fragmented_word_debug_win_ != NULL) { window_wait(learn_fragmented_word_debug_win_); @@ -287,6 +290,7 @@ word->chopped_word->plot(learn_fragmented_word_debug_win_); ScrollView::Update(); } + #endif // GRAPHICS_DISABLED for (int ch = 0; ch < word_len; ++ch) { if (classify_debug_character_fragments) { @@ -410,6 +414,7 @@ if (rotated_blob == NULL) rotated_blob = blob; + #ifndef GRAPHICS_DISABLED // Draw debug windows showing the blob that is being learned if needed. if (strcmp(classify_learn_debug_str.string(), correct_text) == 0) { RefreshDebugWindow(&learn_debug_win_, "LearnPieces", 600, @@ -424,6 +429,7 @@ ScrollView::BLUE, ScrollView::BROWN); learn_fragments_debug_win_->Update(); } + #endif // GRAPHICS_DISABLED if (filename != NULL) { classify_norm_method.set_value(character); // force char norm spc 30/11/93 Index: classify/intproto.cpp =================================================================== --- classify/intproto.cpp (révision 685) +++ classify/intproto.cpp (révision 686) @@ -168,7 +168,7 @@ INT_CLASS Class, PROTO_ID ProtoId, ScrollView::Color color); -#endif +#endif // GRAPHICS_DISABLED int TruncateParam(FLOAT32 Param, int Min, int Max, char *Id); @@ -1942,7 +1942,7 @@ /*---------------------------------------------------------------------------*/ - +#ifndef GRAPHICS_DISABLED /** * Initializes the int matcher window if it is not already * initialized. @@ -1991,3 +1991,4 @@ ScrollView* CreateFeatureSpaceWindow(const char* name, int xpos, int ypos) { return new ScrollView(name, xpos, ypos, 520, 520, 260, 260, true); } +#endif // GRAPHICS_DISABLED Index: classify/intproto.h =================================================================== --- classify/intproto.h (révision 685) +++ classify/intproto.h (révision 686) @@ -239,6 +239,7 @@ } // namespace tesseract. /*----------------------------------------------------------------------------*/ +#ifndef GRAPHICS_DISABLED void RenderIntFeature(ScrollView *window, const INT_FEATURE_STRUCT* Feature, ScrollView::Color color); @@ -251,5 +252,6 @@ // Creates a window of the appropriate size for displaying elements // in feature space. ScrollView* CreateFeatureSpaceWindow(const char* name, int xpos, int ypos); +#endif // GRAPHICS_DISABLED #endif