From d4012ee29fe041885c01baea41d4ac9e40e2706a Mon Sep 17 00:00:00 2001 From: Jakob Heher Date: Thu, 7 Jul 2022 15:52:26 +0200 Subject: disable scrollwheel in config, cf. #100 --- .../main/java/at/asit/pdfover/gui/composites/StateComposite.java | 6 ++++++ .../composites/configuration/AdvancedConfigurationComposite.java | 3 +++ .../composites/configuration/KeystoreConfigurationComposite.java | 2 ++ .../gui/composites/configuration/SimpleConfigurationComposite.java | 2 ++ 4 files changed, 13 insertions(+) (limited to 'pdf-over-gui/src/main/java') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/StateComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/StateComposite.java index 5fc5dc55..ff4c85ad 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/StateComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/StateComposite.java @@ -22,6 +22,7 @@ import org.eclipse.swt.layout.FormData; // Imports import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Event; import at.asit.pdfover.gui.workflow.states.State; @@ -58,6 +59,11 @@ public abstract class StateComposite extends Composite { */ public abstract void reloadResources(); + public static void disableEventDefault(Control c, int event) + { + c.addListener(event, (Event e) -> { e.doit = false; }); + } + public static void setFontHeight(Control c, int height) { FontData[] fD = c.getFont().getFontData(); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java index b2db3875..ea84abce 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java @@ -175,6 +175,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { this.sclTransparenz.setMaximum(255); this.sclTransparenz.setIncrement(1); this.sclTransparenz.setPageIncrement(10); + StateComposite.disableEventDefault(sclTransparenz, SWT.MouseVerticalWheel); this.sclTransparenz.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -238,6 +239,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { this.cmbBKUAuswahl = new Combo(this.grpBkuAuswahl, SWT.READ_ONLY); StateComposite.anchor(cmbBKUAuswahl).right(100,-5).top(0).left(0,5).set(); StateComposite.setFontHeight(cmbBKUAuswahl, Constants.TEXT_SIZE_NORMAL); + StateComposite.disableEventDefault(cmbBKUAuswahl, SWT.MouseVerticalWheel); this.bkuStrings = Arrays.stream(BKUs.values()).map(s -> Messages.getString("BKU."+s)).collect(Collectors.toList()); this.cmbBKUAuswahl.setItems(bkuStrings.toArray(new String[0])); @@ -342,6 +344,7 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { StateComposite.anchor(cmbLocaleAuswahl).right(100,-5).top(0).left(0,5).set(); StateComposite.setFontHeight(cmbLocaleAuswahl, Constants.TEXT_SIZE_NORMAL);; this.cmbLocaleAuswahl.setItems(Arrays.stream(Constants.SUPPORTED_LOCALES).map(l -> l.getDisplayLanguage()).toArray(String[]::new)); + StateComposite.disableEventDefault(cmbLocaleAuswahl, SWT.MouseVerticalWheel); this.cmbLocaleAuswahl.addSelectionListener(new SelectionAdapter() { @Override diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java index 7ea2a642..757c31d7 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java @@ -132,6 +132,7 @@ public class KeystoreConfigurationComposite extends ConfigurationCompositeBase { this.cmbKeystoreType = new Combo(grpKeystore, SWT.READ_ONLY); StateComposite.anchor(cmbKeystoreType).right(100, -5).top(lblKeystoreType, 5).left(0,15).set(); StateComposite.setFontHeight(cmbKeystoreType, Constants.TEXT_SIZE_NORMAL); + StateComposite.disableEventDefault(cmbKeystoreType, SWT.MouseVerticalWheel); this.lblKeystoreStorePass = new Label(this.grpKeystore, SWT.NONE); StateComposite.anchor(lblKeystoreStorePass).top(cmbKeystoreType, 5).left(0,5).set(); @@ -151,6 +152,7 @@ public class KeystoreConfigurationComposite extends ConfigurationCompositeBase { this.cmbKeystoreAlias = new Combo(grpKeystore, SWT.NONE); StateComposite.anchor(cmbKeystoreAlias).top(lblKeystoreAlias, 5).left(0,15).right(100,-5).set(); StateComposite.setFontHeight(cmbKeystoreAlias, Constants.TEXT_SIZE_NORMAL); + StateComposite.disableEventDefault(cmbKeystoreAlias, SWT.MouseVerticalWheel); this.lblKeystoreKeyPass = new Label(this.grpKeystore, SWT.NONE); StateComposite.anchor(lblKeystoreKeyPass).top(cmbKeystoreAlias, 5).left(0,5).set(); 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 887ea91a..83c159a0 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 @@ -164,6 +164,7 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { this.cmbSignatureProfiles = new Combo(this.grpSignatureProfile, SWT.READ_ONLY); StateComposite.anchor(cmbSignatureProfiles).left(0,10).right(100,-10).top(0,10).bottom(100,-10).set(); StateComposite.setFontHeight(cmbSignatureProfiles, Constants.TEXT_SIZE_NORMAL); + StateComposite.disableEventDefault(cmbSignatureProfiles, SWT.MouseVerticalWheel); this.cmbSignatureProfiles.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -296,6 +297,7 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { this.cmbSignatureLang = new Combo(this.grpSignatureLang, SWT.READ_ONLY); StateComposite.anchor(cmbSignatureLang).left(0,10).right(100,-10).top(0,10).bottom(100,-10).set(); StateComposite.setFontHeight(cmbSignatureLang, Constants.TEXT_SIZE_NORMAL); + StateComposite.disableEventDefault(cmbSignatureLang, SWT.MouseVerticalWheel); this.cmbSignatureLang.setItems(Arrays.stream(Constants.SUPPORTED_LOCALES).map(l -> l.getDisplayLanguage()).toArray(String[]::new)); this.cmbSignatureLang.addSelectionListener(new SelectionAdapter() { -- cgit v1.2.3