mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
auto-edit mode
This commit is contained in:
@@ -1,4 +1,8 @@
|
|||||||
<map>
|
<map>
|
||||||
|
<entry>
|
||||||
|
<string>autoEdit</string>
|
||||||
|
<boolean>true</boolean>
|
||||||
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<string>default.org.diylc.components.passive.TrimmerPotentiometer:Type</string>
|
<string>default.org.diylc.components.passive.TrimmerPotentiometer:Type</string>
|
||||||
<org.diylc.components.passive.TrimmerPotentiometer_-TrimmerType>FLAT_LARGE</org.diylc.components.passive.TrimmerPotentiometer_-TrimmerType>
|
<org.diylc.components.passive.TrimmerPotentiometer_-TrimmerType>FLAT_LARGE</org.diylc.components.passive.TrimmerPotentiometer_-TrimmerType>
|
||||||
|
|||||||
+3
-1
@@ -40,6 +40,7 @@ public interface IPlugInPort {
|
|||||||
public static final String SNAP_TO_GRID_KEY = "snapToGrid";
|
public static final String SNAP_TO_GRID_KEY = "snapToGrid";
|
||||||
public static final String AUTO_PADS_KEY = "autoCreatePads";
|
public static final String AUTO_PADS_KEY = "autoCreatePads";
|
||||||
public static final String CONTINUOUS_CREATION_KEY = "continuousCreation";
|
public static final String CONTINUOUS_CREATION_KEY = "continuousCreation";
|
||||||
|
public static final String AUTO_EDIT_KEY = "autoEdit";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns size of the canvas that takes project dimensions into account as
|
* Returns size of the canvas that takes project dimensions into account as
|
||||||
@@ -163,8 +164,9 @@ public interface IPlugInPort {
|
|||||||
* @param ctrlDown
|
* @param ctrlDown
|
||||||
* @param shiftDown
|
* @param shiftDown
|
||||||
* @param altDown
|
* @param altDown
|
||||||
|
* @param clickCount
|
||||||
*/
|
*/
|
||||||
void mouseClicked(Point point, boolean ctrlDown, boolean shiftDown, boolean altDown);
|
void mouseClicked(Point point, boolean ctrlDown, boolean shiftDown, boolean altDown, int clickCount);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notifies the presenter that mouse is moved.
|
* Notifies the presenter that mouse is moved.
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
package org.diylc.core;
|
package org.diylc.core;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.diylc.common.PropertyWrapper;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base interface for the main GUI component.
|
* Base interface for the main GUI component.
|
||||||
@@ -28,4 +33,6 @@ public interface IView {
|
|||||||
void showMessage(String message, String title, int messageType);
|
void showMessage(String message, String title, int messageType);
|
||||||
|
|
||||||
int showConfirmDialog(String message, String title, int optionType, int messageType);
|
int showConfirmDialog(String message, String title, int optionType, int messageType);
|
||||||
|
|
||||||
|
boolean editProperties(List<PropertyWrapper> properties, Set<PropertyWrapper> defaultedProperties);
|
||||||
}
|
}
|
||||||
|
|||||||
+52
-10
@@ -19,6 +19,8 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.swing.JOptionPane;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.diylc.common.ComponentType;
|
import org.diylc.common.ComponentType;
|
||||||
import org.diylc.common.DrawOption;
|
import org.diylc.common.DrawOption;
|
||||||
@@ -348,10 +350,14 @@ public class Presenter implements IPlugInPort {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseClicked(Point point, boolean ctrlDown, boolean shiftDown, boolean altDown) {
|
public void mouseClicked(Point point, boolean ctrlDown, boolean shiftDown, boolean altDown,
|
||||||
|
int clickCount) {
|
||||||
LOG.debug(String
|
LOG.debug(String
|
||||||
.format("mouseClicked(%s, %s, %s, %s)", point, ctrlDown, shiftDown, altDown));
|
.format("mouseClicked(%s, %s, %s, %s)", point, ctrlDown, shiftDown, altDown));
|
||||||
Point scaledPoint = scalePoint(point);
|
Point scaledPoint = scalePoint(point);
|
||||||
|
if (clickCount >= 2) {
|
||||||
|
editSelection();
|
||||||
|
} else {
|
||||||
if (instantiationManager.getComponentTypeSlot() != null) {
|
if (instantiationManager.getComponentTypeSlot() != null) {
|
||||||
// Keep the reference to component type for later.
|
// Keep the reference to component type for later.
|
||||||
ComponentType componentTypeSlot = instantiationManager.getComponentTypeSlot();
|
ComponentType componentTypeSlot = instantiationManager.getComponentTypeSlot();
|
||||||
@@ -379,6 +385,11 @@ public class Presenter implements IPlugInPort {
|
|||||||
LOG.error("Error instatiating component of type: "
|
LOG.error("Error instatiating component of type: "
|
||||||
+ componentTypeSlot.getInstanceClass().getName(), e);
|
+ componentTypeSlot.getInstanceClass().getName(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ConfigurationManager.getInstance().readBoolean(IPlugInPort.AUTO_EDIT_KEY,
|
||||||
|
false)) {
|
||||||
|
editSelection();
|
||||||
|
}
|
||||||
if (ConfigurationManager.getInstance().readBoolean(
|
if (ConfigurationManager.getInstance().readBoolean(
|
||||||
IPlugInPort.CONTINUOUS_CREATION_KEY, false)) {
|
IPlugInPort.CONTINUOUS_CREATION_KEY, false)) {
|
||||||
setNewComponentTypeSlot(componentTypeSlot);
|
setNewComponentTypeSlot(componentTypeSlot);
|
||||||
@@ -389,23 +400,25 @@ public class Presenter implements IPlugInPort {
|
|||||||
case POINT_BY_POINT:
|
case POINT_BY_POINT:
|
||||||
// First click is just to set the controlPointSlot and
|
// First click is just to set the controlPointSlot and
|
||||||
// componentSlot.
|
// componentSlot.
|
||||||
if (ConfigurationManager.getInstance().readBoolean(IPlugInPort.SNAP_TO_GRID_KEY,
|
if (ConfigurationManager.getInstance().readBoolean(
|
||||||
true)) {
|
IPlugInPort.SNAP_TO_GRID_KEY, true)) {
|
||||||
CalcUtils.snapPointToGrid(scaledPoint, currentProject.getGridSpacing());
|
CalcUtils.snapPointToGrid(scaledPoint, currentProject.getGridSpacing());
|
||||||
}
|
}
|
||||||
if (instantiationManager.getComponentSlot() == null) {
|
if (instantiationManager.getComponentSlot() == null) {
|
||||||
try {
|
try {
|
||||||
instantiationManager.instatiatePointByPoint(scaledPoint, currentProject);
|
instantiationManager
|
||||||
|
.instatiatePointByPoint(scaledPoint, currentProject);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
view.showMessage("Could not create component. Check log for details.",
|
view.showMessage("Could not create component. Check log for details.",
|
||||||
"Error", IView.ERROR_MESSAGE);
|
"Error", IView.ERROR_MESSAGE);
|
||||||
LOG.error("Could not create component", e);
|
LOG.error("Could not create component", e);
|
||||||
}
|
}
|
||||||
messageDispatcher.dispatchMessage(EventType.SLOT_CHANGED, componentTypeSlot,
|
messageDispatcher.dispatchMessage(EventType.SLOT_CHANGED,
|
||||||
instantiationManager.getFirstControlPoint());
|
componentTypeSlot, instantiationManager.getFirstControlPoint());
|
||||||
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
||||||
} else {
|
} else {
|
||||||
// On the second click, add the component to the project.
|
// On the second click, add the component to the
|
||||||
|
// project.
|
||||||
IDIYComponent<?> componentSlot = instantiationManager.getComponentSlot();
|
IDIYComponent<?> componentSlot = instantiationManager.getComponentSlot();
|
||||||
componentSlot.setControlPoint(scaledPoint, 1);
|
componentSlot.setControlPoint(scaledPoint, 1);
|
||||||
addComponent(componentSlot, componentTypeSlot, true);
|
addComponent(componentSlot, componentTypeSlot, true);
|
||||||
@@ -416,6 +429,10 @@ public class Presenter implements IPlugInPort {
|
|||||||
}
|
}
|
||||||
updateSelection(newSelection);
|
updateSelection(newSelection);
|
||||||
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
||||||
|
|
||||||
|
if (ConfigurationManager.getInstance().readBoolean(IPlugInPort.AUTO_EDIT_KEY, false)) {
|
||||||
|
editSelection();
|
||||||
|
}
|
||||||
if (ConfigurationManager.getInstance().readBoolean(
|
if (ConfigurationManager.getInstance().readBoolean(
|
||||||
IPlugInPort.CONTINUOUS_CREATION_KEY, false)) {
|
IPlugInPort.CONTINUOUS_CREATION_KEY, false)) {
|
||||||
setNewComponentTypeSlot(componentTypeSlot);
|
setNewComponentTypeSlot(componentTypeSlot);
|
||||||
@@ -429,8 +446,8 @@ public class Presenter implements IPlugInPort {
|
|||||||
}
|
}
|
||||||
// Notify the listeners.
|
// Notify the listeners.
|
||||||
if (!oldProject.equals(currentProject)) {
|
if (!oldProject.equals(currentProject)) {
|
||||||
messageDispatcher.dispatchMessage(EventType.PROJECT_MODIFIED, oldProject, cloner
|
messageDispatcher.dispatchMessage(EventType.PROJECT_MODIFIED, oldProject,
|
||||||
.deepClone(currentProject), "Add " + componentTypeSlot.getName());
|
cloner.deepClone(currentProject), "Add " + componentTypeSlot.getName());
|
||||||
projectFileManager.notifyFileChange();
|
projectFileManager.notifyFileChange();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -464,6 +481,31 @@ public class Presenter implements IPlugInPort {
|
|||||||
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void editSelection() {
|
||||||
|
List<PropertyWrapper> properties = getMutualSelectionProperties();
|
||||||
|
if (properties != null && !properties.isEmpty()) {
|
||||||
|
Set<PropertyWrapper> defaultedProperties = new HashSet<PropertyWrapper>();
|
||||||
|
boolean edited = view.editProperties(properties, defaultedProperties);
|
||||||
|
if (edited) {
|
||||||
|
try {
|
||||||
|
applyPropertiesToSelection(properties);
|
||||||
|
} catch (Exception e1) {
|
||||||
|
view.showMessage(
|
||||||
|
"Error occured while editing selection. Check the log for details.",
|
||||||
|
"Error", JOptionPane.ERROR_MESSAGE);
|
||||||
|
LOG.error("Error applying properties", e1);
|
||||||
|
}
|
||||||
|
// Save default values.
|
||||||
|
for (PropertyWrapper property : defaultedProperties) {
|
||||||
|
if (property.getValue() != null) {
|
||||||
|
setSelectionDefaultPropertyValue(property.getName(), property.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseMoved(Point point, boolean ctrlDown, boolean shiftDown, boolean altDown) {
|
public void mouseMoved(Point point, boolean ctrlDown, boolean shiftDown, boolean altDown) {
|
||||||
@@ -556,7 +598,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
LOG.debug(String.format("dragStarted(%s)", point));
|
LOG.debug(String.format("dragStarted(%s)", point));
|
||||||
if (instantiationManager.getComponentTypeSlot() != null) {
|
if (instantiationManager.getComponentTypeSlot() != null) {
|
||||||
LOG.debug("Cannot start drag because a new component is being created.");
|
LOG.debug("Cannot start drag because a new component is being created.");
|
||||||
mouseClicked(point, ctrlDown, shiftDown, altDown);
|
mouseClicked(point, ctrlDown, shiftDown, altDown, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dragInProgress = true;
|
dragInProgress = true;
|
||||||
|
|||||||
+15
@@ -11,7 +11,9 @@ import java.awt.event.WindowEvent;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.swing.Action;
|
import javax.swing.Action;
|
||||||
import javax.swing.BoxLayout;
|
import javax.swing.BoxLayout;
|
||||||
@@ -35,10 +37,12 @@ import org.diylc.common.EventType;
|
|||||||
import org.diylc.common.IPlugIn;
|
import org.diylc.common.IPlugIn;
|
||||||
import org.diylc.common.IPlugInPort;
|
import org.diylc.common.IPlugInPort;
|
||||||
import org.diylc.common.ITask;
|
import org.diylc.common.ITask;
|
||||||
|
import org.diylc.common.PropertyWrapper;
|
||||||
import org.diylc.core.IView;
|
import org.diylc.core.IView;
|
||||||
import org.diylc.images.IconLoader;
|
import org.diylc.images.IconLoader;
|
||||||
import org.diylc.presenter.Presenter;
|
import org.diylc.presenter.Presenter;
|
||||||
import org.diylc.swing.ISwingUI;
|
import org.diylc.swing.ISwingUI;
|
||||||
|
import org.diylc.swing.gui.editor.PropertyEditorDialog;
|
||||||
import org.diylc.swing.plugins.canvas.CanvasPlugin;
|
import org.diylc.swing.plugins.canvas.CanvasPlugin;
|
||||||
import org.diylc.swing.plugins.config.ConfigPlugin;
|
import org.diylc.swing.plugins.config.ConfigPlugin;
|
||||||
import org.diylc.swing.plugins.edit.EditMenuPlugin;
|
import org.diylc.swing.plugins.edit.EditMenuPlugin;
|
||||||
@@ -48,6 +52,8 @@ import org.diylc.swing.plugins.layers.LayersMenuPlugin;
|
|||||||
import org.diylc.swing.plugins.statusbar.StatusBar;
|
import org.diylc.swing.plugins.statusbar.StatusBar;
|
||||||
import org.diylc.swing.plugins.toolbox.ToolBox;
|
import org.diylc.swing.plugins.toolbox.ToolBox;
|
||||||
|
|
||||||
|
import com.diyfever.gui.ButtonDialog;
|
||||||
|
|
||||||
public class MainFrame extends JFrame implements ISwingUI {
|
public class MainFrame extends JFrame implements ISwingUI {
|
||||||
|
|
||||||
private static final Logger LOG = Logger.getLogger(MainFrame.class);
|
private static final Logger LOG = Logger.getLogger(MainFrame.class);
|
||||||
@@ -196,6 +202,15 @@ public class MainFrame extends JFrame implements ISwingUI {
|
|||||||
return JOptionPane.showConfirmDialog(this, message, title, optionType, messageType);
|
return JOptionPane.showConfirmDialog(this, message, title, optionType, messageType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean editProperties(List<PropertyWrapper> properties, Set<PropertyWrapper> defaultedProperties) {
|
||||||
|
PropertyEditorDialog editor = DialogFactory.getInstance().createPropertyEditorDialog(
|
||||||
|
properties, "Edit Selection");
|
||||||
|
editor.setVisible(true);
|
||||||
|
defaultedProperties.addAll(editor.getDefaultedProperties());
|
||||||
|
return ButtonDialog.OK.equals(editor.getSelectedButtonCaption());
|
||||||
|
}
|
||||||
|
|
||||||
private JMenu findOrCreateMenu(String menuName) {
|
private JMenu findOrCreateMenu(String menuName) {
|
||||||
JMenu menu;
|
JMenu menu;
|
||||||
if (menuMap.containsKey(menuName)) {
|
if (menuMap.containsKey(menuName)) {
|
||||||
|
|||||||
+7
@@ -15,6 +15,7 @@ import java.io.File;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.swing.BorderFactory;
|
import javax.swing.BorderFactory;
|
||||||
import javax.swing.DefaultListCellRenderer;
|
import javax.swing.DefaultListCellRenderer;
|
||||||
@@ -34,6 +35,7 @@ import javax.swing.event.ListSelectionListener;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.diylc.common.DrawOption;
|
import org.diylc.common.DrawOption;
|
||||||
import org.diylc.common.IPlugInPort;
|
import org.diylc.common.IPlugInPort;
|
||||||
|
import org.diylc.common.PropertyWrapper;
|
||||||
import org.diylc.core.IView;
|
import org.diylc.core.IView;
|
||||||
import org.diylc.presenter.Presenter;
|
import org.diylc.presenter.Presenter;
|
||||||
|
|
||||||
@@ -77,6 +79,11 @@ public class TemplateDialog extends JDialog {
|
|||||||
public void showMessage(String message, String title, int messageType) {
|
public void showMessage(String message, String title, int messageType) {
|
||||||
JOptionPane.showMessageDialog(TemplateDialog.this, message, title, messageType);
|
JOptionPane.showMessageDialog(TemplateDialog.this, message, title, messageType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean editProperties(List<PropertyWrapper> properties, Set<PropertyWrapper> defaultedProperties) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
// this.presenter.installPlugin(new IPlugIn() {
|
// this.presenter.installPlugin(new IPlugIn() {
|
||||||
//
|
//
|
||||||
|
|||||||
+47
-34
@@ -25,11 +25,14 @@ import java.util.List;
|
|||||||
|
|
||||||
import javax.swing.AbstractAction;
|
import javax.swing.AbstractAction;
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
|
import javax.swing.JOptionPane;
|
||||||
import javax.swing.KeyStroke;
|
import javax.swing.KeyStroke;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
import org.diylc.common.DrawOption;
|
import org.diylc.common.DrawOption;
|
||||||
import org.diylc.common.IPlugInPort;
|
import org.diylc.common.IPlugInPort;
|
||||||
import org.diylc.common.PropertyWrapper;
|
import org.diylc.common.PropertyWrapper;
|
||||||
|
import org.diylc.presenter.Presenter;
|
||||||
import org.diylc.swing.gui.DialogFactory;
|
import org.diylc.swing.gui.DialogFactory;
|
||||||
import org.diylc.swing.gui.editor.PropertyEditorDialog;
|
import org.diylc.swing.gui.editor.PropertyEditorDialog;
|
||||||
|
|
||||||
@@ -43,6 +46,8 @@ import com.diyfever.gui.miscutils.ConfigurationManager;
|
|||||||
*/
|
*/
|
||||||
class CanvasPanel extends JComponent implements Autoscroll {
|
class CanvasPanel extends JComponent implements Autoscroll {
|
||||||
|
|
||||||
|
private static final Logger LOG = Logger.getLogger(CanvasPanel.class);
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private IPlugInPort plugInPort;
|
private IPlugInPort plugInPort;
|
||||||
@@ -185,53 +190,61 @@ class CanvasPanel extends JComponent implements Autoscroll {
|
|||||||
@Override
|
@Override
|
||||||
public void mouseClicked(MouseEvent e) {
|
public void mouseClicked(MouseEvent e) {
|
||||||
if (e.getButton() == MouseEvent.BUTTON1) {
|
if (e.getButton() == MouseEvent.BUTTON1) {
|
||||||
if (e.getClickCount() == 2) {
|
// if (e.getClickCount() == 2) {
|
||||||
List<PropertyWrapper> properties = plugInPort
|
// List<PropertyWrapper> properties = plugInPort
|
||||||
.getMutualSelectionProperties();
|
// .getMutualSelectionProperties();
|
||||||
if (properties == null || properties.isEmpty()) {
|
// if (properties == null || properties.isEmpty()) {
|
||||||
// properties = plugInPort.getProjectProperties();
|
// // properties = plugInPort.getProjectProperties();
|
||||||
// PropertyEditorDialog editor =
|
// // PropertyEditorDialog editor =
|
||||||
// DialogFactory.getInstance()
|
// // DialogFactory.getInstance()
|
||||||
|
// // .createPropertyEditorDialog(properties,
|
||||||
|
// // "Edit Project");
|
||||||
|
// // editor.setVisible(true);
|
||||||
|
// // if
|
||||||
|
// //
|
||||||
|
// (ButtonDialog.OK.equals(editor.getSelectedButtonCaption()))
|
||||||
|
// // {
|
||||||
|
// // plugInPort.applyPropertiesToProject(properties);
|
||||||
|
// // // Save default values.
|
||||||
|
// // for (PropertyWrapper property :
|
||||||
|
// // editor.getDefaultedProperties()) {
|
||||||
|
// // if (property.getValue() != null) {
|
||||||
|
// //
|
||||||
|
// plugInPort.setProjectDefaultPropertyValue(property.getName(),
|
||||||
|
// // property.getValue());
|
||||||
|
// // }
|
||||||
|
// // }
|
||||||
|
// // }
|
||||||
|
// } else {
|
||||||
|
// PropertyEditorDialog editor = DialogFactory.getInstance()
|
||||||
// .createPropertyEditorDialog(properties,
|
// .createPropertyEditorDialog(properties,
|
||||||
// "Edit Project");
|
// "Edit Selection");
|
||||||
// editor.setVisible(true);
|
// editor.setVisible(true);
|
||||||
// if
|
// if
|
||||||
// (ButtonDialog.OK.equals(editor.getSelectedButtonCaption()))
|
// (ButtonDialog.OK.equals(editor.getSelectedButtonCaption()))
|
||||||
// {
|
// {
|
||||||
// plugInPort.applyPropertiesToProject(properties);
|
// try {
|
||||||
|
// plugInPort.applyPropertiesToSelection(properties);
|
||||||
|
// } catch (Exception e1) {
|
||||||
|
// JOptionPane.showMessageDialog(CanvasPanel.this,
|
||||||
|
// "Error occured while editing selection. Check the log for details.",
|
||||||
|
// "Error", JOptionPane.ERROR_MESSAGE);
|
||||||
|
// LOG.error("Error applying properties", e1);
|
||||||
|
// }
|
||||||
// // Save default values.
|
// // Save default values.
|
||||||
// for (PropertyWrapper property :
|
// for (PropertyWrapper property :
|
||||||
// editor.getDefaultedProperties()) {
|
// editor.getDefaultedProperties()) {
|
||||||
// if (property.getValue() != null) {
|
// if (property.getValue() != null) {
|
||||||
// plugInPort.setProjectDefaultPropertyValue(property.getName(),
|
// plugInPort.setSelectionDefaultPropertyValue(property
|
||||||
// property.getValue());
|
// .getName(), property.getValue());
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
} else {
|
// }
|
||||||
PropertyEditorDialog editor = DialogFactory.getInstance()
|
// } else {
|
||||||
.createPropertyEditorDialog(properties, "Edit Selection");
|
|
||||||
editor.setVisible(true);
|
|
||||||
if (ButtonDialog.OK.equals(editor.getSelectedButtonCaption())) {
|
|
||||||
try {
|
|
||||||
plugInPort.applyPropertiesToSelection(properties);
|
|
||||||
} catch (Exception e1) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e1.printStackTrace();
|
|
||||||
}
|
|
||||||
// Save default values.
|
|
||||||
for (PropertyWrapper property : editor.getDefaultedProperties()) {
|
|
||||||
if (property.getValue() != null) {
|
|
||||||
plugInPort.setSelectionDefaultPropertyValue(property
|
|
||||||
.getName(), property.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
plugInPort.mouseClicked(e.getPoint(), e.isControlDown(), e.isShiftDown(), e
|
plugInPort.mouseClicked(e.getPoint(), e.isControlDown(), e.isShiftDown(), e
|
||||||
.isAltDown());
|
.isAltDown(), e.getClickCount());
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
+2
@@ -50,6 +50,8 @@ public class ConfigPlugin implements IPlugIn {
|
|||||||
"Snap to Grid", IPlugInPort.SNAP_TO_GRID_KEY, true), CONFIG_MENU);
|
"Snap to Grid", IPlugInPort.SNAP_TO_GRID_KEY, true), CONFIG_MENU);
|
||||||
swingUI.injectMenuAction(ActionFactory.getInstance().createConfigAction(plugInPort,
|
swingUI.injectMenuAction(ActionFactory.getInstance().createConfigAction(plugInPort,
|
||||||
"Auto-Create Pads", IPlugInPort.AUTO_PADS_KEY, false), CONFIG_MENU);
|
"Auto-Create Pads", IPlugInPort.AUTO_PADS_KEY, false), CONFIG_MENU);
|
||||||
|
swingUI.injectMenuAction(ActionFactory.getInstance().createConfigAction(plugInPort,
|
||||||
|
"Auto-Edit Mode", IPlugInPort.AUTO_EDIT_KEY, false), CONFIG_MENU);
|
||||||
swingUI.injectMenuAction(ActionFactory.getInstance().createConfigAction(plugInPort,
|
swingUI.injectMenuAction(ActionFactory.getInstance().createConfigAction(plugInPort,
|
||||||
"Continuous Creation", IPlugInPort.CONTINUOUS_CREATION_KEY, false), CONFIG_MENU);
|
"Continuous Creation", IPlugInPort.CONTINUOUS_CREATION_KEY, false), CONFIG_MENU);
|
||||||
File themeDir = new File("themes");
|
File themeDir = new File("themes");
|
||||||
|
|||||||
+8
@@ -10,6 +10,8 @@ import java.beans.PropertyChangeListener;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
import javax.swing.JFileChooser;
|
import javax.swing.JFileChooser;
|
||||||
@@ -18,6 +20,7 @@ import javax.swing.JPanel;
|
|||||||
|
|
||||||
import org.diylc.common.DrawOption;
|
import org.diylc.common.DrawOption;
|
||||||
import org.diylc.common.IPlugInPort;
|
import org.diylc.common.IPlugInPort;
|
||||||
|
import org.diylc.common.PropertyWrapper;
|
||||||
import org.diylc.core.IView;
|
import org.diylc.core.IView;
|
||||||
import org.diylc.core.Project;
|
import org.diylc.core.Project;
|
||||||
import org.diylc.presenter.Presenter;
|
import org.diylc.presenter.Presenter;
|
||||||
@@ -58,6 +61,11 @@ public class ProjectPreview extends JPanel implements PropertyChangeListener, IF
|
|||||||
@Override
|
@Override
|
||||||
public void showMessage(String message, String title, int messageType) {
|
public void showMessage(String message, String title, int messageType) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean editProperties(List<PropertyWrapper> properties, Set<PropertyWrapper> defaultedProperties) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
xStream = new XStream(new DomDriver());
|
xStream = new XStream(new DomDriver());
|
||||||
|
|
||||||
|
|||||||
@@ -252,6 +252,10 @@
|
|||||||
<changeType>NEW_FEATURE</changeType>
|
<changeType>NEW_FEATURE</changeType>
|
||||||
<description>Auto-create solder pads</description>
|
<description>Auto-create solder pads</description>
|
||||||
</com.diyfever.gui.update.Change>
|
</com.diyfever.gui.update.Change>
|
||||||
|
<com.diyfever.gui.update.Change>
|
||||||
|
<changeType>NEW_FEATURE</changeType>
|
||||||
|
<description>Auto-edit mode</description>
|
||||||
|
</com.diyfever.gui.update.Change>
|
||||||
<com.diyfever.gui.update.Change>
|
<com.diyfever.gui.update.Change>
|
||||||
<changeType>NEW_FEATURE</changeType>
|
<changeType>NEW_FEATURE</changeType>
|
||||||
<description>Continuous component creation</description>
|
<description>Continuous component creation</description>
|
||||||
|
|||||||
Reference in New Issue
Block a user