diff --git a/install/makeapp.sh b/install/makeapp.sh index ebb73f4..ecb4711 100755 --- a/install/makeapp.sh +++ b/install/makeapp.sh @@ -1,3 +1,3 @@ #!/bin/sh -jar2app ../out/artifacts/PhotonFileValidator.jar -i img/icons/photonsters.icns -n "Photon File Validator" -v 1.3.0 -s 1.3.0 -c "(C) Copyright by Bonosoft" -j "-Xmx5g -Xms1g" +jar2app ../out/artifacts/PhotonFileValidator.jar -i img/icons/photonsters.icns -n "Photon File Validator" -v 1.4.0 -s 1.4.0 -c "(C) Copyright by Bonosoft" -j "-Xmx5g -Xms1g" diff --git a/install/makeappjre.sh b/install/makeappjre.sh index dc11b80..3e2e95b 100755 --- a/install/makeappjre.sh +++ b/install/makeappjre.sh @@ -1,3 +1,3 @@ #!/bin/sh -jar2app ../out/artifacts/PhotonFileValidator.jar -i img/icons/photonsters.icns -n "Photon File Validator jre" -v 1.3.0 -s 1.3.0 -c "(C) Copyright by Bonosoft" -j "-Xmx5g -Xms1g" -r /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk +jar2app ../out/artifacts/PhotonFileValidator.jar -i img/icons/photonsters.icns -n "Photon File Validator jre" -v 1.4.0 -s 1.4.0 -c "(C) Copyright by Bonosoft" -j "-Xmx5g -Xms1g" -r /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk diff --git a/out/artifacts/PhotonFileValidator.jar b/out/artifacts/PhotonFileValidator.jar index 3fb95c4..b1e7c3b 100644 Binary files a/out/artifacts/PhotonFileValidator.jar and b/out/artifacts/PhotonFileValidator.jar differ diff --git a/src/photon/application/MainForm.form b/src/photon/application/MainForm.form index fd062d9..198478d 100644 --- a/src/photon/application/MainForm.form +++ b/src/photon/application/MainForm.form @@ -196,9 +196,9 @@ - - - + + + @@ -209,9 +209,9 @@ - - - + + + @@ -249,9 +249,9 @@ - - - + + + @@ -262,9 +262,9 @@ - - - + + + diff --git a/src/photon/application/MainForm.java b/src/photon/application/MainForm.java index bb85e5f..c14d730 100644 --- a/src/photon/application/MainForm.java +++ b/src/photon/application/MainForm.java @@ -346,11 +346,11 @@ private void createUIComponents() { marginNextBtn = new JButton(); marginNextBtn.setEnabled(false); marginNextBtn.setText(">"); - panel4.add(marginNextBtn, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, new Dimension(40, 18), new Dimension(40, 18), new Dimension(40, 18), 0, false)); + panel4.add(marginNextBtn, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, new Dimension(35, 18), new Dimension(35, 18), new Dimension(45, 18), 0, false)); marginPrevBtn = new JButton(); marginPrevBtn.setEnabled(false); marginPrevBtn.setText("<"); - panel4.add(marginPrevBtn, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, new Dimension(40, 18), new Dimension(40, 18), new Dimension(40, 18), 0, false)); + panel4.add(marginPrevBtn, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, new Dimension(35, 18), new Dimension(35, 18), new Dimension(45, 18), 0, false)); marginInfo = new JLabel(); marginInfo.setText(""); panel4.add(marginInfo, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 1, false)); @@ -362,11 +362,11 @@ private void createUIComponents() { islandNextBtn = new JButton(); islandNextBtn.setEnabled(false); islandNextBtn.setText(">"); - panel5.add(islandNextBtn, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, new Dimension(40, 18), new Dimension(40, 18), new Dimension(40, 18), 0, false)); + panel5.add(islandNextBtn, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, new Dimension(35, 18), new Dimension(35, 18), new Dimension(45, 18), 0, false)); islandPrevBtn = new JButton(); islandPrevBtn.setEnabled(false); islandPrevBtn.setText("<"); - panel5.add(islandPrevBtn, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, new Dimension(40, 18), new Dimension(40, 18), new Dimension(40, 18), 0, false)); + panel5.add(islandPrevBtn, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, new Dimension(35, 18), new Dimension(35, 18), new Dimension(45, 18), 0, false)); layerInfo = new JLabel(); layerInfo.setText(""); panel5.add(layerInfo, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_NORTHWEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 1, false)); diff --git a/src/photon/application/dialogs/EditDialog.java b/src/photon/application/dialogs/EditDialog.java index a147fb6..0f2d005 100644 --- a/src/photon/application/dialogs/EditDialog.java +++ b/src/photon/application/dialogs/EditDialog.java @@ -37,6 +37,7 @@ import javax.swing.*; import java.awt.*; import java.awt.event.*; +import java.security.PublicKey; import java.util.HashSet; public class EditDialog extends JDialog { @@ -56,6 +57,8 @@ public class EditDialog extends JDialog { private int layerY; private HashSet dots; + public PhotonDot pressedDot; + public EditDialog(MainForm mainForm) { super(mainForm.frame); @@ -63,6 +66,7 @@ public EditDialog(MainForm mainForm) { this.mainForm = mainForm; $$$setupUI$$$(); + setContentPane(contentPane); setModal(true); getRootPane().setDefaultButton(buttonOK); @@ -91,12 +95,23 @@ public void actionPerformed(ActionEvent e) { editArea.addMouseListener(new MouseAdapter() { @Override - public void mouseClicked(MouseEvent e) { - if (e.getX() > 15 && e.getY() > 15) { - int x = (e.getX() - 15) / 10; - int y = (e.getY() - 15) / 10; - if (x < 75 && y < 45) { - me.handleClick(x, y); + public void mousePressed(MouseEvent e) { + pressedDot = getPosition(e); + } + + @Override + public void mouseReleased(MouseEvent e) { + PhotonDot releasedDot = getPosition(e); + if (pressedDot != null && releasedDot != null) { + int x1 = Integer.min(pressedDot.x, releasedDot.x); + int x2 = Integer.max(pressedDot.x, releasedDot.x); + int y1 = Integer.min(pressedDot.y, releasedDot.y); + int y2 = Integer.max(pressedDot.y, releasedDot.y); + + for (int x = x1; x <= x2; x++) { + for (int y = y1; y <= y2; y++) { + me.handleClick(x, y); + } } } } @@ -194,6 +209,18 @@ private void createUIComponents() { editArea = new PhotonEditPanel(780, 480); } + public static PhotonDot getPosition(MouseEvent e) { + if (e.getX() > 15 && e.getY() > 15) { + int x = (e.getX() - 15) / 10; + int y = (e.getY() - 15) / 10; + if (x < 75 && y < 45) { + return new PhotonDot(x, y); + } + } + return null; + } + + /** * Method generated by IntelliJ IDEA GUI Designer * >>> IMPORTANT!! <<< diff --git a/src/photon/application/dialogs/SaveDialog.java b/src/photon/application/dialogs/SaveDialog.java index 201536a..927a0e0 100644 --- a/src/photon/application/dialogs/SaveDialog.java +++ b/src/photon/application/dialogs/SaveDialog.java @@ -35,6 +35,8 @@ import java.awt.*; import java.awt.event.*; import java.io.File; +import java.util.regex.Matcher; +import java.util.regex.Pattern; public class SaveDialog extends JDialog { private JPanel contentPane; @@ -86,9 +88,9 @@ private void onOK() { File file = new File(path + File.separatorChar + textName.getText()); try { PhotonFileHeader header = photonFile.getPhotonFileHeader(); - header.setExposureTimeSeconds(Float.parseFloat(textExposure.getText())); - header.setOffTimeSeconds(Float.parseFloat(textOffTime.getText())); - header.setExposureBottomTimeSeconds(Float.parseFloat(textBottomExposure.getText())); + header.setExposureTimeSeconds(getFloat(textExposure.getText())); + header.setOffTimeSeconds(getFloat(textOffTime.getText())); + header.setExposureBottomTimeSeconds(getFloat(textBottomExposure.getText())); header.setBottomLayers(Integer.parseInt(textBottomLayers.getText())); photonFile.adjustLayerSettings(); photonFile.saveFile(file); @@ -126,11 +128,21 @@ public void setInformation(PhotonFile photonFile, String path, String name) { } private String makeFileName(String path, String name, String ext) { + Pattern pattern = Pattern.compile("(.+)-[0-9]+"); + Matcher matcher = pattern.matcher(name); + if (matcher.matches()) { + name = matcher.group(1); + } int i = 1; while ((new File(path + File.separatorChar + name + "-" + i + ext)).exists()) i++; return name + "-" + i + ext; } + private float getFloat(String str) { + return Float.parseFloat(str.replace(',', '.')); + } + + { // GUI initializer generated by IntelliJ IDEA GUI Designer // >>> IMPORTANT!! <<<