1
0
mirror of https://git.code.sf.net/p/zint/code synced 2025-12-18 02:17:06 +00:00

Add whitespace_height to zint_symbol (vertical whitespace)

This commit is contained in:
gitlost
2021-05-25 20:42:26 +01:00
parent ed761e897d
commit 00e8cb0904
36 changed files with 1555 additions and 350 deletions

View File

@@ -21,7 +21,7 @@
</property>
<property name="minimumSize">
<size>
<width>420</width>
<width>400</width>
<height>460</height>
</size>
</property>
@@ -248,7 +248,7 @@ or import from file</string>
<bool>false</bool>
</property>
<property name="text">
<string>Component &amp;Type:</string>
<string>&amp;Type:</string>
</property>
<property name="buddy">
<cstring>cmbCompType</cstring>
@@ -260,6 +260,12 @@ or import from file</string>
</item>
<item>
<widget class="QComboBox" name="cmbCompType">
<property name="minimumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
<property name="enabled">
<bool>false</bool>
</property>
@@ -379,7 +385,7 @@ p, li { white-space: pre-wrap; }
<widget class="QComboBox" name="cmbECI">
<property name="minimumSize">
<size>
<width>66</width>
<width>64</width>
<height>16777215</height>
</size>
</property>
@@ -660,7 +666,8 @@ to delimit GS1 application identifiers
<cstring>heightb</cstring>
</property>
<property name="toolTip">
<string>Overall symbol height</string>
<string>Overall symbol height
(ignored if disabled)</string>
</property>
</widget>
</item>
@@ -670,7 +677,8 @@ to delimit GS1 application identifiers
<bool>false</bool>
</property>
<property name="toolTip">
<string>Overall symbol height</string>
<string>Overall symbol height
(ignored if disabled)</string>
</property>
<property name="suffix">
<string> X</string>
@@ -768,7 +776,7 @@ to delimit GS1 application identifiers
<item row="4" column="0">
<widget class="QLabel" name="lblWhitespace">
<property name="text">
<string>Hori&amp;zontal Whitespace:</string>
<string>&amp;Whitespace:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
@@ -777,19 +785,33 @@ to delimit GS1 application identifiers
<cstring>spnWhitespace</cstring>
</property>
<property name="toolTip">
<string>Width of whitespace on either side of barcode</string>
<string>Horizontal whitespace, Vertical whitespace</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="spnWhitespace">
<property name="toolTip">
<string>Width of whitespace on either side of barcode</string>
</property>
<property name="suffix">
<string> X</string>
</property>
</widget>
<layout class="QGridLayout" name="gridLayoutWhitespace">
<item row="0" column="0">
<widget class="QSpinBox" name="spnWhitespace">
<property name="toolTip">
<string>Width of horizontal whitespace on either side of barcode</string>
</property>
<property name="suffix">
<string> X</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="spnVWhitespace">
<property name="toolTip">
<string>Height of vertical whitespace above and below the barcode</string>
</property>
<property name="suffix">
<string> X</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="5" column="0">
<widget class="QLabel" name="lblScale">
@@ -844,14 +866,16 @@ to delimit GS1 application identifiers
<cstring>cmbFontSetting</cstring>
</property>
<property name="toolTip">
<string>Set font characteristics</string>
<string>Set font characteristics
(ignored if disabled)</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QComboBox" name="cmbFontSetting">
<property name="toolTip">
<string>Set font characteristics</string>
<string>Set font characteristics
(ignored if disabled)</string>
</property>
<item>
<property name="text">
@@ -1033,14 +1057,16 @@ to delimit GS1 application identifiers
<cstring>spnDotSize</cstring>
</property>
<property name="toolTip">
<string>Size of dots</string>
<string>Size of dots
(ignored if disabled)</string>
</property>
</widget>
</item>
<item row="6" column="3">
<widget class="QDoubleSpinBox" name="spnDotSize">
<property name="toolTip">
<string>Size of dots</string>
<string>Size of dots
(ignored if disabled)</string>
</property>
<property name="enabled">
<bool>false</bool>

View File

