提交 59d244b0 编写于 作者: T theraysmith@gmail.com

More fixes for GRAPHICS_DISABLED from Zdenko and Ray

git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@757 d0cd1f9f-072b-0410-8dd7-cf729c803f20
上级 0ed5c670
...@@ -17,6 +17,11 @@ ...@@ -17,6 +17,11 @@
* *
**********************************************************************/ **********************************************************************/
// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#include "mfcpch.h" #include "mfcpch.h"
#include "blobbox.h" #include "blobbox.h"
#include "helpers.h" #include "helpers.h"
...@@ -425,6 +430,13 @@ ScrollView::Color BLOBNBOX::TextlineColor(BlobRegionType region_type, ...@@ -425,6 +430,13 @@ ScrollView::Color BLOBNBOX::TextlineColor(BlobRegionType region_type,
ScrollView::Color BLOBNBOX::BoxColor() const { ScrollView::Color BLOBNBOX::BoxColor() const {
return TextlineColor(region_type_, flow_); return TextlineColor(region_type_, flow_);
} }
void BLOBNBOX::plot(ScrollView* window, // window to draw in
ScrollView::Color blob_colour, // for outer bits
ScrollView::Color child_colour) { // for holes
if (cblob_ptr != NULL)
cblob_ptr->plot(window, blob_colour, child_colour);
}
#endif #endif
/********************************************************************** /**********************************************************************
* find_cblob_limits * find_cblob_limits
......
...@@ -431,10 +431,7 @@ class BLOBNBOX:public ELIST_LINK ...@@ -431,10 +431,7 @@ class BLOBNBOX:public ELIST_LINK
void plot(ScrollView* window, // window to draw in void plot(ScrollView* window, // window to draw in
ScrollView::Color blob_colour, // for outer bits ScrollView::Color blob_colour, // for outer bits
ScrollView::Color child_colour) { // for holes ScrollView::Color child_colour); // for holes
if (cblob_ptr != NULL)
cblob_ptr->plot(window, blob_colour, child_colour);
}
#endif #endif
// Initializes the bulk of the members to default values for use at // Initializes the bulk of the members to default values for use at
......
...@@ -26,6 +26,11 @@ ...@@ -26,6 +26,11 @@
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
I n c l u d e s I n c l u d e s
----------------------------------------------------------------------*/ ----------------------------------------------------------------------*/
// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#include "mfcpch.h" #include "mfcpch.h"
#include "blobs.h" #include "blobs.h"
#include "ccstruct.h" #include "ccstruct.h"
...@@ -219,9 +224,9 @@ TBOX TESSLINE::bounding_box() const { ...@@ -219,9 +224,9 @@ TBOX TESSLINE::bounding_box() const {
return TBOX(topleft.x, botright.y, botright.x, topleft.y); return TBOX(topleft.x, botright.y, botright.x, topleft.y);
} }
#ifndef GRAPHICS_DISABLED
void TESSLINE::plot(ScrollView* window, ScrollView::Color color, void TESSLINE::plot(ScrollView* window, ScrollView::Color color,
ScrollView::Color child_color) { ScrollView::Color child_color) {
#ifndef GRAPHICS_DISABLED
if (is_hole) if (is_hole)
window->Pen(child_color); window->Pen(child_color);
else else
...@@ -236,8 +241,8 @@ void TESSLINE::plot(ScrollView* window, ScrollView::Color color, ...@@ -236,8 +241,8 @@ void TESSLINE::plot(ScrollView* window, ScrollView::Color color,
else else
window->DrawTo(pt->pos.x, pt->pos.y); window->DrawTo(pt->pos.x, pt->pos.y);
} while (pt != loop); } while (pt != loop);
#endif // GRAPHICS_DISABLED
} }
#endif // GRAPHICS_DISABLED
// Iterate the given list of outlines, converting to TESSLINE by polygonal // Iterate the given list of outlines, converting to TESSLINE by polygonal
// approximation and recursively any children, returning the current tail // approximation and recursively any children, returning the current tail
...@@ -387,11 +392,13 @@ TBOX TBLOB::bounding_box() const { ...@@ -387,11 +392,13 @@ TBOX TBLOB::bounding_box() const {
return box; return box;
} }
#ifndef GRAPHICS_DISABLED
void TBLOB::plot(ScrollView* window, ScrollView::Color color, void TBLOB::plot(ScrollView* window, ScrollView::Color color,
ScrollView::Color child_color) { ScrollView::Color child_color) {
for (TESSLINE* outline = outlines; outline != NULL; outline = outline->next) for (TESSLINE* outline = outlines; outline != NULL; outline = outline->next)
outline->plot(window, color, child_color); outline->plot(window, color, child_color);
} }
#endif // GRAPHICS_DISABLED
// Factory to build a TWERD from a (C_BLOB) WERD, with polygonal // Factory to build a TWERD from a (C_BLOB) WERD, with polygonal
// approximation along the way. // approximation along the way.
...@@ -511,6 +518,7 @@ void TWERD::MergeBlobs(int start, int end) { ...@@ -511,6 +518,7 @@ void TWERD::MergeBlobs(int start, int end) {
} }
} }
#ifndef GRAPHICS_DISABLED
void TWERD::plot(ScrollView* window) { void TWERD::plot(ScrollView* window) {
ScrollView::Color color = WERD::NextColor(ScrollView::BLACK); ScrollView::Color color = WERD::NextColor(ScrollView::BLACK);
for (TBLOB* blob = blobs; blob != NULL; blob = blob->next) { for (TBLOB* blob = blobs; blob != NULL; blob = blob->next) {
...@@ -518,6 +526,7 @@ void TWERD::plot(ScrollView* window) { ...@@ -518,6 +526,7 @@ void TWERD::plot(ScrollView* window) {
color = WERD::NextColor(color); color = WERD::NextColor(color);
} }
} }
#endif // GRAPHICS_DISABLED
/********************************************************************** /**********************************************************************
* blob_origin * blob_origin
...@@ -569,7 +578,7 @@ WIDTH_RECORD *blobs_widths(TBLOB *blobs) { /*blob to compute on */ ...@@ -569,7 +578,7 @@ WIDTH_RECORD *blobs_widths(TBLOB *blobs) { /*blob to compute on */
* *
* Return a count of the number of blobs attached to this one. * Return a count of the number of blobs attached to this one.
**********************************************************************/ **********************************************************************/
int count_blobs(TBLOB *blobs) { int count_blobs(TBLOB *blobs) {
int x = 0; int x = 0;
for (TBLOB* b = blobs; b != NULL; b = b->next) for (TBLOB* b = blobs; b != NULL; b = b->next)
......
...@@ -154,8 +154,10 @@ struct TESSLINE { ...@@ -154,8 +154,10 @@ struct TESSLINE {
botright.y <= pt.y && pt.y <= topleft.y; botright.y <= pt.y && pt.y <= topleft.y;
} }
#ifndef GRAPHICS_DISABLED
void plot(ScrollView* window, ScrollView::Color color, void plot(ScrollView* window, ScrollView::Color color,
ScrollView::Color child_color); ScrollView::Color child_color);
#endif // GRAPHICS_DISABLED
int BBArea() const { int BBArea() const {
return (botright.x - topleft.x) * (topleft.y - botright.y); return (botright.x - topleft.x) * (topleft.y - botright.y);
...@@ -210,8 +212,10 @@ struct TBLOB { ...@@ -210,8 +212,10 @@ struct TBLOB {
TBOX bounding_box() const; TBOX bounding_box() const;
#ifndef GRAPHICS_DISABLED
void plot(ScrollView* window, ScrollView::Color color, void plot(ScrollView* window, ScrollView::Color color,
ScrollView::Color child_color); ScrollView::Color child_color);
#endif // GRAPHICS_DISABLED
int BBArea() const { int BBArea() const {
int total_area = 0; int total_area = 0;
......
...@@ -158,9 +158,11 @@ class DLLSYM C_OUTLINE:public ELIST_LINK ...@@ -158,9 +158,11 @@ class DLLSYM C_OUTLINE:public ELIST_LINK
// being the coords of the upper-left corner of the pix. // being the coords of the upper-left corner of the pix.
void render_outline(int left, int top, Pix* pix) const; void render_outline(int left, int top, Pix* pix) const;
#ifndef GRAPHICS_DISABLED
void plot( //draw one void plot( //draw one
ScrollView* window, //window to draw in ScrollView* window, //window to draw in
ScrollView::Color colour) const; //colour to draw it ScrollView::Color colour) const; //colour to draw it
#endif // GRAPHICS_DISABLED
C_OUTLINE& operator=(const C_OUTLINE& source); C_OUTLINE& operator=(const C_OUTLINE& source);
......
...@@ -187,7 +187,6 @@ void ROW::plot( //draw it ...@@ -187,7 +187,6 @@ void ROW::plot( //draw it
word->plot (window, colour); //all in one colour word->plot (window, colour); //all in one colour
} }
} }
#endif
/********************************************************************** /**********************************************************************
* ROW::plot * ROW::plot
...@@ -195,7 +194,6 @@ void ROW::plot( //draw it ...@@ -195,7 +194,6 @@ void ROW::plot( //draw it
* Draw the ROW in rainbow colours. * Draw the ROW in rainbow colours.
**********************************************************************/ **********************************************************************/
#ifndef GRAPHICS_DISABLED
void ROW::plot( //draw it void ROW::plot( //draw it
ScrollView* window //window to draw in ScrollView* window //window to draw in
) { ) {
...@@ -207,7 +205,7 @@ void ROW::plot( //draw it ...@@ -207,7 +205,7 @@ void ROW::plot( //draw it
word->plot (window); //in rainbow colours word->plot (window); //in rainbow colours
} }
} }
#endif #endif // GRAPHICS_DISABLED
/********************************************************************** /**********************************************************************
* ROW::operator= * ROW::operator=
......
...@@ -121,20 +121,20 @@ class ROW:public ELIST_LINK ...@@ -121,20 +121,20 @@ class ROW:public ELIST_LINK
void print( //print void print( //print
FILE *fp); //file to print on FILE *fp); //file to print on
#ifndef GRAPHICS_DISABLED
void plot( //draw one void plot( //draw one
ScrollView* window, //window to draw in ScrollView* window, //window to draw in
ScrollView::Color colour); //uniform colour ScrollView::Color colour); //uniform colour
void plot( //draw one void plot( //draw one
ScrollView* window); //in rainbow colours ScrollView* window); //in rainbow colours
#ifndef GRAPHICS_DISABLED
void plot_baseline( //draw the baseline void plot_baseline( //draw the baseline
ScrollView* window, //window to draw in ScrollView* window, //window to draw in
ScrollView::Color colour) { //colour to draw ScrollView::Color colour) { //colour to draw
//draw it //draw it
baseline.plot (window, colour); baseline.plot (window, colour);
} }
#endif #endif // GRAPHICS_DISABLED
ROW& operator= (const ROW & source); ROW& operator= (const ROW & source);
private: private:
......
...@@ -93,6 +93,8 @@ class PDBLK ...@@ -93,6 +93,8 @@ class PDBLK
// Returns a binary Pix mask with a 1 pixel for every pixel within the // Returns a binary Pix mask with a 1 pixel for every pixel within the
// block. Rotates the coordinate system by rerotation prior to rendering. // block. Rotates the coordinate system by rerotation prior to rendering.
Pix* render_mask(const FCOORD& rerotation); Pix* render_mask(const FCOORD& rerotation);
#ifndef GRAPHICS_DISABLED
///draw histogram ///draw histogram
///@param window window to draw in ///@param window window to draw in
///@param serial serial number ///@param serial serial number
...@@ -100,7 +102,7 @@ class PDBLK ...@@ -100,7 +102,7 @@ class PDBLK
void plot(ScrollView* window, void plot(ScrollView* window,
inT32 serial, inT32 serial,
ScrollView::Color colour); ScrollView::Color colour);
#endif // GRAPHICS_DISABLED
///show image ///show image
///@param image image to show ///@param image image to show
///@param window window to show in ///@param window window to show in
......
...@@ -393,7 +393,7 @@ int lessthan(const void *first, const void *second) { ...@@ -393,7 +393,7 @@ int lessthan(const void *first, const void *second) {
return (0); return (0);
} }
#ifndef GRAPHICS_DISABLED
/// Returns a color to draw the given type. /// Returns a color to draw the given type.
ScrollView::Color POLY_BLOCK::ColorForPolyBlockType(PolyBlockType type) { ScrollView::Color POLY_BLOCK::ColorForPolyBlockType(PolyBlockType type) {
// Keep kPBColors in sync with PolyBlockType. // Keep kPBColors in sync with PolyBlockType.
...@@ -419,3 +419,4 @@ ScrollView::Color POLY_BLOCK::ColorForPolyBlockType(PolyBlockType type) { ...@@ -419,3 +419,4 @@ ScrollView::Color POLY_BLOCK::ColorForPolyBlockType(PolyBlockType type) {
} }
return ScrollView::WHITE; return ScrollView::WHITE;
} }
#endif // GRAPHICS_DISABLED
...@@ -65,7 +65,9 @@ class DLLSYM POLY_BLOCK { ...@@ -65,7 +65,9 @@ class DLLSYM POLY_BLOCK {
void plot(ScrollView* window, inT32 num); void plot(ScrollView* window, inT32 num);
#ifndef GRAPHICS_DISABLED
void fill(ScrollView* window, ScrollView::Color colour); void fill(ScrollView* window, ScrollView::Color colour);
#endif // GRAPHICS_DISABLED
// Returns true if other is inside this. // Returns true if other is inside this.
bool contains(POLY_BLOCK *other); bool contains(POLY_BLOCK *other);
...@@ -78,10 +80,11 @@ class DLLSYM POLY_BLOCK { ...@@ -78,10 +80,11 @@ class DLLSYM POLY_BLOCK {
// test_pt outside this. // test_pt outside this.
inT16 winding_number(const ICOORD &test_pt); inT16 winding_number(const ICOORD &test_pt);
#ifndef GRAPHICS_DISABLED
// Static utility functions to handle the PolyBlockType. // Static utility functions to handle the PolyBlockType.
// Returns a color to draw the given type. // Returns a color to draw the given type.
static ScrollView::Color ColorForPolyBlockType(PolyBlockType type); static ScrollView::Color ColorForPolyBlockType(PolyBlockType type);
#endif // GRAPHICS_DISABLED
private: private:
ICOORDELT_LIST vertices; // vertices ICOORDELT_LIST vertices; // vertices
......
...@@ -17,6 +17,11 @@ ...@@ -17,6 +17,11 @@
* *
**********************************************************************/ **********************************************************************/
// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#include "mfcpch.h" //precompiled headers #include "mfcpch.h" //precompiled headers
#include "statistc.h" #include "statistc.h"
#include <string.h> #include <string.h>
...@@ -26,11 +31,6 @@ ...@@ -26,11 +31,6 @@
#include "scrollview.h" #include "scrollview.h"
#include "tprintf.h" #include "tprintf.h"
// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
/********************************************************************** /**********************************************************************
* STATS::STATS * STATS::STATS
* *
......
...@@ -59,10 +59,12 @@ class C_BLOB:public ELIST_LINK ...@@ -59,10 +59,12 @@ class C_BLOB:public ELIST_LINK
// pixDestroy after use. // pixDestroy after use.
Pix* render_outline(); Pix* render_outline();
#ifndef GRAPHICS_DISABLED
void plot( //draw one void plot( //draw one
ScrollView* window, //window to draw in ScrollView* window, //window to draw in
ScrollView::Color blob_colour, //for outer bits ScrollView::Color blob_colour, //for outer bits
ScrollView::Color child_colour); //for holes ScrollView::Color child_colour); //for holes
#endif // GRAPHICS_DISABLED
C_BLOB& operator= (const C_BLOB & source) { C_BLOB& operator= (const C_BLOB & source) {
if (!outlines.empty ()) if (!outlines.empty ())
......
...@@ -291,7 +291,6 @@ void WERD::plot(ScrollView *window, ScrollView::Color colour) { ...@@ -291,7 +291,6 @@ void WERD::plot(ScrollView *window, ScrollView::Color colour) {
} }
plot_rej_blobs(window); plot_rej_blobs(window);
} }
#endif // GRAPHICS_DISABLED
// Get the next color in the (looping) rainbow. // Get the next color in the (looping) rainbow.
ScrollView::Color WERD::NextColor(ScrollView::Color colour) { ScrollView::Color WERD::NextColor(ScrollView::Color colour) {
...@@ -301,7 +300,6 @@ ScrollView::Color WERD::NextColor(ScrollView::Color colour) { ...@@ -301,7 +300,6 @@ ScrollView::Color WERD::NextColor(ScrollView::Color colour) {
return next; return next;
} }
#ifndef GRAPHICS_DISABLED
/** /**
* WERD::plot * WERD::plot
* *
......
...@@ -144,12 +144,10 @@ class WERD : public ELIST2_LINK { ...@@ -144,12 +144,10 @@ class WERD : public ELIST2_LINK {
#ifndef GRAPHICS_DISABLED #ifndef GRAPHICS_DISABLED
// plot word on window in a uniform colour // plot word on window in a uniform colour
void plot(ScrollView *window, ScrollView::Color colour); void plot(ScrollView *window, ScrollView::Color colour);
#endif // GRAPHICS_DISABLED
// Get the next color in the (looping) rainbow. // Get the next color in the (looping) rainbow.
static ScrollView::Color NextColor(ScrollView::Color colour); static ScrollView::Color NextColor(ScrollView::Color colour);
#ifndef GRAPHICS_DISABLED
// plot word on window in a rainbow of colours // plot word on window in a rainbow of colours
void plot(ScrollView *window); void plot(ScrollView *window);
......
...@@ -16,6 +16,11 @@ ...@@ -16,6 +16,11 @@
// //
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#include "classify.h" #include "classify.h"
#include "fontinfo.h" #include "fontinfo.h"
#include "intproto.h" #include "intproto.h"
......
...@@ -16,6 +16,12 @@ ...@@ -16,6 +16,12 @@
** See the License for the specific language governing permissions and ** See the License for the specific language governing permissions and
** limitations under the License. ** limitations under the License.
******************************************************************************/ ******************************************************************************/
// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
Include Files and Type Defines Include Files and Type Defines
----------------------------------------------------------------------------*/ ----------------------------------------------------------------------------*/
...@@ -30,11 +36,6 @@ ...@@ -30,11 +36,6 @@
#include "shapetable.h" #include "shapetable.h"
#include <math.h> #include <math.h>
// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
Global Data Definitions and Declarations Global Data Definitions and Declarations
----------------------------------------------------------------------------*/ ----------------------------------------------------------------------------*/
......
...@@ -19,6 +19,11 @@ ...@@ -19,6 +19,11 @@
// //
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#include "mastertrainer.h" #include "mastertrainer.h"
#include <math.h> #include <math.h>
#include <time.h> #include <time.h>
......
...@@ -13,6 +13,11 @@ ...@@ -13,6 +13,11 @@
// //
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#include "trainingsample.h" #include "trainingsample.h"
#include <math.h> #include <math.h>
......
...@@ -17,6 +17,11 @@ ...@@ -17,6 +17,11 @@
* *
**********************************************************************/ **********************************************************************/
// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#include "mfcpch.h" #include "mfcpch.h"
#include "errcode.h" #include "errcode.h"
#ifdef __UNIX__ #ifdef __UNIX__
...@@ -32,11 +37,6 @@ ...@@ -32,11 +37,6 @@
#include "host.h" #include "host.h"
#include "unichar.h" #include "unichar.h"
// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
void void
cprintf ( //Trace printf cprintf ( //Trace printf
const char *format, ... //special message const char *format, ... //special message
......
...@@ -105,9 +105,11 @@ Pix* CCNonTextDetect::ComputeNonTextMask(bool debug, Pix* photo_map, ...@@ -105,9 +105,11 @@ Pix* CCNonTextDetect::ComputeNonTextMask(bool debug, Pix* photo_map,
pixWrite("junknoisemask.png", pix, IFF_PNG); pixWrite("junknoisemask.png", pix, IFF_PNG);
} }
ScrollView* win = NULL; ScrollView* win = NULL;
#ifndef GRAPHICS_DISABLED
if (debug) { if (debug) {
win = MakeWindow(0, 400, "Photo Mask Blobs"); win = MakeWindow(0, 400, "Photo Mask Blobs");
} }
#endif // GRAPHICS_DISABLED
// Large and medium blobs are not text if they overlap with "a lot" of small // Large and medium blobs are not text if they overlap with "a lot" of small
// blobs. // blobs.
MarkAndDeleteNonTextBlobs(&blob_block->large_blobs, MarkAndDeleteNonTextBlobs(&blob_block->large_blobs,
...@@ -136,8 +138,8 @@ Pix* CCNonTextDetect::ComputeNonTextMask(bool debug, Pix* photo_map, ...@@ -136,8 +138,8 @@ Pix* CCNonTextDetect::ComputeNonTextMask(bool debug, Pix* photo_map,
pixWrite("junkccphotomask.png", pix, IFF_PNG); pixWrite("junkccphotomask.png", pix, IFF_PNG);
#ifndef GRAPHICS_DISABLED #ifndef GRAPHICS_DISABLED
delete win->AwaitEvent(SVET_DESTROY); delete win->AwaitEvent(SVET_DESTROY);
#endif // GRAPHICS_DISABLED
delete win; delete win;
#endif // GRAPHICS_DISABLED
} }
return pix; return pix;
} }
......
...@@ -22,6 +22,11 @@ ...@@ -22,6 +22,11 @@
#pragma warning(disable:4244) // Conversion warnings #pragma warning(disable:4244) // Conversion warnings
#endif #endif
// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#include "colfind.h" #include "colfind.h"
#include "ccnontextdetect.h" #include "ccnontextdetect.h"
...@@ -37,11 +42,6 @@ ...@@ -37,11 +42,6 @@
#include "params.h" #include "params.h"
#include "workingpartset.h" #include "workingpartset.h"
// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
namespace tesseract { namespace tesseract {
// Minimum width (in pixels) to be considered when making columns. // Minimum width (in pixels) to be considered when making columns.
......
...@@ -660,8 +660,10 @@ class ColPartition : public ELIST2_LINK { ...@@ -660,8 +660,10 @@ class ColPartition : public ELIST2_LINK {
// treated as read-only. // treated as read-only.
ColPartition* CopyButDontOwnBlobs(); ColPartition* CopyButDontOwnBlobs();
#ifndef GRAPHICS_DISABLED
// Provides a color for BBGrid to draw the rectangle. // Provides a color for BBGrid to draw the rectangle.
ScrollView::Color BoxColor() const; ScrollView::Color BoxColor() const;
#endif // GRAPHICS_DISABLED
// Prints debug information on this. // Prints debug information on this.
void Print() const; void Print() const;
......
...@@ -17,6 +17,11 @@ ...@@ -17,6 +17,11 @@
// //
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#include "drawtord.h" #include "drawtord.h"
#include "textord.h" #include "textord.h"
#include "makerow.h" #include "makerow.h"
......
...@@ -36,6 +36,11 @@ ...@@ -36,6 +36,11 @@
#endif #endif
#endif #endif
// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#include "classify.h" #include "classify.h"
#include "cluster.h" #include "cluster.h"
#include "clusttool.h" #include "clusttool.h"
......
...@@ -16,6 +16,11 @@ ...@@ -16,6 +16,11 @@
// training data of whole, partial or multiple characters. // training data of whole, partial or multiple characters.
// Author: Ray Smith // Author: Ray Smith
// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#ifndef USE_STD_NAMESPACE #ifndef USE_STD_NAMESPACE
#include "base/commandlineflags.h" #include "base/commandlineflags.h"
#endif #endif
......
...@@ -34,9 +34,8 @@ ...@@ -34,9 +34,8 @@
#include "config_auto.h" #include "config_auto.h"
#endif #endif
#ifndef GRAPHICS_DISABLED #include "scrollview.h"
// This class contains the main ScrollView-logic,
// e.g. parsing & sending messages, images etc.
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(disable:4786) // Don't give stupid warnings for stl #pragma warning(disable:4786) // Don't give stupid warnings for stl
#pragma warning(disable:4018) // signed/unsigned warnings #pragma warning(disable:4018) // signed/unsigned warnings
...@@ -47,7 +46,6 @@ const int kSvPort = 8461; ...@@ -47,7 +46,6 @@ const int kSvPort = 8461;
const int kMaxMsgSize = 4096; const int kMaxMsgSize = 4096;
const int kMaxIntPairSize = 45; // Holds %d,%d, for upto 64 bit. const int kMaxIntPairSize = 45; // Holds %d,%d, for upto 64 bit.
#include "scrollview.h"
#include "svutil.h" #include "svutil.h"
#include "allheaders.h" #include "allheaders.h"
...@@ -82,6 +80,7 @@ SVEvent* SVEvent::copy() { ...@@ -82,6 +80,7 @@ SVEvent* SVEvent::copy() {
return any; return any;
} }
#ifndef GRAPHICS_DISABLED
/// This is the main loop which handles the ScrollView-logic from the server /// This is the main loop which handles the ScrollView-logic from the server
/// to the client. It basically loops through messages, parses them to events /// to the client. It basically loops through messages, parses them to events
/// and distributes it to the waiting handlers. /// and distributes it to the waiting handlers.
...@@ -357,8 +356,10 @@ void* ScrollView::StartEventHandler(void* a) { ...@@ -357,8 +356,10 @@ void* ScrollView::StartEventHandler(void* a) {
} while (sv != NULL); } while (sv != NULL);
return 0; return 0;
} }
#endif // GRAPHICS_DISABLED
ScrollView::~ScrollView() { ScrollView::~ScrollView() {
#ifndef GRAPHICS_DISABLED
svmap_mu->Lock(); svmap_mu->Lock();
if (svmap[window_id_] != NULL) { if (svmap[window_id_] != NULL) {
svmap_mu->Unlock(); svmap_mu->Unlock();
...@@ -381,8 +382,10 @@ ScrollView::~ScrollView() { ...@@ -381,8 +382,10 @@ ScrollView::~ScrollView() {
delete mutex_; delete mutex_;
delete semaphore_; delete semaphore_;
delete points_; delete points_;
#endif // GRAPHICS_DISABLED
} }
#ifndef GRAPHICS_DISABLED
/// Send a message to the server, attaching the window id. /// Send a message to the server, attaching the window id.
void ScrollView::SendMsg(const char* format, ...) { void ScrollView::SendMsg(const char* format, ...) {
if (!points_->empty) if (!points_->empty)
......
...@@ -154,6 +154,8 @@ class ScrollView { ...@@ -154,6 +154,8 @@ class ScrollView {
GREEN_YELLOW // Make sure this one is last. GREEN_YELLOW // Make sure this one is last.
}; };
~ScrollView();
#ifndef GRAPHICS_DISABLED #ifndef GRAPHICS_DISABLED
// Create a window. The pixel size of the window may be 0,0, in which case // Create a window. The pixel size of the window may be 0,0, in which case
...@@ -168,8 +170,6 @@ class ScrollView { ...@@ -168,8 +170,6 @@ class ScrollView {
ScrollView(const char* name, int x_pos, int y_pos, int x_size, int y_size, ScrollView(const char* name, int x_pos, int y_pos, int x_size, int y_size,
int x_canvas_size, int y_canvas_size, bool y_axis_reversed, int x_canvas_size, int y_canvas_size, bool y_axis_reversed,
const char* server_name); const char* server_name);
~ScrollView();
/******************************************************************************* /*******************************************************************************
* Event handling * Event handling
* To register as listener, the class has to derive from the SVEventHandler * To register as listener, the class has to derive from the SVEventHandler
......
...@@ -11,12 +11,17 @@ ...@@ -11,12 +11,17 @@
// - A LMB click either draws point-to-point, point or text. // - A LMB click either draws point-to-point, point or text.
// - A LMB dragging either draws a line, a rectangle or ellipse. // - A LMB dragging either draws a line, a rectangle or ellipse.
// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#ifndef GRAPHICS_DISABLED
#include "scrollview.h" #include "scrollview.h"
#include "svmnode.h" #include "svmnode.h"
#include <stdlib.h> #include <stdlib.h>
#include <iostream> #include <iostream>
#ifndef GRAPHICS_DISABLED
// The current color values we use, initially white (== ScrollView::WHITE). // The current color values we use, initially white (== ScrollView::WHITE).
int rgb[3] = { 255, 255, 255 }; int rgb[3] = { 255, 255, 255 };
......
...@@ -22,6 +22,14 @@ ...@@ -22,6 +22,14 @@
** limitations under the License. ** limitations under the License.
* *
*********************************************************************************/ *********************************************************************************/
// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#ifndef GRAPHICS_DISABLED
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
I n c l u d e s I n c l u d e s
----------------------------------------------------------------------*/ ----------------------------------------------------------------------*/
...@@ -32,13 +40,6 @@ ...@@ -32,13 +40,6 @@
#include "const.h" #include "const.h"
#include <math.h> #include <math.h>
// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H
#include "config_auto.h"
#endif
#ifndef GRAPHICS_DISABLED
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
V a r i a b l e s V a r i a b l e s
----------------------------------------------------------------------*/ ----------------------------------------------------------------------*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册