Fix build WITH_NATIVE_GNU_BARCODE enabled.

I verified that app compiles and starts fine with the GnuBarcode backend
enabled. During runtime no noticeable regressions were spotted.

The whole virtual BarkodeEngine::operator=() thing seems to me like
quite a lousy design, but I don't feel comfortable enough to rework the
code.

Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
master
Alexander Golubev 6 days ago committed by Fat-Zer
parent 87107616b8
commit 5602e01ff0

@ -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 )

@ -61,6 +61,7 @@ tde_add_executable( ${PROJECT_NAME} AUTOMOC
tdeabc-shared
${KJS_LIBRARIES}
${PCRE2_LIBRARIES}
${GNU_BARCODE_LIBRARY}
DESTINATION ${BIN_INSTALL_DIR}
)

@ -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;

@ -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<const GnuBarcode*>(&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

@ -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.

Loading…
Cancel
Save