From 685c496d8a265804ddc5c0f649c13d8065939c7a Mon Sep 17 00:00:00 2001 From: MoMeak Date: Tue, 12 Sep 2017 11:28:23 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-4450=20=E8=81=9A=E5=90=88=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8=E5=9C=A8=E7=BC=A9=E6=94=BE=E5=90=8E=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E5=9D=97=EF=BC=8C=E4=BC=9A=E5=87=BA=E7=8E=B0?= =?UTF-8?q?=E5=8D=95=E5=85=83=E6=A0=BC=E9=94=99=E4=B9=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer/src/com/fr/poly/PolyDesignUI.java | 38 +++++++++---------- designer/src/com/fr/poly/PolyUtils.java | 9 ++--- .../com/fr/poly/creator/ECBlockEditor.java | 1 + 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/designer/src/com/fr/poly/PolyDesignUI.java b/designer/src/com/fr/poly/PolyDesignUI.java index efe76a69aa..9fdc8788ef 100644 --- a/designer/src/com/fr/poly/PolyDesignUI.java +++ b/designer/src/com/fr/poly/PolyDesignUI.java @@ -3,12 +3,7 @@ */ package com.fr.poly; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.Point; -import java.awt.Rectangle; +import java.awt.*; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; import java.text.DecimalFormat; @@ -29,6 +24,7 @@ import com.fr.page.PaperSettingProvider; import com.fr.page.ReportSettingsProvider; import com.fr.poly.creator.BlockCreator; import com.fr.poly.creator.ECBlockCreator; +import com.fr.poly.creator.ECBlockEditor; import com.fr.poly.model.AddedData; import com.fr.poly.model.AddingData; import com.fr.report.report.Report; @@ -101,6 +97,7 @@ public class PolyDesignUI extends ComponentUI { paintAddingData(g2d, addData); } paintPaginateLine(g2d); + designer.repaint(); } private void paintAddedData(Graphics g) { @@ -109,8 +106,8 @@ public class PolyDesignUI extends ComponentUI { BlockCreator creator = addedData.getAddedAt(i); // richer:如果当前这个组件正在编辑,那么他是完全被他的编辑器所遮挡的,不需要画出来 if (creator == designer.getSelection()) { - paintPositionLine(g, creator.getX(time), creator.getY(time), - (int) (designer.getHorizontalValue()*time), (int) (designer.getVerticalValue()*time)); + paintPositionLine(g, Math.round(creator.getX() * time), Math.round(creator.getY() * time), + Math.round(designer.getHorizontalValue()*time), Math.round(designer.getVerticalValue()*time)); if (creator.getEditor().isDragging()) { creator.getEditor().paintAbsorptionline(g); //如果与其他块重合了, 需要画出提示禁止重叠 @@ -121,8 +118,8 @@ public class PolyDesignUI extends ComponentUI { creator.getEditor().hideForbiddenWindow(); } } else { - paintCreator(g, creator, (int) (creator.getX()*time - designer.getHorizontalValue()*time), (int) (creator.getY()*time - designer.getVerticalValue()*time), - (int) (creator.getWidth()*time), (int) (creator.getHeight()*time)); + paintCreator(g, creator, creator.getX() - designer.getHorizontalValue(), creator.getY() - designer.getVerticalValue(), + creator.getWidth(), creator.getHeight()); } } } @@ -223,16 +220,19 @@ public class PolyDesignUI extends ComponentUI { ArrayList dbcomponents = new ArrayList(); // richer:禁止双缓冲行为,否则会出现两个图像 ComponentUtils.disableBuffer(comp, dbcomponents); -// Graphics clipg = g.create(x, y, width*resolution/ScreenResolution.getScreenResolution(), height*resolution/ScreenResolution.getScreenResolution()); -// - BufferedImage img = CoreGraphHelper.createBufferedImage(comp.getWidth(), comp.getHeight(), BufferedImage.TYPE_INT_RGB); - Graphics2D g2d = img.createGraphics(); - comp.printAll(g2d); - g2d.dispose(); - g.drawImage(img,x,y,width,height,null); + if (comp instanceof ECBlockCreator) { + Graphics clipg = g.create((int) (x * time), (int) (y * time), (int) (width * time), (int) (height * time)); + comp.paint(clipg); + clipg.dispose(); + }else { + BufferedImage img = CoreGraphHelper.createBufferedImage(comp.getWidth(), comp.getHeight(), BufferedImage.TYPE_INT_RGB); + Graphics2D g2d = img.createGraphics(); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + comp.printAll(g2d); + g2d.dispose(); + g.drawImage(img, (int) (x * time), (int) (y * time), (int) (width * time), (int) (height * time),null); + } -// comp.paint(clipg); -// clipg.dispose(); ComponentUtils.resetBuffer(dbcomponents); } diff --git a/designer/src/com/fr/poly/PolyUtils.java b/designer/src/com/fr/poly/PolyUtils.java index a0d13a0429..d9c54b2fac 100644 --- a/designer/src/com/fr/poly/PolyUtils.java +++ b/designer/src/com/fr/poly/PolyUtils.java @@ -115,11 +115,10 @@ public class PolyUtils { AddedData addedData = designer.getAddedData(); for (int count = addedData.getAddedCount() - 1; count >= 0; count--) { BlockCreator creator = addedData.getAddedAt(count); - float times = (float) designer.getResolution()/ScreenResolution.getScreenResolution(); - int cx = (int) (creator.getX() * times); - int cy = (int) (creator.getY() * times); - int cw = (int) (creator.getWidth() * times); - int ch = (int) (creator.getHeight() * times); + int cx = creator.getX(); + int cy = creator.getY(); + int cw = creator.getWidth(); + int ch = creator.getHeight(); if (x >= cx && x <= (cx + cw)) { if(y >= cy && y <= (cy + ch)) { return creator; diff --git a/designer/src/com/fr/poly/creator/ECBlockEditor.java b/designer/src/com/fr/poly/creator/ECBlockEditor.java index 73d33defee..ee8f2b56c2 100644 --- a/designer/src/com/fr/poly/creator/ECBlockEditor.java +++ b/designer/src/com/fr/poly/creator/ECBlockEditor.java @@ -34,6 +34,7 @@ import java.awt.*; */ public class ECBlockEditor extends BlockEditor { private static final int HEIGHT_MORE = 5; + private int resolution = ScreenResolution.getScreenResolution(); public ECBlockEditor(PolyDesigner designer, ECBlockCreator creator) { super(designer, creator); From e11ab31af65b709beeb8e346bc353bc8ac869a47 Mon Sep 17 00:00:00 2001 From: MoMeak Date: Tue, 12 Sep 2017 17:06:23 +0800 Subject: [PATCH 2/2] =?UTF-8?q?REPORT-4480=20[9.0=E4=B8=80=E8=BD=AE?= =?UTF-8?q?=E5=9B=9E=E5=BD=92]=E8=AE=BE=E8=AE=A1=E5=99=A8=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E6=A0=87=E5=B0=BA=E5=8D=95=E4=BD=8D=E6=97=A0=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/scrollruler/HorizontalRulerUI.java | 2 +- .../src/com/fr/design/scrollruler/VerticalRulerUI.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/designer_base/src/com/fr/design/scrollruler/HorizontalRulerUI.java b/designer_base/src/com/fr/design/scrollruler/HorizontalRulerUI.java index 61a812fda8..fb25c7d3e7 100644 --- a/designer_base/src/com/fr/design/scrollruler/HorizontalRulerUI.java +++ b/designer_base/src/com/fr/design/scrollruler/HorizontalRulerUI.java @@ -27,7 +27,7 @@ public class HorizontalRulerUI extends RulerUI { g.setColor(BaseRuler.UNIT_SIGN_COLOR); if (i % BaseRuler.SCALE_10 == 0) { double times = (double)HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getJTemplateResolution() / ScreenResolution.getScreenResolution(); - String text = Utils.convertNumberStringToString(Math.round(i / times)); + String text = Utils.convertNumberStringToString(Math.round((i / times) / showText)); Graphics2D gg = (Graphics2D) g.create((int) (toPX(i) / ratio) - extra + 1, 0, BaseRuler.NUMBER_100, size.height); BaseUtils.drawStringStyleInRotation(gg, BaseRuler.NUMBER_100, BaseRuler.NUMBER_14, text, Style.getInstance().deriveHorizontalAlignment( Style.LEFT_TO_RIGHT).deriveFRFont(BaseRuler.TEXT_FONT), ScreenResolution.getScreenResolution()); diff --git a/designer_base/src/com/fr/design/scrollruler/VerticalRulerUI.java b/designer_base/src/com/fr/design/scrollruler/VerticalRulerUI.java index e0b6a11bf0..b175c358e0 100644 --- a/designer_base/src/com/fr/design/scrollruler/VerticalRulerUI.java +++ b/designer_base/src/com/fr/design/scrollruler/VerticalRulerUI.java @@ -24,7 +24,7 @@ public class VerticalRulerUI extends RulerUI{ g.setColor(BaseRuler.UNIT_SIGN_COLOR); if (i % BaseRuler.SCALE_10 == 0) { double times = (double) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getJTemplateResolution() / ScreenResolution.getScreenResolution(); - String text = Utils.convertNumberStringToString(Math.round(i / times)); + String text = Utils.convertNumberStringToString(Math.round((i / times) / showText)); GraphHelper.drawLine(g, size.width, toPX(i) / ratio - extra, 0, toPX(i) / ratio - extra); Graphics2D gg = (Graphics2D) g.create(0, (int) (toPX(i) / ratio - extra + 1), size.width, BaseRuler.NUMBER_99); BaseUtils.drawStringStyleInRotation(gg, BaseRuler.NUMBER_11, BaseRuler.NUMBER_100, text, Style.getInstance().deriveVerticalAlignment(1).deriveRotation(