- API: add new zint_symbol `dpmm` field for output resolution (BMP/
EMF/PCX/PNG/TIF only, i.e. excluding EPS, GIF & SVG)
- Add support for specifying scale by X-dimension and resolution
with new option `--scalexdimdp` for CLI/Tcl & new API function
`ZBarcode_Scale_From_XdimDp()` (+ `ZBarcode_XdimDp_From_Scale()`
& `ZBarcode_Default_Xdim()`) and new GUI popup; manual: document
- BMP/EMF/PCX/PNG/TIF: use new `dpmm` resolution field (for EMF
following Inkscape)
- backend_qt: add `dpmm()`, `vectorWidth()`, `vectorHeight()`,
`noPng()`, `getVersion()`, `takesGS1AIData()`, & `XdimDp` stuff
incl. new `QZintXdimDp` struct for passing around scale vars &
use in `getAsCLI()`; add comments
- Raise `scale` limit to 200 (from 100) to allow for large dpmm
- output: create directories & subdirectories as necessary for
output path using new function `out_fopen()` and use in BMP/EMF/
EPS/GIF/PCX/PNG/SVG/TIF
- DPLEIT/DPIDENT: format HRT according to (incomplete)
documentation, and set default height to 72X (from 50X)
- CODE128B renamed to CODE128AB as can use subsets A and/or B
- CODABAR: fix minimum height calc
- EMF: fix indexing of handles (zero-based not 1-based)
- GUI: fix symbology zap (previous technique of clearing and
re-loading settings without doing a sync no longer works);
fix UPCEAN guard descent enable
- MAILMARK: better error message if input < 14 characters
- GUI: add "Default" button for DAFT tracker ratio & enable/disable
various default buttons; use new `takesGS1AIData()` to
enable/disable GS1-specific checkboxes
- CLI: use new `validate_float()` to parse float options (7
significant digits allowed only, no scientific notation)
- DATAMATRIX/GRIDMATRIX/PDF417/QR/ULTRA: micro-optimize structapp
ID parse
- library/CLI: fiddle with static asserts (make CHAR_BIT sensitive,
supposedly)
- win32/README: update building libpng (assembly removed)
- README.linux: document incompatibility of Qt6 >= 6.3
- manual: expand Barcode Studio waffle
- test suite: change range separator to hyphen and allow multiple
excludes
2022-12-03 10:39:01 +13:00
|
|
|
/*
|
|
|
|
Zint Barcode Generator - the open source barcode generator
|
2024-01-06 11:55:57 +13:00
|
|
|
Copyright (C) 2022-2024 Robin Stuart <rstuart114@gmail.com>
|
- API: add new zint_symbol `dpmm` field for output resolution (BMP/
EMF/PCX/PNG/TIF only, i.e. excluding EPS, GIF & SVG)
- Add support for specifying scale by X-dimension and resolution
with new option `--scalexdimdp` for CLI/Tcl & new API function
`ZBarcode_Scale_From_XdimDp()` (+ `ZBarcode_XdimDp_From_Scale()`
& `ZBarcode_Default_Xdim()`) and new GUI popup; manual: document
- BMP/EMF/PCX/PNG/TIF: use new `dpmm` resolution field (for EMF
following Inkscape)
- backend_qt: add `dpmm()`, `vectorWidth()`, `vectorHeight()`,
`noPng()`, `getVersion()`, `takesGS1AIData()`, & `XdimDp` stuff
incl. new `QZintXdimDp` struct for passing around scale vars &
use in `getAsCLI()`; add comments
- Raise `scale` limit to 200 (from 100) to allow for large dpmm
- output: create directories & subdirectories as necessary for
output path using new function `out_fopen()` and use in BMP/EMF/
EPS/GIF/PCX/PNG/SVG/TIF
- DPLEIT/DPIDENT: format HRT according to (incomplete)
documentation, and set default height to 72X (from 50X)
- CODE128B renamed to CODE128AB as can use subsets A and/or B
- CODABAR: fix minimum height calc
- EMF: fix indexing of handles (zero-based not 1-based)
- GUI: fix symbology zap (previous technique of clearing and
re-loading settings without doing a sync no longer works);
fix UPCEAN guard descent enable
- MAILMARK: better error message if input < 14 characters
- GUI: add "Default" button for DAFT tracker ratio & enable/disable
various default buttons; use new `takesGS1AIData()` to
enable/disable GS1-specific checkboxes
- CLI: use new `validate_float()` to parse float options (7
significant digits allowed only, no scientific notation)
- DATAMATRIX/GRIDMATRIX/PDF417/QR/ULTRA: micro-optimize structapp
ID parse
- library/CLI: fiddle with static asserts (make CHAR_BIT sensitive,
supposedly)
- win32/README: update building libpng (assembly removed)
- README.linux: document incompatibility of Qt6 >= 6.3
- manual: expand Barcode Studio waffle
- test suite: change range separator to hyphen and allow multiple
excludes
2022-12-03 10:39:01 +13:00
|
|
|
|
|
|
|
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
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along
|
|
|
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
/* SPDX-License-Identifier: GPL-3.0-or-later */
|
|
|
|
|
|
|
|
//#include <QDebug>
|
|
|
|
#include <QSettings>
|
2024-01-06 11:55:57 +13:00
|
|
|
#include <QUiLoader>
|
- API: add new zint_symbol `dpmm` field for output resolution (BMP/
EMF/PCX/PNG/TIF only, i.e. excluding EPS, GIF & SVG)
- Add support for specifying scale by X-dimension and resolution
with new option `--scalexdimdp` for CLI/Tcl & new API function
`ZBarcode_Scale_From_XdimDp()` (+ `ZBarcode_XdimDp_From_Scale()`
& `ZBarcode_Default_Xdim()`) and new GUI popup; manual: document
- BMP/EMF/PCX/PNG/TIF: use new `dpmm` resolution field (for EMF
following Inkscape)
- backend_qt: add `dpmm()`, `vectorWidth()`, `vectorHeight()`,
`noPng()`, `getVersion()`, `takesGS1AIData()`, & `XdimDp` stuff
incl. new `QZintXdimDp` struct for passing around scale vars &
use in `getAsCLI()`; add comments
- Raise `scale` limit to 200 (from 100) to allow for large dpmm
- output: create directories & subdirectories as necessary for
output path using new function `out_fopen()` and use in BMP/EMF/
EPS/GIF/PCX/PNG/SVG/TIF
- DPLEIT/DPIDENT: format HRT according to (incomplete)
documentation, and set default height to 72X (from 50X)
- CODE128B renamed to CODE128AB as can use subsets A and/or B
- CODABAR: fix minimum height calc
- EMF: fix indexing of handles (zero-based not 1-based)
- GUI: fix symbology zap (previous technique of clearing and
re-loading settings without doing a sync no longer works);
fix UPCEAN guard descent enable
- MAILMARK: better error message if input < 14 characters
- GUI: add "Default" button for DAFT tracker ratio & enable/disable
various default buttons; use new `takesGS1AIData()` to
enable/disable GS1-specific checkboxes
- CLI: use new `validate_float()` to parse float options (7
significant digits allowed only, no scientific notation)
- DATAMATRIX/GRIDMATRIX/PDF417/QR/ULTRA: micro-optimize structapp
ID parse
- library/CLI: fiddle with static asserts (make CHAR_BIT sensitive,
supposedly)
- win32/README: update building libpng (assembly removed)
- README.linux: document incompatibility of Qt6 >= 6.3
- manual: expand Barcode Studio waffle
- test suite: change range separator to hyphen and allow multiple
excludes
2022-12-03 10:39:01 +13:00
|
|
|
|
|
|
|
#include <math.h>
|
|
|
|
#include "scalewindow.h"
|
|
|
|
|
|
|
|
// Shorthand
|
|
|
|
#define QSL QStringLiteral
|
|
|
|
|
|
|
|
/* "Standard" dpmm/dpi equivalents */
|
|
|
|
static int resolution_standard(int inch, int val)
|
|
|
|
{
|
|
|
|
/* Note toss-up between rounding 2400 dpi to 94 or 95 (~94.48818897637795275591) */
|
|
|
|
static int standards[9][2] = {
|
|
|
|
{ 4, 100 }, { 6, 150 }, { 8, 200 }, { 12, 300 }, { 16, 400 },
|
|
|
|
{ 24, 600 }, { 47, 1200 }, { 94, 2400 }, { 189, 4800 },
|
|
|
|
};
|
|
|
|
for (int i = 0; i < 8; i++) {
|
|
|
|
if (standards[i][inch] == val) {
|
|
|
|
return standards[i][inch ? 0 : 1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2023-01-15 13:22:43 +13:00
|
|
|
ScaleWindow::ScaleWindow(BarcodeItem *bc, Zint::QZintXdimDpVars *vars, double originalScale)
|
|
|
|
: m_bc(bc), Valid(false), m_vars(*vars), m_originalScale(originalScale), m_unset(false)
|
- API: add new zint_symbol `dpmm` field for output resolution (BMP/
EMF/PCX/PNG/TIF only, i.e. excluding EPS, GIF & SVG)
- Add support for specifying scale by X-dimension and resolution
with new option `--scalexdimdp` for CLI/Tcl & new API function
`ZBarcode_Scale_From_XdimDp()` (+ `ZBarcode_XdimDp_From_Scale()`
& `ZBarcode_Default_Xdim()`) and new GUI popup; manual: document
- BMP/EMF/PCX/PNG/TIF: use new `dpmm` resolution field (for EMF
following Inkscape)
- backend_qt: add `dpmm()`, `vectorWidth()`, `vectorHeight()`,
`noPng()`, `getVersion()`, `takesGS1AIData()`, & `XdimDp` stuff
incl. new `QZintXdimDp` struct for passing around scale vars &
use in `getAsCLI()`; add comments
- Raise `scale` limit to 200 (from 100) to allow for large dpmm
- output: create directories & subdirectories as necessary for
output path using new function `out_fopen()` and use in BMP/EMF/
EPS/GIF/PCX/PNG/SVG/TIF
- DPLEIT/DPIDENT: format HRT according to (incomplete)
documentation, and set default height to 72X (from 50X)
- CODE128B renamed to CODE128AB as can use subsets A and/or B
- CODABAR: fix minimum height calc
- EMF: fix indexing of handles (zero-based not 1-based)
- GUI: fix symbology zap (previous technique of clearing and
re-loading settings without doing a sync no longer works);
fix UPCEAN guard descent enable
- MAILMARK: better error message if input < 14 characters
- GUI: add "Default" button for DAFT tracker ratio & enable/disable
various default buttons; use new `takesGS1AIData()` to
enable/disable GS1-specific checkboxes
- CLI: use new `validate_float()` to parse float options (7
significant digits allowed only, no scientific notation)
- DATAMATRIX/GRIDMATRIX/PDF417/QR/ULTRA: micro-optimize structapp
ID parse
- library/CLI: fiddle with static asserts (make CHAR_BIT sensitive,
supposedly)
- win32/README: update building libpng (assembly removed)
- README.linux: document incompatibility of Qt6 >= 6.3
- manual: expand Barcode Studio waffle
- test suite: change range separator to hyphen and allow multiple
excludes
2022-12-03 10:39:01 +13:00
|
|
|
{
|
|
|
|
setupUi(this);
|
|
|
|
|
|
|
|
if (m_bc->bc.noPng()) {
|
|
|
|
cmbFileType->setItemText(0, QSL("Raster (BMP/GIF/PCX/TIF)"));
|
|
|
|
}
|
|
|
|
if (m_bc->bc.symbol() != BARCODE_MAXICODE) {
|
|
|
|
cmbFileType->setItemText(1, QSL("Vector (EMF/EPS/SVG)"));
|
|
|
|
cmbFileType->removeItem(2); // EMF
|
|
|
|
}
|
|
|
|
|
|
|
|
QSettings settings;
|
|
|
|
#if QT_VERSION < 0x60000
|
|
|
|
settings.setIniCodec("UTF-8");
|
|
|
|
#endif
|
|
|
|
|
|
|
|
QByteArray geometry = settings.value(QSL("studio/scale/window_geometry")).toByteArray();
|
|
|
|
restoreGeometry(geometry);
|
|
|
|
|
|
|
|
spnXdim->setValue(m_vars.x_dim);
|
|
|
|
cmbXdimUnits->setCurrentIndex(m_vars.x_dim_units);
|
|
|
|
spnResolution->setValue(m_vars.resolution);
|
|
|
|
cmbResolutionUnits->setCurrentIndex(m_vars.resolution_units);
|
|
|
|
|
|
|
|
if (m_bc->bc.symbol() == BARCODE_MAXICODE) {
|
|
|
|
cmbFileType->setCurrentIndex(std::min(m_vars.filetype_maxicode, cmbFileType->count() - 1));
|
|
|
|
} else {
|
|
|
|
cmbFileType->setCurrentIndex(std::min(m_vars.filetype, cmbFileType->count() - 1));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cmbXdimUnits->currentIndex() == 1) { // Inches
|
|
|
|
spnXdim->setSingleStep(0.001);
|
|
|
|
} else {
|
|
|
|
spnXdim->setSingleStep(0.01);
|
|
|
|
}
|
|
|
|
if (cmbResolutionUnits->currentIndex() == 1) { // Inches
|
|
|
|
spnResolution->setSingleStep(50);
|
|
|
|
} else {
|
|
|
|
spnResolution->setSingleStep(1);
|
|
|
|
}
|
2023-12-23 10:29:54 +13:00
|
|
|
set_maxima();
|
- API: add new zint_symbol `dpmm` field for output resolution (BMP/
EMF/PCX/PNG/TIF only, i.e. excluding EPS, GIF & SVG)
- Add support for specifying scale by X-dimension and resolution
with new option `--scalexdimdp` for CLI/Tcl & new API function
`ZBarcode_Scale_From_XdimDp()` (+ `ZBarcode_XdimDp_From_Scale()`
& `ZBarcode_Default_Xdim()`) and new GUI popup; manual: document
- BMP/EMF/PCX/PNG/TIF: use new `dpmm` resolution field (for EMF
following Inkscape)
- backend_qt: add `dpmm()`, `vectorWidth()`, `vectorHeight()`,
`noPng()`, `getVersion()`, `takesGS1AIData()`, & `XdimDp` stuff
incl. new `QZintXdimDp` struct for passing around scale vars &
use in `getAsCLI()`; add comments
- Raise `scale` limit to 200 (from 100) to allow for large dpmm
- output: create directories & subdirectories as necessary for
output path using new function `out_fopen()` and use in BMP/EMF/
EPS/GIF/PCX/PNG/SVG/TIF
- DPLEIT/DPIDENT: format HRT according to (incomplete)
documentation, and set default height to 72X (from 50X)
- CODE128B renamed to CODE128AB as can use subsets A and/or B
- CODABAR: fix minimum height calc
- EMF: fix indexing of handles (zero-based not 1-based)
- GUI: fix symbology zap (previous technique of clearing and
re-loading settings without doing a sync no longer works);
fix UPCEAN guard descent enable
- MAILMARK: better error message if input < 14 characters
- GUI: add "Default" button for DAFT tracker ratio & enable/disable
various default buttons; use new `takesGS1AIData()` to
enable/disable GS1-specific checkboxes
- CLI: use new `validate_float()` to parse float options (7
significant digits allowed only, no scientific notation)
- DATAMATRIX/GRIDMATRIX/PDF417/QR/ULTRA: micro-optimize structapp
ID parse
- library/CLI: fiddle with static asserts (make CHAR_BIT sensitive,
supposedly)
- win32/README: update building libpng (assembly removed)
- README.linux: document incompatibility of Qt6 >= 6.3
- manual: expand Barcode Studio waffle
- test suite: change range separator to hyphen and allow multiple
excludes
2022-12-03 10:39:01 +13:00
|
|
|
|
|
|
|
size_msg_ui_set();
|
|
|
|
|
|
|
|
QIcon closeIcon(QIcon::fromTheme(QSL("window-close"), QIcon(QSL(":res/x.svg"))));
|
2023-01-15 13:22:43 +13:00
|
|
|
QIcon unsetIcon(QSL(":res/delete.svg"));
|
- API: add new zint_symbol `dpmm` field for output resolution (BMP/
EMF/PCX/PNG/TIF only, i.e. excluding EPS, GIF & SVG)
- Add support for specifying scale by X-dimension and resolution
with new option `--scalexdimdp` for CLI/Tcl & new API function
`ZBarcode_Scale_From_XdimDp()` (+ `ZBarcode_XdimDp_From_Scale()`
& `ZBarcode_Default_Xdim()`) and new GUI popup; manual: document
- BMP/EMF/PCX/PNG/TIF: use new `dpmm` resolution field (for EMF
following Inkscape)
- backend_qt: add `dpmm()`, `vectorWidth()`, `vectorHeight()`,
`noPng()`, `getVersion()`, `takesGS1AIData()`, & `XdimDp` stuff
incl. new `QZintXdimDp` struct for passing around scale vars &
use in `getAsCLI()`; add comments
- Raise `scale` limit to 200 (from 100) to allow for large dpmm
- output: create directories & subdirectories as necessary for
output path using new function `out_fopen()` and use in BMP/EMF/
EPS/GIF/PCX/PNG/SVG/TIF
- DPLEIT/DPIDENT: format HRT according to (incomplete)
documentation, and set default height to 72X (from 50X)
- CODE128B renamed to CODE128AB as can use subsets A and/or B
- CODABAR: fix minimum height calc
- EMF: fix indexing of handles (zero-based not 1-based)
- GUI: fix symbology zap (previous technique of clearing and
re-loading settings without doing a sync no longer works);
fix UPCEAN guard descent enable
- MAILMARK: better error message if input < 14 characters
- GUI: add "Default" button for DAFT tracker ratio & enable/disable
various default buttons; use new `takesGS1AIData()` to
enable/disable GS1-specific checkboxes
- CLI: use new `validate_float()` to parse float options (7
significant digits allowed only, no scientific notation)
- DATAMATRIX/GRIDMATRIX/PDF417/QR/ULTRA: micro-optimize structapp
ID parse
- library/CLI: fiddle with static asserts (make CHAR_BIT sensitive,
supposedly)
- win32/README: update building libpng (assembly removed)
- README.linux: document incompatibility of Qt6 >= 6.3
- manual: expand Barcode Studio waffle
- test suite: change range separator to hyphen and allow multiple
excludes
2022-12-03 10:39:01 +13:00
|
|
|
QIcon okIcon(QIcon(QSL(":res/check.svg")));
|
|
|
|
btnCancel->setIcon(closeIcon);
|
2023-01-15 13:22:43 +13:00
|
|
|
btnScaleUnset->setIcon(unsetIcon);
|
|
|
|
btnScaleUnset->setEnabled(m_vars.set);
|
- API: add new zint_symbol `dpmm` field for output resolution (BMP/
EMF/PCX/PNG/TIF only, i.e. excluding EPS, GIF & SVG)
- Add support for specifying scale by X-dimension and resolution
with new option `--scalexdimdp` for CLI/Tcl & new API function
`ZBarcode_Scale_From_XdimDp()` (+ `ZBarcode_XdimDp_From_Scale()`
& `ZBarcode_Default_Xdim()`) and new GUI popup; manual: document
- BMP/EMF/PCX/PNG/TIF: use new `dpmm` resolution field (for EMF
following Inkscape)
- backend_qt: add `dpmm()`, `vectorWidth()`, `vectorHeight()`,
`noPng()`, `getVersion()`, `takesGS1AIData()`, & `XdimDp` stuff
incl. new `QZintXdimDp` struct for passing around scale vars &
use in `getAsCLI()`; add comments
- Raise `scale` limit to 200 (from 100) to allow for large dpmm
- output: create directories & subdirectories as necessary for
output path using new function `out_fopen()` and use in BMP/EMF/
EPS/GIF/PCX/PNG/SVG/TIF
- DPLEIT/DPIDENT: format HRT according to (incomplete)
documentation, and set default height to 72X (from 50X)
- CODE128B renamed to CODE128AB as can use subsets A and/or B
- CODABAR: fix minimum height calc
- EMF: fix indexing of handles (zero-based not 1-based)
- GUI: fix symbology zap (previous technique of clearing and
re-loading settings without doing a sync no longer works);
fix UPCEAN guard descent enable
- MAILMARK: better error message if input < 14 characters
- GUI: add "Default" button for DAFT tracker ratio & enable/disable
various default buttons; use new `takesGS1AIData()` to
enable/disable GS1-specific checkboxes
- CLI: use new `validate_float()` to parse float options (7
significant digits allowed only, no scientific notation)
- DATAMATRIX/GRIDMATRIX/PDF417/QR/ULTRA: micro-optimize structapp
ID parse
- library/CLI: fiddle with static asserts (make CHAR_BIT sensitive,
supposedly)
- win32/README: update building libpng (assembly removed)
- README.linux: document incompatibility of Qt6 >= 6.3
- manual: expand Barcode Studio waffle
- test suite: change range separator to hyphen and allow multiple
excludes
2022-12-03 10:39:01 +13:00
|
|
|
btnOK->setIcon(okIcon);
|
|
|
|
|
2024-01-06 11:55:57 +13:00
|
|
|
connect(btnCancel, SIGNAL(clicked(bool)), SLOT(close()));
|
|
|
|
connect(btnScaleUnset, SIGNAL(clicked(bool)), SLOT(unset_scale()));
|
|
|
|
connect(btnOK, SIGNAL(clicked(bool)), SLOT(okay()));
|
|
|
|
connect(spnXdim, SIGNAL(valueChanged(double)), SLOT(update_scale()));
|
|
|
|
connect(cmbXdimUnits, SIGNAL(currentIndexChanged(int)), SLOT(x_dim_units_change()));
|
|
|
|
connect(btnXdimDefault, SIGNAL(clicked(bool)), SLOT(x_dim_default()));
|
|
|
|
connect(spnResolution, SIGNAL(valueChanged(int)), SLOT(update_scale()));
|
|
|
|
connect(cmbResolutionUnits, SIGNAL(currentIndexChanged(int)), SLOT(resolution_units_change()));
|
|
|
|
connect(btnResolutionDefault, SIGNAL(clicked(bool)), SLOT(resolution_default()));
|
|
|
|
connect(cmbFileType, SIGNAL(currentIndexChanged(int)), SLOT(update_scale()));
|
- API: add new zint_symbol `dpmm` field for output resolution (BMP/
EMF/PCX/PNG/TIF only, i.e. excluding EPS, GIF & SVG)
- Add support for specifying scale by X-dimension and resolution
with new option `--scalexdimdp` for CLI/Tcl & new API function
`ZBarcode_Scale_From_XdimDp()` (+ `ZBarcode_XdimDp_From_Scale()`
& `ZBarcode_Default_Xdim()`) and new GUI popup; manual: document
- BMP/EMF/PCX/PNG/TIF: use new `dpmm` resolution field (for EMF
following Inkscape)
- backend_qt: add `dpmm()`, `vectorWidth()`, `vectorHeight()`,
`noPng()`, `getVersion()`, `takesGS1AIData()`, & `XdimDp` stuff
incl. new `QZintXdimDp` struct for passing around scale vars &
use in `getAsCLI()`; add comments
- Raise `scale` limit to 200 (from 100) to allow for large dpmm
- output: create directories & subdirectories as necessary for
output path using new function `out_fopen()` and use in BMP/EMF/
EPS/GIF/PCX/PNG/SVG/TIF
- DPLEIT/DPIDENT: format HRT according to (incomplete)
documentation, and set default height to 72X (from 50X)
- CODE128B renamed to CODE128AB as can use subsets A and/or B
- CODABAR: fix minimum height calc
- EMF: fix indexing of handles (zero-based not 1-based)
- GUI: fix symbology zap (previous technique of clearing and
re-loading settings without doing a sync no longer works);
fix UPCEAN guard descent enable
- MAILMARK: better error message if input < 14 characters
- GUI: add "Default" button for DAFT tracker ratio & enable/disable
various default buttons; use new `takesGS1AIData()` to
enable/disable GS1-specific checkboxes
- CLI: use new `validate_float()` to parse float options (7
significant digits allowed only, no scientific notation)
- DATAMATRIX/GRIDMATRIX/PDF417/QR/ULTRA: micro-optimize structapp
ID parse
- library/CLI: fiddle with static asserts (make CHAR_BIT sensitive,
supposedly)
- win32/README: update building libpng (assembly removed)
- README.linux: document incompatibility of Qt6 >= 6.3
- manual: expand Barcode Studio waffle
- test suite: change range separator to hyphen and allow multiple
excludes
2022-12-03 10:39:01 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
ScaleWindow::~ScaleWindow()
|
|
|
|
{
|
|
|
|
QSettings settings;
|
|
|
|
#if QT_VERSION < 0x60000
|
|
|
|
settings.setIniCodec("UTF-8");
|
|
|
|
#endif
|
|
|
|
settings.setValue(QSL("studio/scale/window_geometry"), saveGeometry());
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScaleWindow::size_msg_ui_set()
|
|
|
|
{
|
|
|
|
msgPrintingScale->setText(QString::asprintf("%.2f", m_bc->bc.scale()));
|
|
|
|
float width_x_dim, height_x_dim;
|
|
|
|
if (m_bc->bc.getWidthHeightXdim((float) m_vars.x_dim, width_x_dim, height_x_dim)) {
|
|
|
|
const char *fmt = cmbXdimUnits->currentIndex() == 1 ? "%.3f x %.3f in" : "%.2f x %.2f mm";
|
|
|
|
msgWidthHeight->setText(QString::asprintf(fmt, width_x_dim, height_x_dim));
|
|
|
|
} else {
|
|
|
|
msgWidthHeight->clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool defaultDisable;
|
|
|
|
QWidget *focus = QApplication::focusWidget();
|
|
|
|
|
|
|
|
// This doesn't work well due to rounding errors TODO: fix
|
|
|
|
defaultDisable = m_bc->bc.defaultXdim() == (float) get_x_dim_mm();
|
|
|
|
btnXdimDefault->setEnabled(!defaultDisable);
|
|
|
|
if (focus == btnXdimDefault && defaultDisable) {
|
|
|
|
spnXdim->setFocus();
|
|
|
|
}
|
|
|
|
|
|
|
|
defaultDisable = (cmbResolutionUnits->currentIndex() == 0 && spnResolution->value() == 12)
|
|
|
|
|| (cmbResolutionUnits->currentIndex() == 1 && spnResolution->value() == 300);
|
|
|
|
btnResolutionDefault->setEnabled(!defaultDisable);
|
|
|
|
if (focus == btnResolutionDefault && defaultDisable) {
|
|
|
|
spnResolution->setFocus();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-15 13:22:43 +13:00
|
|
|
void ScaleWindow::unset_scale()
|
|
|
|
{
|
|
|
|
m_vars.x_dim = m_bc->bc.getXdimDpFromScale(m_originalScale, get_dpmm(), getFileType());
|
|
|
|
m_vars.set = 0;
|
|
|
|
|
|
|
|
if (cmbXdimUnits->currentIndex() == 1) { // Inches
|
|
|
|
spnXdim->setValue(m_vars.x_dim / 25.4);
|
|
|
|
} else {
|
|
|
|
spnXdim->setValue(m_vars.x_dim);
|
|
|
|
}
|
|
|
|
m_unset = true;
|
|
|
|
btnScaleUnset->setEnabled(false);
|
|
|
|
}
|
|
|
|
|
- API: add new zint_symbol `dpmm` field for output resolution (BMP/
EMF/PCX/PNG/TIF only, i.e. excluding EPS, GIF & SVG)
- Add support for specifying scale by X-dimension and resolution
with new option `--scalexdimdp` for CLI/Tcl & new API function
`ZBarcode_Scale_From_XdimDp()` (+ `ZBarcode_XdimDp_From_Scale()`
& `ZBarcode_Default_Xdim()`) and new GUI popup; manual: document
- BMP/EMF/PCX/PNG/TIF: use new `dpmm` resolution field (for EMF
following Inkscape)
- backend_qt: add `dpmm()`, `vectorWidth()`, `vectorHeight()`,
`noPng()`, `getVersion()`, `takesGS1AIData()`, & `XdimDp` stuff
incl. new `QZintXdimDp` struct for passing around scale vars &
use in `getAsCLI()`; add comments
- Raise `scale` limit to 200 (from 100) to allow for large dpmm
- output: create directories & subdirectories as necessary for
output path using new function `out_fopen()` and use in BMP/EMF/
EPS/GIF/PCX/PNG/SVG/TIF
- DPLEIT/DPIDENT: format HRT according to (incomplete)
documentation, and set default height to 72X (from 50X)
- CODE128B renamed to CODE128AB as can use subsets A and/or B
- CODABAR: fix minimum height calc
- EMF: fix indexing of handles (zero-based not 1-based)
- GUI: fix symbology zap (previous technique of clearing and
re-loading settings without doing a sync no longer works);
fix UPCEAN guard descent enable
- MAILMARK: better error message if input < 14 characters
- GUI: add "Default" button for DAFT tracker ratio & enable/disable
various default buttons; use new `takesGS1AIData()` to
enable/disable GS1-specific checkboxes
- CLI: use new `validate_float()` to parse float options (7
significant digits allowed only, no scientific notation)
- DATAMATRIX/GRIDMATRIX/PDF417/QR/ULTRA: micro-optimize structapp
ID parse
- library/CLI: fiddle with static asserts (make CHAR_BIT sensitive,
supposedly)
- win32/README: update building libpng (assembly removed)
- README.linux: document incompatibility of Qt6 >= 6.3
- manual: expand Barcode Studio waffle
- test suite: change range separator to hyphen and allow multiple
excludes
2022-12-03 10:39:01 +13:00
|
|
|
void ScaleWindow::okay()
|
|
|
|
{
|
|
|
|
if (update_vars()) {
|
|
|
|
Valid = true;
|
2023-01-15 13:22:43 +13:00
|
|
|
m_vars.set = m_unset ? 0 : 1;
|
- API: add new zint_symbol `dpmm` field for output resolution (BMP/
EMF/PCX/PNG/TIF only, i.e. excluding EPS, GIF & SVG)
- Add support for specifying scale by X-dimension and resolution
with new option `--scalexdimdp` for CLI/Tcl & new API function
`ZBarcode_Scale_From_XdimDp()` (+ `ZBarcode_XdimDp_From_Scale()`
& `ZBarcode_Default_Xdim()`) and new GUI popup; manual: document
- BMP/EMF/PCX/PNG/TIF: use new `dpmm` resolution field (for EMF
following Inkscape)
- backend_qt: add `dpmm()`, `vectorWidth()`, `vectorHeight()`,
`noPng()`, `getVersion()`, `takesGS1AIData()`, & `XdimDp` stuff
incl. new `QZintXdimDp` struct for passing around scale vars &
use in `getAsCLI()`; add comments
- Raise `scale` limit to 200 (from 100) to allow for large dpmm
- output: create directories & subdirectories as necessary for
output path using new function `out_fopen()` and use in BMP/EMF/
EPS/GIF/PCX/PNG/SVG/TIF
- DPLEIT/DPIDENT: format HRT according to (incomplete)
documentation, and set default height to 72X (from 50X)
- CODE128B renamed to CODE128AB as can use subsets A and/or B
- CODABAR: fix minimum height calc
- EMF: fix indexing of handles (zero-based not 1-based)
- GUI: fix symbology zap (previous technique of clearing and
re-loading settings without doing a sync no longer works);
fix UPCEAN guard descent enable
- MAILMARK: better error message if input < 14 characters
- GUI: add "Default" button for DAFT tracker ratio & enable/disable
various default buttons; use new `takesGS1AIData()` to
enable/disable GS1-specific checkboxes
- CLI: use new `validate_float()` to parse float options (7
significant digits allowed only, no scientific notation)
- DATAMATRIX/GRIDMATRIX/PDF417/QR/ULTRA: micro-optimize structapp
ID parse
- library/CLI: fiddle with static asserts (make CHAR_BIT sensitive,
supposedly)
- win32/README: update building libpng (assembly removed)
- README.linux: document incompatibility of Qt6 >= 6.3
- manual: expand Barcode Studio waffle
- test suite: change range separator to hyphen and allow multiple
excludes
2022-12-03 10:39:01 +13:00
|
|
|
}
|
|
|
|
close();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScaleWindow::update_scale()
|
|
|
|
{
|
|
|
|
float scale = update_vars();
|
|
|
|
if (scale) {
|
|
|
|
// Need up-to-date `vectorWidth()` and `vectorHeight()` to estimate size including borders, whitespace & text,
|
|
|
|
// so tell main window to encode and it will update UI here via `size_msg_ui_set()`
|
|
|
|
emit scaleChanged(scale);
|
2023-01-15 13:22:43 +13:00
|
|
|
m_unset = false;
|
|
|
|
btnScaleUnset->setEnabled(true);
|
2023-12-23 10:29:54 +13:00
|
|
|
set_maxima();
|
- API: add new zint_symbol `dpmm` field for output resolution (BMP/
EMF/PCX/PNG/TIF only, i.e. excluding EPS, GIF & SVG)
- Add support for specifying scale by X-dimension and resolution
with new option `--scalexdimdp` for CLI/Tcl & new API function
`ZBarcode_Scale_From_XdimDp()` (+ `ZBarcode_XdimDp_From_Scale()`
& `ZBarcode_Default_Xdim()`) and new GUI popup; manual: document
- BMP/EMF/PCX/PNG/TIF: use new `dpmm` resolution field (for EMF
following Inkscape)
- backend_qt: add `dpmm()`, `vectorWidth()`, `vectorHeight()`,
`noPng()`, `getVersion()`, `takesGS1AIData()`, & `XdimDp` stuff
incl. new `QZintXdimDp` struct for passing around scale vars &
use in `getAsCLI()`; add comments
- Raise `scale` limit to 200 (from 100) to allow for large dpmm
- output: create directories & subdirectories as necessary for
output path using new function `out_fopen()` and use in BMP/EMF/
EPS/GIF/PCX/PNG/SVG/TIF
- DPLEIT/DPIDENT: format HRT according to (incomplete)
documentation, and set default height to 72X (from 50X)
- CODE128B renamed to CODE128AB as can use subsets A and/or B
- CODABAR: fix minimum height calc
- EMF: fix indexing of handles (zero-based not 1-based)
- GUI: fix symbology zap (previous technique of clearing and
re-loading settings without doing a sync no longer works);
fix UPCEAN guard descent enable
- MAILMARK: better error message if input < 14 characters
- GUI: add "Default" button for DAFT tracker ratio & enable/disable
various default buttons; use new `takesGS1AIData()` to
enable/disable GS1-specific checkboxes
- CLI: use new `validate_float()` to parse float options (7
significant digits allowed only, no scientific notation)
- DATAMATRIX/GRIDMATRIX/PDF417/QR/ULTRA: micro-optimize structapp
ID parse
- library/CLI: fiddle with static asserts (make CHAR_BIT sensitive,
supposedly)
- win32/README: update building libpng (assembly removed)
- README.linux: document incompatibility of Qt6 >= 6.3
- manual: expand Barcode Studio waffle
- test suite: change range separator to hyphen and allow multiple
excludes
2022-12-03 10:39:01 +13:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScaleWindow::x_dim_units_change()
|
|
|
|
{
|
|
|
|
if (cmbXdimUnits->currentIndex() == 1) { // Inches
|
|
|
|
spnXdim->setValue(spnXdim->value() / 25.4);
|
|
|
|
spnXdim->setSingleStep(0.001);
|
|
|
|
} else {
|
|
|
|
spnXdim->setValue(spnXdim->value() * 25.4);
|
|
|
|
spnXdim->setSingleStep(0.01);
|
|
|
|
}
|
|
|
|
update_scale();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScaleWindow::x_dim_default()
|
|
|
|
{
|
|
|
|
if (cmbXdimUnits->currentIndex() == 1) { // Inches
|
|
|
|
spnXdim->setValue(m_bc->bc.defaultXdim() / 25.4);
|
|
|
|
} else {
|
|
|
|
spnXdim->setValue(m_bc->bc.defaultXdim());
|
|
|
|
}
|
|
|
|
update_scale();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScaleWindow::resolution_units_change()
|
|
|
|
{
|
|
|
|
int value;
|
|
|
|
if (cmbResolutionUnits->currentIndex() == 1) { // Inches
|
|
|
|
if ((value = resolution_standard(0, spnResolution->value()))) {
|
|
|
|
spnResolution->setValue(value);
|
|
|
|
} else {
|
|
|
|
spnResolution->setValue((int) roundf(spnResolution->value() * 25.4f));
|
|
|
|
}
|
|
|
|
spnResolution->setSingleStep(50);
|
|
|
|
} else {
|
|
|
|
if ((value = resolution_standard(1, spnResolution->value()))) {
|
|
|
|
spnResolution->setValue(value);
|
|
|
|
} else {
|
|
|
|
spnResolution->setValue((int) roundf(spnResolution->value() / 25.4f));
|
|
|
|
}
|
|
|
|
spnResolution->setSingleStep(1);
|
|
|
|
}
|
|
|
|
update_scale();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScaleWindow::resolution_default()
|
|
|
|
{
|
|
|
|
spnResolution->setValue(cmbResolutionUnits->currentIndex() == 1 ? 300 : 12);
|
|
|
|
update_scale();
|
|
|
|
}
|
|
|
|
|
|
|
|
float ScaleWindow::get_x_dim_mm() const
|
|
|
|
{
|
|
|
|
return (float) (cmbXdimUnits->currentIndex() == 1 ? spnXdim->value() * 25.4 : spnXdim->value());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
float ScaleWindow::get_dpmm() const
|
|
|
|
{
|
|
|
|
return (float) (cmbResolutionUnits->currentIndex() == 1 ? spnResolution->value() / 25.4 : spnResolution->value());
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *ScaleWindow::getFileType() const
|
|
|
|
{
|
|
|
|
static const char *filetypes[3] = { "GIF", "SVG", "EMF" };
|
|
|
|
return filetypes[std::max(std::min(cmbFileType->currentIndex(), 2), 0)];
|
|
|
|
}
|
|
|
|
|
2023-12-23 10:29:54 +13:00
|
|
|
void ScaleWindow::set_maxima()
|
|
|
|
{
|
|
|
|
float maxXdim = m_bc->bc.getXdimDpFromScale(200.0f, get_dpmm(), getFileType());
|
|
|
|
if (cmbXdimUnits->currentIndex() == 1) { // Inches
|
|
|
|
spnXdim->setMaximum(maxXdim / 25.4);
|
|
|
|
} else {
|
|
|
|
spnXdim->setMaximum(maxXdim);
|
|
|
|
}
|
|
|
|
float maxRes = m_bc->bc.getXdimDpFromScale(200.0f, get_x_dim_mm(), getFileType());
|
|
|
|
if (cmbResolutionUnits->currentIndex() == 1) { // Inches
|
|
|
|
spnResolution->setMaximum(maxRes * 25.4);
|
|
|
|
} else {
|
|
|
|
spnResolution->setMaximum(maxRes);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
- API: add new zint_symbol `dpmm` field for output resolution (BMP/
EMF/PCX/PNG/TIF only, i.e. excluding EPS, GIF & SVG)
- Add support for specifying scale by X-dimension and resolution
with new option `--scalexdimdp` for CLI/Tcl & new API function
`ZBarcode_Scale_From_XdimDp()` (+ `ZBarcode_XdimDp_From_Scale()`
& `ZBarcode_Default_Xdim()`) and new GUI popup; manual: document
- BMP/EMF/PCX/PNG/TIF: use new `dpmm` resolution field (for EMF
following Inkscape)
- backend_qt: add `dpmm()`, `vectorWidth()`, `vectorHeight()`,
`noPng()`, `getVersion()`, `takesGS1AIData()`, & `XdimDp` stuff
incl. new `QZintXdimDp` struct for passing around scale vars &
use in `getAsCLI()`; add comments
- Raise `scale` limit to 200 (from 100) to allow for large dpmm
- output: create directories & subdirectories as necessary for
output path using new function `out_fopen()` and use in BMP/EMF/
EPS/GIF/PCX/PNG/SVG/TIF
- DPLEIT/DPIDENT: format HRT according to (incomplete)
documentation, and set default height to 72X (from 50X)
- CODE128B renamed to CODE128AB as can use subsets A and/or B
- CODABAR: fix minimum height calc
- EMF: fix indexing of handles (zero-based not 1-based)
- GUI: fix symbology zap (previous technique of clearing and
re-loading settings without doing a sync no longer works);
fix UPCEAN guard descent enable
- MAILMARK: better error message if input < 14 characters
- GUI: add "Default" button for DAFT tracker ratio & enable/disable
various default buttons; use new `takesGS1AIData()` to
enable/disable GS1-specific checkboxes
- CLI: use new `validate_float()` to parse float options (7
significant digits allowed only, no scientific notation)
- DATAMATRIX/GRIDMATRIX/PDF417/QR/ULTRA: micro-optimize structapp
ID parse
- library/CLI: fiddle with static asserts (make CHAR_BIT sensitive,
supposedly)
- win32/README: update building libpng (assembly removed)
- README.linux: document incompatibility of Qt6 >= 6.3
- manual: expand Barcode Studio waffle
- test suite: change range separator to hyphen and allow multiple
excludes
2022-12-03 10:39:01 +13:00
|
|
|
double ScaleWindow::update_vars()
|
|
|
|
{
|
|
|
|
double scale = (double) m_bc->bc.getScaleFromXdimDp(get_x_dim_mm(), get_dpmm(), getFileType());
|
|
|
|
if (scale != 0.0) {
|
|
|
|
m_vars.x_dim = spnXdim->value();
|
|
|
|
m_vars.x_dim_units = cmbXdimUnits->currentIndex();
|
|
|
|
m_vars.resolution = spnResolution->value();
|
|
|
|
m_vars.resolution_units = cmbResolutionUnits->currentIndex();
|
|
|
|
if (m_bc->bc.symbol() == BARCODE_MAXICODE) {
|
|
|
|
m_vars.filetype_maxicode = cmbFileType->currentIndex();
|
|
|
|
} else {
|
|
|
|
m_vars.filetype = cmbFileType->currentIndex();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return scale;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* vim: set ts=4 sw=4 et : */
|