mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
abstract leaded component changes
This commit is contained in:
+1
-2
@@ -27,7 +27,6 @@ import org.diylc.plugins.canvas.CanvasPlugin;
|
||||
import org.diylc.plugins.clipboard.ClipboardManager;
|
||||
import org.diylc.plugins.file.FileManager;
|
||||
import org.diylc.plugins.help.HelpManager;
|
||||
import org.diylc.plugins.online.OnlineManager;
|
||||
import org.diylc.plugins.statusbar.StatusBar;
|
||||
import org.diylc.plugins.toolbox.ToolBox;
|
||||
import org.diylc.presenter.Presenter;
|
||||
@@ -65,7 +64,7 @@ public class MainFrame extends JFrame implements IView {
|
||||
presenter.installPlugin(new ToolBox());
|
||||
presenter.installPlugin(new FileManager());
|
||||
presenter.installPlugin(new ClipboardManager());
|
||||
presenter.installPlugin(new OnlineManager());
|
||||
// presenter.installPlugin(new OnlineManager());
|
||||
presenter.installPlugin(new HelpManager());
|
||||
|
||||
presenter.installPlugin(new StatusBar());
|
||||
|
||||
+3
-2
@@ -33,6 +33,8 @@ public class StatusBar extends JPanel implements IPlugIn {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public static String UPDATE_URL = "http://www.diy-fever.com/update.xml";
|
||||
|
||||
private JComboBox zoomBox;
|
||||
private UpdateLabel updateLabel;
|
||||
private MemoryBar memoryPanel;
|
||||
@@ -70,8 +72,7 @@ public class StatusBar extends JPanel implements IPlugIn {
|
||||
|
||||
private UpdateLabel getUpdateLabel() {
|
||||
if (updateLabel == null) {
|
||||
updateLabel = new UpdateLabel(plugInPort.getCurrentVersionNumber(),
|
||||
"http://www.diy-fever.com/update.xml");
|
||||
updateLabel = new UpdateLabel(plugInPort.getCurrentVersionNumber(), UPDATE_URL);
|
||||
// updateLabel.setBorder(BorderFactory.createCompoundBorder(
|
||||
// BorderFactory.createEtchedBorder(), BorderFactory
|
||||
// .createEmptyBorder(2, 4, 2, 4)));
|
||||
|
||||
+3
@@ -46,6 +46,7 @@ class G2DWrapper extends Graphics2D {
|
||||
private Color originalColor;
|
||||
private Composite originalComposite;
|
||||
private AffineTransform originalTx;
|
||||
private Font originalFont;
|
||||
private AffineTransform currentTx;
|
||||
private Area currentArea;
|
||||
|
||||
@@ -69,6 +70,7 @@ class G2DWrapper extends Graphics2D {
|
||||
originalColor = canvasGraphics.getColor();
|
||||
originalTx = canvasGraphics.getTransform();
|
||||
originalComposite = canvasGraphics.getComposite();
|
||||
originalFont = canvasGraphics.getFont();
|
||||
currentTx = new AffineTransform();
|
||||
}
|
||||
|
||||
@@ -83,6 +85,7 @@ class G2DWrapper extends Graphics2D {
|
||||
canvasGraphics.setColor(originalColor);
|
||||
canvasGraphics.setTransform(originalTx);
|
||||
canvasGraphics.setComposite(originalComposite);
|
||||
canvasGraphics.setFont(originalFont);
|
||||
return currentArea;
|
||||
}
|
||||
|
||||
|
||||
+8
-7
@@ -63,10 +63,11 @@ public class Presenter implements IPlugInPort {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(Presenter.class);
|
||||
|
||||
private static final VersionNumber CURRENT_VERSION = new VersionNumber(0, 0, 0);
|
||||
private static final String DEFAULTS_KEY = "defaults";
|
||||
private static final int CONTROL_POINT_SENSITIVITY = 4;
|
||||
private static final int ICON_SIZE = 32;
|
||||
public static final VersionNumber CURRENT_VERSION = new VersionNumber(0, 0, 0);
|
||||
public static final String DEFAULTS_KEY = "defaults";
|
||||
public static final int CONTROL_POINT_SENSITIVITY = 4;
|
||||
public static final int ICON_SIZE = 32;
|
||||
public static boolean ENABLE_ANTIALIASING = true;
|
||||
|
||||
private double zoomLevel = 1;
|
||||
private Map<IDIYComponent, Area> componentAreaMap;
|
||||
@@ -255,7 +256,7 @@ public class Presenter implements IPlugInPort {
|
||||
}
|
||||
G2DWrapper g2dWrapper = new G2DWrapper(g2d);
|
||||
|
||||
if (drawOptions.contains(DrawOption.ANTIALIASING)) {
|
||||
if (drawOptions.contains(DrawOption.ANTIALIASING) && ENABLE_ANTIALIASING) {
|
||||
g2d
|
||||
.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
|
||||
RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
@@ -264,7 +265,7 @@ public class Presenter implements IPlugInPort {
|
||||
AffineTransform initialTx = g2d.getTransform();
|
||||
Dimension d = getCanvasDimensions(drawOptions.contains(DrawOption.ZOOM));
|
||||
|
||||
g2dWrapper.setColor(Color.white);
|
||||
g2dWrapper.setColor(Constants.CANVAS_COLOR);
|
||||
g2dWrapper.fillRect(0, 0, d.width, d.height);
|
||||
|
||||
if (drawOptions.contains(DrawOption.GRID)) {
|
||||
@@ -706,7 +707,7 @@ public class Presenter implements IPlugInPort {
|
||||
// Instantiate the component.
|
||||
IDIYComponent component = componentClass.newInstance();
|
||||
|
||||
// Find the next available name for the component.
|
||||
// Find the next available componentName for the component.
|
||||
int i = 0;
|
||||
boolean exists = true;
|
||||
while (exists) {
|
||||
|
||||
+1
@@ -9,6 +9,7 @@ public class Constants {
|
||||
|
||||
public static final float GRID = Toolkit.getDefaultToolkit().getScreenResolution() / 10f;
|
||||
|
||||
public static final Color CANVAS_COLOR = Color.white;
|
||||
public static final Color GRID_COLOR = new Color(240, 240, 240);
|
||||
|
||||
public static final Stroke dashedStroke = new BasicStroke(1.0f, BasicStroke.CAP_BUTT,
|
||||
|
||||
Reference in New Issue
Block a user