Skip to content

Commit

Permalink
Changed shared cursors from bmps and masks to single pngs
Browse files Browse the repository at this point in the history
Thx to Phillipus <p.beauvoir@dadabeatnik.com> for providing the cursor
images.
  • Loading branch information
azoitl committed Oct 31, 2023
1 parent 45b2929 commit 04817e4
Show file tree
Hide file tree
Showing 17 changed files with 25 additions and 13 deletions.
38 changes: 25 additions & 13 deletions org.eclipse.gef/src/org/eclipse/gef/SharedCursors.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*******************************************************************************
* Copyright (c) 2000, 2010 IBM Corporation and others.
*
* This program and the accompanying materials are made available under the
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
Expand All @@ -22,7 +22,7 @@

/**
* A shared collection of Cursors.
*
*
* @since 2.0
*/
public class SharedCursors extends Cursors {
Expand All @@ -44,21 +44,33 @@ public class SharedCursors extends Cursors {
*/
public static final Cursor CURSOR_TREE_MOVE;

private static int deviceZoom = -1;

static {
CURSOR_PLUG = createCursor("icons/plugmask.gif", //$NON-NLS-1$
"icons/plug.bmp"); //$NON-NLS-1$
CURSOR_PLUG_NOT = createCursor("icons/plugmasknot.gif", //$NON-NLS-1$
"icons/plugnot.bmp"); //$NON-NLS-1$
CURSOR_TREE_ADD = createCursor("icons/Tree_Add_Mask.gif", //$NON-NLS-1$
"icons/Tree_Add.gif"); //$NON-NLS-1$
CURSOR_TREE_MOVE = createCursor("icons/Tree_Move_Mask.gif", //$NON-NLS-1$
"icons/Tree_Move.gif"); //$NON-NLS-1$
CURSOR_PLUG = createCursor("icons/plug-cursor.png"); //$NON-NLS-1$
CURSOR_PLUG_NOT = createCursor("icons/plugnot-cursor.png"); //$NON-NLS-1$
CURSOR_TREE_ADD = createCursor("icons/tree_add-cursor.png"); //$NON-NLS-1$
CURSOR_TREE_MOVE = createCursor("icons/tree_move-cursor.png"); //$NON-NLS-1$
}

private static Cursor createCursor(String sourceName, String maskName) {
private static Cursor createCursor(String sourceName) {
ImageDescriptor src = ImageDescriptor.createFromFile(Internal.class, sourceName);
ImageDescriptor mask = ImageDescriptor.createFromFile(Internal.class, maskName);
return new Cursor(null, src.getImageData(), mask.getImageData(), 0, 0);
return new Cursor(null, src.getImageData(getDeviceZoom()), 0, 0);
}

private static int getDeviceZoom() {
if (deviceZoom == -1) {
deviceZoom = 100; // default value
String deviceZoomProperty = System.getProperty("org.eclipse.swt.internal.deviceZoom"); //$NON-NLS-1$
if (deviceZoomProperty != null) {
try {
deviceZoom = Integer.parseInt(deviceZoomProperty);
} catch (NumberFormatException ex) {
// if the property can not be parsed we keep the default 100% zoom level
}
}
}
return deviceZoom;
}

}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 04817e4

Please sign in to comment.