diff options
author | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-08-09 15:13:36 +0200 |
---|---|---|
committer | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-08-09 15:13:36 +0200 |
commit | 8736033b6460b2f88b22d85fe01276c3cee68235 (patch) | |
tree | 2d8ac149e363d2d0db965aba0fd5dff3377f7986 | |
parent | c428cf110dd16fa25e2751becceef9abb4e9df34 (diff) | |
download | pdf-over-8736033b6460b2f88b22d85fe01276c3cee68235.tar.gz pdf-over-8736033b6460b2f88b22d85fe01276c3cee68235.tar.bz2 pdf-over-8736033b6460b2f88b22d85fe01276c3cee68235.zip |
add logo size to config
3 files changed, 52 insertions, 0 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java index a30b2ee7..64657eb6 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java @@ -47,6 +47,7 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.FileDialog; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Scale; import org.eclipse.swt.widgets.Text; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -94,6 +95,14 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { protected final Group grpSignatureLang; protected final Combo cmbSignatureLang; + final Group grpLogoOnlyTargetSize; + final Label lblLogoOnlyTargetSizeCurrentValue; + /** in millimeters */ + final Scale sclLogoOnlyTargetSize; + private void updateLogoOnlyTargetSizeCurrentValueLabel() { + lblLogoOnlyTargetSizeCurrentValue.setText(String.format("%4.1fcm", configurationContainer.logoOnlyTargetSize / 10.0)); + } + protected String logoFile = null; protected final Group grpSignatureProfile; @@ -241,6 +250,39 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { } }); + this.grpLogoOnlyTargetSize = new Group(this, SWT.NONE); + SWTUtils.anchor(grpLogoOnlyTargetSize).left(0,5).right(100,-5).top(grpSignatureProfile,5).set(); + this.grpLogoOnlyTargetSize.setLayout(new FormLayout()); + SWTUtils.setFontHeight(grpLogoOnlyTargetSize, Constants.TEXT_SIZE_NORMAL); + + Label lblLOTSLeft = new Label(this.grpLogoOnlyTargetSize, SWT.HORIZONTAL); + SWTUtils.anchor(lblLOTSLeft).top(0, 5).left(0, 15).set(); + lblLOTSLeft.setText("1cm"); + SWTUtils.setFontHeight(lblLOTSLeft, Constants.TEXT_SIZE_NORMAL); + + Label lblLOTSRight = new Label(this.grpLogoOnlyTargetSize, SWT.HORIZONTAL); + SWTUtils.anchor(lblLOTSRight).top(0,5).right(100, -5).set(); + lblLOTSRight.setText("20cm"); + SWTUtils.setFontHeight(lblLOTSRight, Constants.TEXT_SIZE_NORMAL); + + this.sclLogoOnlyTargetSize = new Scale(this.grpLogoOnlyTargetSize, SWT.HORIZONTAL); + SWTUtils.anchor(sclLogoOnlyTargetSize).top(0,5).left(lblLOTSLeft,5).right(lblLOTSRight,-5).set(); + sclLogoOnlyTargetSize.setMinimum(10); + sclLogoOnlyTargetSize.setMaximum(200); + sclLogoOnlyTargetSize.setIncrement(1); + sclLogoOnlyTargetSize.setPageIncrement(10); + SWTUtils.disableEventDefault(sclLogoOnlyTargetSize, SWT.MouseVerticalWheel); + SWTUtils.addSelectionListener(sclLogoOnlyTargetSize, e -> + { + configurationContainer.logoOnlyTargetSize = sclLogoOnlyTargetSize.getSelection(); + this.updateLogoOnlyTargetSizeCurrentValueLabel(); + }); + + this.lblLogoOnlyTargetSizeCurrentValue = new Label(this.grpLogoOnlyTargetSize, SWT.HORIZONTAL); + SWTUtils.anchor(lblLogoOnlyTargetSizeCurrentValue).top(sclLogoOnlyTargetSize, 5).left(0,5).right(100,-5).set(); + lblLogoOnlyTargetSizeCurrentValue.setAlignment(SWT.CENTER); + SWTUtils.setFontHeight(lblLogoOnlyTargetSizeCurrentValue, Constants.TEXT_SIZE_NORMAL); + this.grpPreview = new Group(this, SWT.NONE); SWTUtils.anchor(grpPreview).left(0,5).right(100,-5).top(grpSignatureNote, 5).height(250).set(); this.grpPreview.setLayout(new FormLayout()); @@ -519,6 +561,7 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { this.grpSignatureLang.setVisible(newProfile.hasText()); this.grpSignatureNote.setVisible(newProfile.hasText()); + this.sclLogoOnlyTargetSize.setVisible(newProfile.equals(Profile.BASE_LOGO)); this.grpPreview.setVisible(newProfile.isVisibleSignature()); signatureBlockPreviewChanged(); @@ -571,6 +614,7 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { this.configurationContainer.signatureLocale = provider.getSignatureLocale(); this.configurationContainer.signatureNote = provider.getSignatureNote(); + this.configurationContainer.logoOnlyTargetSize = provider.getLogoOnlyTargetSize(); } /* @@ -607,6 +651,9 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { this.txtSignatureNote.setText(note); } + this.sclLogoOnlyTargetSize.setSelection((int)this.configurationContainer.logoOnlyTargetSize); + this.updateLogoOnlyTargetSizeCurrentValueLabel(); + this.signatureBlockPreviewChanged(); this.performSignatureLangSelectionChanged(this.configurationContainer.signatureLocale, null); @@ -622,6 +669,7 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { store.setSignatureLocalePersistent(this.configurationContainer.signatureLocale); store.setSignatureNotePersistent(this.configurationContainer.signatureNote); store.setSignatureProfilePersistent(this.configurationContainer.getSignatureProfile()); + store.setLogoOnlyTargetSizePersistent(this.configurationContainer.logoOnlyTargetSize); } /* @@ -670,5 +718,7 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { SWTUtils.setLocalizedText(grpSignatureProfile, "simple_config.SigProfile_Title"); this.cmbSignatureProfiles.setItems(Arrays.stream(Profile.values()).map(v -> Messages.getString("simple_config."+v.name())).toArray(String[]::new)); + + SWTUtils.setLocalizedText(grpLogoOnlyTargetSize, "simple_config.LogoOnlyTargetSize_Title"); } } diff --git a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties index f47cd76b..da1cb68e 100644 --- a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties +++ b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties @@ -243,6 +243,7 @@ simple_config.PhoneNumber=Username (or mobile no.)\: simple_config.SigBlockLang_Title=Signature block lan&guage\: simple_config.SigBlockLang_ToolTip=Select the language to be used in the signature block displayed on the signed document simple_config.SigProfile_Title=Signature Profile +simple_config.LogoOnlyTargetSize_Title=Logo signature size simple_config.SIGNATURBLOCK_SMALL=Standard Signature Block simple_config.AMTSSIGNATURBLOCK=Official Signature simple_config.BASE_LOGO=Logo Only diff --git a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties index cecda6c4..b476be9d 100644 --- a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties +++ b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties @@ -238,6 +238,7 @@ simple_config.SIGNATURBLOCK_SMALL=Standard Signaturblock simple_config.AMTSSIGNATURBLOCK=Amtssignatur simple_config.BASE_LOGO=Nur Bildmarke simple_config.INVISIBLE=Unsichtbar +simple_config.LogoOnlyTargetSize_Title=Größe der Bildmarke tanEnter.QR=QR Code\: tanEnter.FP=Bitte öffnen Sie die Handy-Signatur App\nund bestätigen Sie die Signatur. tanEnter.ReferenceValue=Vergleichswert\: |