Add GS1PARENS_MODE (input_mode) to allow inputting GS1 AIs in parentheses

This commit is contained in:
gitlost 2021-05-15 12:23:46 +01:00
parent 6fb0d077bc
commit 79d3c1dc7a
38 changed files with 672 additions and 359 deletions

View file

@ -54,6 +54,7 @@ HEADERS += barcodeitem.h \
..\backend\stdint_msvc.h \
..\backend\tif.h \
..\backend\tif_lzw.h \
..\backend\zfiletypes.h \
..\backend\zint.h \
..\backend\zintconfig.h \

View file

@ -379,7 +379,7 @@ p, li { white-space: pre-wrap; }
<widget class="QComboBox" name="cmbECI">
<property name="minimumSize">
<size>
<width>80</width>
<width>66</width>
<height>16777215</height>
</size>
</property>
@ -585,6 +585,21 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkGS1Parens">
<property name="toolTip">
<string>Use parentheses "()" instead of square brackets "[]"
to delimit GS1 application identifiers
(ignored if disabled)</string>
</property>
<property name="text">
<string>GS1 &amp;()</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkRInit">
<property name="toolTip">

View file

@ -163,6 +163,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags fl)
chkEscape->setChecked(settings.value("studio/chk_escape").toInt() ? true : false);
chkData->setChecked(settings.value("studio/chk_data").toInt() ? true : false);
chkRInit->setChecked(settings.value("studio/chk_rinit").toInt() ? true : false);
chkGS1Parens->setChecked(settings.value("studio/chk_gs1parens").toInt() ? true : false);
chkAutoHeight->setChecked(settings.value("studio/appearance/autoheight", 1).toInt() ? true : false);
heightb->setValue(settings.value("studio/appearance/height", 50).toInt());
bwidth->setValue(settings.value("studio/appearance/border", 0).toInt());
@ -198,6 +199,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags fl)
connect(chkEscape, SIGNAL(stateChanged( int )), SLOT(update_preview()));
connect(chkData, SIGNAL(stateChanged( int )), SLOT(update_preview()));
connect(chkRInit, SIGNAL(stateChanged( int )), SLOT(update_preview()));
connect(chkGS1Parens, SIGNAL(stateChanged( int )), SLOT(update_preview()));
connect(spnWhitespace, SIGNAL(valueChanged( int )), SLOT(update_preview()));
connect(btnAbout, SIGNAL(clicked( bool )), SLOT(about()));
connect(btnSave, SIGNAL(clicked( bool )), SLOT(save()));
@ -250,6 +252,7 @@ MainWindow::~MainWindow()
settings.setValue("studio/chk_escape", chkEscape->isChecked() ? 1 : 0);
settings.setValue("studio/chk_data", chkData->isChecked() ? 1 : 0);
settings.setValue("studio/chk_rinit", chkRInit->isChecked() ? 1 : 0);
settings.setValue("studio/chk_gs1parens", chkGS1Parens->isChecked() ? 1 : 0);
settings.setValue("studio/appearance/autoheight", chkAutoHeight->isChecked() ? 1 : 0);
settings.setValue("studio/appearance/height", heightb->value());
settings.setValue("studio/appearance/border", bwidth->value());
@ -1029,6 +1032,7 @@ void MainWindow::change_options()
break;
}
cmbECI->setEnabled(m_bc.bc.supportsECI(symbology)); /* Will need checking again in update_preview() as encoding mode dependent (HIBC) */
chkGS1Parens->setEnabled(m_bc.bc.supportsGS1(symbology)); /* Ditto (GS1) */
chkRInit->setEnabled(m_bc.bc.supportsReaderInit(symbology)); /* Ditto (HIBC and GS1) */
chkAutoHeight->setEnabled(!m_bc.bc.isFixedRatio(symbology));
chkHRTShow->setEnabled(m_bc.bc.hasHRT(symbology));
@ -1601,6 +1605,7 @@ void MainWindow::update_preview()
cmbECI->setEnabled(m_bc.bc.supportsECI());
lblECI->setEnabled(cmbECI->isEnabled());
}
chkGS1Parens->setEnabled(m_bc.bc.supportsGS1());
chkRInit->setEnabled(m_bc.bc.supportsReaderInit() && (m_bc.bc.inputMode() & 0x07) != GS1_MODE);
if (!grpComposite->isHidden() && chkComposite->isChecked())
@ -1612,6 +1617,8 @@ void MainWindow::update_preview()
m_bc.bc.setHeight(heightb->value());
}
m_bc.bc.setECI(cmbECI->isEnabled() ? cmbECI->currentIndex() : 0);
m_bc.bc.setGS1Parens(chkGS1Parens->isEnabled() && chkGS1Parens->isChecked());
m_bc.bc.setReaderInit(chkRInit->isEnabled() && chkRInit->isChecked());
m_bc.bc.setReaderInit(chkRInit->isEnabled() && chkRInit->isChecked());
m_bc.bc.setShowText(chkHRTShow->isEnabled() && chkHRTShow->isChecked());
m_bc.bc.setBorderType(btype->currentIndex());
@ -1901,6 +1908,7 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology) {
if (chkRInit->isEnabled()) {
settings.setValue(QString("studio/bc/%1/chk_rinit").arg(name), chkRInit->isChecked() ? 1 : 0);
}
settings.setValue(QString("studio/bc/%1/chk_gs1parens").arg(name), chkGS1Parens->isChecked() ? 1 : 0);
if (chkAutoHeight->isEnabled()) {
settings.setValue(QString("studio/bc/%1/appearance/autoheight").arg(name), chkAutoHeight->isChecked() ? 1 : 0);
settings.setValue(QString("studio/bc/%1/appearance/height").arg(name), heightb->value());
@ -2130,6 +2138,7 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology) {
if (chkRInit->isEnabled()) {
chkRInit->setChecked(settings.value(QString("studio/bc/%1/chk_rinit").arg(name)).toInt() ? true : false);
}
chkGS1Parens->setChecked(settings.value(QString("studio/bc/%1/chk_gs1parens").arg(name)).toInt() ? true : false);
if (chkAutoHeight->isEnabled()) {
chkAutoHeight->setChecked(settings.value(QString("studio/bc/%1/appearance/autoheight").arg(name), 1).toInt() ? true : false);
heightb->setValue(settings.value(QString("studio/bc/%1/appearance/height").arg(name), 50).toInt());

View file

@ -53,6 +53,7 @@ namespace Zint {
target_size_vert = 0;
m_option_2 = 0;
m_whitespace = 0;
m_gs1parens = false;
m_gssep = false;
m_reader_init = false;
m_rotate_angle = 0;
@ -86,6 +87,9 @@ namespace Zint {
m_zintSymbol->eci = m_eci;
m_zintSymbol->option_3 = m_option_3;
m_zintSymbol->scale = m_scale;
if (m_gs1parens) {
m_zintSymbol->input_mode |= GS1PARENS_MODE;
}
if (m_gssep) {
m_zintSymbol->output_options |= GS1_GS_SEPARATOR;
}
@ -312,6 +316,10 @@ namespace Zint {
}
}
void QZint::setGS1Parens(bool gs1parens) {
m_gs1parens = gs1parens;
}
void QZint::setReaderInit(bool reader_init) {
m_reader_init = reader_init;
}
@ -332,6 +340,10 @@ namespace Zint {
return ZBarcode_Cap(symbology ? symbology : m_symbol, ZINT_CAP_ECI);
}
bool QZint::supportsGS1(int symbology) const {
return ZBarcode_Cap(symbology ? symbology : m_symbol, ZINT_CAP_GS1);
}
bool QZint::isFixedRatio(int symbology) const {
return ZBarcode_Cap(symbology ? symbology : m_symbol, ZINT_CAP_FIXED_RATIO);
}

View file

@ -96,6 +96,8 @@ public:
void setECI(int ECIIndex);
void setGS1Parens(bool gs1parens);
void setReaderInit(bool reader_init);
void setDebug(bool debug);
@ -103,6 +105,7 @@ public:
bool hasHRT(int symbology = 0) const;
bool isExtendable(int symbology = 0) const;
bool supportsECI(int symbology = 0) const;
bool supportsGS1(int symbology = 0) const;
bool isFixedRatio(int symbology = 0) const;
bool isDotty(int symbology = 0) const;
bool supportsReaderInit(int symbology = 0) const;
@ -155,6 +158,7 @@ private:
float m_dot_size;
int target_size_horiz;
int target_size_vert;
bool m_gs1parens;
bool m_gssep;
bool m_reader_init;
bool m_debug;