[Git][java-team/openchemlib][master] 4 commits: New upstream version 2020.12.1+dfsg

Andrius Merkys gitlab at salsa.debian.org
Mon Dec 14 12:45:19 GMT 2020



Andrius Merkys pushed to branch master at Debian Java Maintainers / openchemlib


Commits:
b6db7476 by Andrius Merkys at 2020-12-14T02:52:08-05:00
New upstream version 2020.12.1+dfsg
- - - - -
81b70ed0 by Andrius Merkys at 2020-12-14T02:52:39-05:00
Update upstream source from tag 'upstream/2020.12.1+dfsg'

Update to upstream version '2020.12.1+dfsg'
with Debian dir b5f8865328a03fd49930f20650109924d1aca47c
- - - - -
7db1032f by Andrius Merkys at 2020-12-14T03:06:04-05:00
Refreshing patches.

- - - - -
a7fd213e by Andrius Merkys at 2020-12-14T03:06:22-05:00
Update changelog for 2020.12.1+dfsg-1 release

- - - - -


11 changed files:

- debian/changelog
- debian/patches/javafx.patch
- debian/patches/libtablelayout-java.patch
- pom.xml
- src/main/java/com/actelion/research/chem/AromaticityResolver.java
- src/main/java/com/actelion/research/chem/ExtendedMolecule.java
- src/main/java/com/actelion/research/chem/IDCodeParserWithoutCoordinateInvention.java
- src/main/java/com/actelion/research/chem/Molecule.java
- src/main/java/com/actelion/research/chem/io/CompoundTableConstants.java
- src/main/java/com/actelion/research/gui/CompoundCollectionPane.java
- + src/main/java/com/actelion/research/gui/ScrollPaneAutoScrollerWhenDragging.java


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+openchemlib (2020.12.1+dfsg-1) unstable; urgency=medium
+
+  * New upstream version 2020.12.1+dfsg
+  * Refreshing patches.
+
+ -- Andrius Merkys <merkys at debian.org>  Mon, 14 Dec 2020 03:06:17 -0500
+
 openchemlib (2020.12.0+dfsg-1) unstable; urgency=medium
 
   * New upstream version 2020.12.0+dfsg


=====================================
debian/patches/javafx.patch
=====================================
@@ -1,6 +1,6 @@
 --- a/pom.xml
 +++ b/pom.xml
-@@ -101,6 +101,21 @@
+@@ -107,6 +107,21 @@
              <version>4.13.1</version>
              <scope>test</scope>
          </dependency>


=====================================
debian/patches/libtablelayout-java.patch
=====================================
@@ -1,6 +1,6 @@
 --- a/pom.xml
 +++ b/pom.xml
-@@ -116,6 +116,10 @@
+@@ -122,6 +122,10 @@
              <artifactId>javafx-graphics</artifactId>
              <version>11</version>
          </dependency>


=====================================
pom.xml
=====================================
@@ -8,7 +8,7 @@
     Please follow the naming scheme YEAR.MONTH.RELEASE_NO_OF_MONTH
     (eg. 2016.4.1 for second release in Apr 2016)
     -->
-    <version>2020.12.0</version>
+    <version>2020.12.1</version>
 
     <name>OpenChemLib</name>
     <description>Open Source Chemistry Library</description>
@@ -195,7 +195,7 @@
         <connection>scm:git:git at github.com:Actelion/openchemlib.git</connection>
         <developerConnection>scm:git:git at github.com:Actelion/openchemlib.git</developerConnection>
         <url>https://github.com/Actelion/openchemlib</url>
-      <tag>openchemlib-2020.12.0</tag>
+      <tag>openchemlib-2020.12.1</tag>
   </scm>
 
     <distributionManagement>


