Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed shared cursors from bmps and masks to single pngs #273

Merged
merged 1 commit into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Loading