mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Add Codablock options to Studio
Also remove divide by zero bug calculating row height
This commit is contained in:
parent
c351ed492e
commit
0dd072437e
@ -378,23 +378,22 @@ static int hibc(struct zint_symbol *symbol, unsigned char source[], size_t lengt
|
||||
|
||||
static void check_row_heights(struct zint_symbol *symbol) {
|
||||
/* Check that rows with undefined heights are never less than 5x */
|
||||
int large_bar_count;
|
||||
int large_bar_count = 0;
|
||||
int i;
|
||||
int preset_height;
|
||||
int large_bar_height;
|
||||
int preset_height = 0;
|
||||
int large_bar_height = 0;
|
||||
|
||||
large_bar_count = 0;
|
||||
preset_height = 0;
|
||||
for (i = 0; i < symbol->rows; i++) {
|
||||
preset_height += symbol->row_height[i];
|
||||
if (symbol->row_height[i] == 0) {
|
||||
large_bar_count++;
|
||||
}
|
||||
}
|
||||
large_bar_height = (symbol->height - preset_height) / large_bar_count;
|
||||
|
||||
|
||||
if (large_bar_count == 0) {
|
||||
symbol->height = preset_height;
|
||||
} else {
|
||||
large_bar_height = (symbol->height - preset_height) / large_bar_count;
|
||||
}
|
||||
|
||||
if (large_bar_height < 5) {
|
||||
|
@ -52,7 +52,7 @@ void types(void) {
|
||||
"21: Leitcode 70: RM4SCC 116: Han Xin Code\n"
|
||||
"22: Identcode 71: Data Matrix 128: Aztec Runes\n"
|
||||
"23: Code 16k 72: EAN-14 129: Code 32\n"
|
||||
"24: Code 49 74: Codablock 130: Comp EAN\n"
|
||||
"24: Code 49 74: Codablock-F 130: Comp EAN\n"
|
||||
"25: Code 93 75: NVE-18 131: Comp GS1-128\n"
|
||||
"28: Flattermarken 76: Japanese Post 132: Comp DataBar Omni\n"
|
||||
"29: GS1 DataBar Omni 77: Korea Post 133: Comp DataBar Ltd\n"
|
||||
|
@ -25,6 +25,7 @@ FORMS += extData.ui \
|
||||
grpC49.ui \
|
||||
grpChannel.ui \
|
||||
grpCodeOne.ui \
|
||||
grpCodablockF.ui \
|
||||
grpDBExtend.ui \
|
||||
grpDM.ui \
|
||||
grpGrid.ui \
|
||||
|
@ -39,7 +39,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags fl)
|
||||
"Aztec Runes",
|
||||
"Channel Code",
|
||||
"Codabar",
|
||||
"Codablock",
|
||||
"Codablock-F",
|
||||
"Code 11",
|
||||
"Code 128 (ISO 15417)",
|
||||
"Code 16k",
|
||||
@ -57,7 +57,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags fl)
|
||||
"Data Matrix (ISO 16022)",
|
||||
"Deutsche Post Identcode",
|
||||
"Deutsche Post Leitcode",
|
||||
"DotCode",
|
||||
"DotCode",
|
||||
"Dutch Post KIX",
|
||||
"EAN-14",
|
||||
"European Article Number (EAN)",
|
||||
@ -71,7 +71,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags fl)
|
||||
"GS1 DataBar Stacked",
|
||||
"GS1 DataBar Stacked Omnidirectional",
|
||||
"Han Xin (Chinese Sensible) Code",
|
||||
"ITF-14",
|
||||
"ITF-14",
|
||||
"International Standard Book Number (ISBN)",
|
||||
"Japanese Postal Barcode",
|
||||
"Korean Postal Barcode",
|
||||
@ -365,6 +365,21 @@ void MainWindow::change_options()
|
||||
connect(m_optionWidget->findChild<QObject*>("radC16kStand"), SIGNAL(toggled( bool )), SLOT(update_preview()));
|
||||
}
|
||||
|
||||
if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_CODABLOCKF)
|
||||
{
|
||||
QFile file (":/grpCodablockF.ui");
|
||||
if (!file.open(QIODevice::ReadOnly))
|
||||
return;
|
||||
m_optionWidget=uiload.load(&file);
|
||||
file.close();
|
||||
tabMain->insertTab(1,m_optionWidget,tr("Codablock-F"));
|
||||
connect(m_optionWidget->findChild<QObject*>("radCbfAutosize"), SIGNAL(toggled( bool )), SLOT(update_preview()));
|
||||
connect(m_optionWidget->findChild<QObject*>("radCbfSetWidth"), SIGNAL(toggled( bool )), SLOT(update_preview()));
|
||||
connect(m_optionWidget->findChild<QObject*>("radCbfSetHeight"), SIGNAL(toggled( bool )), SLOT(update_preview()));
|
||||
connect(m_optionWidget->findChild<QObject*>("cmbCbfWidth"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
|
||||
connect(m_optionWidget->findChild<QObject*>("cmbCbfHeight"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
|
||||
}
|
||||
|
||||
if(metaObject()->enumerator(0).value(bstyle->currentIndex()) == BARCODE_DATAMATRIX)
|
||||
{
|
||||
QFile file(":/grpDM.ui");
|
||||
@ -744,6 +759,15 @@ void MainWindow::update_preview()
|
||||
m_bc.bc.setInputMode(GS1_MODE);
|
||||
break;
|
||||
|
||||
case BARCODE_CODABLOCKF:
|
||||
m_bc.bc.setSymbol(BARCODE_CODABLOCKF);
|
||||
if(m_optionWidget->findChild<QRadioButton*>("radCbfSetWidth")->isChecked())
|
||||
m_bc.bc.setWidth(m_optionWidget->findChild<QComboBox*>("cmbCbfWidth")->currentIndex() + 6);
|
||||
// Height selection uses option 1 in zint_symbol
|
||||
if(m_optionWidget->findChild<QRadioButton*>("radCbfSetHeight")->isChecked())
|
||||
m_bc.bc.setSecurityLevel(m_optionWidget->findChild<QComboBox*>("cmbCbfHeight")->currentIndex() + 1);
|
||||
break;
|
||||
|
||||
case BARCODE_DATAMATRIX:
|
||||
m_bc.bc.setSecurityLevel(1);
|
||||
if(m_optionWidget->findChild<QRadioButton*>("radDM200HIBC")->isChecked())
|
||||
|
@ -23,5 +23,6 @@
|
||||
<file>images/zint.png</file>
|
||||
<file>grpHX.ui</file>
|
||||
<file>grpDotCode.ui</file>
|
||||
<file>grpCodablockF.ui</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
Loading…
Reference in New Issue
Block a user