PDF417: fix cols/rows calculation to require multiple <= 928 codewords;

add specify rows option (option_3) (#204);
  warn if cols increased from specified (back-incompatible);
  move table definitions from "pdf417.h" to new "pdf417_tabs.h" and
  make INTERNAL_DATA and share with composite.c (saves ~10K);
  prefix routines and tables with "pdf_";
  some small performance improvements through if/elses, pdf_textprocess()
  & pdf_numbprocess() loop simplifications
MICROQR: fix debug access crash on printing non-NUL-terminating binary
DATAMATRIX: fix missing ++ from "[tp]" at C40/TEXT EOD processing of GS1
  (though probably never reached); use "[tp++]" throughout
Add const to static tables missing it and also to some variables
Change "debug" -> "debug_print" throughout
This commit is contained in:
gitlost 2021-10-30 22:00:31 +01:00
parent 706f021637
commit 4e72a541f7
47 changed files with 1949 additions and 1231 deletions

View file

@ -27,7 +27,8 @@
<string>&amp;Number of Data Columns:</string>
</property>
<property name="toolTip">
<string>Set number of data characters in a row</string>
<string>Set number of data characters in a row - may
be set to more than this depending on data</string>
</property>
<property name="alignment" >
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
@ -43,7 +44,8 @@
<number>21</number>
</property>
<property name="toolTip">
<string>Set number of data characters in a row</string>
<string>Set number of data characters in a row - may
be set to more than this depending on data</string>
</property>
<item>
<property name="text" >
@ -203,6 +205,479 @@
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="lblPDFRows" >
<property name="text" >
<string>Number of Ro&amp;ws:</string>
</property>
<property name="toolTip">
<string>Set number of rows - may be set to more than
this depending on data and columns setting</string>
</property>
<property name="alignment" >
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<cstring>cmbPDFRows</cstring>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QComboBox" name="cmbPDFRows" >
<property name="maxVisibleItems">
<number>21</number>
</property>
<property name="toolTip">
<string>Set number of rows - may be set to more than
this depending on data and columns setting</string>
</property>
<item>
<property name="text" >
<string>Automatic</string>
</property>
</item>
<item>
<property name="text" >
<string>3</string>
</property>
</item>
<item>
<property name="text" >
<string>4</string>
</property>
</item>
<item>
<property name="text" >
<string>5</string>
</property>
</item>
<item>
<property name="text" >
<string>6</string>
</property>
</item>
<item>
<property name="text" >
<string>7</string>
</property>
</item>
<item>
<property name="text" >
<string>8</string>
</property>
</item>
<item>
<property name="text" >
<string>9</string>
</property>
</item>
<item>
<property name="text" >
<string>10</string>
</property>
</item>
<item>
<property name="text" >
<string>11</string>
</property>
</item>
<item>
<property name="text" >
<string>12</string>
</property>
</item>
<item>
<property name="text" >
<string>13</string>
</property>
</item>
<item>
<property name="text" >
<string>14</string>
</property>
</item>
<item>
<property name="text" >
<string>15</string>
</property>
</item>
<item>
<property name="text" >
<string>16</string>
</property>
</item>
<item>
<property name="text" >
<string>17</string>
</property>
</item>
<item>
<property name="text" >
<string>18</string>
</property>
</item>
<item>
<property name="text" >
<string>19</string>
</property>
</item>
<item>
<property name="text" >
<string>20</string>
</property>
</item>
<item>
<property name="text" >
<string>21</string>
</property>
</item>
<item>
<property name="text" >
<string>22</string>
</property>
</item>
<item>
<property name="text" >
<string>23</string>
</property>
</item>
<item>
<property name="text" >
<string>24</string>
</property>
</item>
<item>
<property name="text" >
<string>25</string>
</property>
</item>
<item>
<property name="text" >
<string>26</string>
</property>
</item>
<item>
<property name="text" >
<string>27</string>
</property>
</item>
<item>
<property name="text" >
<string>28</string>
</property>
</item>
<item>
<property name="text" >
<string>29</string>
</property>
</item>
<item>
<property name="text" >
<string>30</string>
</property>
</item>
<item>
<property name="text" >
<string>31</string>
</property>
</item>
<item>
<property name="text" >
<string>32</string>
</property>
</item>
<item>
<property name="text" >
<string>33</string>
</property>
</item>
<item>
<property name="text" >
<string>34</string>
</property>
</item>
<item>
<property name="text" >
<string>35</string>
</property>
</item>
<item>
<property name="text" >
<string>36</string>
</property>
</item>
<item>
<property name="text" >
<string>37</string>
</property>
</item>
<item>
<property name="text" >
<string>38</string>
</property>
</item>
<item>
<property name="text" >
<string>39</string>
</property>
</item>
<item>
<property name="text" >
<string>40</string>
</property>
</item>
<item>
<property name="text" >
<string>41</string>
</property>
</item>
<item>
<property name="text" >
<string>42</string>
</property>
</item>
<item>
<property name="text" >
<string>43</string>
</property>
</item>
<item>
<property name="text" >
<string>44</string>
</property>
</item>
<item>
<property name="text" >
<string>45</string>
</property>
</item>
<item>
<property name="text" >
<string>46</string>
</property>
</item>
<item>
<property name="text" >
<string>47</string>
</property>
</item>
<item>
<property name="text" >
<string>48</string>
</property>
</item>
<item>
<property name="text" >
<string>49</string>
</property>
</item>
<item>
<property name="text" >
<string>50</string>
</property>
</item>
<item>
<property name="text" >
<string>51</string>
</property>
</item>
<item>
<property name="text" >
<string>52</string>
</property>
</item>
<item>
<property name="text" >
<string>53</string>
</property>
</item>
<item>
<property name="text" >
<string>54</string>
</property>
</item>
<item>
<property name="text" >
<string>55</string>
</property>
</item>
<item>
<property name="text" >
<string>56</string>
</property>
</item>
<item>
<property name="text" >
<string>57</string>
</property>
</item>
<item>
<property name="text" >
<string>58</string>
</property>
</item>
<item>
<property name="text" >
<string>59</string>
</property>
</item>
<item>
<property name="text" >
<string>60</string>
</property>
</item>
<item>
<property name="text" >
<string>61</string>
</property>
</item>
<item>
<property name="text" >
<string>62</string>
</property>
</item>
<item>
<property name="text" >
<string>63</string>
</property>
</item>
<item>
<property name="text" >
<string>64</string>
</property>
</item>
<item>
<property name="text" >
<string>65</string>
</property>
</item>
<item>
<property name="text" >
<string>66</string>
</property>
</item>
<item>
<property name="text" >
<string>67</string>
</property>
</item>
<item>
<property name="text" >
<string>68</string>
</property>
</item>
<item>
<property name="text" >
<string>69</string>
</property>
</item>
<item>
<property name="text" >
<string>70</string>
</property>
</item>
<item>
<property name="text" >
<string>71</string>
</property>
</item>
<item>
<property name="text" >
<string>72</string>
</property>
</item>
<item>
<property name="text" >
<string>73</string>
</property>
</item>
<item>
<property name="text" >
<string>74</string>
</property>
</item>
<item>
<property name="text" >
<string>75</string>
</property>
</item>
<item>
<property name="text" >
<string>76</string>
</property>
</item>
<item>
<property name="text" >
<string>77</string>
</property>
</item>
<item>
<property name="text" >
<string>78</string>
</property>
</item>
<item>
<property name="text" >
<string>79</string>
</property>
</item>
<item>
<property name="text" >
<string>80</string>
</property>
</item>
<item>
<property name="text" >
<string>81</string>
</property>
</item>
<item>
<property name="text" >
<string>82</string>
</property>
</item>
<item>
<property name="text" >
<string>83</string>
</property>
</item>
<item>
<property name="text" >
<string>84</string>
</property>
</item>
<item>
<property name="text" >
<string>85</string>
</property>
</item>
<item>
<property name="text" >
<string>86</string>
</property>
</item>
<item>
<property name="text" >
<string>87</string>
</property>
</item>
<item>
<property name="text" >
<string>88</string>
</property>
</item>
<item>
<property name="text" >
<string>89</string>
</property>
</item>
<item>
<property name="text" >
<string>90</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="lblPDFECC" >
<property name="text" >
<string>E&amp;rror Correction Capacity:</string>
@ -218,7 +693,7 @@
</property>
</widget>
</item>
<item row="1" column="1" >
<item row="2" column="1" >
<widget class="QComboBox" name="cmbPDFECC" >
<property name="toolTip">
<string>Set number of error correction characters</string>
@ -292,7 +767,7 @@
<item row="0" column="0">
<widget class="QRadioButton" name="radPDFStand">
<property name="text">
<string>S&amp;tandard Mode</string>
<string>S&amp;tandard</string>
</property>
<property name="toolTip">
<string>Process data as normal</string>
@ -315,7 +790,7 @@ the data with a slash &quot;/&quot;</string>
</property>
</widget>
</item>
<item row="1" column="0">
<item row="0" column="2">
<widget class="QRadioButton" name="radPDFTruncated">
<property name="text">
<string>&amp;Compact PDF417</string>

View file

@ -306,7 +306,7 @@ MainWindow::~MainWindow()
save_sub_settings(settings, m_bc.bc.symbol());
}
QString MainWindow::get_zint_version()
QString MainWindow::get_zint_version(void)
{
QString zint_version;
@ -882,6 +882,7 @@ void MainWindow::change_options()
tabMain->insertTab(1, m_optionWidget, tr("PDF41&7"));
connect(get_widget(QSL("cmbPDFECC")), SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
connect(get_widget(QSL("cmbPDFCols")), SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
connect(get_widget(QSL("cmbPDFRows")), SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
connect(get_widget(QSL("radPDFTruncated")), SIGNAL(toggled( bool )), SLOT(update_preview()));
connect(get_widget(QSL("radPDFStand")), SIGNAL(toggled( bool )), SLOT(update_preview()));
connect(get_widget(QSL("radPDFHIBC")), SIGNAL(toggled( bool )), SLOT(update_preview()));
@ -1654,6 +1655,9 @@ void MainWindow::update_preview()
m_bc.bc.setSymbol(BARCODE_PDF417);
m_bc.bc.setOption2(get_cmb_index(QSL("cmbPDFCols")));
if ((item_val = get_cmb_index(QSL("cmbPDFRows"))) != 0) {
m_bc.bc.setOption3(item_val + 2); // Starts at 3 rows
}
m_bc.bc.setOption1(get_cmb_index(QSL("cmbPDFECC")) - 1);
if ((item_val = get_spn_val(QSL("spnPDFStructAppCount"))) > 1) {
@ -2674,6 +2678,7 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology)
case BARCODE_PDF417COMP:
case BARCODE_HIBC_PDF:
settings.setValue(QSL("studio/bc/pdf417/cols"), get_cmb_index(QSL("cmbPDFCols")));
settings.setValue(QSL("studio/bc/pdf417/rows"), get_cmb_index(QSL("cmbPDFRows")));
settings.setValue(QSL("studio/bc/pdf417/ecc"), get_cmb_index(QSL("cmbPDFECC")));
settings.setValue(QSL("studio/bc/pdf417/encoding_mode"), get_rad_grp_index(
QStringList() << QSL("radPDFStand") << QSL("radPDFTruncated") << QSL("radPDFHIBC")));
@ -2994,7 +2999,8 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology)
QSL("studio/bc/%1/appearance/chk_hrt_show").arg(name), 1).toInt() ? true : false);
}
chkCMYK->setChecked(settings.value(QSL("studio/bc/%1/appearance/cmyk").arg(name), 0).toInt() ? true : false);
chkQuietZones->setChecked(settings.value(QSL("studio/bc/%1/appearance/chk_quietzones").arg(name), 0).toInt() ? true : false);
chkQuietZones->setChecked(settings.value(
QSL("studio/bc/%1/appearance/chk_quietzones").arg(name), 0).toInt() ? true : false);
cmbRotate->setCurrentIndex(settings.value(QSL("studio/bc/%1/appearance/rotate").arg(name), 0).toInt());
if (symbology == BARCODE_DOTCODE || chkDotty->isEnabled()) {
chkDotty->setChecked(settings.value(
@ -3027,6 +3033,7 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology)
case BARCODE_PDF417COMP:
case BARCODE_HIBC_PDF:
set_cmb_from_setting(settings, QSL("studio/bc/pdf417/cols"), QSL("cmbPDFCols"));
set_cmb_from_setting(settings, QSL("studio/bc/pdf417/rows"), QSL("cmbPDFRows"));
set_cmb_from_setting(settings, QSL("studio/bc/pdf417/ecc"), QSL("cmbPDFECC"));
set_rad_from_setting(settings, QSL("studio/bc/pdf417/encoding_mode"),
QStringList() << QSL("radPDFStand") << QSL("radPDFTruncated") << QSL("radPDFHIBC"));

View file

@ -37,7 +37,7 @@ public:
MainWindow(QWidget *parent = 0, Qt::WindowFlags fl = Qt::WindowFlags());
~MainWindow();
static QString get_zint_version();
static QString get_zint_version(void);
public slots:
void update_preview();