Merge branch 'master' into feature/multimeter3

This commit is contained in:
Branislav Stojkovic
2025-03-25 13:18:37 +01:00
80 changed files with 1036 additions and 864 deletions
-30
View File
@@ -1,30 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="test"/>
<classpathentry kind="lib" path="lib/commons-compiler-3.0.6.jar"/>
<classpathentry kind="lib" path="lib/janino-3.0.6.jar"/>
<classpathentry kind="lib" path="lib/log4j-1.2.15.jar"/>
<classpathentry kind="lib" path="lib/junit-4.7.jar"/>
<classpathentry kind="lib" path="lib/jettison-1.0.1.jar"/>
<classpathentry kind="lib" path="lib/app-framework.jar" sourcepath="/app-framework"/>
<classpathentry kind="lib" path="lib/swing-framework.jar" sourcepath="/swing-framework"/>
<classpathentry kind="lib" path="lib/balloontip-1.2.4.1.jar"/>
<classpathentry kind="lib" path="lib/jep-2.4.1.jar"/>
<classpathentry kind="lib" path="lib/poi-3.5-FINAL-20090928.jar"/>
<classpathentry kind="lib" path="lib/AppleJavaExtensions.jar"/>
<classpathentry kind="lib" path="lib/orsonpdf-1.8.jar"/>
<classpathentry kind="lib" path="lib/gestures-wrapper-0.2.jar"/>
<classpathentry kind="lib" path="lib/jar-loader.jar"/>
<classpathentry kind="lib" path="lib/svgSalamander-1.1.2.4.jar"/>
<classpathentry kind="lib" path="lib/xstream-1.4.19.jar"/>
<classpathentry kind="lib" path="lib/guava-31.1-jre.jar"/>
<classpathentry kind="lib" path="lib/pdfbox-2.0.27.jar"/>
<classpathentry kind="lib" path="lib/commons-logging-1.2.jar"/>
<classpathentry kind="lib" path="lib/gerber-writer-api-1.0.0.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/diylc-core"/>
<classpathentry kind="lib" path="lib/java-http-proxy.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="library/main.jar" sourcepath="/diylc-library"/>
<classpathentry kind="output" path="bin"/>
</classpath>
-34
View File
@@ -1,34 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>diylc-swing</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<filteredResources>
<filter>
<id>1741597247368</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
@@ -1,26 +1,25 @@
#!/bin/bash
#set -x # Enable debug mode
HERE="$(dirname "$(readlink -f "$0")")"
# Get the AppImage directory
if [ -n "$APPDIR" ]; then
HERE="$APPDIR/usr/bin"
else
HERE="$(cd "$(dirname "$0")" && pwd)"
fi
echo "diylc.sh: Running from directory: $HERE"
# Check if Java is available
if [ -d "$HERE/jre" ]; then
export JAVA_HOME="$HERE/jre"
export PATH="$JAVA_HOME/bin:$PATH"
JAVA="$JAVA_HOME/bin/java"
echo "diylc.sh: Using bundled JRE: $JAVA"
else
JAVA="$(which java)"
echo "diylc.sh: Using system Java: $JAVA"
fi
# Debug: Check Java existence
if [ ! -x "$JAVA" ]; then
echo "diylc.sh: ERROR - Java binary not found or not executable!"
# Use system Java
JAVA="$(which java)"
if [ -z "$JAVA" ] || [ ! -x "$JAVA" ]; then
echo "diylc.sh: ERROR - System Java not found or not executable!"
echo "diylc.sh: Please install Java 17 or later"
exit 1
fi
echo "diylc.sh: Using system Java: $JAVA"
cd "$HERE"
echo "diylc.sh: Current working directory: $(pwd)"
@@ -28,11 +27,9 @@ echo "diylc.sh: Current working directory: $(pwd)"
echo "diylc.sh: Executing DIYLCStarter with Java"
exec "$JAVA" \
-Xms512m \
-Xms1024m \
-Xmx4096m \
-cp "$HERE/../lib/diylc.jar" \
--add-exports java.desktop/com.apple.eawt.event=ALL-UNNAMED \
--add-exports java.desktop/com.apple.eio=ALL-UNNAMED \
-cp "$APPDIR/usr/lib/diylc.jar" \
--add-opens java.base/java.util=ALL-UNNAMED \
--add-opens java.base/java.lang=ALL-UNNAMED \
--add-opens java.base/java.text=ALL-UNNAMED \
+16 -1
View File
@@ -2,4 +2,19 @@
JAVA_BIN="$(which java)"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
CLASS_PATH="${DIR}/diylc.jar"
exec java -Xms512m -Xmx4096m -Dorg.diylc.scriptRun=true -Dfile.encoding=UTF-8 -cp "$CLASS_PATH" --add-exports java.desktop/com.apple.eawt.event=ALL-UNNAMED --add-exports java.desktop/com.apple.eio=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.text=ALL-UNNAMED --add-opens java.desktop/java.awt=ALL-UNNAMED --add-opens java.desktop/java.awt.font=ALL-UNNAMED --add-opens java.desktop/java.awt.geom=ALL-UNNAMED org.diylc.DIYLCStarter "$@"
exec java \
-Xms1024m \
-Xmx4096m \
-Dorg.diylc.scriptRun=true \
-Dfile.encoding=UTF-8 \
-cp "$CLASS_PATH" \
--add-exports java.desktop/com.apple.eawt.event=ALL-UNNAMED \
--add-exports java.desktop/com.apple.eio=ALL-UNNAMED \
--add-opens java.base/java.util=ALL-UNNAMED \
--add-opens java.base/java.lang=ALL-UNNAMED \
--add-opens java.base/java.text=ALL-UNNAMED \
--add-opens java.desktop/java.awt=ALL-UNNAMED \
--add-opens java.desktop/java.awt.font=ALL-UNNAMED \
--add-opens java.desktop/java.awt.geom=ALL-UNNAMED \
org.diylc.DIYLCStarter "$@"
+72
View File
@@ -0,0 +1,72 @@
#!/bin/bash
# Build the AppImage
echo "Building AppImage..."
cd ../..
#mvn clean package -P linux-appimage
# Check if build was successful
if [ $? -ne 0 ]; then
echo "Build failed!"
exit 1
fi
# Get the AppImage path
APPIMAGE="target/DIYLayoutCreator-5.1.0-x86_64.AppImage"
ZIP_FILE="target/diylc-5.1.0-linux.zip"
# Check if files exist
if [ ! -f "$APPIMAGE" ]; then
echo "AppImage not found at $APPIMAGE"
exit 1
fi
if [ ! -f "$ZIP_FILE" ]; then
echo "Zip file not found at $ZIP_FILE"
exit 1
fi
# Create test directory
TEST_DIR="target/appimage-test"
rm -rf "$TEST_DIR"
mkdir -p "$TEST_DIR"
# Copy files to test directory
echo "Copying files to test directory..."
cp "$APPIMAGE" "$TEST_DIR/"
cp "$ZIP_FILE" "$TEST_DIR/"
# Extract zip file
echo "Extracting zip file..."
cd "$TEST_DIR"
unzip "diylc-5.1.0-linux.zip"
# Make AppImage executable
chmod +x "DIYLayoutCreator-5.1.0-x86_64.AppImage"
# Test AppImage structure
echo "Testing AppImage structure..."
if [ -f "DIYLayoutCreator-5.1.0-x86_64.AppImage" ]; then
echo "AppImage file exists and is executable"
echo "AppImage size: $(ls -lh DIYLayoutCreator-5.1.0-x86_64.AppImage | awk '{print $5}')"
echo "AppImage permissions: $(ls -l DIYLayoutCreator-5.1.0-x86_64.AppImage | awk '{print $1}')"
# Check if AppImage has the correct magic number
if file "DIYLayoutCreator-5.1.0-x86_64.AppImage" | grep -q "ELF 64-bit LSB executable"; then
echo "AppImage has correct ELF format"
else
echo "Warning: AppImage might not have correct ELF format"
fi
# Check if AppImage has the correct AppImage magic bytes
if dd if="DIYLayoutCreator-5.1.0-x86_64.AppImage" bs=8 count=1 2>/dev/null | grep -q "AI"; then
echo "AppImage has correct AppImage magic bytes"
else
echo "Warning: AppImage might not have correct AppImage magic bytes"
fi
echo "AppImage structure test completed successfully!"
else
echo "AppImage file not found in test directory!"
exit 1
fi
+16
View File
@@ -0,0 +1,16 @@
#!/bin/bash
# Get the directory where this script is located
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Set DEBUG environment variable
export DEBUG=true
# Run the VersionReader class
java -cp "../target/diylc.jar" --add-opens java.base/java.util=ALL-UNNAMED \
--add-opens java.base/java.lang=ALL-UNNAMED \
--add-opens java.base/java.text=ALL-UNNAMED \
--add-opens java.desktop/java.awt=ALL-UNNAMED \
--add-opens java.desktop/java.awt.font=ALL-UNNAMED \
--add-opens java.desktop/java.awt.geom=ALL-UNNAMED \
org.diylc.utils.VersionReader "$SCRIPT_DIR/../"
+40
View File
@@ -0,0 +1,40 @@
#!/bin/bash
# Get the directory where this script is located
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# FTP settings
FTP_USER="diylc_deploy@diy-fever.com"
FTP_HOST="ftp.diy-fever.com"
# Check if password is set
if [ -z "$DIYLC_DEPLOY_PWD" ]; then
echo "Error: DIYLC_DEPLOY_PWD environment variable is not set"
exit 1
fi
# Source file path
SOURCE_FILE="$SCRIPT_DIR/../../diylc-core/src/main/resources/update.xml"
# Check if source file exists
if [ ! -f "$SOURCE_FILE" ]; then
echo "Error: update.xml not found at $SOURCE_FILE"
exit 1
fi
# Upload using FTP
echo "Uploading update.xml to $FTP_USER@$FTP_HOST..."
ftp -n "$FTP_HOST" << EOF
user $FTP_USER $DIYLC_DEPLOY_PWD
binary
put "$SOURCE_FILE" update.xml
quit
EOF
# Check FTP exit status
if [ $? -eq 0 ]; then
echo "Upload successful"
else
echo "Upload failed"
exit 1
fi
@@ -24,7 +24,7 @@
<requires64Bit>true</requires64Bit>
<minVersion>17</minVersion>
<maxVersion></maxVersion>
<initialHeapSize>512</initialHeapSize>
<initialHeapSize>1024</initialHeapSize>
<maxHeapSize>4096</maxHeapSize>
<opt>-Dorg.diylc.scriptRun=true</opt>
<opt>-Dfile.encoding=UTF-8</opt>
+5
View File
@@ -74,6 +74,7 @@ And
Angle
Angle Offset
Anti-Aliasing
Apply Model
Arrow Size
Author
Auto-Create Pads
@@ -85,6 +86,8 @@ Below
Board
Board Color
Board Width
Board1
Board2
Boards
Bobbin 1
Bobbin 2
@@ -588,6 +591,8 @@ Tubular Beveled
Two
Type
Ultra-miniature
Underside Display
Underside Offset
Underside Pad Color
Underside Trace Color
Undo
+113 -93
View File
@@ -260,47 +260,6 @@
</target>
</configuration>
</execution>
<execution>
<id>sign-jar-launcher</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<!-- Extract JavaAppLauncher -->
<unzip src="${project.build.directory}/diylc.jar" dest="${project.build.directory}/jar-contents">
<patternset>
<include name="com/oracle/appbundler/JavaAppLauncher"/>
</patternset>
</unzip>
<!-- Make it executable -->
<chmod file="${project.build.directory}/jar-contents/com/oracle/appbundler/JavaAppLauncher" perm="755"/>
<!-- Sign the launcher -->
<exec executable="codesign" failonerror="true">
<arg value="--force"/>
<arg value="--sign"/>
<arg value="${env.APPLE_DEVELOPER_IDENTITY}"/>
<arg value="--timestamp"/>
<arg value="--options"/>
<arg value="runtime"/>
<arg value="--entitlements"/>
<arg value="${project.basedir}/deploy/mac/entitlements.plist"/>
<arg value="--all-architectures"/>
<arg value="--strict"/>
<arg value="--verbose"/>
<arg value="${project.build.directory}/jar-contents/com/oracle/appbundler/JavaAppLauncher"/>
</exec>
<!-- Update the jar with signed launcher -->
<jar destfile="${project.build.directory}/diylc.jar" update="true">
<fileset dir="${project.build.directory}/jar-contents"/>
</jar>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
@@ -328,7 +287,7 @@
<goal>single</goal>
</goals>
<configuration>
<finalName>diylc-${project.version}</finalName>
<finalName>diylc-${project.version}-universal</finalName>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</execution>
@@ -391,39 +350,6 @@
<copy file="${project.basedir}/deploy/linux/appimage/com.diy_fever.DIYLayoutCreator.metainfo.xml"
todir="${appdir.dir}/usr/share/metainfo" />
<!-- Download and extract JRE for Linux -->
<!-- Ensure clean jre folders -->
<delete dir="${jre.dest.linux}" />
<mkdir dir="${jre.dest.linux}" />
<mkdir dir="${project.build.directory}/downloads" />
<!-- Download JRE 17 if not already present -->
<get src="${jdk.url.linux}"
dest="${project.build.directory}/downloads/${jdk.archive.linux}"
usetimestamp="true" />
<!-- Extract JRE -->
<untar src="${project.build.directory}/downloads/${jdk.archive.linux}"
dest="${jre.dest.linux}"
compression="gzip" />
<!-- Move extracted folder into AppImage location -->
<mkdir dir="${appdir.dir}/usr/bin/jre" />
<move todir="${appdir.dir}/usr/bin/jre">
<fileset dir="${jre.dest.linux}/jdk-${jdk.version}-jre" />
</move>
<!-- Clean up temporary directory -->
<delete dir="${jre.dest.linux}" />
<echo message="JRE 17 bundled into ${appdir.dir}/usr/bin/jre" />
<!-- Update the launch script to use the correct JRE path -->
<replace file="${appdir.dir}/usr/bin/diylc.sh">
<replacetoken>JAVA_HOME="$APPDIR/usr/lib/jre"</replacetoken>
<replacevalue>JAVA_HOME="$APPDIR/usr/bin/jre"</replacevalue>
</replace>
<echo message="AppDir structure created successfully at: ${appdir.dir}" />
</target>
</configuration>
@@ -539,9 +465,17 @@
<fileset dir="${appdir.dir}" />
</copy>
<!-- Run AppImageTool in Docker -->
<!-- Ensure proper permissions in Docker volume -->
<exec executable="chmod" failonerror="true" osfamily="mac">
<arg line="-R 755 ${project.build.directory}/docker-tmp/AppDir/AppRun" />
</exec>
<exec executable="chmod" failonerror="true" osfamily="mac">
<arg line="-R 755 ${project.build.directory}/docker-tmp/AppDir/usr/bin/diylc.sh" />
</exec>
<!-- Run AppImageTool in Docker with proper volume mounting -->
<exec executable="docker" failonerror="true" osfamily="mac">
<arg line="run --rm -v &quot;${project.build.directory}/docker-tmp:/workspace&quot; -w /workspace appimagecrafters/appimage-builder:latest /bin/bash -c &quot;ARCH=x86_64 appimagetool AppDir ${appimage.output.file}&quot;" />
<arg line="run --rm -v &quot;${project.build.directory}/docker-tmp:/workspace&quot; -w /workspace appimagecrafters/appimage-builder:latest /bin/bash -c &quot;chmod +x AppDir/AppRun AppDir/usr/bin/diylc.sh &amp;&amp; ARCH=x86_64 appimagetool AppDir ${appimage.output.file}&quot;" />
</exec>
<!-- Copy the AppImage to the build directory -->
@@ -703,6 +637,49 @@
</configuration>
</execution>
<!-- Sign JAR launcher -->
<execution>
<id>sign-jar-launcher</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<!-- Extract JavaAppLauncher -->
<unzip src="${project.build.directory}/diylc.jar" dest="${project.build.directory}/jar-contents">
<patternset>
<include name="com/oracle/appbundler/JavaAppLauncher"/>
</patternset>
</unzip>
<!-- Make it executable -->
<chmod file="${project.build.directory}/jar-contents/com/oracle/appbundler/JavaAppLauncher" perm="755"/>
<!-- Sign the launcher -->
<exec executable="codesign" failonerror="true">
<arg value="--force"/>
<arg value="--sign"/>
<arg value="${env.APPLE_DEVELOPER_IDENTITY}"/>
<arg value="--timestamp"/>
<arg value="--options"/>
<arg value="runtime"/>
<arg value="--entitlements"/>
<arg value="${project.basedir}/deploy/mac/entitlements.plist"/>
<arg value="--all-architectures"/>
<arg value="--strict"/>
<arg value="--verbose"/>
<arg value="${project.build.directory}/jar-contents/com/oracle/appbundler/JavaAppLauncher"/>
</exec>
<!-- Update the jar with signed launcher -->
<jar destfile="${project.build.directory}/diylc.jar" update="true">
<fileset dir="${project.build.directory}/jar-contents"/>
</jar>
</target>
</configuration>
</execution>
<!-- Create macOS app bundle -->
<execution>
<id>create-mac-bundle</id>
@@ -740,7 +717,7 @@
<runtime dir="${jre.dest.osx}/Contents/Home" />
<arch name="x86_64"/>
<classpath file="${project.build.directory}/diylc.jar" />
<option value="-Xms512m" />
<option value="-Xms1024m" />
<option value="-Xmx4096m" />
<option value="--add-exports=java.desktop/com.apple.eawt.event=ALL-UNNAMED" />
<option value="--add-exports=java.desktop/com.apple.eio=ALL-UNNAMED" />
@@ -760,13 +737,6 @@
<option value="-Xdock:name=DIY Layout Creator"/>
<option value="-Xdock:icon=Contents/Resources/diylc.icns"/>
</bundleapp>
<!-- First remove existing signatures -->
<echo message="Removing any existing signatures..."/>
<exec executable="codesign" failonerror="false">
<arg value="--remove-signature"/>
<arg value="${project.build.directory}/DIYLC.app"/>
</exec>
<echo message="Creating unsigned zip for distribution..."/>
<!-- Create unsigned zip for distribution -->
@@ -776,6 +746,13 @@
</zip>
<echo message="Unsigned zip created at: ${project.build.directory}/diylc-${project.version}-osx-x86-unsigned.zip"/>
<!-- First remove existing signatures -->
<echo message="Removing any existing signatures..."/>
<exec executable="codesign" failonerror="false">
<arg value="--remove-signature"/>
<arg value="${project.build.directory}/DIYLC.app"/>
</exec>
<!-- Sign the entire app bundle in one shot -->
<echo message="Signing complete app bundle..."/>
<exec executable="codesign" failonerror="true">
@@ -973,6 +950,49 @@
</configuration>
</execution>
<!-- Sign JAR launcher -->
<execution>
<id>sign-jar-launcher</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<!-- Extract JavaAppLauncher -->
<unzip src="${project.build.directory}/diylc.jar" dest="${project.build.directory}/jar-contents">
<patternset>
<include name="com/oracle/appbundler/JavaAppLauncher"/>
</patternset>
</unzip>
<!-- Make it executable -->
<chmod file="${project.build.directory}/jar-contents/com/oracle/appbundler/JavaAppLauncher" perm="755"/>
<!-- Sign the launcher -->
<exec executable="codesign" failonerror="true">
<arg value="--force"/>
<arg value="--sign"/>
<arg value="${env.APPLE_DEVELOPER_IDENTITY}"/>
<arg value="--timestamp"/>
<arg value="--options"/>
<arg value="runtime"/>
<arg value="--entitlements"/>
<arg value="${project.basedir}/deploy/mac/entitlements.plist"/>
<arg value="--all-architectures"/>
<arg value="--strict"/>
<arg value="--verbose"/>
<arg value="${project.build.directory}/jar-contents/com/oracle/appbundler/JavaAppLauncher"/>
</exec>
<!-- Update the jar with signed launcher -->
<jar destfile="${project.build.directory}/diylc.jar" update="true">
<fileset dir="${project.build.directory}/jar-contents"/>
</jar>
</target>
</configuration>
</execution>
<!-- Create macOS app bundle -->
<execution>
<id>create-mac-bundle</id>
@@ -1011,7 +1031,7 @@
<arch name="arm64"/>
<arch name="arm64e"/>
<classpath file="${project.build.directory}/diylc.jar" />
<option value="-Xms512m" />
<option value="-Xms1024m" />
<option value="-Xmx4096m" />
<option value="--add-exports=java.desktop/com.apple.eawt.event=ALL-UNNAMED" />
<option value="--add-exports=java.desktop/com.apple.eio=ALL-UNNAMED" />
@@ -1031,13 +1051,6 @@
<option value="-Xdock:name=DIY Layout Creator"/>
<option value="-Xdock:icon=Contents/Resources/diylc.icns"/>
</bundleapp>
<!-- First remove existing signatures -->
<echo message="Removing any existing signatures..."/>
<exec executable="codesign" failonerror="false">
<arg value="--remove-signature"/>
<arg value="${project.build.directory}/DIYLC.app"/>
</exec>
<echo message="Creating unsigned zip for distribution..."/>
<!-- Create unsigned zip for distribution -->
@@ -1047,6 +1060,13 @@
</zip>
<echo message="Unsigned zip created at: ${project.build.directory}/diylc-${project.version}-osx-arm-unsigned.zip"/>
<!-- First remove existing signatures -->
<echo message="Removing any existing signatures..."/>
<exec executable="codesign" failonerror="false">
<arg value="--remove-signature"/>
<arg value="${project.build.directory}/DIYLC.app"/>
</exec>
<!-- Sign the entire app bundle in one shot -->
<echo message="Signing complete app bundle..."/>
<exec executable="codesign" failonerror="true">
@@ -28,7 +28,7 @@ public class CopyAction extends AbstractAction {
this.clipboardOwner = clipboardOwner;
putValue(AbstractAction.NAME, "Copy");
putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_C,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx()));
putValue(AbstractAction.SMALL_ICON, IconLoader.Copy.getIcon());
}
@@ -28,7 +28,7 @@ public class CutAction extends AbstractAction {
this.clipboardOwner = clipboardOwner;
putValue(AbstractAction.NAME, "Cut");
putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_X,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx()));
putValue(AbstractAction.SMALL_ICON, IconLoader.Cut.getIcon());
}
@@ -40,4 +40,4 @@ public class CutAction extends AbstractAction {
clipboardOwner);
plugInPort.deleteSelectedComponents();
}
}
}
@@ -21,7 +21,7 @@ public class DuplicateAction extends AbstractAction {
this.plugInPort = plugInPort;
putValue(AbstractAction.NAME, "Duplicate");
putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_D,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx()));
putValue(AbstractAction.SMALL_ICON, IconLoader.DocumentsGear.getIcon());
}
@@ -34,4 +34,4 @@ public class DuplicateAction extends AbstractAction {
ActionFactory.LOG.error("Coule not duplicate.", ex);
}
}
}
}
@@ -23,7 +23,7 @@ public class EditSelectionAction extends AbstractAction {
this.plugInPort = plugInPort;
putValue(AbstractAction.NAME, "Edit Selection");
putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_E,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx()));
putValue(AbstractAction.SMALL_ICON, IconLoader.EditComponent.getIcon());
}
@@ -21,7 +21,7 @@ public class GroupAction extends AbstractAction {
this.plugInPort = plugInPort;
putValue(AbstractAction.NAME, "Group Selection");
putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_G,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx()));
putValue(AbstractAction.SMALL_ICON, IconLoader.Group.getIcon());
}
@@ -30,4 +30,4 @@ public class GroupAction extends AbstractAction {
ActionFactory.LOG.info("Group Selection triggered");
plugInPort.groupSelectedComponents();
}
}
}
@@ -32,7 +32,7 @@ public class NudgeAction extends AbstractAction {
putValue(AbstractAction.NAME, "Nudge");
putValue(AbstractAction.SMALL_ICON, IconLoader.FitToSize.getIcon());
putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_Q,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx()));
}
@Override
@@ -56,4 +56,4 @@ public class NudgeAction extends AbstractAction {
plugInPort.nudgeSelection(n.getxOffset(), n.getyOffset(), n.getAffectStuckComponents());
}
}
}
}
@@ -27,7 +27,7 @@ public class PasteAction extends AbstractAction {
this.clipboard = clipboard;
putValue(AbstractAction.NAME, "Paste");
putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_V,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx()));
putValue(AbstractAction.SMALL_ICON, IconLoader.Paste.getIcon());
}
@@ -43,4 +43,4 @@ public class PasteAction extends AbstractAction {
ActionFactory.LOG.error("Coule not paste.", ex);
}
}
}
}
@@ -21,7 +21,7 @@ public class SelectAllAction extends AbstractAction {
this.plugInPort = plugInPort;
putValue(AbstractAction.NAME, "Select All");
putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_A,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx()));
putValue(AbstractAction.SMALL_ICON, IconLoader.Selection.getIcon());
}
@@ -30,4 +30,4 @@ public class SelectAllAction extends AbstractAction {
ActionFactory.LOG.info("Select All triggered");
plugInPort.selectAll(0);
}
}
}
@@ -21,7 +21,7 @@ public class UngroupAction extends AbstractAction {
this.plugInPort = plugInPort;
putValue(AbstractAction.NAME, "Ungroup Selection");
putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_U,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx()));
putValue(AbstractAction.SMALL_ICON, IconLoader.Ungroup.getIcon());
}
@@ -66,7 +66,7 @@ public class ImportAction extends AbstractAction {
}, InMemoryConfigurationManager.getInstance());
putValue(AbstractAction.NAME, "Import");
putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_I,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx()));
putValue(AbstractAction.SMALL_ICON, IconLoader.ElementInto.getIcon());
}
@@ -107,4 +107,4 @@ public class ImportAction extends AbstractAction {
}, true);
}
}
}
}
@@ -28,7 +28,7 @@ public class NewAction extends AbstractAction {
this.plugInPort = plugInPort;
putValue(AbstractAction.NAME, "New");
putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_N,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx()));
putValue(AbstractAction.SMALL_ICON, IconLoader.DocumentPlain.getIcon());
}
@@ -54,4 +54,4 @@ public class NewAction extends AbstractAction {
}
}
}
}
}
@@ -28,7 +28,7 @@ public class OpenAction extends AbstractAction {
this.swingUI = swingUI;
putValue(AbstractAction.NAME, "Open");
putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_O,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx()));
putValue(AbstractAction.SMALL_ICON, IconLoader.FolderOut.getIcon());
}
@@ -28,7 +28,7 @@ public class SaveAction extends AbstractAction {
this.swingUI = swingUI;
putValue(AbstractAction.NAME, "Save");
putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_S,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx()));
putValue(AbstractAction.SMALL_ICON, IconLoader.DiskBlue.getIcon());
}
@@ -79,4 +79,4 @@ public class SaveAction extends AbstractAction {
}, true);
}
}
}
}
@@ -29,7 +29,7 @@ public class SaveAsAction extends AbstractAction {
this.swingUI = swingUI;
putValue(AbstractAction.NAME, "Save As");
putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_S,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() | ActionEvent.SHIFT_MASK));
Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx() | ActionEvent.SHIFT_MASK));
putValue(AbstractAction.SMALL_ICON, IconLoader.DiskBlue.getIcon());
}
@@ -63,4 +63,4 @@ public class SaveAsAction extends AbstractAction {
}, true);
}
}
}
}
@@ -22,6 +22,7 @@ import java.io.FileInputStream;
import java.io.InputStream;
import java.util.EnumSet;
import java.util.List;
import java.util.Map;
import javax.swing.Icon;
import org.apache.log4j.Logger;
import org.diylc.appframework.miscutils.ConfigurationManager;
@@ -174,23 +175,24 @@ public class ConfigPlugin implements IPlugIn {
ActionFactory.getInstance()
.createConfigAction(plugInPort, "Sticky Points", IPlugInPort.STICKY_POINTS_KEY, true), CONFIG_MENU);
List<File> themeFiles = ResourceUtils.getResourceFiles(THEMES_DIR);
if (!themeFiles.isEmpty()) {
Map<String, String> themeContents = ResourceUtils.getResourceContents(THEMES_DIR);
if (!themeContents.isEmpty()) {
XStream xStream = new XStream(new DomDriver());
xStream.addPermission(AnyTypePermission.ANY);
swingUI.injectSubmenu(THEME_MENU, IconLoader.Pens.getIcon(), CONFIG_MENU);
for (File file : themeFiles) {
if (file.getName().toLowerCase().endsWith(".xml")) {
try {
InputStream in = new FileInputStream(file);
Theme theme = (Theme) xStream.fromXML(in);
LOG.debug("Found theme: " + theme.getName());
swingUI.injectMenuAction(ActionFactory.getInstance().createThemeAction(plugInPort, theme), THEME_MENU);
} catch (Exception e) {
LOG.error("Could not load theme file " + file.getName(), e);
}
}
}
themeContents.entrySet().stream()
.sorted(Map.Entry.comparingByKey())
.forEach(entry -> {
if (entry.getKey().toLowerCase().endsWith(".xml")) {
try {
Theme theme = (Theme) xStream.fromXML(entry.getValue());
LOG.debug("Found theme: " + theme.getName());
swingUI.injectMenuAction(ActionFactory.getInstance().createThemeAction(plugInPort, theme), THEME_MENU);
} catch (Exception e) {
LOG.error("Could not load theme file " + entry.getKey(), e);
}
}
});
}
swingUI.injectSubmenu(COMPONENT_BROWSER_MENU, IconLoader.Hammer.getIcon(), CONFIG_MENU);
@@ -90,8 +90,7 @@ public class ExplorerPlugin implements IPlugIn {
@Override
public boolean dispatchKeyEvent(KeyEvent e) {
if ((canvasPanel.hasFocus() || explorerPane.hasFocus())
&& e.getKeyChar() == 'x'
if (e.getKeyChar() == 'x' && e.getModifiersEx() == 0
&& ConfigurationManager.getInstance()
.readBoolean(ConfigPlugin.PROJECT_EXPLORER, true)) {
explorerPane.getSearchField().requestFocusInWindow();
@@ -86,7 +86,7 @@ public class FileMenuPlugin implements IPlugIn, IDynamicSubmenuHandler {
swingUI.injectMenuAction(
actionFactory.createExportGerberAction(plugInPort, swingUI), EXPORT_TITLE);
swingUI.injectMenuAction(actionFactory.createPrintAction(drawingProvider, swingUI,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), FILE_TITLE);
Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx()), FILE_TITLE);
swingUI.injectSubmenu(TRACE_MASK_TITLE, IconLoader.TraceMask.getIcon(), FILE_TITLE);
swingUI.injectMenuAction(actionFactory.createExportPDFAction(plugInPort,
traceMaskDrawingProvider, swingUI, " (mask)"), TRACE_MASK_TITLE);
@@ -94,7 +94,7 @@ public class FileMenuPlugin implements IPlugIn, IDynamicSubmenuHandler {
traceMaskDrawingProvider, swingUI, " (mask)"), TRACE_MASK_TITLE);
swingUI.injectMenuAction(
actionFactory.createPrintAction(traceMaskDrawingProvider, swingUI,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() | KeyEvent.SHIFT_DOWN_MASK),
Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx() | KeyEvent.SHIFT_DOWN_MASK),
TRACE_MASK_TITLE);
swingUI.injectSubmenu(ANALYZE_TITLE, IconLoader.Scientist.getIcon(), FILE_TITLE);
@@ -79,7 +79,7 @@ public class LayersMenuPlugin implements IPlugIn {
};
visibleAction.putValue(IView.CHECK_BOX_MENU_ITEM, true);
visibleAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_0 + zOrder,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx()));
visibleActionMap.put(layer, visibleAction);
AbstractAction selectAllAction = new AbstractAction("Select All") {