mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-161501 ui: fix indeterminate progress rendering under HiDPI
This commit is contained in:
+7
-5
@@ -69,7 +69,9 @@ public class DarculaProgressBarUI extends BasicProgressBarUI {
|
||||
int x = -offset;
|
||||
final float R = JBUI.scale(8f);
|
||||
final float R2 = JBUI.scale(9f);
|
||||
final Area containingRoundRect = new Area(new RoundRectangle2D.Float(1f, 1f, w - 2f, h - 2f, R, R));
|
||||
final float off = JBUI.scale(1f);
|
||||
|
||||
final Area containingRoundRect = new Area(new RoundRectangle2D.Float(2f * off, 2f * off, w - 4f * off, h - 4f * off, R, R));
|
||||
while (x < Math.max(c.getWidth(), c.getHeight())) {
|
||||
Path2D.Double path = new Path2D.Double();
|
||||
float ww = getPeriodLength() / 2f;
|
||||
@@ -87,17 +89,17 @@ public class DarculaProgressBarUI extends BasicProgressBarUI {
|
||||
}
|
||||
offset = (offset + 1) % getPeriodLength();
|
||||
Area area = new Area(new Rectangle2D.Float(0, 0, w, h));
|
||||
area.subtract(new Area(new RoundRectangle2D.Float(1f, 1f, w - 2f, h - 2f, R, R)));
|
||||
g.setPaint(Gray._128);
|
||||
area.subtract(new Area(new RoundRectangle2D.Float(off, off, w - 2f * off, h - 2f * off, R, R)));
|
||||
g.setColor(Gray._128);
|
||||
if (c.isOpaque()) {
|
||||
g.fill(area);
|
||||
}
|
||||
area.subtract(new Area(new RoundRectangle2D.Float(0, 0, w, h, R2, R2)));
|
||||
g.setPaint(c.getParent().getBackground());
|
||||
g.setColor(c.getParent().getBackground());
|
||||
if (c.isOpaque()) {
|
||||
g.fill(area);
|
||||
}
|
||||
g.draw(new RoundRectangle2D.Float(1f, 1f, w - 2f - 1f, h - 2f -1f, R, R));
|
||||
g.draw(new RoundRectangle2D.Float(off, off, w - 2f * off - off, h - 2f * off - off, R, R));
|
||||
g.translate(0, -(c.getHeight() - h) / 2);
|
||||
|
||||
// Deal with possible text painting
|
||||
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.openapi.wm.impl.status;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.ui.JBProgressBar;
|
||||
import com.intellij.ui.LightColors;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
@SuppressWarnings({"HardCodedStringLiteral"})
|
||||
public class ShowProgressTestDialogAction extends AnAction implements DumbAware {
|
||||
public ShowProgressTestDialogAction() {
|
||||
super("Show Progress Test Dialog");
|
||||
}
|
||||
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
new DialogWrapper(e.getProject()) {
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected JComponent createCenterPanel() {
|
||||
JPanel panel = new JPanel();
|
||||
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
|
||||
|
||||
panel.add(createPanel(false, false));
|
||||
panel.add(createPanel(false, true));
|
||||
panel.add(createPanel(true, false));
|
||||
panel.add(createPanel(true, true));
|
||||
return panel;
|
||||
}
|
||||
}.show();
|
||||
}
|
||||
|
||||
private static JComponent createPanel(boolean indeterminate, boolean opaque) {
|
||||
String text = (indeterminate ? "indeterminate" : "determinate") +
|
||||
(opaque ? "; opaque" : "; non opaque");
|
||||
JLabel label = new JLabel(text);
|
||||
|
||||
JBProgressBar progress = new JBProgressBar();
|
||||
progress.setIndeterminate(indeterminate);
|
||||
progress.setValue(30);
|
||||
progress.setOpaque(opaque);
|
||||
|
||||
JPanel wrapper = new JPanel(new BorderLayout());
|
||||
wrapper.add(progress);
|
||||
wrapper.setBackground(LightColors.BLUE);
|
||||
|
||||
JPanel panel = new JPanel();
|
||||
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
|
||||
panel.add(label);
|
||||
panel.add(wrapper);
|
||||
panel.add(Box.createVerticalStrut(5));
|
||||
|
||||
return panel;
|
||||
}
|
||||
}
|
||||
@@ -740,6 +740,7 @@
|
||||
<action id="AddTestProcessAction" internal="true" class="com.intellij.openapi.wm.impl.status.AddTestProcessAction" text="Add Test Process"/>
|
||||
<action id="AddTestProcessActionIndefinte" internal="true" class="com.intellij.openapi.wm.impl.status.AddTestProcessActionIndefinite" text="Add Test Process Indefinite"/>
|
||||
<action id="AddManyTestProcesses" internal="true" class="com.intellij.openapi.wm.impl.status.AddManyTestProcesses" text="Add Many Test Processes"/>
|
||||
<action id="ShowProgressTestDialogAction" internal="true" class="com.intellij.openapi.wm.impl.status.ShowProgressTestDialogAction" text="Show Progress Test Dialog"/>
|
||||
<separator/>
|
||||
<action id="TestGestureAction" class="com.intellij.openapi.keymap.impl.ui.TestGestureAction" text="Test Gesture Action"/>
|
||||
<action id="TestDndAction" class="com.intellij.internal.validation.TestDnd" text="Test Dnd"/>
|
||||
|
||||
Reference in New Issue
Block a user