diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index cc77191..bbcb85b 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -30,10 +30,11 @@ endif( WITH_GCC_VISIBILITY ) if( WITH_NATIVE_GNU_BARCODE ) check_include_file( "barcode.h" HAVE_NATIVE_GNU_BARCODE ) - if( HAVE_NATIVE_GNU_BARCODE ) + find_library( GNU_BARCODE_LIBRARY barcode ) + if( HAVE_NATIVE_GNU_BARCODE AND GNU_BARCODE_LIBRARY ) set( _ENABLE_NATIVE_GNU_BARCODE 1 ) else() - tde_message_fatal( "Barcode is requested, but GNU Barcode header was not found on your system" ) + tde_message_fatal( "Barcode is requested, but GNU Barcode library was not found on your system" ) endif() endif( WITH_NATIVE_GNU_BARCODE ) diff --git a/kbarcode/CMakeLists.txt b/kbarcode/CMakeLists.txt index be08786..430fc00 100644 --- a/kbarcode/CMakeLists.txt +++ b/kbarcode/CMakeLists.txt @@ -61,6 +61,7 @@ tde_add_executable( ${PROJECT_NAME} AUTOMOC tdeabc-shared ${KJS_LIBRARIES} ${PCRE2_LIBRARIES} + ${GNU_BARCODE_LIBRARY} DESTINATION ${BIN_INSTALL_DIR} ) diff --git a/kbarcode/barkodeengine.h b/kbarcode/barkodeengine.h index 0975baf..f3bbc6c 100644 --- a/kbarcode/barkodeengine.h +++ b/kbarcode/barkodeengine.h @@ -53,6 +53,7 @@ class BarkodeEngine{ BarkodeEngine(); virtual ~BarkodeEngine(); + // FIXME: the operator should rather be called copySettings() virtual const BarkodeEngine & operator=( const BarkodeEngine & rhs ) = 0; virtual EEngine engine() const = 0; diff --git a/kbarcode/gnubarcode.cpp b/kbarcode/gnubarcode.cpp index deef484..5767493 100644 --- a/kbarcode/gnubarcode.cpp +++ b/kbarcode/gnubarcode.cpp @@ -165,6 +165,33 @@ void GnuBarcode::setupSize() m_size.setHeight( (int)(m_item->height * m_scaley) ); } +const BarkodeEngine &GnuBarcode::operator=( const BarkodeEngine & rhs ) +{ + const GnuBarcode* gb = dynamic_cast(&rhs); + + if( gb ) + { + m_bar_height = gb->m_bar_height; + m_barcode_height = gb->m_barcode_height; + m_font_size = gb->m_font_size; + + m_scalex = gb->m_scalex; + m_scaley = gb->m_scaley; + m_scale_ps_x = gb->m_scale_ps_x; + m_scale_ps_y = gb->m_scale_ps_y; + m_size = gb->m_size; + + if( m_item ) + { + tqDebug("GnuBarcode::operator=() : deleting internal barcode item"); + Barcode_Delete( m_item ); + m_item = NULL; + } + } + + return *this; +} + int GnuBarcode::drawBars( TQPainter* painter, int x, int y ) { #if 0 diff --git a/kbarcode/gnubarcode.h b/kbarcode/gnubarcode.h index 1f71e79..1f66912 100644 --- a/kbarcode/gnubarcode.h +++ b/kbarcode/gnubarcode.h @@ -41,6 +41,7 @@ class GnuBarcode : public BarkodeEngine { void update( const TQPaintDevice* device ); void drawBarcode( TQPainter & painter, int x, int y ); + const BarkodeEngine & operator=( const BarkodeEngine & rhs ); private: /** Draws the barcodes bars if @p painter is not 0. * Otherwise only the required width is returned.