@@ -168,6 +168,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags fl)
heightb->setValue(settings.value("studio/appearance/height", 50).toInt());
bwidth->setValue(settings.value("studio/appearance/border", 0).toInt());
spnWhitespace->setValue(settings.value("studio/appearance/whitespace", 0).toInt());
spnVWhitespace->setValue(settings.value("studio/appearance/vwhitespace", 0).toInt());
spnScale->setValue(settings.value("studio/appearance/scale", 1.0).toFloat());
btype->setCurrentIndex(settings.value("studio/appearance/border_type", 0).toInt());
cmbFontSetting->setCurrentIndex(settings.value("studio/appearance/font_setting", 0).toInt());
@@ -201,6 +202,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags fl)
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(spnVWhitespace, SIGNAL(valueChanged( int )), SLOT(update_preview()));
connect(btnAbout, SIGNAL(clicked( bool )), SLOT(about()));
connect(btnSave, SIGNAL(clicked( bool )), SLOT(save()));
connect(spnScale, SIGNAL(valueChanged( double )), SLOT(change_print_scale()));
@@ -257,6 +259,7 @@ MainWindow::~MainWindow()
settings.setValue("studio/appearance/height", heightb->value());
settings.setValue("studio/appearance/border", bwidth->value());
settings.setValue("studio/appearance/whitespace", spnWhitespace->value());
settings.setValue("studio/appearance/vwhitespace", spnVWhitespace->value());
settings.setValue("studio/appearance/scale", spnScale->value());
settings.setValue("studio/appearance/border_type", btype->currentIndex());
settings.setValue("studio/appearance/font_setting", cmbFontSetting->currentIndex());
@@ -705,6 +708,7 @@ void MainWindow::change_options()
m_optionWidget = uiload.load(&file);
file.close();
static const char *names[] = { "Standard (Matrix)", "Interleaved", "IATA", "", "Data Logic", "Industrial" };
/*: %1 is name of variant (Standard, Interleaved, IATA, Data Logic, Industrial) */
tabMain->insertTab(1, m_optionWidget, tr("Cod&e 2 of 5 %1").arg(names[symbology - BARCODE_C25STANDARD]));
connect(m_optionWidget->findChild<QObject*>("radC25Stand"), SIGNAL(clicked( bool )), SLOT(update_preview()));
connect(m_optionWidget->findChild<QObject*>("radC25Check"), SIGNAL(clicked( bool )), SLOT(update_preview()));
@@ -898,6 +902,7 @@ void MainWindow::change_options()
m_optionWidget = uiload.load(&file);
file.close();
tabMain->insertTab(1, m_optionWidget, tr("Cod&e 49"));
btype->setItemText(0, tr("Default (bind)"));
connect(m_optionWidget->findChild<QObject*>("cmbC49RowSepHeight"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
connect(m_optionWidget->findChild<QObject*>("radC49GS1"), SIGNAL(toggled( bool )), SLOT(update_preview()));
} else if (symbology == BARCODE_DBAR_EXPSTK) {
@@ -1578,11 +1583,11 @@ void MainWindow::update_preview()
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());
m_bc.bc.setBorderWidth(bwidth->value());
m_bc.bc.setWhitespace(spnWhitespace->value());
m_bc.bc.setVWhitespace(spnVWhitespace->value());
m_bc.bc.setFontSetting(cmbFontSetting->currentIndex());
m_bc.bc.setRotateAngle(cmbRotate->currentIndex());
m_bc.bc.setDotty(chkDotty->isEnabled() && chkDotty->isChecked());
@@ -1878,6 +1883,7 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology) {
}
settings.setValue(QString("studio/bc/%1/appearance/border").arg(name), bwidth->value());
settings.setValue(QString("studio/bc/%1/appearance/whitespace").arg(name), spnWhitespace->value());
settings.setValue(QString("studio/bc/%1/appearance/vwhitespace").arg(name), spnVWhitespace->value());
settings.setValue(QString("studio/bc/%1/appearance/scale").arg(name), spnScale->value());
settings.setValue(QString("studio/bc/%1/appearance/border_type").arg(name), btype->currentIndex());
if (chkHRTShow->isEnabled()) {
@@ -2124,6 +2130,7 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology) {
}
bwidth->setValue(settings.value(QString("studio/bc/%1/appearance/border").arg(name), 0).toInt());
spnWhitespace->setValue(settings.value(QString("studio/bc/%1/appearance/whitespace").arg(name), 0).toInt());
spnVWhitespace->setValue(settings.value(QString("studio/bc/%1/appearance/vwhitespace").arg(name), 0).toInt());
spnScale->setValue(settings.value(QString("studio/bc/%1/appearance/scale").arg(name), 1.0).toFloat());
btype->setCurrentIndex(settings.value(QString("studio/bc/%1/appearance/border_type").arg(name), 0).toInt());
if (chkHRTShow->isEnabled()) {

View File

@@ -1,7 +1,7 @@
/***************************************************************************
* Copyright (C) 2008 by BogDan Vatra *
* bogdan@licentia.eu *
* Copyright (C) 2010-2020 Robin Stuart *
* Copyright (C) 2010-2021 Robin Stuart *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -53,6 +53,7 @@ namespace Zint {
target_size_vert = 0;
m_option_2 = 0;
m_whitespace = 0;
m_vwhitespace = 0;
m_gs1parens = false;
m_gssep = false;
m_reader_init = false;
@@ -75,6 +76,7 @@ namespace Zint {
m_zintSymbol->symbology = m_symbol;
m_zintSymbol->height = m_height;
m_zintSymbol->whitespace_width = m_whitespace;
m_zintSymbol->whitespace_height = m_vwhitespace;
m_zintSymbol->border_width = m_borderWidth;
m_zintSymbol->option_1 = m_option_1;
m_zintSymbol->input_mode = m_input_mode;
@@ -125,6 +127,7 @@ namespace Zint {
m_height = m_zintSymbol->height;
m_borderWidth = m_zintSymbol->border_width;
m_whitespace = m_zintSymbol->whitespace_width;
m_vwhitespace = m_zintSymbol->whitespace_height;
emit encoded();
}
}
@@ -253,6 +256,10 @@ namespace Zint {
m_whitespace = whitespace;
}
void QZint::setVWhitespace(int vwhitespace) {
m_vwhitespace = vwhitespace;
}
int QZint::option1() const {
return m_option_1;
}

View File

@@ -1,6 +1,7 @@
/***************************************************************************
* Copyright (C) 2008 by BogDan Vatra *
* bogdan@licentia.eu *
* Copyright (C) 2010-2021 Robin Stuart *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -83,6 +84,8 @@ public:
void setWhitespace(int whitespace);
void setVWhitespace(int vwhitespace);
void setFontSetting(int fontSettingIndex);
void setShowText(bool show);
@@ -148,6 +151,7 @@ private:
QString m_lastError;
int m_error;
int m_whitespace;
int m_vwhitespace;
zint_symbol * m_zintSymbol;
float m_scale;
int m_option_3;