From 1695eae7dd230bbec6a94213c4faba0d96027d31 Mon Sep 17 00:00:00 2001 From: hooper114 Date: Tue, 17 Nov 2009 22:36:04 +0000 Subject: [PATCH] Structural changes and updates from tgotic --- backend/2of5.c | 4 +- backend/Makefile.mingw | 2 +- backend/pdf417.c | 8 +- backend/qr.c | 8 +- backend_qt4/backend_qt4.pro | 4 +- frontend/Makefile.mingw | 6 +- frontend/zint.rc | 84 +++---- frontend_qt4/main.cpp | 4 +- frontend_qt4/mainWindow.ui | 178 ++++++++------- frontend_qt4/mainwindow.cpp | 25 +- frontend_qt4/mainwindow.h | 4 + frontend_qt4/resources.qrc | 14 +- frontend_qt4/sequencewindow.cpp | 392 ++++++++++++++++---------------- win32/libzint.vcproj | 136 +++++++++-- win32/zint.sln | 18 +- win32/zint.vcproj | 85 ++++++- zint.spec | 138 +++++------ 17 files changed, 671 insertions(+), 439 deletions(-) diff --git a/backend/2of5.c b/backend/2of5.c index 07c17a25..38700cde 100644 --- a/backend/2of5.c +++ b/backend/2of5.c @@ -23,7 +23,9 @@ #include #include #include "common.h" - +#ifdef _MSC_VER +#include +#endif static char *C25MatrixTable[10] = {"113311", "311131", "131131", "331111", "113131", "313111", "133111", "111331", "311311", "131311"}; diff --git a/backend/Makefile.mingw b/backend/Makefile.mingw index 851ceeb9..f2115b8b 100644 --- a/backend/Makefile.mingw +++ b/backend/Makefile.mingw @@ -55,7 +55,7 @@ all: $(DLL) $(STATLIB) $(DLL):$(DLL_OBJ) @echo Linking $@... - o2dll.sh -o $@ $(DLL_OBJ) $(LIBS) #-version-info 2:2:0 -version-number 2:2:0 + o2dll.sh -o $@ $(DLL_OBJ) $(LIBS) $(STATLIB): $(LIB_OBJ) @echo Linking $@... diff --git a/backend/pdf417.c b/backend/pdf417.c index 473ea756..c4723ad6 100644 --- a/backend/pdf417.c +++ b/backend/pdf417.c @@ -30,7 +30,7 @@ symbol->option_2 is used to adjust the width of the resulting symbol (i.e. the number of codeword columns not including row start and end data) */ -/* @(#) $Id: pdf417.c,v 1.15 2009/10/06 19:31:43 hooper114 Exp $ */ +/* @(#) $Id: pdf417.c,v 1.16 2009/11/17 22:36:04 hooper114 Exp $ */ #include #include @@ -294,10 +294,8 @@ void textprocess(int *chainemc, int *mclength, char chaine[], int start, int len wnet++; } /* Now translate the string chainet into codewords */ - if (block > 0) { - chainemc[*(mclength)] = 900; - *(mclength) = *(mclength) + 1; - } + chainemc[*(mclength)] = 900; + *(mclength) = *(mclength) + 1; for(j = 0; j < wnet; j+= 2) { int cw_number; diff --git a/backend/qr.c b/backend/qr.c index 3e0672a4..2d1833ad 100644 --- a/backend/qr.c +++ b/backend/qr.c @@ -157,7 +157,7 @@ int estimate_binary_length(char mode[], int length, int gs1) return count; } -void qr_binary(int datastream[], int version, int target_binlen, char mode[], int jisdata[], int length, int gs1) +void qr_binary(int datastream[], int version, int target_binlen, char mode[], int jisdata[], int length, int gs1, int est_binlen) { /* Convert input data to a binary stream and add padding */ int position = 0, debug = 0; @@ -167,9 +167,9 @@ void qr_binary(int datastream[], int version, int target_binlen, char mode[], in int toggle, percent; #ifndef _MSC_VER - char binary[target_binlen * 8]; + char binary[est_binlen + 12]; #else - char* binary = (char *)_alloca(target_binlen * 8); + char* binary = (char *)_alloca(est_binlen + 12); #endif strcpy(binary, ""); @@ -1241,7 +1241,7 @@ int qr_code(struct zint_symbol *symbol, unsigned char source[], int length) int* fullstream = (int *)_alloca((qr_total_codewords[version - 1] + 1) * sizeof(int)); #endif - qr_binary(datastream, version, target_binlen, mode, jisdata, length, gs1); + qr_binary(datastream, version, target_binlen, mode, jisdata, length, gs1, est_binlen); add_ecc(fullstream, datastream, version, target_binlen, blocks); size = qr_sizes[version - 1]; diff --git a/backend_qt4/backend_qt4.pro b/backend_qt4/backend_qt4.pro index e9b76abf..6fbfd44a 100644 --- a/backend_qt4/backend_qt4.pro +++ b/backend_qt4/backend_qt4.pro @@ -12,7 +12,7 @@ TARGET = QtZint INCLUDEPATH += ../backend #EDIT THIS !!!! -DEFINES += NO_PNG NO_QR ZINT_VERSION=\"2.1.3\" +DEFINES += NO_PNG NO_QR ZINT_VERSION="2.3.0" !contains(DEFINES, NO_PNG) { SOURCES += ../backend/png.c @@ -97,7 +97,7 @@ SOURCES += ../backend/2of5.c \ ../backend/code1.c \ qzint.cpp -VERSION = 2.1.3 +VERSION = 2.3.0 #DESTDIR = . diff --git a/frontend/Makefile.mingw b/frontend/Makefile.mingw index 051fa8ca..201d6aa9 100644 --- a/frontend/Makefile.mingw +++ b/frontend/Makefile.mingw @@ -9,7 +9,7 @@ ZINT_VERSION:=-DZINT_VERSION=\"2.3.0\" CC := gcc -CFLAGS := -D_WIN32 -O2 -fms-extensions -mms-bitfields -fno-exceptions -fomit-frame-pointer -Wall +CFLAGS := -D_WIN32 -O2 -fms-extensions -mms-bitfields -fno-exceptions -fomit-frame-pointer -Wall -I../backend prefix := /mingw bindir := $(prefix)/bin DESTDIR := @@ -20,10 +20,10 @@ all: zint zint_static windres -O coff --input-format=rc -i $< -o $@ zint: main.c zint.res - $(CC) $(CFLAGS) -DZINT_DLL -DQRENCODE_DLL -DPNG_DLL -DZLIB_DLL $(ZINT_VERSION) $? zint.res -o $@ -lzint + $(CC) $(CFLAGS) -DZINT_DLL -DPNG_DLL -DZLIB_DLL $(ZINT_VERSION) $? zint.res -o $@ -L../backend -lzint zint_static: main.c zint.res - $(CC) -static $(CFLAGS) $(ZINT_VERSION) $? zint.res -o $@ -lzint -lqrencode -lpng -lz + $(CC) -static $(CFLAGS) $(ZINT_VERSION) $? zint.res -o $@ -L../backend -lzint -lpng -lz .PHONY: install uninstall clean dist diff --git a/frontend/zint.rc b/frontend/zint.rc index 5cfdc996..831ecc90 100644 --- a/frontend/zint.rc +++ b/frontend/zint.rc @@ -1,42 +1,42 @@ -#define WIN32_LEAN_AND_MEAN -#include -#include - -#ifdef GCC_WINDRES -VS_VERSION_INFO VERSIONINFO -#else -VS_VERSION_INFO VERSIONINFO -#endif - FILEVERSION 2,1,3,0 - PRODUCTVERSION 2,1,3,0 - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK -#ifdef _DEBUG - FILEFLAGS VS_FF_DEBUG -#else - FILEFLAGS 0 -#endif - FILEOS VOS_NT_WINDOWS32 - FILETYPE VFT_APP - FILESUBTYPE VFT2_UNKNOWN -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904E4" - //language ID = U.S. English, char set = Windows, Multilingual - BEGIN - VALUE "FileDescription", "libzint barcode library\0" - VALUE "FileVersion", "2.1.3.0\0" - VALUE "InternalName", "zint.exe\0" - VALUE "LegalCopyright", "Copyright © 2009 Robin Stuart & BogDan Vatra\0" - VALUE "OriginalFilename", "zint.exe\0" - VALUE "ProductName", "libzint\0" - VALUE "ProductVersion", "2.1.3.0\0" - VALUE "License", "GNU General Public License version 3\0" - VALUE "WWW", "http://www.sourceforge.net/projects/zint\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0409, 1250 - END -END +#define WIN32_LEAN_AND_MEAN +#include +#include + +#ifdef GCC_WINDRES +VS_VERSION_INFO VERSIONINFO +#else +VS_VERSION_INFO VERSIONINFO +#endif + FILEVERSION 2,3,0,0 + PRODUCTVERSION 2,3,0,0 + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#ifdef _DEBUG + FILEFLAGS VS_FF_DEBUG +#else + FILEFLAGS 0 +#endif + FILEOS VOS_NT_WINDOWS32 + FILETYPE VFT_APP + FILESUBTYPE VFT2_UNKNOWN +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" + //language ID = U.S. English, char set = Windows, Multilingual + BEGIN + VALUE "FileDescription", "zint barcode generator\0" + VALUE "FileVersion", "2.3.0.0\0" + VALUE "InternalName", "zint.exe\0" + VALUE "LegalCopyright", "Copyright © 2009 Robin Stuart & BogDan Vatra\0" + VALUE "OriginalFilename", "zint.exe\0" + VALUE "ProductName", "zint\0" + VALUE "ProductVersion", "2.3.0.0\0" + VALUE "License", "GNU General Public License version 3\0" + VALUE "WWW", "http://www.sourceforge.net/projects/zint\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 1250 + END +END diff --git a/frontend_qt4/main.cpp b/frontend_qt4/main.cpp index c3d97fcd..ceda84c3 100644 --- a/frontend_qt4/main.cpp +++ b/frontend_qt4/main.cpp @@ -14,13 +14,13 @@ * along with this program. If not, see . * ***************************************************************************/ -#include "mainwindow.h" #include +#include "mainwindow.h" int main(int argc, char *argv[]) { - QApplication app(argc, argv); Q_INIT_RESOURCE(resources); + QApplication app(argc, argv); MainWindow w; w.show(); return app.exec(); diff --git a/frontend_qt4/mainWindow.ui b/frontend_qt4/mainWindow.ui index 0f9f4ea2..e5d93625 100644 --- a/frontend_qt4/mainWindow.ui +++ b/frontend_qt4/mainWindow.ui @@ -2,6 +2,9 @@ mainWindow + + Qt::NonModal + 0 @@ -10,10 +13,16 @@ 711 + + + 749 + 711 + + - 800 - 800 + 749 + 711 @@ -21,10 +30,10 @@ - :/zico.png:/zico.png + :/images/zico.png:/images/zico.png - - background-image: url(:/blueback.png); + + @@ -50,7 +59,19 @@ - + + + + 28 + 28 + + + + + 28 + 28 + + Zoom out @@ -59,7 +80,7 @@ - :/zoomout.png:/zoomout.png + :/images/zoomout.png:/images/zoomout.png @@ -74,6 +95,9 @@ Adjust zoom + + + 50 @@ -95,13 +119,25 @@ - + + + + 28 + 28 + + + + + 28 + 28 + + Zoom in - :/zoomin.png:/zoomin.png + :/images/zoomin.png:/images/zoomin.png @@ -112,13 +148,28 @@ - + + + + 28 + 28 + + + + + 28 + 28 + + Rotate anti-clockwise + + + - :/rotateleft.png:/rotateleft.png + :/images/rotateleft.png:/images/rotateleft.png @@ -133,22 +184,46 @@ Adjust Rotation + + + 360 + + 15 + Qt::Horizontal + + QSlider::TicksBelow + + + 90 + - + + + + 28 + 28 + + + + + 28 + 28 + + Rotate clockwise - :/rotateright.png:/rotateright.png + :/images/rotateright.png:/images/rotateright.png @@ -391,7 +466,7 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'DejaVu Sans'; font-size:8pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:9pt;">Your Data Here!</span></p></body></html> @@ -704,80 +779,15 @@ p, li { white-space: pre-wrap; } btnSave btnExit view - toolButton_5 + btnZoomOut scaleSlider - toolButton_4 - toolButton + btnZoomIn + btnRotateLeft rotateSlider - toolButton_2 + btnRotatRight - - - toolButton - clicked() - rotateSlider - subtractStep() - - - 29 - 265 - - - 76 - 265 - - - - - toolButton_2 - clicked() - rotateSlider - addStep() - - - 491 - 260 - - - 431 - 260 - - - - - toolButton_4 - clicked() - scaleSlider - addStep() - - - 532 - 231 - - - 528 - 191 - - - - - toolButton_5 - clicked() - scaleSlider - subtractStep() - - - 530 - 56 - - - 530 - 94 - - - - + diff --git a/frontend_qt4/mainwindow.cpp b/frontend_qt4/mainwindow.cpp index 859e0130..883a8519 100644 --- a/frontend_qt4/mainwindow.cpp +++ b/frontend_qt4/mainwindow.cpp @@ -132,6 +132,10 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags fl) connect(btnMoreData, SIGNAL(clicked( bool )), SLOT(open_data_dialog())); connect(btnSequence, SIGNAL(clicked( bool )), SLOT(open_sequence_dialog())); connect(chkHRTHide, SIGNAL(stateChanged( int )), SLOT(update_preview())); + connect(btnZoomIn, SIGNAL(clicked(void)), SLOT(zoomIn(void))); + connect(btnZoomOut, SIGNAL(clicked(void)), SLOT(zoomOut(void))); + connect(btnRotateLeft, SIGNAL(clicked(void)), SLOT(rotateLeft(void))); + connect(btnRotatRight, SIGNAL(clicked(void)), SLOT(rotateRight(void))); } MainWindow::~MainWindow() @@ -848,4 +852,23 @@ void MainWindow::update_preview() view->scene()->update(); } - +void +MainWindow::zoomIn(void) +{ + scaleSlider->setValue(scaleSlider->value() + scaleSlider->singleStep()); +} +void +MainWindow::zoomOut(void) +{ + scaleSlider->setValue(scaleSlider->value() - scaleSlider->singleStep()); +} +void +MainWindow::rotateLeft(void) +{ + rotateSlider->setValue(rotateSlider->value() - rotateSlider->singleStep()); +} +void +MainWindow::rotateRight(void) +{ + rotateSlider->setValue(rotateSlider->value() + rotateSlider->singleStep()); +} diff --git a/frontend_qt4/mainwindow.h b/frontend_qt4/mainwindow.h index 8af049bc..ae83de3e 100644 --- a/frontend_qt4/mainwindow.h +++ b/frontend_qt4/mainwindow.h @@ -118,6 +118,10 @@ public slots: void maxi_primary(); void change_print_scale(); void scaleRotate(); + void zoomIn(void); + void zoomOut(void); + void rotateLeft(void); + void rotateRight(void); private slots: bool save(); diff --git a/frontend_qt4/resources.qrc b/frontend_qt4/resources.qrc index 800b5381..f9d38a65 100644 --- a/frontend_qt4/resources.qrc +++ b/frontend_qt4/resources.qrc @@ -1,10 +1,10 @@ - - zoomin.png - zoomout.png - rotateleft.png - rotateright.png - zico.png + + images/zoomout.png + images/rotateleft.png + images/rotateright.png + images/zico.png + images/zoomin.png grpAztec.ui grpC39.ui grpDM.ui @@ -21,5 +21,5 @@ grpCodeOne.ui grpC49.ui grpGrid.ui - + diff --git a/frontend_qt4/sequencewindow.cpp b/frontend_qt4/sequencewindow.cpp index dcb4bea7..f5076b84 100644 --- a/frontend_qt4/sequencewindow.cpp +++ b/frontend_qt4/sequencewindow.cpp @@ -1,196 +1,196 @@ -/* - Zint Barcode Generator - the open source barcode generator - Copyright (C) 2009 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 - 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. -*/ - -#include -#include -#include -#include -#include - -#include "sequencewindow.h" -#include "exportwindow.h" -#include - -SequenceWindow::SequenceWindow() -{ - setupUi(this); - QValidator *intvalid = new QIntValidator(this); - - linStartVal->setValidator(intvalid); - linEndVal->setValidator(intvalid); - linIncVal->setValidator(intvalid); - connect(btnClose, SIGNAL( clicked( bool )), SLOT(quit_now())); - connect(btnReset, SIGNAL( clicked( bool )), SLOT(reset_preview())); - connect(btnCreate, SIGNAL( clicked( bool )), SLOT(create_sequence())); - connect(txtPreview, SIGNAL( textChanged()), SLOT(check_generate())); - connect(btnImport, SIGNAL( clicked( bool )), SLOT(import())); - connect(btnExport, SIGNAL( clicked( bool )), SLOT(generate_sequence())); -} - -SequenceWindow::~SequenceWindow() -{ -} - -void SequenceWindow::quit_now() -{ - close(); -} - -void SequenceWindow::reset_preview() -{ - txtPreview->clear(); -} - -QString SequenceWindow::apply_format(QString raw_number) -{ - QString adjusted, reversed; - QString format; - int format_len, input_len, i, inpos; - char format_char; - QChar format_qchar; - - format = linFormat->text(); - input_len = raw_number.length(); - format_len = format.length(); - - inpos = input_len; - - for(i = format_len; i > 0; i--) { - format_qchar = format[i - 1]; - format_char = format_qchar.toAscii(); - switch(format_char) { - case '#': - if (inpos > 0) { - adjusted += raw_number[inpos - 1]; - inpos--; - } else { - adjusted += ' '; - } - break; - case '$': - if (inpos > 0) { - adjusted += raw_number[inpos - 1]; - inpos--; - } else { - adjusted += '0'; - } - break; - case '*': - if (inpos > 0) { - adjusted += raw_number[inpos - 1]; - inpos--; - } else { - adjusted += '*'; - } - break; - default: - adjusted += format_char; - break; - } - } - - for(i = format_len; i > 0; i--) { - reversed += adjusted[i - 1]; - } - - return reversed; -} - -void SequenceWindow::create_sequence() -{ - QString startval, endval, incval, part, outputtext; - int start, stop, step, i; - bool ok; - - startval = linStartVal->text(); - endval = linEndVal->text(); - incval = linIncVal->text(); - start = startval.toInt(&ok, 10); - stop = endval.toInt(&ok, 10); - step = incval.toInt(&ok, 10); - - if((stop <= start) || (step <= 0)) { - QMessageBox::critical(this, tr("Sequence Error"), tr("One or more of the input values is incorrect.")); - return; - } - - for(i = start; i <= stop; i += step) { - part = apply_format(QString::number(i, 10)); - part += '\n'; - outputtext += part; - } - - txtPreview->setPlainText(outputtext); -} - -void SequenceWindow::check_generate() -{ - QString preview_copy; - - preview_copy = txtPreview->toPlainText(); - if(preview_copy.isEmpty()) { - btnExport->setEnabled(false); - } else { - btnExport->setEnabled(true); - } -} - -void SequenceWindow::import() -{ - //QString fileName; - //QFileDialog fdialog; - QFile file; - QString selectedFilter; - - //fdialog.setFileMode(QFileDialog::ExistingFile); - - //if(fdialog.exec()) { - // fileName = fdialog.selectedFiles().at(0); - //} else { - // return; - //} - - QString fileName = QFileDialog::getOpenFileName(this, - tr("Import File"), - "./", - tr("All Files (*);;Text Files (*.txt)")); - if (fileName.isEmpty()) - return; - - file.setFileName(fileName); - if(!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - QMessageBox::critical(this, tr("Open Error"), tr("Could not open selected file.")); - return; - } - - QByteArray outstream = file.readAll(); - - txtPreview->setPlainText(QString(outstream)); - file.close(); -} - -void SequenceWindow::generate_sequence() -{ - int returnval; - - ExportWindow dlg; - dlg.barcode = barcode; - dlg.output_data = txtPreview->toPlainText(); - returnval = dlg.exec(); -} \ No newline at end of file +/* + Zint Barcode Generator - the open source barcode generator + Copyright (C) 2009 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 + 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. +*/ + +#include +#include +#include +#include +#include + +#include "sequencewindow.h" +#include "exportwindow.h" +#include + +SequenceWindow::SequenceWindow() +{ + setupUi(this); + QValidator *intvalid = new QIntValidator(this); + + linStartVal->setValidator(intvalid); + linEndVal->setValidator(intvalid); + linIncVal->setValidator(intvalid); + connect(btnClose, SIGNAL( clicked( bool )), SLOT(quit_now())); + connect(btnReset, SIGNAL( clicked( bool )), SLOT(reset_preview())); + connect(btnCreate, SIGNAL( clicked( bool )), SLOT(create_sequence())); + connect(txtPreview, SIGNAL( textChanged()), SLOT(check_generate())); + connect(btnImport, SIGNAL( clicked( bool )), SLOT(import())); + connect(btnExport, SIGNAL( clicked( bool )), SLOT(generate_sequence())); +} + +SequenceWindow::~SequenceWindow() +{ +} + +void SequenceWindow::quit_now() +{ + close(); +} + +void SequenceWindow::reset_preview() +{ + txtPreview->clear(); +} + +QString SequenceWindow::apply_format(QString raw_number) +{ + QString adjusted, reversed; + QString format; + int format_len, input_len, i, inpos; + char format_char; + QChar format_qchar; + + format = linFormat->text(); + input_len = raw_number.length(); + format_len = format.length(); + + inpos = input_len; + + for(i = format_len; i > 0; i--) { + format_qchar = format[i - 1]; + format_char = format_qchar.toAscii(); + switch(format_char) { + case '#': + if (inpos > 0) { + adjusted += raw_number[inpos - 1]; + inpos--; + } else { + adjusted += ' '; + } + break; + case '$': + if (inpos > 0) { + adjusted += raw_number[inpos - 1]; + inpos--; + } else { + adjusted += '0'; + } + break; + case '*': + if (inpos > 0) { + adjusted += raw_number[inpos - 1]; + inpos--; + } else { + adjusted += '*'; + } + break; + default: + adjusted += format_char; + break; + } + } + + for(i = format_len; i > 0; i--) { + reversed += adjusted[i - 1]; + } + + return reversed; +} + +void SequenceWindow::create_sequence() +{ + QString startval, endval, incval, part, outputtext; + int start, stop, step, i; + bool ok; + + startval = linStartVal->text(); + endval = linEndVal->text(); + incval = linIncVal->text(); + start = startval.toInt(&ok, 10); + stop = endval.toInt(&ok, 10); + step = incval.toInt(&ok, 10); + + if((stop <= start) || (step <= 0)) { + QMessageBox::critical(this, tr("Sequence Error"), tr("One or more of the input values is incorrect.")); + return; + } + + for(i = start; i <= stop; i += step) { + part = apply_format(QString::number(i, 10)); + part += '\n'; + outputtext += part; + } + + txtPreview->setPlainText(outputtext); +} + +void SequenceWindow::check_generate() +{ + QString preview_copy; + + preview_copy = txtPreview->toPlainText(); + if(preview_copy.isEmpty()) { + btnExport->setEnabled(false); + } else { + btnExport->setEnabled(true); + } +} + +void SequenceWindow::import() +{ + //QString fileName; + //QFileDialog fdialog; + QFile file; + QString selectedFilter; + + //fdialog.setFileMode(QFileDialog::ExistingFile); + + //if(fdialog.exec()) { + // fileName = fdialog.selectedFiles().at(0); + //} else { + // return; + //} + + QString fileName = QFileDialog::getOpenFileName(this, + tr("Import File"), + "./", + tr("All Files (*);;Text Files (*.txt)")); + if (fileName.isEmpty()) + return; + + file.setFileName(fileName); + if(!file.open(QIODevice::ReadOnly | QIODevice::Text)) { + QMessageBox::critical(this, tr("Open Error"), tr("Could not open selected file.")); + return; + } + + QByteArray outstream = file.readAll(); + + txtPreview->setPlainText(QString(outstream)); + file.close(); +} + +void SequenceWindow::generate_sequence() +{ + int returnval; + + ExportWindow dlg; + dlg.barcode = barcode; + dlg.output_data = txtPreview->toPlainText(); + returnval = dlg.exec(); +} diff --git a/win32/libzint.vcproj b/win32/libzint.vcproj index 693d11f1..40f81839 100644 --- a/win32/libzint.vcproj +++ b/win32/libzint.vcproj @@ -1,10 +1,10 @@ @@ -41,8 +41,8 @@ + + + + + + + + + + + + + + + + + @@ -235,6 +309,14 @@ + + + + + @@ -268,10 +354,6 @@ RelativePath="..\backend\medical.c" > - - @@ -280,6 +362,10 @@ RelativePath="..\backend\plessey.c" > + + @@ -350,6 +436,14 @@ RelativePath="..\backend\font.h" > + + + + @@ -367,17 +461,25 @@ > + + + + @@ -397,8 +499,16 @@ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" > + + + diff --git a/win32/zint.sln b/win32/zint.sln index cb0228a8..cb918305 100644 --- a/win32/zint.sln +++ b/win32/zint.sln @@ -1,26 +1,32 @@ + Microsoft Visual Studio Solution File, Format Version 10.00 # Visual Studio 2008 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zint", "zint.vcproj", "{3169C7FA-E52C-4BFC-B7BB-E55EBA133770}" ProjectSection(ProjectDependencies) = postProject - {63287BBA-3B4C-44A8-B538-B2E8530B2BE6} = {63287BBA-3B4C-44A8-B538-B2E8530B2BE6} + {5C08DC40-8F7D-475E-AA3C-814DED735A4B} = {5C08DC40-8F7D-475E-AA3C-814DED735A4B} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libzint", "libzint.vcproj", "{63287BBA-3B4C-44A8-B538-B2E8530B2BE6}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libzint", "libzint.vcproj", "{5C08DC40-8F7D-475E-AA3C-814DED735A4B}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 + Release_LIB|Win32 = Release_LIB|Win32 Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {3169C7FA-E52C-4BFC-B7BB-E55EBA133770}.Debug|Win32.ActiveCfg = Debug|Win32 {3169C7FA-E52C-4BFC-B7BB-E55EBA133770}.Debug|Win32.Build.0 = Debug|Win32 + {3169C7FA-E52C-4BFC-B7BB-E55EBA133770}.Release_LIB|Win32.ActiveCfg = Release_LIB|Win32 + {3169C7FA-E52C-4BFC-B7BB-E55EBA133770}.Release_LIB|Win32.Build.0 = Release_LIB|Win32 {3169C7FA-E52C-4BFC-B7BB-E55EBA133770}.Release|Win32.ActiveCfg = Release|Win32 {3169C7FA-E52C-4BFC-B7BB-E55EBA133770}.Release|Win32.Build.0 = Release|Win32 - {63287BBA-3B4C-44A8-B538-B2E8530B2BE6}.Debug|Win32.ActiveCfg = Debug|Win32 - {63287BBA-3B4C-44A8-B538-B2E8530B2BE6}.Debug|Win32.Build.0 = Debug|Win32 - {63287BBA-3B4C-44A8-B538-B2E8530B2BE6}.Release|Win32.ActiveCfg = Release|Win32 - {63287BBA-3B4C-44A8-B538-B2E8530B2BE6}.Release|Win32.Build.0 = Release|Win32 + {5C08DC40-8F7D-475E-AA3C-814DED735A4B}.Debug|Win32.ActiveCfg = Debug|Win32 + {5C08DC40-8F7D-475E-AA3C-814DED735A4B}.Debug|Win32.Build.0 = Debug|Win32 + {5C08DC40-8F7D-475E-AA3C-814DED735A4B}.Release_LIB|Win32.ActiveCfg = Release_LIB|Win32 + {5C08DC40-8F7D-475E-AA3C-814DED735A4B}.Release_LIB|Win32.Build.0 = Release_LIB|Win32 + {5C08DC40-8F7D-475E-AA3C-814DED735A4B}.Release|Win32.ActiveCfg = Release|Win32 + {5C08DC40-8F7D-475E-AA3C-814DED735A4B}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/win32/zint.vcproj b/win32/zint.vcproj index 5858989c..b6868a96 100644 --- a/win32/zint.vcproj +++ b/win32/zint.vcproj @@ -42,7 +42,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="..\backend" - PreprocessorDefinitions="WIN32;_WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;ZINT_VERSION="\"2.1.3\"";ZINT_DLL" + PreprocessorDefinitions="WIN32;_WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;ZINT_VERSION="\"2.3.0\"";ZINT_DLL" MinimalRebuild="true" ExceptionHandling="0" BasicRuntimeChecks="3" @@ -114,12 +114,13 @@ + + + + + + + + + + + + + + + + + + + + + -Packager: Radist Tagan -Group: Development/Libraries/C and C++ - -BuildRoot: %{_tmppath}/%{name}-%{version}-build -Source: %name-%version.tar.bz2 -Patch: error_svg_plot_fix.patch - -##Requires: Qt >= 4.4 -BuildRequires: cmake -BuildRequires: libqt4-devel -BuildRequires: libpng-devel -BuildRequires: zlib-devel -BuildRequires: qrencode-devel - -%description -A library for encoding data in barcode symbols. Includes support for over 50 symbologies including -all ISO/IEC standards. - -%package -n zint-devel -Summary: Library and header files for zint. -Group: Development/C -Provides: %{name}-devel = %{version} -Requires: zint = %{version} - -%description -n zint-devel -A library for encoding data in barcode symbols. Includes support for over 50 symbologies including -all ISO/IEC standards. - -%debug_package - -%prep -%setup -%patch -p1 - -%build -##mkdir 'build' -##cd build -cmake CMakeLists.txt -make -j2 - -%install -rm -rf $RPM_BUILD_ROOT -%makeinstall -cd %buildroot/usr/ && mv ./local/* ./ -##make install DESTDIR=$RPM_BUILD_ROOT -%post -/sbin/ldconfig -%postun -ldconfig -%clean - -%files -%{_libdir}/* -%{_datadir}/cmake/Modules/FindZint.cmake - -%files -n zint-devel -%defattr(-,root,root,-) -%{_includedir}/*.h - -%changelog -* Thu Mar 17 2009 radist +Name: zint +Version: 2.3 +Release: 1 +Summary: A barcode encoding library. +Summary(ru_RU.UTF8): A barcode encoding library. +License: GPL +Url: http://www.zint.org.uk +Vendor: Robin Stuart +Packager: Radist Tagan +Group: Development/Libraries/C and C++ + +BuildRoot: %{_tmppath}/%{name}-%{version}-build +Source: %name-%version.tar.bz2 +Patch: error_svg_plot_fix.patch + +##Requires: Qt >= 4.4 +BuildRequires: cmake +BuildRequires: libqt4-devel +BuildRequires: libpng-devel +BuildRequires: zlib-devel +BuildRequires: qrencode-devel + +%description +A library for encoding data in barcode symbols. Includes support for over 50 symbologies including +all ISO/IEC standards. + +%package -n zint-devel +Summary: Library and header files for zint. +Group: Development/C +Provides: %{name}-devel = %{version} +Requires: zint = %{version} + +%description -n zint-devel +A library for encoding data in barcode symbols. Includes support for over 50 symbologies including +all ISO/IEC standards. + +%debug_package + +%prep +%setup +%patch -p1 + +%build +##mkdir 'build' +##cd build +cmake CMakeLists.txt +make -j2 + +%install +rm -rf $RPM_BUILD_ROOT +%makeinstall +cd %buildroot/usr/ && mv ./local/* ./ +##make install DESTDIR=$RPM_BUILD_ROOT +%post +/sbin/ldconfig +%postun +ldconfig +%clean + +%files +%{_libdir}/* +%{_datadir}/cmake/Modules/FindZint.cmake + +%files -n zint-devel +%defattr(-,root,root,-) +%{_includedir}/*.h + +%changelog +* Thu Mar 17 2009 radist + Make spec \ No newline at end of file