* flatpak file updated

* add sha generator

* fix mail

* remove mail

* Mini Toggle Switch - lugs do not get rotated when changing orientation;
rotate from the context menu doesn't work

* Added 'SVG Image' component

* Fixed the issue with Perf Board, Vero Board and TriPad Board sometimes
rendering an extra row with pads when there's no space for them

* release 4.18

* Keep grouped components together when pasting

* Added 'Dial Scale' component for designing device face-plates

* dial scale updates

* dial scale tweaks

* release

* release

* release

* release
This commit is contained in:
Bane Stojkovic
2021-08-21 23:19:57 +02:00
committed by GitHub
parent 878d048040
commit 06cb3913ae
15 changed files with 461 additions and 48 deletions
+1 -1
View File
@@ -10,7 +10,7 @@
<property name="jar.dir" value="${build.dir}/jar" />
<property name="report.dir" value="${build.dir}/junitreport" />
<property name="main.class" value="org.diylc.DIYLCStarter" />
<property name="diylc.version" value="4.18.0" />
<property name="diylc.version" value="4.19.0" />
<property name="osx.jre8.path" value="jre\osx\jdk8u275-b01-jre\Contents\Home\" />
Binary file not shown.
Binary file not shown.
@@ -31,7 +31,6 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
@@ -52,6 +51,8 @@ import org.apache.log4j.Logger;
import org.diylc.appframework.miscutils.ConfigurationManager;
import org.diylc.appframework.miscutils.IConfigListener;
import org.diylc.appframework.miscutils.InMemoryConfigurationManager;
import org.diylc.clipboard.ComponentTransferable;
import org.diylc.clipboard.ComponentTransferableFactory;
import org.diylc.common.BuildingBlockPackage;
import org.diylc.common.ComponentType;
import org.diylc.common.IComponentTransformer;
@@ -84,7 +85,6 @@ import org.diylc.swing.gui.DialogFactory;
import org.diylc.swing.gui.editor.PropertyEditorDialog;
import org.diylc.swing.images.IconLoader;
import org.diylc.swing.plugins.config.ConfigPlugin;
import org.diylc.swing.plugins.edit.ComponentTransferable;
import org.diylc.swing.plugins.edit.FindDialog;
import org.diylc.swing.plugins.file.BomDialog;
import org.diylc.swing.plugins.file.FileFilterEnum;
@@ -463,7 +463,8 @@ public class ActionFactory {
presenter.loadProjectFromFile(file.getAbsolutePath());
// Grab all components and paste them into the main
// presenter
plugInPort.pasteComponents(presenter.getCurrentProject().getComponents(), false, false);
plugInPort.pasteComponents(ComponentTransferableFactory.getInstance()
.build(presenter.getCurrentProject().getComponents(), presenter.getCurrentProject().getGroups()), false, false);
// Cleanup components in the temp presenter, don't need
// them anymore
presenter.selectAll(0);
@@ -565,7 +566,7 @@ public class ActionFactory {
List<IDIYComponent<?>> components = parser.generateComponents(parsedComponents, outputWarnings);
if (!outputWarnings.isEmpty())
LOG.warn("Component creation produced warnings:\n" + String.join("\n", outputWarnings));
plugInPort.pasteComponents(components, false, false);
plugInPort.pasteComponents(new ComponentTransferable(components), false, false);
}
} catch (Exception e) {
swingUI.showMessage("Could not import netlist file: " + e.getMessage(), "Error",
@@ -1245,7 +1246,7 @@ public class ActionFactory {
public void actionPerformed(ActionEvent e) {
LOG.info("Cut triggered");
clipboard.setContents(
new ComponentTransferable(cloneComponents(plugInPort.getSelectedComponents())),
ComponentTransferableFactory.getInstance().build(plugInPort.getSelectedComponents(), plugInPort.getCurrentProject().getGroups()),
clipboardOwner);
plugInPort.deleteSelectedComponents();
}
@@ -1268,14 +1269,13 @@ public class ActionFactory {
putValue(AbstractAction.SMALL_ICON, IconLoader.Paste.getIcon());
}
@SuppressWarnings("unchecked")
@Override
public void actionPerformed(ActionEvent e) {
LOG.info("Paste triggered");
try {
List<IDIYComponent<?>> components =
(List<IDIYComponent<?>>) clipboard.getData(ComponentTransferable.listFlavor);
plugInPort.pasteComponents(cloneComponents(components), false,
ComponentTransferable componentTransferable =
(ComponentTransferable) clipboard.getData(ComponentTransferable.listFlavor);
plugInPort.pasteComponents(componentTransferable, false,
ConfigurationManager.getInstance().readBoolean(Presenter.RENUMBER_ON_PASTE_KEY, true));
} catch (Exception ex) {
LOG.error("Coule not paste.", ex);
@@ -1306,7 +1306,7 @@ public class ActionFactory {
public void actionPerformed(ActionEvent e) {
LOG.info("Copy triggered");
clipboard.setContents(
new ComponentTransferable(cloneComponents(plugInPort.getSelectedComponents())),
ComponentTransferableFactory.getInstance().build(plugInPort.getSelectedComponents(), plugInPort.getCurrentProject().getGroups()),
clipboardOwner);
}
}
@@ -1338,18 +1338,6 @@ public class ActionFactory {
}
}
private static List<IDIYComponent<?>> cloneComponents(Collection<IDIYComponent<?>> components) {
List<IDIYComponent<?>> result = new ArrayList<IDIYComponent<?>>(components.size());
for (IDIYComponent<?> component : components) {
try {
result.add(component.clone());
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
}
return result;
}
public static class SelectAllAction extends AbstractAction {
private static final long serialVersionUID = 1L;
@@ -53,6 +53,7 @@ import org.apache.log4j.Logger;
import org.diylc.appframework.miscutils.IConfigListener;
import org.diylc.appframework.miscutils.IConfigurationManager;
import org.diylc.appframework.miscutils.Utils;
import org.diylc.clipboard.ComponentTransferable;
import org.diylc.common.BadPositionException;
import org.diylc.common.EventType;
import org.diylc.common.IComponentTransformer;
@@ -68,7 +69,6 @@ import org.diylc.swing.ISwingUI;
import org.diylc.swing.gui.TranslatedMenu;
import org.diylc.swing.gui.TranslatedPopupMenu;
import org.diylc.swing.images.IconLoader;
import org.diylc.swing.plugins.edit.ComponentTransferable;
import org.diylc.swing.plugins.file.ProjectDrawingProvider;
import org.diylc.swingframework.ruler.IRulerListener;
import org.diylc.swingframework.ruler.Ruler.InchSubdivision;
@@ -1,71 +0,0 @@
/*
DIY Layout Creator (DIYLC).
Copyright (c) 2009-2018 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.swing.plugins.edit;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.diylc.core.IDIYComponent;
/**
* Represents component selection as a {@link List} of {@link IDIYComponent} objects. Implements
* {@link Transferable}, so it is suitable for clipboard usage.
*
* @author Branislav Stojkovic
*/
public class ComponentTransferable extends ArrayList<IDIYComponent<?>> implements Transferable {
private static final long serialVersionUID = 1L;
public static final DataFlavor listFlavor = new DataFlavor(ComponentTransferable.class, "application/diylc");
public ComponentTransferable() {
super();
}
public ComponentTransferable(Collection<IDIYComponent<?>> selectedComponents) {
super(selectedComponents);
}
@Override
public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException {
if (flavor.equals(listFlavor)) {
return this;
}
throw new UnsupportedFlavorException(flavor);
}
@Override
public DataFlavor[] getTransferDataFlavors() {
return new DataFlavor[] {listFlavor};
}
@Override
public boolean isDataFlavorSupported(DataFlavor flavor) {
return flavor.equals(listFlavor);
}
}
@@ -31,6 +31,7 @@ import java.util.EnumSet;
import org.diylc.appframework.undo.IUndoListener;
import org.diylc.appframework.undo.UndoHandler;
import org.diylc.clipboard.ComponentTransferable;
import org.diylc.common.EventType;
import org.diylc.common.IComponentTransformer;
import org.diylc.common.IPlugIn;