Compare commits

..

1 Commits

Author SHA1 Message Date
Bane Stojkovic af83a69ee0 initial 2025-05-17 21:29:52 +02:00
575 changed files with 4608 additions and 12790 deletions
-7
View File
@@ -147,10 +147,3 @@ buildNumber.properties
# Avoid ignoring Maven wrapper jar file (.jar files are usually ignored) # Avoid ignoring Maven wrapper jar file (.jar files are usually ignored)
!/.mvn/wrapper/maven-wrapper.jar !/.mvn/wrapper/maven-wrapper.jar
######################
###### Custom ######
######################
# Deployment folder
deploy/
+1 -1
View File
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
-123
View File
@@ -1,123 +0,0 @@
#!/bin/bash
# Script to build all Maven profiles and copy zip files to deployment folder
# Usage: ./build-all-profiles.sh [to-deploy-folder]
set -e # Exit on error
# Parse arguments
DEPLOY_DIR="${1:-}"
# Configuration
PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SWING_MODULE_DIR="${PROJECT_DIR}/diylc-swing"
DEPLOY_DIR="${DEPLOY_DIR:-${PROJECT_DIR}/deploy}"
# List of profiles to build
PROFILES=(
"universal-zip"
"linux-appimage"
"win64-zip"
"win64-installer"
"mac-x86"
"mac-arm"
)
echo "=========================================="
echo "Building all Maven profiles"
echo "=========================================="
echo "Project directory: ${PROJECT_DIR}"
echo "Swing module directory: ${SWING_MODULE_DIR}"
echo "Deployment directory: ${DEPLOY_DIR}"
echo "Tests: Skipped"
echo ""
# Create deployment directory if it doesn't exist
mkdir -p "${DEPLOY_DIR}"
# Change to project root directory
cd "${PROJECT_DIR}"
# Build each profile (clean before each one)
TARGET_DIR="${SWING_MODULE_DIR}/target"
TOTAL_ZIP_COUNT=0
for profile in "${PROFILES[@]}"; do
echo "----------------------------------------"
echo "Building profile: ${profile}"
echo "----------------------------------------"
# Clean and build from root, specifying the swing module and profile
# This ensures dependencies (diylc-core, diylc-library) are built first
mvn clean package -pl diylc-swing -am -P"${profile}" -DskipTests || {
echo "ERROR: Failed to build profile ${profile}"
echo "Continuing with next profile..."
continue
}
echo "✓ Profile ${profile} built successfully"
# Copy zip and exe files immediately after each build (before next clean)
if [ -d "${TARGET_DIR}" ]; then
echo "Looking for artifacts in ${TARGET_DIR}..."
PROFILE_FILE_COUNT=0
# Find all zip files in target directory (excluding DIYLC-notarize.zip)
while IFS= read -r -d '' zipfile; do
filename=$(basename "${zipfile}")
# Skip DIYLC-notarize.zip files
if [[ "${filename}" != "DIYLC-notarize.zip" ]] && [ -f "${zipfile}" ]; then
dest="${DEPLOY_DIR}/${filename}"
echo " → Copying: ${filename}"
cp "${zipfile}" "${dest}"
TOTAL_ZIP_COUNT=$((TOTAL_ZIP_COUNT + 1))
PROFILE_FILE_COUNT=$((PROFILE_FILE_COUNT + 1))
fi
done < <(find "${TARGET_DIR}" -maxdepth 1 -type f -name "*.zip" -print0 2>/dev/null)
# Find all exe files in target directory
while IFS= read -r -d '' exefile; do
if [ -f "${exefile}" ]; then
filename=$(basename "${exefile}")
dest="${DEPLOY_DIR}/${filename}"
echo " → Copying: ${filename}"
cp "${exefile}" "${dest}"
TOTAL_ZIP_COUNT=$((TOTAL_ZIP_COUNT + 1))
PROFILE_FILE_COUNT=$((PROFILE_FILE_COUNT + 1))
fi
done < <(find "${TARGET_DIR}" -maxdepth 1 -type f -name "*.exe" -print0 2>/dev/null)
if [ ${PROFILE_FILE_COUNT} -eq 0 ]; then
echo " ⚠ Warning: No artifacts found for profile ${profile}"
# List what's actually in the target directory for debugging
echo " Debug: Files in target directory:"
ls -la "${TARGET_DIR}"/*.{zip,exe} 2>/dev/null | head -5 || echo " (no zip/exe files found)"
else
echo " ✓ Copied ${PROFILE_FILE_COUNT} file(s) from ${profile}"
fi
else
echo " ⚠ Warning: Target directory ${TARGET_DIR} does not exist"
fi
echo ""
done
echo "=========================================="
echo "Copying summary"
echo "=========================================="
if [ ${TOTAL_ZIP_COUNT} -eq 0 ]; then
echo "No artifacts were copied"
else
echo "✓ Copied ${TOTAL_ZIP_COUNT} file(s) total to ${DEPLOY_DIR}"
fi
echo ""
echo "=========================================="
echo "Build and deployment complete!"
echo "=========================================="
echo "Deployment folder: ${DEPLOY_DIR}"
echo "Files:"
ls -lh "${DEPLOY_DIR}"/*.{zip,exe} 2>/dev/null || echo " (no zip/exe files found)"
+1 -1
View File
@@ -7,7 +7,7 @@
<parent> <parent>
<groupId>org.diylc</groupId> <groupId>org.diylc</groupId>
<artifactId>diylc-parent</artifactId> <artifactId>diylc-parent</artifactId>
<version>5.10.0</version> <version>5.4.0</version>
</parent> </parent>
<artifactId>diylc-core</artifactId> <artifactId>diylc-core</artifactId>
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -29,7 +29,6 @@ import java.io.Serializable;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import org.diylc.core.ComponentGroup;
import org.diylc.core.IDIYComponent; import org.diylc.core.IDIYComponent;
/** /**
@@ -45,21 +44,19 @@ public class ComponentTransferable implements Transferable, Serializable {
public static final DataFlavor listFlavor = new DataFlavor(ComponentTransferable.class, "application/diylc"); public static final DataFlavor listFlavor = new DataFlavor(ComponentTransferable.class, "application/diylc");
private List<IDIYComponent<?>> components; private List<IDIYComponent<?>> components;
private Set<ComponentGroup> groups; private Set<Set<IDIYComponent<?>>> groups;
private String name;
public ComponentTransferable() { public ComponentTransferable() {
super(); super();
} }
public ComponentTransferable(List<IDIYComponent<?>> components, String name) { public ComponentTransferable(List<IDIYComponent<?>> components) {
super(); super();
this.components = components; this.components = components;
this.name = name;
this.groups = null; this.groups = null;
} }
public ComponentTransferable(List<IDIYComponent<?>> components, Set<ComponentGroup> groups) { public ComponentTransferable(List<IDIYComponent<?>> components, Set<Set<IDIYComponent<?>>> groups) {
super(); super();
this.components = components; this.components = components;
this.groups = groups; this.groups = groups;
@@ -87,11 +84,7 @@ public class ComponentTransferable implements Transferable, Serializable {
return components; return components;
} }
public Set<ComponentGroup> getGroups() { public Set<Set<IDIYComponent<?>>> getGroups() {
return groups; return groups;
} }
public String getName() {
return name;
}
} }
@@ -1,6 +1,6 @@
/* /*
* *
* DIY Layout Creator (DIYLC). Copyright (c) 2009-2025 held jointly by the individual authors. * DIY Layout Creator (DIYLC). Copyright (c) 2009-2018 held jointly by the individual authors.
* *
* This file is part of DIYLC. * This file is part of DIYLC.
* *
@@ -17,11 +17,15 @@
*/ */
package org.diylc.clipboard; package org.diylc.clipboard;
import java.util.*; import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.diylc.core.ComponentGroup;
import org.diylc.core.IDIYComponent; import org.diylc.core.IDIYComponent;
public class ComponentTransferableFactory { public class ComponentTransferableFactory {
@@ -36,19 +40,13 @@ public class ComponentTransferableFactory {
return instance; return instance;
} }
public ComponentTransferable build(Collection<IDIYComponent<?>> selectedComponents, Set<ComponentGroup> groups) { public ComponentTransferable build(Collection<IDIYComponent<?>> selectedComponents, Set<Set<IDIYComponent<?>>> groups) {
Set<IDIYComponent<?>> originalComponentSet = new HashSet<IDIYComponent<?>>(selectedComponents);
List<IDIYComponent<?>> originalComponents = new ArrayList<IDIYComponent<?>>(selectedComponents); List<IDIYComponent<?>> originalComponents = new ArrayList<IDIYComponent<?>>(selectedComponents);
Map<UUID, UUID> idMap = new HashMap<>();
List<IDIYComponent<?>> clonedComponents = originalComponents.stream( List<IDIYComponent<?>> clonedComponents = originalComponents.stream(
).map(x -> { ).map(x -> {
try { try {
IDIYComponent<?> clone = x.clone(); return x.clone();
clone.setId(UUID.randomUUID());
idMap.put(x.getId(), clone.getId());
return clone;
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
LOG.error(e); LOG.error(e);
return null; return null;
@@ -56,18 +54,22 @@ public class ComponentTransferableFactory {
}) })
.filter(Objects::nonNull) .filter(Objects::nonNull)
.collect(Collectors.toList()); .collect(Collectors.toList());
Set<Set<IDIYComponent<?>>> clonedGroups = new HashSet<Set<IDIYComponent<?>>>();
Set<ComponentGroup> clonedGroups = groups.stream()
.map(group -> { for (Set<IDIYComponent<?>> group : groups) {
Set<UUID> newIds = group.getComponentIds().stream() if (group.isEmpty())
.map(idMap::get) continue;
.filter(Objects::nonNull)
.collect(Collectors.toSet()); if (originalComponentSet.contains(group.iterator().next())) {
// Only create group if it has at least one valid ID Set<IDIYComponent<?>> clonedGroup = new HashSet<IDIYComponent<?>>();
return newIds.isEmpty() ? null : new ComponentGroup(newIds, group.getName()); clonedGroups.add(clonedGroup);
}) for (int i = 0; i < originalComponents.size(); i++) {
.filter(Objects::nonNull) if (group.contains(originalComponents.get(i))) {
.collect(Collectors.toSet()); clonedGroup.add(clonedComponents.get(i));
}
}
}
}
return new ComponentTransferable(clonedComponents, clonedGroups); return new ComponentTransferable(clonedComponents, clonedGroups);
} }
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,6 +1,6 @@
/* /*
* *
* DIY Layout Creator (DIYLC). Copyright (c) 2009-2025 held jointly by the individual authors. * DIY Layout Creator (DIYLC). Copyright (c) 2009-2018 held jointly by the individual authors.
* *
* This file is part of DIYLC. * This file is part of DIYLC.
* *
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -68,9 +68,5 @@ public enum DrawOption {
/** /**
* Whether locked components should be rendered as transparent or not. * Whether locked components should be rendered as transparent or not.
*/ */
LOCKED_ALPHA, LOCKED_ALPHA;
/**
* When applied, all colors will be converted to blackest black or whitest white
*/
MONOCHROMATIC;
} }
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -21,6 +21,7 @@
*/ */
package org.diylc.common; package org.diylc.common;
import java.awt.Rectangle;
import java.awt.geom.Point2D; import java.awt.geom.Point2D;
import org.diylc.core.Project; import org.diylc.core.Project;
@@ -54,7 +55,12 @@ public enum EventType {
*/ */
FILE_STATUS_CHANGED, FILE_STATUS_CHANGED,
/** /**
* Called when component selection is changed. New list of components and control point map is attached as a * Called when selection rectangle is changed. Object of type {@link Rectangle} is the only
* parameter and it contains the new selection rectangle.
*/
SELECTION_RECT_CHANGED,
/**
* Called when component selection is changed. New {@link ComponentSelection} is attached as a
* parameter. * parameter.
*/ */
SELECTION_CHANGED, SELECTION_CHANGED,
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -19,7 +19,7 @@
along with DIYLC. If not, see <http://www.gnu.org/licenses/>. along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/ */
package org.diylc.filter; package org.diylc.common;
import org.diylc.core.IDIYComponent; import org.diylc.core.IDIYComponent;
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,52 +0,0 @@
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
DIYLC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.common;
import java.util.Set;
import org.diylc.core.ComponentGroup;
/**
* Interface for component grouping operations.
*
* @author Branislav Stojkovic
*/
public interface IGroupProcessor {
/**
* Returns the set of component groups in the current project. Each group is a set of components
* that are grouped together.
*
* @return set of component groups
*/
Set<ComponentGroup> getComponentGroups();
/**
* Groups all selected components.
*/
void groupSelectedComponents();
/**
* Ungroups all selected components.
*/
void ungroupSelectedComponents();
}
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -41,18 +41,16 @@ import org.diylc.core.IDIYComponent;
import org.diylc.core.Project; import org.diylc.core.Project;
import org.diylc.core.Template; import org.diylc.core.Template;
import org.diylc.core.Theme; import org.diylc.core.Theme;
import org.diylc.core.measures.ResizeDimensions;
import org.diylc.core.measures.Size; import org.diylc.core.measures.Size;
import org.diylc.filter.IComponentFilter;
import org.diylc.test.ITestProcessor; import org.diylc.test.ITestProcessor;
/** /**
* Interface for communication between plug-ins and the application. Plug-ins may acquire * Interface for communication between plug-ins and the application. Plug-ins may acquire
* information or make changes through this interface. Application events are dispatched to plug-ins * information or make changes through this interface. Application events are dispatched to plug-ins
* through {@link MessageDispatcher} * through {@link MessageDispatcher}
* *
* @author Branislav Stojkovic * @author Branislav Stojkovic
* *
* @see IPlugIn * @see IPlugIn
* @see MessageDispatcher * @see MessageDispatcher
* @see IMessageListener * @see IMessageListener
@@ -86,20 +84,18 @@ public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyP
public static final String RENUMBER_ON_PASTE_KEY = "renumberOnPaste"; public static final String RENUMBER_ON_PASTE_KEY = "renumberOnPaste";
public static final String RULER_IN_SUBDIVISION_KEY = "rulerInSubdivision"; public static final String RULER_IN_SUBDIVISION_KEY = "rulerInSubdivision";
public static final String CACHING_ENABLED_KEY = "cachingEnabled"; public static final String CACHING_ENABLED_KEY = "cachingEnabled";
public static final String FONT_SCALE_FACTOR_KEY = "fontScaleFactor";
public static final String SHOW_RESIZE_DIMENSIONS_TOOLTIP_KEY = "showResizeDimensionsTooltip";
public static final String RULER_IN_SUBDIVISION_2 = "base of 2"; public static final String RULER_IN_SUBDIVISION_2 = "base of 2";
public static final String RULER_IN_SUBDIVISION_10 = "base of 10"; public static final String RULER_IN_SUBDIVISION_10 = "base of 10";
public static final String RULER_IN_SUBDIVISION_DEFAULT = RULER_IN_SUBDIVISION_10; public static final String RULER_IN_SUBDIVISION_DEFAULT = RULER_IN_SUBDIVISION_10;
public static final String SNAP_TO_NONE = "None"; public static final String SNAP_TO_NONE = "None";
public static final String SNAP_TO_GRID = "Grid"; public static final String SNAP_TO_GRID = "Grid";
public static final String SNAP_TO_COMPONENTS = "Components"; public static final String SNAP_TO_COMPONENTS = "Components";
public static final String SNAP_TO_DEFAULT = SNAP_TO_GRID; public static final String SNAP_TO_DEFAULT = SNAP_TO_GRID;
public static final String LOCKED_ALPHA = "lockedAlpha"; public static final String LOCKED_ALPHA = "lockedAlpha";
public static final String LANGUAGE = "language"; public static final String LANGUAGE = "language";
public static final String LANGUAGE_DEFAULT = "English"; public static final String LANGUAGE_DEFAULT = "English";
@@ -112,25 +108,25 @@ public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyP
public static final int NOBUTTON = 0; public static final int NOBUTTON = 0;
public static final int BUTTON1 = 1; public static final int BUTTON1 = 1;
public static final int BUTTON2 = 2; public static final int BUTTON2 = 2;
public static final int BUTTON3 = 3; public static final int BUTTON3 = 3;
/** /**
* Returns size of the canvas that takes project dimensions into account as well as zoom level. * Returns size of the canvas that takes project dimensions into account as well as zoom level.
* Each dimension is calculated as the product of the actual size and the number of pixels per * Each dimension is calculated as the product of the actual size and the number of pixels per
* unit. If <code>useZoom</code> is set to true, the result is scaled by zoom factor. * unit. If <code>useZoom</code> is set to true, the result is scaled by zoom factor.
* *
* @param useZoom * @param useZoom
* @param includeExtraSpace * @param includeExtraSpace
* *
* @return canvas dimensions * @return canvas dimensions
*/ */
Dimension getCanvasDimensions(boolean useZoom, boolean includeExtraSpace); Dimension getCanvasDimensions(boolean useZoom, boolean includeExtraSpace);
/** /**
* Returns an instance of {@link Cursor} that should be used at the specified location. * Returns an instance of {@link Cursor} that should be used at the specified location.
* *
* Note: point coordinates are scaled for zoom factor. * Note: point coordinates are scaled for zoom factor.
* *
* @param point * @param point
* @param ctrlDown * @param ctrlDown
* @param shiftDown * @param shiftDown
@@ -141,14 +137,14 @@ public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyP
/** /**
* Returns an instance of currently loaded project. * Returns an instance of currently loaded project.
* *
* @return * @return
*/ */
Project getCurrentProject(); Project getCurrentProject();
/** /**
* Loads specified {@link Project}. * Loads specified {@link Project}.
* *
* @param project * @param project
* @param freshStart * @param freshStart
* @param filename file name when loading from a file * @param filename file name when loading from a file
@@ -162,22 +158,22 @@ public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyP
/** /**
* Loads a project from the specified file. * Loads a project from the specified file.
* *
* @param fileName * @param fileName
*/ */
void loadProjectFromFile(String fileName); void loadProjectFromFile(String fileName);
/** /**
* Saves the current project into the specified file. * Saves the current project into the specified file.
* *
* @param fileName * @param fileName
* @param isBackup * @param isBackup
*/ */
void saveProjectToFile(String fileName, boolean isBackup); void saveProjectToFile(String fileName, boolean isBackup);
/** /**
* Exports the current project into one or more files - one per layer and potentially drill layer. * Exports the current project into one or more files - one per layer and potentially drill layer.
* *
* @param fileNameBase * @param fileNameBase
* @param g2d * @param g2d
*/ */
@@ -195,7 +191,7 @@ public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyP
/** /**
* Shows a user dialog if there are changes to confirm that it's safe to proceed. * Shows a user dialog if there are changes to confirm that it's safe to proceed.
* *
* @return true, if file actions (new, open, close) can be taken * @return true, if file actions (new, open, close) can be taken
*/ */
boolean allowFileAction(); boolean allowFileAction();
@@ -204,7 +200,7 @@ public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyP
* Returns all available {@link ComponentType}s classified by category. Result is a {@link Map} * Returns all available {@link ComponentType}s classified by category. Result is a {@link Map}
* between category name to a {@link List} of all {@link ComponentType}s that share that category * between category name to a {@link List} of all {@link ComponentType}s that share that category
* name. * name.
* *
* @return * @return
*/ */
Map<String, List<ComponentType>> getComponentTypes(); Map<String, List<ComponentType>> getComponentTypes();
@@ -212,7 +208,7 @@ public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyP
/** /**
* Draws project on the provided {@link Graphics2D}. If the provided filter is not null, it will * Draws project on the provided {@link Graphics2D}. If the provided filter is not null, it will
* be used to filter the components that are shown. * be used to filter the components that are shown.
* *
* @param g2d * @param g2d
* @param drawOptions specific drawing options * @param drawOptions specific drawing options
* @param filter * @param filter
@@ -226,35 +222,35 @@ public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyP
/** /**
* Returns current zoom level where <code>zoomLevel = 1.0d</code> means 100%. * Returns current zoom level where <code>zoomLevel = 1.0d</code> means 100%.
* *
* @return current zoom level * @return current zoom level
*/ */
double getZoomLevel(); double getZoomLevel();
/** /**
* Changes current zoom level where <code>zoomLevel = 1.0d</code> means 100% * Changes current zoom level where <code>zoomLevel = 1.0d</code> means 100%
* *
* @param zoomLevel new zoom leve * @param zoomLevel new zoom leve
*/ */
void setZoomLevel(double zoomLevel); void setZoomLevel(double zoomLevel);
/** /**
* Returns current version number. * Returns current version number.
* *
* @return * @return
*/ */
VersionNumber getCurrentVersionNumber(); VersionNumber getCurrentVersionNumber();
/** /**
* Returns few most recent versions. * Returns few most recent versions.
* *
* @return * @return
*/ */
List<Version> getRecentUpdates(); List<Version> getRecentUpdates();
/** /**
* Adds a list of components to the project. * Adds a list of components to the project.
* *
* @param componentTransferable * @param componentTransferable
* @param autoGroup * @param autoGroup
* @param assignNewNames * @param assignNewNames
@@ -273,7 +269,7 @@ public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyP
/** /**
* Sets default value for the specified property name for currently selected component types. * Sets default value for the specified property name for currently selected component types.
* *
* @param propertyName display name for property * @param propertyName display name for property
* @param value new default value, must not be null * @param value new default value, must not be null
*/ */
@@ -281,7 +277,7 @@ public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyP
/** /**
* Sets default value for the specified property name for projects. * Sets default value for the specified property name for projects.
* *
* @param clazz class to set defaults to * @param clazz class to set defaults to
* @param propertyName display name for property * @param propertyName display name for property
* @param value new default value, must not be null * @param value new default value, must not be null
@@ -295,15 +291,6 @@ public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyP
*/ */
List<PropertyWrapper> getMutualSelectionProperties(); List<PropertyWrapper> getMutualSelectionProperties();
/**
* Available only during resizing, returns the dimensions of the component being resized.
* Otherwise returns null.
*
* @return ResizeDimensions with width, height (in mm or in depending on configuration),
* and length (if component implements IHaveLength), or null if not resizing
*/
ResizeDimensions getResizeDimensions();
void editSelection(); void editSelection();
/** /**
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -31,7 +31,7 @@ import org.diylc.core.ExpansionMode;
import org.diylc.core.IDIYComponent; import org.diylc.core.IDIYComponent;
import org.diylc.core.measures.Size; import org.diylc.core.measures.Size;
public interface ISelectionProcessor extends IGroupProcessor { public interface ISelectionProcessor {
/** /**
* Returns the current {@link ComponentTransferable}. * Returns the current {@link ComponentTransferable}.
@@ -89,6 +89,16 @@ public interface ISelectionProcessor extends IGroupProcessor {
*/ */
void rotateSelection(int direction); void rotateSelection(int direction);
/**
* Groups all selected components.
*/
void groupSelectedComponents();
/**
* Ungroups all selected components.
*/
void ungroupSelectedComponents();
/** /**
* Mirrors selected components in the given axis. * Mirrors selected components in the given axis.
* *
@@ -3,7 +3,6 @@ package org.diylc.common;
import org.diylc.appframework.simplemq.MessageDispatcher; import org.diylc.appframework.simplemq.MessageDispatcher;
import org.diylc.plugins.chatbot.service.ChatbotService; import org.diylc.plugins.chatbot.service.ChatbotService;
import org.diylc.plugins.cloud.service.CloudService; import org.diylc.plugins.cloud.service.CloudService;
import org.diylc.plugins.compare.service.CompareService;
import org.diylc.presenter.DrawingManager; import org.diylc.presenter.DrawingManager;
public interface IServiceManager { public interface IServiceManager {
@@ -12,8 +11,6 @@ public interface IServiceManager {
ChatbotService getChatbotService(); ChatbotService getChatbotService();
CompareService getCompareService();
MessageDispatcher<EventType> getMessageDispatcher(); MessageDispatcher<EventType> getMessageDispatcher();
DrawingManager getDrawingManager(); DrawingManager getDrawingManager();
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,6 +1,6 @@
/* /*
* *
* DIY Layout Creator (DIYLC). Copyright (c) 2009-2025 held jointly by the individual authors. * DIY Layout Creator (DIYLC). Copyright (c) 2009-2018 held jointly by the individual authors.
* *
* This file is part of DIYLC. * This file is part of DIYLC.
* *
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -30,7 +30,6 @@ import java.lang.reflect.Array;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Modifier; import java.lang.reflect.Modifier;
import java.util.Arrays; import java.util.Arrays;
import java.util.UUID;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.diylc.core.IDIYComponent; import org.diylc.core.IDIYComponent;
@@ -53,7 +52,6 @@ public abstract class AbstractComponent<T> implements IDIYComponent<T> {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
protected UUID id = UUID.randomUUID();
protected String name = ""; protected String name = "";
public static Color SELECTION_COLOR = Color.red; public static Color SELECTION_COLOR = Color.red;
@@ -64,7 +62,6 @@ public abstract class AbstractComponent<T> implements IDIYComponent<T> {
public static Color LIGHT_METAL_COLOR = Color.decode("#EEEEEE"); public static Color LIGHT_METAL_COLOR = Color.decode("#EEEEEE");
public static Color COPPER_COLOR = Color.decode("#DA8A67"); public static Color COPPER_COLOR = Color.decode("#DA8A67");
public static Color GOLD_COLOR = Color.decode("#F4B301"); public static Color GOLD_COLOR = Color.decode("#F4B301");
public static Color BRASS_COLOR = Color.decode("#B8860B");
public static Color FR4_COLOR = Color.decode("#6B9B6B"); public static Color FR4_COLOR = Color.decode("#6B9B6B");
public static Color FR4_LIGHT_COLOR = Color.decode("#BABE71"); public static Color FR4_LIGHT_COLOR = Color.decode("#BABE71");
public static Color PHENOLIC_COLOR = Color.decode("#F8EBB3"); public static Color PHENOLIC_COLOR = Color.decode("#F8EBB3");
@@ -81,19 +78,6 @@ public abstract class AbstractComponent<T> implements IDIYComponent<T> {
this.name = name; this.name = name;
} }
@Override
public UUID getId() {
if (id == null) {
id = UUID.randomUUID();
}
return id;
}
@Override
public void setId(UUID id) {
this.id = id;
}
@Override @Override
public boolean canControlPointOverlap(int index) { public boolean canControlPointOverlap(int index) {
return false; return false;
@@ -202,10 +186,6 @@ public abstract class AbstractComponent<T> implements IDIYComponent<T> {
field.setAccessible(true); field.setAccessible(true);
Object value = field.get(this); Object value = field.get(this);
if (field.getName().equalsIgnoreCase("id")) {
value = getId();
}
// Deep copy point arrays. // Deep copy point arrays.
// TODO: something nicer // TODO: something nicer
if (value != null && value.getClass().isArray() if (value != null && value.getClass().isArray()
@@ -1,6 +1,6 @@
/* /*
* *
* DIY Layout Creator (DIYLC). Copyright (c) 2009-2025 held jointly by the individual authors. * DIY Layout Creator (DIYLC). Copyright (c) 2009-2018 held jointly by the individual authors.
* *
* This file is part of DIYLC. * This file is part of DIYLC.
* *
@@ -37,14 +37,16 @@ import com.thoughtworks.xstream.annotations.XStreamOmitField;
import org.diylc.common.IPlugInPort; import org.diylc.common.IPlugInPort;
import org.diylc.common.LineStyle; import org.diylc.common.LineStyle;
import org.diylc.common.ObjectCache; import org.diylc.common.ObjectCache;
import org.diylc.core.*; import org.diylc.core.ComponentState;
import org.diylc.core.IDrawingObserver;
import org.diylc.core.Project;
import org.diylc.core.VisibilityPolicy;
import org.diylc.core.annotations.EditableProperty; import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Size; import org.diylc.core.measures.Size;
import org.diylc.core.measures.SizeUnit; import org.diylc.core.measures.SizeUnit;
import org.diylc.utils.Constants; import org.diylc.utils.Constants;
public abstract class AbstractCurvedComponent<T> extends AbstractTransparentComponent<T> implements public abstract class AbstractCurvedComponent<T> extends AbstractTransparentComponent<T> {
IHaveLength {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@@ -335,12 +337,8 @@ public abstract class AbstractCurvedComponent<T> extends AbstractTransparentComp
// } // }
} }
@EditableProperty(name = "Length") @EditableProperty
public Size getLength() { public Size getLength() {
return calculateLength();
}
public Size calculateLength() {
double d = 0; double d = 0;
try { try {
Point2D[] p = getControlPoints(); Point2D[] p = getControlPoints();
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,43 +0,0 @@
package org.diylc.core;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
public class ComponentGroup implements Serializable {
private Set<UUID> componentIds;
private String name;
public ComponentGroup(Set<UUID> componentIds) {
this.componentIds = componentIds;
}
public ComponentGroup(Set<UUID> componentIds, String name) {
this.componentIds = componentIds;
this.name = name;
}
public static ComponentGroup from(Collection<IDIYComponent<?>> components, String name) {
Set<UUID> componentIds = components.stream()
.map(IDIYComponent::getId)
.filter(id -> id != null)
.collect(Collectors.toSet());
return new ComponentGroup(componentIds, name);
}
public Set<UUID> getComponentIds() {
return componentIds;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,6 +1,6 @@
/* /*
* *
* DIY Layout Creator (DIYLC). Copyright (c) 2009-2025 held jointly by the individual authors. * DIY Layout Creator (DIYLC). Copyright (c) 2009-2018 held jointly by the individual authors.
* *
* This file is part of DIYLC. * This file is part of DIYLC.
* *
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -25,7 +25,6 @@ import java.awt.Graphics2D;
import java.awt.geom.Point2D; import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import java.io.Serializable; import java.io.Serializable;
import java.util.UUID;
import org.diylc.core.annotations.ComponentDescriptor; import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty; import org.diylc.core.annotations.EditableProperty;
@@ -56,10 +55,6 @@ public interface IDIYComponent<T> extends Serializable, Cloneable {
public static final int WIRING = 5; public static final int WIRING = 5;
public static final int TEXT = 6; public static final int TEXT = 6;
UUID getId();
void setId(UUID id);
/** /**
* @return component instance name. * @return component instance name.
*/ */
@@ -204,13 +199,4 @@ public interface IDIYComponent<T> extends Serializable, Cloneable {
* @param project * @param project
*/ */
void createdIn(Project project); void createdIn(Project project);
/**
* Returns whether this component is polarized (direction matters for electronic function).
* Default implementation returns true, components that are not polarized should override this.
* @return true if the component is polarized, false otherwise
*/
default boolean isPolarized() {
return true;
}
} }
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,29 +0,0 @@
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors.
This file is part of DIYLC.
DIYLC is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
DIYLC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
*/
package org.diylc.core;
import org.diylc.core.measures.Size;
public interface IHaveLength {
Size calculateLength();
}
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -23,9 +23,13 @@ package org.diylc.core;
import java.awt.Font; import java.awt.Font;
import java.io.Serializable; import java.io.Serializable;
import java.util.*; import java.util.ArrayList;
import java.util.stream.Collectors; import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.diylc.appframework.update.VersionNumber; import org.diylc.appframework.update.VersionNumber;
import org.diylc.core.annotations.EditableProperty; import org.diylc.core.annotations.EditableProperty;
@@ -63,7 +67,6 @@ public class Project implements Serializable, Cloneable {
private Integer dotSpacing; private Integer dotSpacing;
private List<IDIYComponent<?>> components; private List<IDIYComponent<?>> components;
private Set<Set<IDIYComponent<?>>> groups; private Set<Set<IDIYComponent<?>>> groups;
private Set<ComponentGroup> groupsEx;
private Set<Integer> lockedLayers; private Set<Integer> lockedLayers;
private Set<IDIYComponent<?>> lockedComponents; private Set<IDIYComponent<?>> lockedComponents;
private Set<Integer> hiddenLayers; private Set<Integer> hiddenLayers;
@@ -72,7 +75,6 @@ public class Project implements Serializable, Cloneable {
public Project() { public Project() {
components = new ArrayList<IDIYComponent<?>>(); components = new ArrayList<IDIYComponent<?>>();
groups = new HashSet<Set<IDIYComponent<?>>>(); groups = new HashSet<Set<IDIYComponent<?>>>();
groupsEx = new HashSet<>();
lockedLayers = new HashSet<Integer>(); lockedLayers = new HashSet<Integer>();
hiddenLayers = new HashSet<Integer>(); hiddenLayers = new HashSet<Integer>();
lockedComponents = new HashSet<IDIYComponent<?>>(); lockedComponents = new HashSet<IDIYComponent<?>>();
@@ -151,35 +153,22 @@ public class Project implements Serializable, Cloneable {
/** /**
* List of components sorted by z-order ascending. * List of components sorted by z-order ascending.
* s *
* @return * @return
*/ */
public List<IDIYComponent<?>> getComponents() { public List<IDIYComponent<?>> getComponents() {
return components; return components;
} }
public Set<ComponentGroup> getGroupsEx() { /**
if (groupsEx == null) { * Set of grouped components.
groupsEx = new HashSet<>(); *
* @return
if (groups != null && !groups.isEmpty()) { */
for (Set<IDIYComponent<?>> group : groups) { public Set<Set<IDIYComponent<?>>> getGroups() {
Set<IDIYComponent<?>> nonNullIds = return groups;
group.stream().filter(Objects::nonNull).collect(Collectors.toSet());
if (!nonNullIds.isEmpty()) {
ComponentGroup newGroup = ComponentGroup.from(group, null);
groupsEx.add(newGroup);
}
}
groups.clear();
}
}
groupsEx.removeAll(groupsEx.stream().
filter(x -> x.getComponentIds() == null ||
x.getComponentIds().stream().noneMatch(Objects::nonNull)).collect(Collectors.toSet()));
return groupsEx;
} }
public Set<IDIYComponent<?>> getLockedComponents() { public Set<IDIYComponent<?>> getLockedComponents() {
if (lockedComponents == null) if (lockedComponents == null)
lockedComponents = new HashSet<IDIYComponent<?>>(); lockedComponents = new HashSet<IDIYComponent<?>>();
@@ -303,11 +292,6 @@ public class Project implements Serializable, Cloneable {
return false; return false;
} else if (!groups.equals(other.groups)) } else if (!groups.equals(other.groups))
return false; return false;
if (groupsEx == null) {
if (other.groupsEx != null)
return false;
} else if (!groupsEx.equals(other.groupsEx))
return false;
if (lockedLayers == null) { if (lockedLayers == null) {
if (other.lockedLayers != null) if (other.lockedLayers != null)
return false; return false;
@@ -372,15 +356,12 @@ public class Project implements Serializable, Cloneable {
} }
} }
for (ComponentGroup group : this.getGroupsEx()) { for (Set<IDIYComponent<?>> group : this.groups) {
// Filter out null IDs when cloning groups Set<IDIYComponent<?>> cloneGroup = new HashSet<IDIYComponent<?>>();
Set<UUID> validIds = group.getComponentIds().stream() for (IDIYComponent<?> component : group) {
.filter(id -> id != null) cloneGroup.add(cloneMap.get(component));
.collect(Collectors.toSet());
// Only add group if it has valid component IDs
if (!validIds.isEmpty()) {
project.getGroupsEx().add(new ComponentGroup(validIds, group.getName()));
} }
project.groups.add(cloneGroup);
} }
for (IDIYComponent<?> component : this.getLockedComponents()) { for (IDIYComponent<?> component : this.getLockedComponents()) {
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -300,7 +300,7 @@ public class GerberG2DWrapper extends Graphics2D
@Override @Override
public AffineTransform getTransform() { public AffineTransform getTransform() {
return new AffineTransform(tx); return tx;
} }
@Override @Override
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.
@@ -1,7 +1,7 @@
/* /*
DIY Layout Creator (DIYLC). DIY Layout Creator (DIYLC).
Copyright (c) 2009-2025 held jointly by the individual authors. Copyright (c) 2009-2018 held jointly by the individual authors.
This file is part of DIYLC. This file is part of DIYLC.

Some files were not shown because too many files have changed in this diff Show More