=====================================
src/main/java/com/actelion/research/chem/AromaticityResolver.java
=====================================
@@ -672,28 +672,34 @@ public class AromaticityResolver {
 	private boolean checkAtomTypePi1(int atom, boolean correctCharge) {
 		int atomicNo = mMol.getAtomicNo(atom);
 		if ((atomicNo >=5 && atomicNo <= 8)
-				|| atomicNo == 15 || atomicNo == 16 || atomicNo == 33 || atomicNo == 34) {	// P,S,As,Se
-			int freeValence = mMol.getFreeValence(atom);
-			if (freeValence == 1 || freeValence == 2)	// we allow one more free valence, because the atom may have a missing charge
+		 || atomicNo == 15 || atomicNo == 16 || atomicNo == 33 || atomicNo == 34 || atomicNo == 52) {	// P,S,As,Se,Te
+
+// Old logic seems fishy to me; TLS 10Dec2020
+//			int freeValence = mMol.getFreeValence(atom);
+//			if (freeValence == 1 || freeValence == 2)	// we allow one more free valence, because the atom may have a missing charge
+//  			return true;
+
+			int freeValence = mMol.getLowestFreeValence(atom);
+			if (freeValence != 0)
 				return true;
 
 			if (mMol.getAtomCharge(atom) == 0) {
-				if ((atomicNo == 15 || atomicNo == 33) && freeValence == 3) {
+				if ((atomicNo == 15 || atomicNo == 33) /* && freeValence == 3 */) {
 					if (correctCharge)
 						mMol.setAtomCharge(atom, 1);
 					return true;
 					}
-				if ((atomicNo == 16 || atomicNo == 34) && freeValence == 4) {
+				if ((atomicNo == 16 || atomicNo == 34 || atomicNo == 52) /* && freeValence == 4 */) {
 					if (correctCharge)
 						mMol.setAtomCharge(atom, 1);
 					return true;
 					}
-				if (atomicNo == 5 && freeValence == 0) {
+				if (atomicNo == 5 /* && freeValence == 0 */) {
 					if (correctCharge)
 						mMol.setAtomCharge(atom, -1);
 					return true;
 					}
-				if ((atomicNo == 7 || atomicNo == 8) && freeValence == 0) {
+				if ((atomicNo == 7 || atomicNo == 8) /* && freeValence == 0 */) {
 					if (correctCharge)
 						mMol.setAtomCharge(atom, 1);
 					return true;
@@ -725,7 +731,7 @@ public class AromaticityResolver {
 			if (mMol.getConnAtoms(atom) == 3)
 				return 8;
 			}
-		else if (mMol.getAtomicNo(atom) == 16 || mMol.getAtomicNo(atom) == 34) {
+		else if (mMol.getAtomicNo(atom) == 16 || mMol.getAtomicNo(atom) == 34 || mMol.getAtomicNo(atom) == 52) {
 			if (mMol.getConnAtoms(atom) == 2)
 				return 12;
 			}


=====================================
src/main/java/com/actelion/research/chem/ExtendedMolecule.java
=====================================
@@ -548,7 +548,7 @@ public class ExtendedMolecule extends Molecule implements Serializable {
 
 
 	/**
-	 * The free valence is the number of potential additional single bonded
+	 * The lowest free valence is the number of potential additional single bonded
 	 * neighbours to reach the atom's lowest valence above or equal its current
 	 * occupied valence. Atom charges are considered. Implicit hydrogens are not considered.
 	 * Thus, the phosphor atoms in PF2 and PF4 both have a lowest free valence of 1.


=====================================
src/main/java/com/actelion/research/chem/IDCodeParserWithoutCoordinateInvention.java
=====================================
@@ -957,20 +957,24 @@ public class IDCodeParserWithoutCoordinateInvention {
 		}
 
 	public boolean coordinatesAre3D(byte[] idcode, byte[] coordinates) {
-		if (coordinates == null || coordinates.length == 0)
+		return coordinatesAre3D(idcode, coordinates, 0, 0);
+		}
+
+	public boolean coordinatesAre3D(byte[] idcode, byte[] coordinates, int idcodeStart, int coordsStart) {
+		if (coordinates == null || coordinates.length <= coordsStart)
 			return false;
 
-		if (coordinates[0] == '!' || coordinates[0] == '#') {
+		if (coordinates[coordsStart] == '!' || coordinates[coordsStart] == '#') {
 			// current version starts with '!' (ASC 33) or '#' (ASC 35) (includs implicit hydrogen coordinates)
 			// further versions may start with ASC 36 to 38
-			decodeBitsStart(coordinates, 1);
+			decodeBitsStart(coordinates, coordsStart+1);
 			return (decodeBits(1) == 1);
 			}
 		else {	// old format uses ACSII 39 and higher
-			int allAtoms = getAtomCount(idcode, 0);
+			int allAtoms = getAtomCount(idcode, idcodeStart);
 			return (allAtoms != 0
-				 && coordinates.length >= 3*allAtoms-3
-				 && coordinates[2*allAtoms-2] != '\'');
+				 && coordinates.length >= coordsStart+3*allAtoms-3
+				 && coordinates[coordsStart+2*allAtoms-2] != '\'');
 			}
 		}
 


=====================================
src/main/java/com/actelion/research/chem/Molecule.java
=====================================
@@ -3775,6 +3775,7 @@ public class Molecule implements Serializable {
 		case 33: 	// As
 		case 34: 	// Se
 		case 35: 	// Br
+		case 52: 	// Te
 		case 53: 	// I
 			return true;
 			}


=====================================
src/main/java/com/actelion/research/chem/io/CompoundTableConstants.java
=====================================
@@ -91,7 +91,7 @@ public interface CompoundTableConstants {
     int cStructureHiliteModeFilter = 0;
     int cStructureHiliteModeCurrentRow = 1;
     int cStructureHiliteModeNone = 2;
-    String[] cStructureHiliteModeText = { "Most Recent Filter", "Current Row Similarity", "No Highlighting" };
+    String[] cStructureHiliteModeText = { "Most Recent Filter", "Similarity To Reference Row", "No Highlighting" };
     String[] cStructureHiliteModeCode = { "hiliteFilter", "hiliteCurrent", "hiliteNone" };
 
     // highlight mode for part-of-reaction highlighting depending on current record similarity


=====================================
src/main/java/com/actelion/research/gui/CompoundCollectionPane.java
=====================================
@@ -79,6 +79,8 @@ public class CompoundCollectionPane<T> extends JScrollPane
 	private JPanel			    mContentPanel;
 	private boolean			    mIsVertical,mIsEditable,mIsSelectable,mCreateFragments,
 								mIsEnabled,mShowValidationError,mInternalDragAndDropIsMove;
+	private ScrollPaneAutoScrollerWhenDragging mScroller;
+
 
 	/**
 	 * This is a visual component to display and edit a compound collection maintained
@@ -108,6 +110,7 @@ public class CompoundCollectionPane<T> extends JScrollPane
 		mDropIndex = -1;
 		init();
 		initializeDragAndDrop(dragAction, dropAction);
+		mScroller = new ScrollPaneAutoScrollerWhenDragging(this, isVertical);
 		}
 
 	public CompoundCollectionModel<T> getModel() {
@@ -424,7 +427,7 @@ public class CompoundCollectionPane<T> extends JScrollPane
 								g.drawString("?", bounds.x+(bounds.width-(int)b.getWidth())/2, bounds.y+(bounds.height-(int)b.getHeight())/2+m.getAscent());
 								}
 							}
-	
+
 						Depictor2D d = new Depictor2D(compound, mDisplayMode);
 						d.validateView(g,
 									   new Rectangle2D.Double(bounds.x, bounds.y, bounds.width, bounds.height),
@@ -706,6 +709,7 @@ public class CompoundCollectionPane<T> extends JScrollPane
 
 				@Override
 				public void dragOver(DropTargetDragEvent e) {
+					mScroller.autoScroll();
 					updateDropPosition(getDropIndex(e));
 					}
 


=====================================
src/main/java/com/actelion/research/gui/ScrollPaneAutoScrollerWhenDragging.java
=====================================
@@ -0,0 +1,73 @@
+package com.actelion.research.gui;
+
+import com.actelion.research.gui.hidpi.HiDPIHelper;
+
+import javax.swing.*;
+import java.awt.*;
+
+public class ScrollPaneAutoScrollerWhenDragging {
+	private static final int SCROLL_AREA_HEIGHT = HiDPIHelper.scale(32);
+	private static final int SCROLL_SLEEP_MILLIS = 20;
+	private static final int SCROLL_MAX_PIXELS = HiDPIHelper.scale(16);
+
+	private JScrollPane	mScrollPane;
+	private boolean		mIsVertical;
+	private int			mContentSize,mViewportSize;
+	private Thread		mScrollThread;
+	private float		mScrollSpeed;
+
+	public ScrollPaneAutoScrollerWhenDragging(JScrollPane scrollPane, boolean isVertical) {
+		mScrollPane = scrollPane;
+		mIsVertical = isVertical;
+		}
+
+	public void autoScroll() {
+		Component content = mScrollPane.getViewport().getView();
+		mContentSize = mIsVertical ? content.getHeight() : content.getWidth();
+		mViewportSize = mIsVertical ? mScrollPane.getViewport().getHeight() : mScrollPane.getViewport().getWidth();
+
+		Point mp = mScrollPane.getMousePosition();
+		if (mp != null) {
+			int mousePosition = mIsVertical ? mp.y : mp.x;
+			int viewportPosition = mIsVertical ? mScrollPane.getViewport().getY() : mScrollPane.getViewport().getX();
+			int mouseToTop = mousePosition - viewportPosition;
+			int mouseToBottom = viewportPosition + mViewportSize - mousePosition;
+			mScrollSpeed = (mouseToTop < SCROLL_AREA_HEIGHT) ? -Math.min(1.0f, (float) (SCROLL_AREA_HEIGHT - mouseToTop) / SCROLL_AREA_HEIGHT)
+					: (mouseToBottom < SCROLL_AREA_HEIGHT) ? Math.min(1.0f, (float) (SCROLL_AREA_HEIGHT - mouseToBottom) / SCROLL_AREA_HEIGHT) : 0;
+			}
+
+		if (mScrollSpeed == 0) {
+			mScrollThread = null;
+			}
+		else if (mScrollThread == null) {
+			mScrollThread = new Thread(() -> {
+				while (mScrollThread != null) {
+					Point vp = mScrollPane.getViewport().getViewPosition();
+					int minStep = mIsVertical ? -vp.y : -vp.x;
+					int maxStep = Math.max(0, mContentSize - mViewportSize + minStep);
+					int step = Math.max(minStep, Math.min(maxStep, Math.round(mScrollSpeed * SCROLL_MAX_PIXELS)));
+					if (step == 0) {
+						mScrollThread = null;
+						}
+					else {
+						if (mIsVertical)
+							vp.y += step;
+						else
+							vp.x += step;
+						try {
+//System.out.println("Thread:"+mScrollThread+" auto-scrolling:"+step);
+							SwingUtilities.invokeAndWait(() -> mScrollPane.getViewport().setViewPosition(vp));
+							Thread.sleep(SCROLL_SLEEP_MILLIS);
+							}
+						catch (Exception ie) {}
+						}
+					}
+				});
+			mScrollThread.start();
+			}
+		}
+
+	public void stopScrolling() {
+		mScrollThread = null;
+		}
+	}



View it on GitLab: https://salsa.debian.org/java-team/openchemlib/-/compare/c1316dfc3459d1af730a8dbceb79f5a32377fce3...a7fd213ee0b1ef8a3a5c279a138bd0673368829e

-- 
View it on GitLab: https://salsa.debian.org/java-team/openchemlib/-/compare/c1316dfc3459d1af730a8dbceb79f5a32377fce3...a7fd213ee0b1ef8a3a5c279a138bd0673368829e
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20201214/bacda2a8/attachment.html>


More information about the pkg-java-commits mailing list