Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2016-08-26 19:55:55 +0000
committerChristian W. Damus2016-08-26 20:28:43 +0000
commit7851474fe5f33de156c797942945a3e9c97cb0a8 (patch)
tree9edef23c6cbebff3a6927a7e171c9cc15b6c9410 /extraplugins
parent847c62ff92d54a0723a0b143afa12771d6855c72 (diff)
downloadorg.eclipse.papyrus-7851474fe5f33de156c797942945a3e9c97cb0a8.tar.gz
org.eclipse.papyrus-7851474fe5f33de156c797942945a3e9c97cb0a8.tar.xz
org.eclipse.papyrus-7851474fe5f33de156c797942945a3e9c97cb0a8.zip
Bug 497841: [Model Import] Size of imported capsule part is smaller than in legacy model causing additional layout issues
https://bugs.eclipse.org/bugs/show_bug.cgi?id=497841 SWT on Windows reports 96 DPI, which means that himetric conversion does not agree well with hard-coded default sizes for shapes that assume 72 DPI as is usually reported on Mac and Linux platforms. So, as an expedient, fake out himetric conversion using the 72 DPI assumption. Change-Id: Ib3d63fe55a870fc34063f45a5cf5b5406bba5830 (cherry picked from commit 762b85f6f26e2f08c8b54452ea3acfa7902cd0c3)
Diffstat (limited to 'extraplugins')
-rw-r--r--extraplugins/migration/org.eclipse.papyrus.m2m.qvto/src/org/eclipse/papyrus/m2m/qvto/NotationTypes.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/extraplugins/migration/org.eclipse.papyrus.m2m.qvto/src/org/eclipse/papyrus/m2m/qvto/NotationTypes.java b/extraplugins/migration/org.eclipse.papyrus.m2m.qvto/src/org/eclipse/papyrus/m2m/qvto/NotationTypes.java
index 12d7c15a2f7..8dd656b905c 100644
--- a/extraplugins/migration/org.eclipse.papyrus.m2m.qvto/src/org/eclipse/papyrus/m2m/qvto/NotationTypes.java
+++ b/extraplugins/migration/org.eclipse.papyrus.m2m.qvto/src/org/eclipse/papyrus/m2m/qvto/NotationTypes.java
@@ -15,7 +15,6 @@ package org.eclipse.papyrus.m2m.qvto;
import java.util.LinkedList;
import java.util.List;
-import org.eclipse.gmf.runtime.draw2d.ui.mapmode.MapModeTypes;
import org.eclipse.gmf.runtime.notation.Anchor;
import org.eclipse.gmf.runtime.notation.LayoutConstraint;
import org.eclipse.gmf.runtime.notation.RelativeBendpoints;
@@ -27,6 +26,15 @@ import org.eclipse.m2m.qvt.oml.blackbox.java.Operation.Kind;
public class NotationTypes {
+ private static final double HIMETRIC_UNITS_PER_INCH = 2540.0;
+
+ private static float pseudoHimetricDPI = 72.0f;
+ private static double pseudoHimetricScale = 1.0;
+
+ static {
+ pseudoHimetricScale = pseudoHimetricDPI / HIMETRIC_UNITS_PER_INCH;
+ }
+
@Operation(contextual = true, kind = Kind.QUERY)
public static int toPixels(LayoutConstraint self, Integer himetric) {
return (himetric == null) ? -1 : convertToPixels(himetric);
@@ -78,6 +86,10 @@ public class NotationTypes {
}
private static int convertToPixels(int source) {
- return MapModeTypes.HIMETRIC_MM.LPtoDP(source);
+ // TODO: Fix hard-coded pixel defaults in the QVTos and
+ // elsewhere that assume a 72-DPI display (cf. bug 497841).
+
+ // return MapModeTypes.HIMETRIC_MM.LPtoDP(source);
+ return (int) (source * pseudoHimetricScale);
}
}

Back to the top