mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
diff: high resolution icons for frame windows
This commit is contained in:
@@ -22,7 +22,6 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.WindowWrapper;
|
||||
import com.intellij.openapi.ui.WindowWrapperBuilder;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.util.ImageLoader;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -58,7 +57,7 @@ public abstract class DiffWindowBase {
|
||||
myProcessor.updateRequest();
|
||||
})
|
||||
.build();
|
||||
myWrapper.setImage(ImageLoader.loadFromResource("/diff/Diff.png"));
|
||||
myWrapper.setImages(DiffUtil.DIFF_FRAME_ICONS);
|
||||
Disposer.register(myWrapper, myProcessor);
|
||||
}
|
||||
|
||||
|
||||
@@ -88,6 +88,7 @@ import com.intellij.ui.awt.RelativePoint;
|
||||
import com.intellij.ui.components.JBLabel;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.DocumentUtil;
|
||||
import com.intellij.util.ImageLoader;
|
||||
import com.intellij.util.LineSeparator;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.Convertor;
|
||||
@@ -113,6 +114,19 @@ public class DiffUtil {
|
||||
@NotNull public static final String DIFF_CONFIG = "diff.xml";
|
||||
public static final int TITLE_GAP = JBUI.scale(2);
|
||||
|
||||
public static final List<Image> DIFF_FRAME_ICONS = loadDiffFrameImages();
|
||||
|
||||
|
||||
@NotNull
|
||||
private static List<Image> loadDiffFrameImages() {
|
||||
return ContainerUtil.list(
|
||||
ImageLoader.loadFromResource("/diff_frame16.png"),
|
||||
ImageLoader.loadFromResource("/diff_frame32.png"),
|
||||
ImageLoader.loadFromResource("/diff_frame64.png"),
|
||||
ImageLoader.loadFromResource("/diff_frame128.png")
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Editor
|
||||
//
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 633 B |
Binary file not shown.
|
After Width: | Height: | Size: 155 B |
Binary file not shown.
|
After Width: | Height: | Size: 217 B |
Binary file not shown.
|
After Width: | Height: | Size: 363 B |
@@ -0,0 +1 @@
|
||||
skip: diff_frame*
|
||||
@@ -20,6 +20,7 @@ import com.intellij.CommonBundle;
|
||||
import com.intellij.diff.contents.DiffContent;
|
||||
import com.intellij.diff.requests.ContentDiffRequest;
|
||||
import com.intellij.diff.requests.SimpleDiffRequest;
|
||||
import com.intellij.diff.util.DiffUtil;
|
||||
import com.intellij.history.core.LocalHistoryFacade;
|
||||
import com.intellij.history.integration.IdeaGateway;
|
||||
import com.intellij.history.integration.LocalHistoryBundle;
|
||||
@@ -54,7 +55,6 @@ import com.intellij.ui.*;
|
||||
import com.intellij.ui.awt.RelativePoint;
|
||||
import com.intellij.ui.components.JBLayeredPane;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.ImageLoader;
|
||||
import com.intellij.util.ui.AbstractLayoutManager;
|
||||
import com.intellij.util.ui.AnimatedIcon;
|
||||
import com.intellij.util.ui.AsyncProcessIcon;
|
||||
@@ -98,7 +98,7 @@ public abstract class HistoryDialog<T extends HistoryDialogModel> extends FrameW
|
||||
|
||||
setProject(project);
|
||||
setDimensionKey(getPropertiesKey());
|
||||
setImage(ImageLoader.loadFromResource("/diff/Diff.png"));
|
||||
setImages(DiffUtil.DIFF_FRAME_ICONS);
|
||||
closeOnEsc();
|
||||
|
||||
if (doInit) init();
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.List;
|
||||
|
||||
public interface WindowWrapper extends Disposable {
|
||||
enum Mode {FRAME, MODAL, NON_MODAL}
|
||||
@@ -27,7 +28,7 @@ public interface WindowWrapper extends Disposable {
|
||||
|
||||
void setTitle(@Nullable String title);
|
||||
|
||||
void setImage(@Nullable Image image);
|
||||
void setImages(@Nullable List<Image> images);
|
||||
|
||||
void close();
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ import com.intellij.openapi.actionSystem.DataProvider;
|
||||
import com.intellij.openapi.actionSystem.ex.ActionManagerEx;
|
||||
import com.intellij.openapi.actionSystem.ex.ActionUtil;
|
||||
import com.intellij.openapi.actionSystem.impl.MouseGestureManager;
|
||||
import com.intellij.openapi.application.impl.ApplicationInfoImpl;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectManager;
|
||||
import com.intellij.openapi.project.ProjectManagerAdapter;
|
||||
@@ -45,7 +44,6 @@ import com.intellij.ui.AppUIUtil;
|
||||
import com.intellij.ui.BalloonLayout;
|
||||
import com.intellij.ui.FocusTrackback;
|
||||
import com.intellij.ui.FrameState;
|
||||
import com.intellij.util.ImageLoader;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.ui.ImageUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
@@ -57,6 +55,8 @@ import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.io.File;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class FrameWrapper implements Disposable, DataProvider {
|
||||
@@ -65,7 +65,7 @@ public class FrameWrapper implements Disposable, DataProvider {
|
||||
private JComponent myComponent = null;
|
||||
private JComponent myPreferredFocus = null;
|
||||
private String myTitle = "";
|
||||
private Image myImage = ImageLoader.loadFromResource(ApplicationInfoImpl.getShadowInstance().getIconUrl());
|
||||
private List<Image> myImages = null;
|
||||
private boolean myCloseOnEsc = false;
|
||||
private Window myFrame;
|
||||
private final Map<String, Object> myDataMap = ContainerUtil.newHashMap();
|
||||
@@ -81,7 +81,6 @@ public class FrameWrapper implements Disposable, DataProvider {
|
||||
protected StatusBar myStatusBar;
|
||||
private boolean myShown;
|
||||
private boolean myIsDialog;
|
||||
private boolean myImageWasChanged;
|
||||
|
||||
public FrameWrapper(Project project) {
|
||||
this(project, null);
|
||||
@@ -175,9 +174,9 @@ public class FrameWrapper implements Disposable, DataProvider {
|
||||
} else {
|
||||
((JDialog)frame).setTitle(myTitle);
|
||||
}
|
||||
if (myImageWasChanged && myImage != null) {
|
||||
if (myImages != null) {
|
||||
// unwrap the image before setting as frame's icon
|
||||
frame.setIconImage(ImageUtil.toBufferedImage(myImage));
|
||||
frame.setIconImages(ContainerUtil.map(myImages, ImageUtil::toBufferedImage));
|
||||
}
|
||||
else {
|
||||
AppUIUtil.updateWindowIcon(myFrame);
|
||||
@@ -230,7 +229,7 @@ public class FrameWrapper implements Disposable, DataProvider {
|
||||
myFocusedCallback = null;
|
||||
myFocusTrackback = null;
|
||||
myComponent = null;
|
||||
myImage = null;
|
||||
myImages = null;
|
||||
myDisposed = true;
|
||||
|
||||
if (statusBar != null) {
|
||||
@@ -333,8 +332,11 @@ public class FrameWrapper implements Disposable, DataProvider {
|
||||
}
|
||||
|
||||
public void setImage(Image image) {
|
||||
myImageWasChanged = true;
|
||||
myImage = image;
|
||||
setImages(image != null ? Collections.singletonList(image) : Collections.emptyList());
|
||||
}
|
||||
|
||||
public void setImages(List<Image> images) {
|
||||
myImages = images;
|
||||
}
|
||||
|
||||
protected void loadFrameState() {
|
||||
|
||||
@@ -14,6 +14,7 @@ import javax.swing.border.Border;
|
||||
import java.awt.*;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.util.List;
|
||||
|
||||
public class WindowWrapperBuilder {
|
||||
@NotNull private final Mode myMode;
|
||||
@@ -170,7 +171,7 @@ public class WindowWrapperBuilder {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setImage(@Nullable Image image) {
|
||||
public void setImages(@Nullable List<Image> images) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -305,8 +306,8 @@ public class WindowWrapperBuilder {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setImage(@Nullable Image image) {
|
||||
myFrame.setImage(image);
|
||||
public void setImages(@Nullable List<Image> images) {
|
||||
myFrame.setImages(images);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user