|
|
|
@ -15,6 +15,8 @@
|
|
|
|
|
* *
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
|
|
|
|
|
|
#include "label.h"
|
|
|
|
|
#include "measurements.h"
|
|
|
|
|
#include "kbarcode.h"
|
|
|
|
@ -72,6 +74,13 @@ Label::Label( Definition* _def, TQIODevice* device, TQString labelname, TQPaintD
|
|
|
|
|
|
|
|
|
|
Label::~Label()
|
|
|
|
|
{
|
|
|
|
|
for (DocumentItem *item : m_list)
|
|
|
|
|
{
|
|
|
|
|
if (item)
|
|
|
|
|
{
|
|
|
|
|
delete item;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Label::epcl( TQTextStream* stream )
|
|
|
|
@ -79,7 +88,7 @@ void Label::epcl( TQTextStream* stream )
|
|
|
|
|
*stream << EPCLUtils::header();
|
|
|
|
|
|
|
|
|
|
DocumentItem* item;
|
|
|
|
|
for( item = m_list.first();item;item=m_list.next())
|
|
|
|
|
for (DocumentItem *item : m_list)
|
|
|
|
|
if( drawThisItem( item ) )
|
|
|
|
|
item->drawEPcl( stream );
|
|
|
|
|
|
|
|
|
@ -92,7 +101,7 @@ void Label::ipl( TQTextStream* stream )
|
|
|
|
|
*stream << utils.header();
|
|
|
|
|
|
|
|
|
|
DocumentItem* item;
|
|
|
|
|
for( item = m_list.first();item;item=m_list.next())
|
|
|
|
|
for (DocumentItem *item : m_list)
|
|
|
|
|
if( drawThisItem( item ) )
|
|
|
|
|
item->drawIpl( stream, &utils );
|
|
|
|
|
|
|
|
|
@ -105,7 +114,7 @@ void Label::zpl( TQTextStream* stream )
|
|
|
|
|
*stream << ZPLUtils::header();
|
|
|
|
|
|
|
|
|
|
DocumentItem* item;
|
|
|
|
|
for( item = m_list.first();item;item=m_list.next())
|
|
|
|
|
for (DocumentItem *item : m_list)
|
|
|
|
|
if( drawThisItem( item ) )
|
|
|
|
|
item->drawZpl( stream );
|
|
|
|
|
|
|
|
|
@ -117,7 +126,7 @@ void Label::InitBarcodes()
|
|
|
|
|
bool firstbarcode = true;
|
|
|
|
|
|
|
|
|
|
DocumentItem* item;
|
|
|
|
|
for( item = m_list.first();item;item=m_list.next())
|
|
|
|
|
for (DocumentItem *item : m_list)
|
|
|
|
|
{
|
|
|
|
|
if( item->rtti() == eRtti_Barcode )
|
|
|
|
|
{
|
|
|
|
@ -155,7 +164,7 @@ void Label::draw( TQPainter* painter, int x, int y )
|
|
|
|
|
InitBarcodes();
|
|
|
|
|
|
|
|
|
|
DocumentItem* item;
|
|
|
|
|
for( item = m_list.first();item;item=m_list.next())
|
|
|
|
|
for (DocumentItem *item : m_list)
|
|
|
|
|
if( drawThisItem( item ) )
|
|
|
|
|
{
|
|
|
|
|
// add x and y to clip coordinates
|
|
|
|
@ -231,13 +240,12 @@ void Label::load( TQIODevice* device )
|
|
|
|
|
delete definition;
|
|
|
|
|
|
|
|
|
|
readDocumentItems( &m_list, &doc, NULL, kbarcode18 );
|
|
|
|
|
m_list.setAutoDelete( true );
|
|
|
|
|
|
|
|
|
|
// sort the list by z index
|
|
|
|
|
m_list.sort();
|
|
|
|
|
std::sort(m_list.begin(), m_list.end(), [](DocumentItem *a, DocumentItem *b) { return *a < *b; });
|
|
|
|
|
|
|
|
|
|
DocumentItem* item;
|
|
|
|
|
for( item = m_list.first();item;item=m_list.next())
|
|
|
|
|
for (DocumentItem *item : m_list)
|
|
|
|
|
{
|
|
|
|
|
// set the paint device for all items
|
|
|
|
|
item->setPaintDevice( m_printer );
|
|
|
|
@ -295,7 +303,7 @@ bool Label::drawThisItem( const DocumentItem* item )
|
|
|
|
|
bool Label::update()
|
|
|
|
|
{
|
|
|
|
|
DocumentItem* item;
|
|
|
|
|
for( item = m_list.first();item;item=m_list.next())
|
|
|
|
|
for (DocumentItem *item : m_list)
|
|
|
|
|
if( !item->visibilityScript().isEmpty() && item->visibilityScript() != "true" )
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|