diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 670408e..6a16b17 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -38,3 +38,4 @@ jobs:
draft: true
files: staging/*
fail_on_unmatched_files: true
+ body: "[${{ github.event.head_commit.message }}](https://github.com/kristian/JDigitalSimulator/commit/${{ github.event.head_commit.id }})"
diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 0000000..d8bab77
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,16 @@
+{
+ // Use IntelliSense to learn about possible attributes.
+ // Hover to view descriptions of existing attributes.
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "type": "java",
+ "name": "Application",
+ "request": "launch",
+ "mainClass": "lc.kra.jds.gui.Application",
+ "projectName": "jds",
+ "vmArgs": "--add-opens java.base/java.io=ALL-UNNAMED"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9878aab..54060f7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 2.4.0 (2024-02-05)
+### Added
+ - Option to change worksheet size
+
## 2.3.0 (2024-02-05)
### Fixed
- Ability to open files from old JDigitalSimulator versions (before open-sourcing, version < 1.*), see the README.md instructions
diff --git a/pom.xml b/pom.xml
index 5f33d72..546bbf4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
lc.kra.jds
jds
- 2.3.0
+ 2.4.0
JDigitalSimulator
JDigitalSimulator is a plattform independend Electronic Design Automation software entirely build in Java
diff --git a/src/main/java/lc/kra/jds/Simulation.java b/src/main/java/lc/kra/jds/Simulation.java
index 77c6115..97cbe1e 100644
--- a/src/main/java/lc/kra/jds/Simulation.java
+++ b/src/main/java/lc/kra/jds/Simulation.java
@@ -137,9 +137,9 @@ public class Simulation extends JComponent implements Scrollable, Printable {
private static final long serialVersionUID = 1l;
public enum Layer { TOPMOST, BOTTOMMOST; }
+ public static final Dimension DEFAULT_SIZE = new Dimension(2000, 2000);
private static final Color SELECTION = new Color(10, 200, 10, 75);
- private static final Dimension SIZE = new Dimension(2000, 2000);
private static final int GRID_STEPS = 20;
private static final int STACK_SIZE = 200;
@@ -196,7 +196,7 @@ private void initialize() {
future = new LinkedList();
this.setZoom(1.0d);
this.setFocusable(true);
- this.setPreferredSize(SIZE);
+ this.setPreferredSize(properties.size != null ? properties.size : DEFAULT_SIZE);
initializeListeners();
initializeDropTarget();
}
@@ -466,10 +466,11 @@ public void mouseDragged(MouseEvent event) {
}
GraphicsConfiguration context = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
- dragImage = context.createCompatibleImage(SIZE.height, SIZE.width, Transparency.TRANSLUCENT);
+ Dimension size = getPreferredSize();
+ dragImage = context.createCompatibleImage(size.height, size.width, Transparency.TRANSLUCENT);
Graphics2D graphics = prepareGraphics(dragImage.createGraphics());
graphics.setColor(new Color(0, 0, 0, 0));
- graphics.fillRect(0, 0, SIZE.height, SIZE.width);
+ graphics.fillRect(0, 0, size.height, size.width);
paintComponents(graphics, dragComponents, dragWires);
} else if(selectWire!=null) {
selectWire.setPreferredLocation(event.getPoint());
@@ -1205,6 +1206,7 @@ public static class SimulationProperies implements Serializable {
public AuthorDescription author = new AuthorDescription();
public CircuitDescription circuit = new CircuitDescription();
+ public Dimension size = DEFAULT_SIZE;
private String hash;
public class AuthorDescription implements Serializable {
diff --git a/src/main/java/lc/kra/jds/gui/Application.java b/src/main/java/lc/kra/jds/gui/Application.java
index 05a6aec..82dc4cf 100644
--- a/src/main/java/lc/kra/jds/gui/Application.java
+++ b/src/main/java/lc/kra/jds/gui/Application.java
@@ -105,6 +105,7 @@
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
+import javax.swing.JSpinner;
import javax.swing.JSeparator;
import javax.swing.JSplitPane;
import javax.swing.JTextArea;
@@ -113,6 +114,7 @@
import javax.swing.JToolBar;
import javax.swing.JViewport;
import javax.swing.JWindow;
+import javax.swing.SpinnerNumberModel;
import javax.swing.SwingUtilities;
import javax.swing.TransferHandler;
import javax.swing.UIManager;
@@ -140,7 +142,7 @@
/**
* JDigitalSimulator
* @author Kristian Kraljic
- * @version 2.3.0
+ * @version 2.4.0
*/
public class Application extends JFrame {
private static final long serialVersionUID = -4693271310855486553L;
@@ -148,7 +150,7 @@ public class Application extends JFrame {
public static final String FILE_EXTENSION = "jdsim";
public static File pluginDirectory, currentDirectory;
- private static final String VERSION = "2.3.0", COPYRIGHT = "2010-2024", LINES_OF_CODE = "9.509", WORDS_OF_CODE = "36.133", PAGES_OF_CODE = "245";
+ private static final String VERSION = "2.4.0", COPYRIGHT = "2010-2024", LINES_OF_CODE = "9.509", WORDS_OF_CODE = "36.133", PAGES_OF_CODE = "245";
private static final String[]
TOOLBAR_FRAME_FOCUS = new String[]{"save", "print", "print_level", "simulate", "left", "right", "up", "down", "grid", "secure", "zoom_default", "zoom", "zoom_in", "zoom_out"},
@@ -502,8 +504,8 @@ private JMenuBar createMenuBar() {
properties.add(createMenuItem("properties.worksheet", new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
- SimulationFrame frame = desktop.getSelectedFrame();
- Simulation simulation = frame.getSimulation();
+ final SimulationFrame frame = desktop.getSelectedFrame();
+ final Simulation simulation = frame.getSimulation();
final Simulation.SimulationProperies properties = simulation.properties;
String fileName = getTranslation("properties.worksheet", TranslationType.TITLE, frame.getFileName());
final JDialog dialog = Guitilities.createDialog(Application.this, fileName);
@@ -527,6 +529,12 @@ public void actionPerformed(ActionEvent event) {
final JTextField circuitVersion = Guitilities.addGridPairLine(circuitPane, 2, new JLabel(getTranslation("properties.circuit.version")), new JTextField(properties.circuit.version));
centerPane.add(circuitPane);
+ centerPane.add(Guitilities.createSeparator(getTranslation("properties.worksheet")));
+ JPanel worksheetPane = new JPanel(new GridBagLayout());
+ final JSpinner worksheetWidth = Guitilities.addGridPairLine(worksheetPane, 0, new JLabel(getTranslation("properties.worksheet.width")), new JSpinner(new SpinnerNumberModel((properties.size != null ? properties.size : Simulation.DEFAULT_SIZE).getWidth(), 100, Short.MAX_VALUE, 100)), new JLabel(getTranslation("properties.worksheet.pixels")));
+ final JSpinner worksheetHeight = Guitilities.addGridPairLine(worksheetPane, 1, new JLabel(getTranslation("properties.worksheet.height")), new JSpinner(new SpinnerNumberModel((properties.size != null ? properties.size : Simulation.DEFAULT_SIZE).getHeight(), 100, Short.MAX_VALUE, 100)), new JLabel(getTranslation("properties.worksheet.pixels")));
+ centerPane.add(worksheetPane);
+
JPanel bottomPane = Guitilities.createGradientFooter();
bottomPane.add(Guitilities.createButton(getTranslation("properties.secure"), new ActionListener() {
@Override public void actionPerformed(ActionEvent event) { getToolBarButton("secure").getActionListeners()[0].actionPerformed(event); }
@@ -541,6 +549,8 @@ public void actionPerformed(ActionEvent event) {
properties.circuit.name = circuitName.getText();
properties.circuit.description = ((JTextArea)circuitDescription.getViewport().getComponent(0)).getText();
properties.circuit.version = circuitVersion.getText();
+ properties.size.setSize((double) worksheetWidth.getValue(), (double) worksheetHeight.getValue());
+ simulation.setPreferredSize(properties.size); if (simulation.getParent() != null) simulation.getParent().revalidate();
}
};
bottomPane.add(Guitilities.createButton(getTranslation("properties.okay"), new ActionListener() {
diff --git a/src/main/resources/lc/kra/jds/TranslationBundle.properties b/src/main/resources/lc/kra/jds/TranslationBundle.properties
index fc11a88..928dc13 100644
--- a/src/main/resources/lc/kra/jds/TranslationBundle.properties
+++ b/src/main/resources/lc/kra/jds/TranslationBundle.properties
@@ -297,6 +297,10 @@ properties.circuit = Circuit
properties.circuit.name = Name:
properties.circuit.description = Description:
properties.circuit.version = Version:
+properties.worksheet = Worksheet
+properties.worksheet.width = Width:
+properties.worksheet.height = Height:
+properties.worksheet.pixels = pixels
properties.localization = Language options
properties.localization.language = Language:
properties.localization.info = Note: You will have to restart the JDigitalSimulator in order to complete the change of the default display language completely.
diff --git a/src/main/resources/lc/kra/jds/TranslationBundle_de.properties b/src/main/resources/lc/kra/jds/TranslationBundle_de.properties
index a670050..0e64ac8 100644
--- a/src/main/resources/lc/kra/jds/TranslationBundle_de.properties
+++ b/src/main/resources/lc/kra/jds/TranslationBundle_de.properties
@@ -297,6 +297,10 @@ properties.circuit = Schaltung
properties.circuit.name = Name:
properties.circuit.description = Beschreibung:
properties.circuit.version = Version:
+properties.worksheet = Arbeitsblatt
+properties.worksheet.width = Breite:
+properties.worksheet.height = Höhe:
+properties.worksheet.pixels = Pixel
properties.localization = Spracheinstellungen
properties.localization.language = Sprache:
properties.localization.info = Hinweis: Sie müssen den JDigitalSimulator neustarten damit die Sprachänderungen vollständig wirksam werden.