lazbarcodes: Mode 2 of Maxicode working.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8227 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2022-03-24 22:17:32 +00:00
parent 3c2efad7b9
commit 482be29d78
5 changed files with 639 additions and 19 deletions

View File

@@ -26,12 +26,20 @@ type
clbForeground: TColorButton;
cmbBearerBarsBox: TComboBox;
clbBackground: TColorButton;
cbMaxicode_CountryCode: TComboBox;
edMaxicode_Primary: TEdit;
edMaxicode_ServiceCode: TEdit;
edMaxicode_Postcode: TEdit;
edText: TEdit;
FontDialog: TFontDialog;
gbGeometry: TGroupBox;
gbShow: TGroupBox;
gbChecksum: TGroupBox;
gbColors: TGroupBox;
lblMaxicode_Primary: TLabel;
lblMaxicode_ServiceCode: TLabel;
lblMaxicode_CountryCode: TLabel;
lblMaxicode_Postcode: TLabel;
lblWhiteSpaceWidth: TLabel;
lblScale: TLabel;
lblError: TLabel;
@@ -39,11 +47,13 @@ type
lblText: TLabel;
lblSymbolHeight: TLabel;
nbOptions: TNotebook;
pgOptions_Maxicode: TPage;
pgOptions_Plessey: TPage;
pgOptions_QR: TPage;
Panel1: TPanel;
Panel2: TPanel;
BarcodePanel: TPanel;
rgMaxicode_Mode: TRadioGroup;
rgPlessey_Checkchar: TRadioGroup;
rgQR_ECCLevel: TRadioGroup;
SaveDialog1: TSaveDialog;
@@ -62,9 +72,14 @@ type
procedure btnSampleTextClick(Sender: TObject);
procedure btnSaveToFileClick(Sender: TObject);
procedure cbAutoSizeChange(Sender: TObject);
procedure cbMaxicode_CountryCodeChange(Sender: TObject);
procedure cbRecommendedSymbolSizeChange(Sender: TObject);
procedure edMaxicode_PostcodeChange(Sender: TObject);
procedure edMaxicode_PrimaryChange(Sender: TObject);
procedure edMaxicode_ServiceCodeChange(Sender: TObject);
procedure edTextChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure rgMaxicode_ModeClick(Sender: TObject);
procedure rgPlessey_CheckcharClick(Sender: TObject);
procedure rgQR_ECCLevelClick(Sender: TObject);
procedure SaveDialogTypeChange(Sender: TObject);
@@ -263,6 +278,18 @@ begin
end;
end;
procedure TMainForm.cbMaxicode_CountryCodeChange(Sender: TObject);
var
s: String;
begin
if FBarcode is TBarcodeMaxicode then
begin
s := cbMaxicode_Countrycode.Items[cbMaxicode_Countrycode.ItemIndex];
TBarcodeMaxicode(FBarcode).CountryCode := StrToInt(Copy(s, 1, 3));
edMaxicode_Primary.Text := TBarcodeMaxicode(FBarcode).Primary;
end;
end;
procedure TMainForm.cbRecommendedSymbolSizeChange(Sender: TObject);
begin
seScale.Enabled := not cbRecommendedSymbolSize.Checked;
@@ -293,12 +320,66 @@ begin
end;
end;
procedure TMainForm.edMaxicode_PostcodeChange(Sender: TObject);
begin
if FBarcode is TBarcodeMaxicode then
begin
TBarcodeMaxicode(FBarcode).Postcode := edMaxicode_Postcode.Text;
edMaxicode_Primary.Text := TBarcodeMaxicode(FBarcode).Primary;
end;
end;
procedure TMainForm.edMaxicode_PrimaryChange(Sender: TObject);
begin
if FBarcode is TBarcodeMaxicode then
begin
TBarcodeMaxicode(FBarcode).Primary := edMaxicode_Primary.Text;
edMaxicode_Primary.Text := TBarcodeMaxicode(FBarcode).Primary;
end;
end;
procedure TMainForm.edMaxicode_ServiceCodeChange(Sender: TObject);
begin
if FBarcode is TBarcodeMaxicode then
begin
TBarcodeMaxicode(FBarcode).Servicecode := StrToInt(edMaxicode_Servicecode.Text);
edMaxicode_Primary.Text := TBarcodeMaxicode(FBarcode).Primary;
end;
end;
procedure TMainForm.FormCreate(Sender: TObject);
begin
nbOptions.PageIndex := -1;
PopulateBarcodesTree;
end;
procedure TMainForm.rgMaxicode_ModeClick(Sender: TObject);
begin
if FBarcode is TBarcodeMaxicode then
begin
case rgMaxicode_Mode.ItemIndex of
-1: exit;
0: TBarcodeMaxicode(FBarcode).Mode := mcmAuto;
1: TBarcodeMaxicode(FBarcode).Mode := mcmMode2;
2: TBarcodeMaxicode(FBarcode).Mode := mcmMode3;
3: TBarcodeMaxicode(FBarcode).Mode := mcmMode4;
4: TBarcodeMaxicode(FBarcode).Mode := mcmMode5;
5: TBarcodeMaxicode(FBarcode).Mode := mcmMode6;
else raise Exception.Create('Mode not supported.');
end;
edMaxicode_Primary.Text := TBarcodeMaxicode(FBarcode).Primary;
end;
edMaxicode_Postcode.Visible := rgMaxicode_Mode.ItemIndex in [0, 1, 2];
lblMaxicode_Postcode.Visible := edMaxicode_Postcode.Visible;
cbMaxicode_Countrycode.Visible := edMaxicode_Postcode.Visible;
lblMaxicode_Countrycode.Visible := edMaxicode_Postcode.Visible;
edMaxicode_ServiceCode.Visible := edMaxicode_Postcode.Visible;
lblMaxicode_ServiceCode.Visible := edMaxicode_Postcode.Visible;
edMaxicode_Primary.Visible := edMaxicode_Postcode.Visible;
lblMaxicode_Primary.Visible := edMaxicode_Postcode.Visible;
end;
procedure TMainForm.rgPlessey_CheckcharClick(Sender: TObject);
begin
if FBarcode is TBarcodePlessey then
@@ -488,6 +569,9 @@ begin
else
if (FBarcode is TBarcodeQR) then
nbOptions.PageIndex := pgOptions_QR.PageIndex
else
if (FBarcode is TBarcodeMaxiCode) then
nbOptions.PageIndex := pgOptions_Maxicode.PageIndex
else
nbOptions.PageIndex := -1;