Java Code Examples for com.intellij.util.ui.JBUI#isHiDPI()
The following examples show how to use
com.intellij.util.ui.JBUI#isHiDPI() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FileSystemViewDelegate.java From consulo with Apache License 2.0 | 5 votes |
@Nullable public static Icon getIcon(@Nonnull File file) { if (ourShellFolderMethod == null) { return getDefaultIcon(file); } try { Object object = ourShellFolderMethod.invoke(FileSystemView.getFileSystemView(), file); if (!(object instanceof ShellFolder)) { return getDefaultIcon(file); } if (SystemInfo.isWindows) { if(!JBUI.isHiDPI()) { return getIconFromShellFolder(file, (ShellFolder)object); } // on HiDPI monitors, ShellFolder return 32x32 only icons, and cut base icon // it ignore scale, for 2.5 scale return icon with 32x32 (and cut only 25% of icon, not resize) // that why - return default icon } else { return getIconFromShellFolder(file, (ShellFolder)object); } } catch (IllegalAccessException | InvocationTargetException ignored) { } return getDefaultIcon(file); }
Example 2
Source File: SystemHealthMonitor.java From consulo with Apache License 2.0 | 5 votes |
private void checkHiDPIMode() { // if switched from JRE-HiDPI to IDE-HiDPI boolean switchedHiDPIMode = SystemInfo.isJetBrainsJvm && "true".equalsIgnoreCase(System.getProperty("sun.java2d.uiScale.enabled")) && !UIUtil.isJreHiDPIEnabled(); if (SystemInfo.isWindows && ((switchedHiDPIMode && JBUI.isHiDPI(JBUI.sysScale())) || RemoteDesktopService.isRemoteSession())) { showNotification(new KeyHyperlinkAdapter("ide.set.hidpi.mode")); } }
Example 3
Source File: ImageLoader.java From consulo with Apache License 2.0 | 5 votes |
public static ImageDescList create(@Nonnull String path, @Nullable Class cls, boolean dark, boolean allowFloatScaling, JBUI.ScaleContext ctx) { // Prefer retina images for HiDPI scale, because downscaling // retina images provides a better result than up-scaling non-retina images. boolean retina = JBUI.isHiDPI(ctx.getScale(PIX_SCALE)); Builder list = new Builder(FileUtil.getNameWithoutExtension(path), FileUtilRt.getExtension(path), cls, true, adjustScaleFactor(allowFloatScaling, ctx.getScale(PIX_SCALE))); if (path.contains("://") && !path.startsWith("file:")) { list.add(StringUtil.endsWithIgnoreCase(path, ".svg") ? SVG : IMG); } else if (retina && dark) { list.add(true, true); list.add(true, false); // fallback to non-dark } else if (dark) { list.add(false, true); list.add(false, false); // fallback to non-dark } else if (retina) { list.add(true, false); } else { list.add(false, false); } return list.build(); }
Example 4
Source File: IdeaMenuUI.java From consulo with Apache License 2.0 | 5 votes |
@Override protected void installDefaults() { super.installDefaults(); Integer integer = UIUtil.getPropertyMaxGutterIconWidth(getPropertyPrefix()); if (integer != null){ myMaxGutterIconWidth = JBUI.scale(integer.intValue()); } // define selft icon due with hidpi, jdk icon is too small if (JBUI.isHiDPI()) { arrowIcon = AllIcons.Nodes.TreeExpandNode; } }
Example 5
Source File: ImageLoader.java From consulo with Apache License 2.0 | 4 votes |
private static double adjustScaleFactor(boolean allowFloatScaling, double scale) { return allowFloatScaling ? scale : JBUI.isHiDPI(scale) ? 2f : 1f; }