Compare commits
401 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e2fb415a59 | |||
| 34720db33a | |||
| 146634f75d | |||
| 6f19985c73 | |||
| 0507812178 | |||
| 368ec6a30d | |||
| c1268afb68 | |||
| 1c1703d606 | |||
| 3e18c5e1db | |||
| fbc3c4bfc4 | |||
| 0b8a3d6f9f | |||
| f0a2473763 | |||
| 91f21c1896 | |||
| 9808e672c5 | |||
| 7e310a9a9c | |||
| 4843cc729f | |||
| 335e2a572f | |||
| 12e49ceabf | |||
| f23f396c0a | |||
| 94b92cc0d7 | |||
| 448f87666d | |||
| 8c0cec70de | |||
| 05eba5195e | |||
| e5c54242bc | |||
| f7f669bff3 | |||
| 0a490d148a | |||
| bee14895d7 | |||
| 8def96d03c | |||
| dab4e76f44 | |||
| ac81b30e8e | |||
| 689ddebdb8 | |||
| 2b0d9dd9d3 | |||
| b335f0aabe | |||
| bdfa255439 | |||
| bc3875ecbf | |||
| 59f516df9c | |||
| 0c86f60752 | |||
| 91deb1d7da | |||
| 1714ddb444 | |||
| 35326e7d17 | |||
| b2dc050c32 | |||
| eb58f1786a | |||
| 16ce229b57 | |||
| 93954f60c7 | |||
| dc533368a8 | |||
| e9a54d1fe2 | |||
| cfd7af2793 | |||
| f8310b1fac | |||
| 8a125e8a4f | |||
| b975cc79b1 | |||
| 171ebf4473 | |||
| 5cb9824da4 | |||
| 6ef5ad5854 | |||
| 18edd60763 | |||
| ea1da54202 | |||
| 7497e89afd | |||
| 8ed165766f | |||
| 8c98e9dece | |||
| a082e0be63 | |||
| 6f0df4fdc9 | |||
| d85f496702 | |||
| ef24664eac | |||
| bfb554a930 | |||
| 0ff52979ea | |||
| eb1c4a6688 | |||
| 47d42c5456 | |||
| 297a4f3518 | |||
| d678f6fed1 | |||
| 3583d6e5f5 | |||
| e84e0c10e1 | |||
| b6c1ebd079 | |||
| 42190d3498 | |||
| 00bc6808d8 | |||
| 1e90621545 | |||
| 06b204fc38 | |||
| ac95d45f95 | |||
| 16e3241a94 | |||
| 1760161aa3 | |||
| c57e5f837c | |||
| 024884d85d | |||
| 50562ae901 | |||
| c8d0711889 | |||
| 4338200088 | |||
| 5ea4ed44a4 | |||
| b1a1611a3a | |||
| 9af88002b0 | |||
| a6386dda96 | |||
| 352b3aeb6f | |||
| 5d6b787404 | |||
| 3e36bce7ad | |||
| 5d4cbadf6e | |||
| 6d10c45a18 | |||
| 4c04b72d44 | |||
| dd15702ca6 | |||
| c6bfb5a562 | |||
| bfa71e93d5 | |||
| 1a048d0b7c | |||
| 6039f85631 | |||
| c843d8c28d | |||
| e7b05f109f | |||
| 5d2c4e0fc9 | |||
| ac0da8667c | |||
| cc81fa1a56 | |||
| 954bf200d2 | |||
| 7bf8ff9347 | |||
| 1eba691750 | |||
| c20b17b12e | |||
| b734c87946 | |||
| 5e25f25fc7 | |||
| 80582f61ec | |||
| 9a43597f6f | |||
| 2993900cc6 | |||
| 39efdca0b8 | |||
| 2dcaabf3f2 | |||
| af9798772f | |||
| 4ddcea7bc7 | |||
| 6087b39ccd | |||
| b77120f742 | |||
| 0acae7c28d | |||
| 0cb0e950f7 | |||
| 951dc3861a | |||
| 0483656258 | |||
| 34a0000d3c | |||
| 426eb3c6c2 | |||
| 4c8cae36c1 | |||
| 5cd2ceeac3 | |||
| 979eb7a9cf | |||
| c9d60e4d4f | |||
| 948d8e7b4a | |||
| 2f06f00d2f | |||
| 45841657a0 | |||
| e481fdb986 | |||
| 44c358af2b | |||
| d57ce6dc4a | |||
| e9b81795b7 | |||
| 6c7e149c93 | |||
| db173acf77 | |||
| deae73f6be | |||
| 7ac43b5e1e | |||
| 514b659677 | |||
| 06d642b494 | |||
| 12b46bdfc8 | |||
| e98f61ae6f | |||
| 44cc3f1dd5 | |||
| 6e510c56a2 | |||
| b181a86fa9 | |||
| fbb28d74cd | |||
| bf9bf70761 | |||
| f7a5038912 | |||
| f62df8d58e | |||
| d0f6302038 | |||
| d7198e4705 | |||
| 8ea4ba6aab | |||
| e604a54dd8 | |||
| 85207733d5 | |||
| 3385d04d95 | |||
| ec597d964c | |||
| abf9faa05a | |||
| e2412c223a | |||
| edc4bd4928 | |||
| 90be75db5e | |||
| ee0a503bbb | |||
| eed1d9601c | |||
| ce3d5fc808 | |||
| 09db593d28 | |||
| 25cdfd199a | |||
| 92495b1cf0 | |||
| 039fabc916 | |||
| f7a73f2bcb | |||
| a6731fd284 | |||
| 5db8288b0a | |||
| aea4c434dd | |||
| 35dfe799c0 | |||
| 5087a84dc1 | |||
| bda92b6982 | |||
| 732cb102a3 | |||
| cf7dc0778b | |||
| 75b2afad09 | |||
| e85ffd1483 | |||
| 5abf2ebaa3 | |||
| b0164a1ddd | |||
| 371fee0614 | |||
| 28f56693a9 | |||
| 9ebfad7d05 | |||
| acbd3d8378 | |||
| 4997e5b3bf | |||
| 5e86621f37 | |||
| 84f2da5313 | |||
| f164473d25 | |||
| 8804295df6 | |||
| 8c3c6ea56e | |||
| 7f5f61f5b0 | |||
| 6d79b453de | |||
| 894f070fee | |||
| e115f87f65 | |||
| 6068619c43 | |||
| cb547e40fb | |||
| 502186b1e3 | |||
| a051382e6c | |||
| 4e3451bdf9 | |||
| 9f891d19c2 | |||
| 923107e3ea | |||
| a1d39c047e | |||
| 5b439c1603 | |||
| c3308fa6e9 | |||
| 19e1a3576a | |||
| 532b482fed | |||
| 6c34a4cd8d | |||
| de348acff7 | |||
| ce63423c66 | |||
| 293c3096b0 | |||
| 3db2a06f52 | |||
| 064d83d2c4 | |||
| a1a9171c7c | |||
| b0ce8242be | |||
| c08e52b994 | |||
| b454c017a2 | |||
| 9a6a8cc646 | |||
| 28cbc39b5f | |||
| 1b24c8eb16 | |||
| 80bd386564 | |||
| ddfac76b58 | |||
| bb22ef61ff | |||
| 4b9349fbcb | |||
| 7d13dd647a | |||
| a1a290671d | |||
| 0c99b2b6a6 | |||
| cce34c9d9a | |||
| 1e34913d1a | |||
| f419c1afb9 | |||
| 4b2242336a | |||
| 30ab42a47b | |||
| 34c9648b47 | |||
| 0aea4c6eed | |||
| ff43225f11 | |||
| 585351bb11 | |||
| 58ac3d8148 | |||
| 00a05f6f15 | |||
| a800542a14 | |||
| 65a5775d5d | |||
| 2001015f9e | |||
| cd3b03433f | |||
| 547fb9b44f | |||
| 78d76197cf | |||
| e351d2669d | |||
| 9209782401 | |||
| c406632299 | |||
| 23fc091667 | |||
| 6e6d70fcd3 | |||
| 56fef06b22 | |||
| 4897b803b6 | |||
| 6c698e935e | |||
| 1645eae18d | |||
| 5adbc2c6ca | |||
| e3b1f0d4e6 | |||
| bc88253c70 | |||
| 1d45bf345c | |||
| c61ec71ee1 | |||
| 35272c1339 | |||
| 93e057dfb2 | |||
| aef5c88a3f | |||
| 591bdd313c | |||
| 3f9caf9918 | |||
| 246decdf7c | |||
| 0bc8141dc7 | |||
| 6e8e8b9d49 | |||
| c8ff6afe6e | |||
| 714740da28 | |||
| 45b759fa75 | |||
| 2445f05767 | |||
| 22578a4e3f | |||
| 10a42b7fcf | |||
| 0498eb2c51 | |||
| d384711759 | |||
| 5e0c422c30 | |||
| 73cc182dad | |||
| 7932657fb2 | |||
| 50bacee70a | |||
| 1c0219f4bf | |||
| 4522d9aeb5 | |||
| a25d43b710 | |||
| 18261eab69 | |||
| 3b984d0850 | |||
| d72d898f3f | |||
| 03bc58eb96 | |||
| 17427a0071 | |||
| 39704e3625 | |||
| 6ef7459d46 | |||
| a6448676f7 | |||
| 4cf6f9f4a5 | |||
| 162b67bf25 | |||
| ccc90dd3a6 | |||
| 237639b9a1 | |||
| 37b89fe3a2 | |||
| 860bb0071b | |||
| 56fd800e77 | |||
| 1a95e43f9f | |||
| 9817aa549e | |||
| c38bd87a7d | |||
| 21e46b3835 | |||
| 6a4508b4a9 | |||
| 33d3e03ffb | |||
| 98c3804529 | |||
| 4f88bb988a | |||
| 5a4eeb2de2 | |||
| abf99285cf | |||
| e83a2bd5f8 | |||
| 445a56f563 | |||
| aa434048f3 | |||
| 1b043abfe5 | |||
| b08395ee27 | |||
| a23342f682 | |||
| 93a4978e68 | |||
| 0d845677c4 | |||
| ab10103e41 | |||
| 0d17046170 | |||
| 880e618e30 | |||
| 176abc2428 | |||
| 061bc520c6 | |||
| 9c9d6ecd70 | |||
| d9f5e2e42b | |||
| 0c1659cde0 | |||
| 53feb60b63 | |||
| 8c2700b92c | |||
| 298d575696 | |||
| 931138083f | |||
| f2a814e41c | |||
| d07965a3c0 | |||
| 9e1f5c3ac8 | |||
| 569a50e97a | |||
| 80e7e3a487 | |||
| 5d73617af3 | |||
| 8169e3a6ba | |||
| a7b48f4f52 | |||
| 89bf22bcf8 | |||
| ae99ce2702 | |||
| 61937d6d42 | |||
| e618a1e1ad | |||
| 513a229e64 | |||
| f834aa6d0b | |||
| 35d8b13d41 | |||
| 989e0a03e4 | |||
| c6cb77f4ef | |||
| af1a11e848 | |||
| 4bcff4a574 | |||
| 36f65423e0 | |||
| ef11c931a7 | |||
| 732a9954b7 | |||
| 2b5b904d8d | |||
| 6ca16d07e6 | |||
| 4f113f032d | |||
| e572412f1e | |||
| dd9e9f054c | |||
| 4ee7381959 | |||
| d11a8b906a | |||
| 9fdd96c889 | |||
| d776a3df32 | |||
| ebf06841a0 | |||
| 616b09b4b2 | |||
| dccd91e56b | |||
| 59c543da34 | |||
| 7c933fa0f3 | |||
| 8294caa8ba | |||
| a7637767cd | |||
| 2dccd41f41 | |||
| 2dfec28dc9 | |||
| fe527eece2 | |||
| d459ea898c | |||
| 19cfca3df8 | |||
| 3d3a6e27d2 | |||
| 10884452fd | |||
| 6d4c2a8141 | |||
| 66f4d98ff9 | |||
| a00028131f | |||
| 7f2b973638 | |||
| 144bfb01ad | |||
| 84d0da6308 | |||
| 0df3bc37a0 | |||
| a0b43def22 | |||
| 602c98ead4 | |||
| 4b64917654 | |||
| 030ba71126 | |||
| eb4d08be68 | |||
| b642dc6cbd | |||
| 112bfdd3d0 | |||
| 79f83308d8 | |||
| 5df467a254 | |||
| 7c4d82b28c | |||
| 6b7d1c4277 | |||
| a0ae53d53c | |||
| bd79ef2817 | |||
| 69e2296c23 | |||
| 7d3a7c30ca | |||
| bea19f326c | |||
| ba694add0c | |||
| f137a398dc | |||
| 15ac8ff2e9 | |||
| 1213dcaeac | |||
| 2ebcd1fe96 | |||
| 943d123ca9 | |||
| 79c29dc349 |
@@ -0,0 +1 @@
|
||||
/bin/
|
||||
@@ -5,7 +5,7 @@
|
||||
</entry>
|
||||
<entry>
|
||||
<string>lastPath</string>
|
||||
<string>C:\Documents and Settings\Branislav Stojkovic\Desktop</string>
|
||||
<string>C:\Documents and Settings\Branislav Stojkovic\My Documents\Downloads</string>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>abnormalExit</string>
|
||||
@@ -31,6 +31,12 @@
|
||||
<blue>240</blue>
|
||||
<alpha>240</alpha>
|
||||
</gridColor>
|
||||
<outlineColor>
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
<alpha>255</alpha>
|
||||
</outlineColor>
|
||||
</org.diylc.core.Theme>
|
||||
</entry>
|
||||
<entry>
|
||||
@@ -45,6 +51,10 @@
|
||||
<string>hiQualityRender</string>
|
||||
<boolean>false</boolean>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>outline</string>
|
||||
<boolean>true</boolean>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>exportGrid</string>
|
||||
<boolean>true</boolean>
|
||||
@@ -63,11 +73,11 @@
|
||||
</entry>
|
||||
<entry>
|
||||
<string>autoCreatePads</string>
|
||||
<boolean>false</boolean>
|
||||
<boolean>true</boolean>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>continuousCreation</string>
|
||||
<boolean>false</boolean>
|
||||
<boolean>true</boolean>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>showTemplatesAtStartup</string>
|
||||
@@ -32,5 +32,9 @@ public enum DrawOption {
|
||||
/**
|
||||
* Anti-aliasing is used when drawing.
|
||||
*/
|
||||
ANTIALIASING;
|
||||
ANTIALIASING,
|
||||
/**
|
||||
* Draw components in outline mode.
|
||||
*/
|
||||
OUTLINE_MODE;
|
||||
}
|
||||
@@ -43,6 +43,9 @@ public interface IPlugInPort {
|
||||
public static final String AUTO_EDIT_KEY = "autoEdit";
|
||||
public static final String ABNORMAL_EXIT_KEY = "abnormalExit";
|
||||
public static final String WHEEL_ZOOM_KEY = "wheelZoom";
|
||||
public static final String OUTLINE_KEY = "outline";
|
||||
public static final String THEME_KEY = "theme";
|
||||
public static final String RECENT_COMPONENTS_KEY = "recentComponents";
|
||||
|
||||
/**
|
||||
* Returns size of the canvas that takes project dimensions into account as
|
||||
@@ -98,7 +101,7 @@ public interface IPlugInPort {
|
||||
* Saves the current project into the specified file.
|
||||
*
|
||||
* @param fileName
|
||||
* @param isBackup
|
||||
* @param isBackup
|
||||
*/
|
||||
void saveProjectToFile(String fileName, boolean isBackup);
|
||||
|
||||
@@ -169,7 +172,8 @@ public interface IPlugInPort {
|
||||
* @param altDown
|
||||
* @param clickCount
|
||||
*/
|
||||
void mouseClicked(Point point, boolean ctrlDown, boolean shiftDown, boolean altDown, int clickCount);
|
||||
void mouseClicked(Point point, boolean ctrlDown, boolean shiftDown, boolean altDown,
|
||||
int clickCount);
|
||||
|
||||
/**
|
||||
* Notifies the presenter that mouse is moved.
|
||||
@@ -190,6 +194,15 @@ public interface IPlugInPort {
|
||||
*/
|
||||
List<IDIYComponent<?>> getSelectedComponents();
|
||||
|
||||
/**
|
||||
* Updates the selection with the specified list of component. Also, updates
|
||||
* control point map with all components that are stuck to the newly
|
||||
* selected components.
|
||||
*
|
||||
* @param newSelection
|
||||
*/
|
||||
void updateSelection(List<IDIYComponent<?>> newSelection);
|
||||
|
||||
/**
|
||||
* Selects all components in the project.
|
||||
*/
|
||||
@@ -274,9 +287,8 @@ public interface IPlugInPort {
|
||||
*/
|
||||
List<PropertyWrapper> getMutualSelectionProperties();
|
||||
|
||||
|
||||
void editSelection();
|
||||
|
||||
|
||||
/**
|
||||
* @return a list of editable properties of the current project.
|
||||
*/
|
||||
@@ -353,4 +365,11 @@ public interface IPlugInPort {
|
||||
* @param theme
|
||||
*/
|
||||
void setSelectedTheme(Theme theme);
|
||||
|
||||
/**
|
||||
* Renumbers all the selected components.
|
||||
*
|
||||
* @param xAxisFirst
|
||||
*/
|
||||
void renumberSelectedComponents(boolean xAxisFirst);
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.diylc.common;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.diylc.core.IPropertyValidator;
|
||||
|
||||
@@ -16,12 +15,14 @@ public class PropertyWrapper implements Cloneable {
|
||||
private String name;
|
||||
private Class<?> type;
|
||||
private Object value;
|
||||
private Method setter;
|
||||
private Method getter;
|
||||
private String setter;
|
||||
private String getter;
|
||||
private boolean defaultable;
|
||||
private IPropertyValidator validator;
|
||||
private boolean unique = true;
|
||||
private boolean changed = false;
|
||||
|
||||
public PropertyWrapper(String name, Class<?> type, Method getter, Method setter,
|
||||
public PropertyWrapper(String name, Class<?> type, String getter, String setter,
|
||||
boolean defaultable, IPropertyValidator validator) {
|
||||
super();
|
||||
this.name = name;
|
||||
@@ -33,8 +34,8 @@ public class PropertyWrapper implements Cloneable {
|
||||
}
|
||||
|
||||
public void readFrom(Object object) throws IllegalArgumentException, IllegalAccessException,
|
||||
InvocationTargetException {
|
||||
this.value = getter.invoke(object);
|
||||
InvocationTargetException, SecurityException, NoSuchMethodException {
|
||||
this.value = object.getClass().getMethod(getter).invoke(object);
|
||||
}
|
||||
|
||||
// public void readUniqueFrom(IDIYComponent component)
|
||||
@@ -47,8 +48,8 @@ public class PropertyWrapper implements Cloneable {
|
||||
// }
|
||||
|
||||
public void writeTo(Object object) throws IllegalArgumentException, IllegalAccessException,
|
||||
InvocationTargetException {
|
||||
setter.invoke(object, value);
|
||||
InvocationTargetException, SecurityException, NoSuchMethodException {
|
||||
object.getClass().getMethod(setter, type).invoke(object, this.value);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
@@ -74,6 +75,22 @@ public class PropertyWrapper implements Cloneable {
|
||||
public IPropertyValidator getValidator() {
|
||||
return validator;
|
||||
}
|
||||
|
||||
public boolean isUnique() {
|
||||
return unique;
|
||||
}
|
||||
|
||||
public void setUnique(boolean unique) {
|
||||
this.unique = unique;
|
||||
}
|
||||
|
||||
public boolean isChanged() {
|
||||
return changed;
|
||||
}
|
||||
|
||||
public void setChanged(boolean changed) {
|
||||
this.changed = changed;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public Object clone() throws CloneNotSupportedException {
|
||||
@@ -95,7 +112,6 @@ public class PropertyWrapper implements Cloneable {
|
||||
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||
result = prime * result + ((setter == null) ? 0 : setter.hashCode());
|
||||
result = prime * result + ((type == null) ? 0 : type.hashCode());
|
||||
result = prime * result + ((value == null) ? 0 : value.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -130,11 +146,6 @@ public class PropertyWrapper implements Cloneable {
|
||||
return false;
|
||||
} else if (!type.equals(other.type))
|
||||
return false;
|
||||
if (value == null) {
|
||||
if (other.value != null)
|
||||
return false;
|
||||
} else if (!value.equals(other.value))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -63,8 +63,8 @@ public abstract class AbstractCurvedComponent<T> extends AbstractTransparentComp
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Graphics2D g2d, ComponentState componentState, Project project,
|
||||
IDrawingObserver drawingObserver) {
|
||||
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode,
|
||||
Project project, IDrawingObserver drawingObserver) {
|
||||
if (checkPointsClipped(g2d.getClip())) {
|
||||
return;
|
||||
}
|
||||
@@ -13,14 +13,19 @@ import java.awt.geom.Ellipse2D;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
|
||||
import org.diylc.common.Display;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
import org.diylc.core.Project;
|
||||
import org.diylc.core.Theme;
|
||||
import org.diylc.core.VisibilityPolicy;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
import org.diylc.core.measures.Size;
|
||||
import org.diylc.core.measures.SizeUnit;
|
||||
import org.diylc.utils.Constants;
|
||||
|
||||
import com.diyfever.gui.miscutils.ConfigurationManager;
|
||||
|
||||
/**
|
||||
* Base class for all leaded components such as resistors or capacitors. Has two
|
||||
@@ -45,7 +50,7 @@ public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComp
|
||||
protected Color bodyColor = Color.white;
|
||||
protected Color borderColor = Color.black;
|
||||
protected Color labelColor = LABEL_COLOR;
|
||||
protected Display display = Display.NAME;
|
||||
protected Display display = Display.VALUE;
|
||||
|
||||
protected AbstractLeadedComponent() {
|
||||
super();
|
||||
@@ -60,8 +65,8 @@ public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComp
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Graphics2D g2d, ComponentState componentState, Project project,
|
||||
IDrawingObserver drawingObserver) {
|
||||
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode,
|
||||
Project project, IDrawingObserver drawingObserver) {
|
||||
double distance = points[0].distance(points[1]);
|
||||
Shape shape = getBodyShape();
|
||||
// If there's no body, just draw the line connecting the ending points.
|
||||
@@ -74,13 +79,32 @@ public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComp
|
||||
int width = getClosestOdd(this.width.convertToPixels());
|
||||
Shape body = new Ellipse2D.Double(points[0].x - width / 2, points[0].y - width / 2,
|
||||
width, width);
|
||||
g2d.setColor(bodyColor);
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha
|
||||
/ MAX_ALPHA));
|
||||
}
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : bodyColor);
|
||||
g2d.fill(body);
|
||||
Color finalBorderColor = componentState == ComponentState.SELECTED
|
||||
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : borderColor;
|
||||
g2d.setComposite(oldComposite);
|
||||
Color finalBorderColor;
|
||||
if (outlineMode) {
|
||||
Theme theme = (Theme) ConfigurationManager.getInstance().readObject(
|
||||
IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME);
|
||||
finalBorderColor = componentState == ComponentState.SELECTED
|
||||
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : theme
|
||||
.getOutlineColor();
|
||||
} else {
|
||||
finalBorderColor = componentState == ComponentState.SELECTED
|
||||
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
||||
: borderColor;
|
||||
}
|
||||
|
||||
g2d.setColor(finalBorderColor);
|
||||
g2d.draw(body);
|
||||
drawLead(g2d, componentState);
|
||||
if (!outlineMode) {
|
||||
drawLead(g2d, componentState);
|
||||
}
|
||||
} else {
|
||||
// Normal mode with component body in the center and two lead parts.
|
||||
Rectangle shapeRect = shape.getBounds();
|
||||
@@ -99,23 +123,42 @@ public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComp
|
||||
}
|
||||
if (bodyColor != null) {
|
||||
if (bodyColor != null) {
|
||||
g2d.setColor(bodyColor);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : bodyColor);
|
||||
g2d.fill(shape);
|
||||
}
|
||||
}
|
||||
decorateComponentBody(g2d);
|
||||
decorateComponentBody(g2d, outlineMode);
|
||||
g2d.setComposite(oldComposite);
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||
Color finalBorderColor = componentState == ComponentState.SELECTED
|
||||
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : borderColor;
|
||||
Color finalBorderColor;
|
||||
if (outlineMode) {
|
||||
Theme theme = (Theme) ConfigurationManager.getInstance().readObject(
|
||||
IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME);
|
||||
finalBorderColor = componentState == ComponentState.SELECTED
|
||||
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : theme
|
||||
.getOutlineColor();
|
||||
} else {
|
||||
finalBorderColor = componentState == ComponentState.SELECTED
|
||||
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
||||
: borderColor;
|
||||
}
|
||||
g2d.setColor(finalBorderColor);
|
||||
g2d.draw(shape);
|
||||
// Draw label.
|
||||
g2d.setFont(LABEL_FONT);
|
||||
Color finalLabelFont = componentState == ComponentState.SELECTED
|
||||
|| componentState == ComponentState.DRAGGING ? LABEL_COLOR_SELECTED
|
||||
: labelColor;
|
||||
g2d.setColor(finalLabelFont);
|
||||
Color finalLabelColor;
|
||||
if (outlineMode) {
|
||||
Theme theme = (Theme) ConfigurationManager.getInstance().readObject(
|
||||
IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME);
|
||||
finalLabelColor = componentState == ComponentState.SELECTED
|
||||
|| componentState == ComponentState.DRAGGING ? LABEL_COLOR_SELECTED : theme
|
||||
.getOutlineColor();
|
||||
} else {
|
||||
finalLabelColor = componentState == ComponentState.SELECTED
|
||||
|| componentState == ComponentState.DRAGGING ? LABEL_COLOR_SELECTED
|
||||
: labelColor;
|
||||
}
|
||||
g2d.setColor(finalLabelColor);
|
||||
FontMetrics fontMetrics = g2d.getFontMetrics();
|
||||
String label = display == Display.NAME ? getName() : getValue().toString();
|
||||
// Adjust label angle if needed to make sure that it's readable.
|
||||
@@ -128,30 +171,31 @@ public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComp
|
||||
calculateLabelYCoordinate(shapeRect, textRect, fontMetrics));
|
||||
|
||||
// Go back to the original transformation to draw leads.
|
||||
g2d.setTransform(oldTransform);
|
||||
int leadThickness = getClosestOdd(getLeadThickness());
|
||||
double leadLength = (distance - shapeRect.width) / 2 - leadThickness / 2;
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(leadThickness));
|
||||
Color leadColor = shouldShadeLeads() ? getLeadColor(componentState).darker()
|
||||
: getLeadColor(componentState);
|
||||
g2d.setColor(leadColor);
|
||||
int endX = (int) (points[0].x + Math.cos(theta) * leadLength);
|
||||
int endY = (int) Math.round(points[0].y + Math.sin(theta) * leadLength);
|
||||
g2d.drawLine(points[0].x, points[0].y, endX, endY);
|
||||
endX = (int) (points[1].x + Math.cos(theta - Math.PI) * leadLength);
|
||||
endY = (int) Math.round(points[1].y + Math.sin(theta - Math.PI) * leadLength);
|
||||
g2d.drawLine(points[1].x, points[1].y, endX, endY);
|
||||
if (shouldShadeLeads()) {
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(leadThickness - 2));
|
||||
leadColor = getLeadColor(componentState);
|
||||
if (!outlineMode) {
|
||||
g2d.setTransform(oldTransform);
|
||||
int leadThickness = getClosestOdd(getLeadThickness());
|
||||
double leadLength = (distance - shapeRect.width) / 2 - leadThickness / 2;
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(leadThickness));
|
||||
Color leadColor = shouldShadeLeads() ? getLeadColor(componentState).darker()
|
||||
: getLeadColor(componentState);
|
||||
g2d.setColor(leadColor);
|
||||
g2d.drawLine(points[0].x, points[0].y, (int) (points[0].x + Math.cos(theta)
|
||||
* leadLength), (int) (points[0].y + Math.sin(theta) * leadLength));
|
||||
g2d
|
||||
.drawLine(points[1].x, points[1].y, (int) (points[1].x + Math.cos(theta
|
||||
- Math.PI)
|
||||
* leadLength), (int) (points[1].y + Math.sin(theta - Math.PI)
|
||||
* leadLength));
|
||||
int endX = (int) (points[0].x + Math.cos(theta) * leadLength);
|
||||
int endY = (int) Math.round(points[0].y + Math.sin(theta) * leadLength);
|
||||
g2d.drawLine(points[0].x, points[0].y, endX, endY);
|
||||
endX = (int) (points[1].x + Math.cos(theta - Math.PI) * leadLength);
|
||||
endY = (int) Math.round(points[1].y + Math.sin(theta - Math.PI) * leadLength);
|
||||
g2d.drawLine(points[1].x, points[1].y, endX, endY);
|
||||
if (shouldShadeLeads()) {
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(leadThickness - 2));
|
||||
leadColor = getLeadColor(componentState);
|
||||
g2d.setColor(leadColor);
|
||||
g2d.drawLine(points[0].x, points[0].y, (int) (points[0].x + Math.cos(theta)
|
||||
* leadLength), (int) (points[0].y + Math.sin(theta) * leadLength));
|
||||
g2d.drawLine(points[1].x, points[1].y, (int) (points[1].x + Math.cos(theta
|
||||
- Math.PI)
|
||||
* leadLength), (int) (points[1].y + Math.sin(theta - Math.PI)
|
||||
* leadLength));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -170,7 +214,7 @@ public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComp
|
||||
}
|
||||
}
|
||||
|
||||
protected void decorateComponentBody(Graphics2D g2d) {
|
||||
protected void decorateComponentBody(Graphics2D g2d, boolean outlineMode) {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
@@ -103,10 +103,11 @@ public interface IDIYComponent<T> extends Serializable {
|
||||
*
|
||||
* @param g2d
|
||||
* @param componentState
|
||||
* @param outlineMode
|
||||
* @param project
|
||||
* @param drawingObserver
|
||||
*/
|
||||
void draw(Graphics2D g2d, ComponentState componentState, Project project,
|
||||
void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project,
|
||||
IDrawingObserver drawingObserver);
|
||||
|
||||
/**
|
||||
@@ -10,12 +10,14 @@ public class Theme implements Serializable {
|
||||
private String name;
|
||||
private Color bgColor;
|
||||
private Color gridColor;
|
||||
private Color outlineColor;
|
||||
|
||||
public Theme(String name, Color bgColor, Color gridColor) {
|
||||
public Theme(String name, Color bgColor, Color gridColor, Color outlineColor) {
|
||||
super();
|
||||
this.name = name;
|
||||
this.bgColor = bgColor;
|
||||
this.gridColor = gridColor;
|
||||
this.outlineColor = outlineColor;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
@@ -30,12 +32,17 @@ public class Theme implements Serializable {
|
||||
return gridColor;
|
||||
}
|
||||
|
||||
public Color getOutlineColor() {
|
||||
return outlineColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((bgColor == null) ? 0 : bgColor.hashCode());
|
||||
result = prime * result + ((gridColor == null) ? 0 : gridColor.hashCode());
|
||||
result = prime * result + ((outlineColor == null) ? 0 : outlineColor.hashCode());
|
||||
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||
return result;
|
||||
}
|
||||
@@ -59,6 +66,11 @@ public class Theme implements Serializable {
|
||||
return false;
|
||||
} else if (!gridColor.equals(other.gridColor))
|
||||
return false;
|
||||
if (outlineColor == null) {
|
||||
if (other.outlineColor != null)
|
||||
return false;
|
||||
} else if (!outlineColor.equals(other.outlineColor))
|
||||
return false;
|
||||
if (name == null) {
|
||||
if (other.name != null)
|
||||
return false;
|
||||
@@ -10,7 +10,7 @@ public class PositiveMeasureValidator implements IPropertyValidator {
|
||||
public void validate(Object value) throws ValidationException {
|
||||
if (value instanceof AbstractMeasure) {
|
||||
AbstractMeasure measure = (AbstractMeasure) value;
|
||||
if (measure.getValue() <= 0) {
|
||||
if (measure.getValue() < 0) {
|
||||
throw new ValidationException("must be greater than zero.");
|
||||
}
|
||||
} else {
|
||||
@@ -31,7 +31,7 @@ public enum IconLoader {
|
||||
"donate.png"), Bug("bug.png"), IconLarge("icon_large.png"), IconMedium(
|
||||
"icon_medium.png"), IconSmall("icon_small.png"), DocumentEdit("document_edit.png"), EditComponent(
|
||||
"edit_component.png"), Size("size.png"), Front("front.png"), Back("back.png"), Pens(
|
||||
"pens.png");
|
||||
"pens.png"), Sort("sort.png");
|
||||
|
||||
protected String name;
|
||||
|
||||
|
Before Width: | Height: | Size: 875 B After Width: | Height: | Size: 875 B |
|
Before Width: | Height: | Size: 729 B After Width: | Height: | Size: 729 B |
|
Before Width: | Height: | Size: 749 B After Width: | Height: | Size: 749 B |
|
Before Width: | Height: | Size: 736 B After Width: | Height: | Size: 736 B |
|
Before Width: | Height: | Size: 707 B After Width: | Height: | Size: 707 B |
|
Before Width: | Height: | Size: 714 B After Width: | Height: | Size: 714 B |
|
Before Width: | Height: | Size: 993 B After Width: | Height: | Size: 993 B |
|
Before Width: | Height: | Size: 537 B After Width: | Height: | Size: 537 B |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 863 B After Width: | Height: | Size: 863 B |
|
Before Width: | Height: | Size: 850 B After Width: | Height: | Size: 850 B |
|
Before Width: | Height: | Size: 708 B After Width: | Height: | Size: 708 B |
|
Before Width: | Height: | Size: 960 B After Width: | Height: | Size: 960 B |
|
Before Width: | Height: | Size: 901 B After Width: | Height: | Size: 901 B |
|
Before Width: | Height: | Size: 728 B After Width: | Height: | Size: 728 B |
|
Before Width: | Height: | Size: 595 B After Width: | Height: | Size: 595 B |
|
Before Width: | Height: | Size: 781 B After Width: | Height: | Size: 781 B |
|
Before Width: | Height: | Size: 914 B After Width: | Height: | Size: 914 B |
|
Before Width: | Height: | Size: 876 B After Width: | Height: | Size: 876 B |
|
Before Width: | Height: | Size: 853 B After Width: | Height: | Size: 853 B |
|
Before Width: | Height: | Size: 596 B After Width: | Height: | Size: 596 B |
|
Before Width: | Height: | Size: 765 B After Width: | Height: | Size: 765 B |
|
Before Width: | Height: | Size: 696 B After Width: | Height: | Size: 696 B |
|
Before Width: | Height: | Size: 597 B After Width: | Height: | Size: 597 B |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 845 B After Width: | Height: | Size: 845 B |
|
Before Width: | Height: | Size: 928 B After Width: | Height: | Size: 928 B |
|
Before Width: | Height: | Size: 697 B After Width: | Height: | Size: 697 B |
|
Before Width: | Height: | Size: 892 B After Width: | Height: | Size: 892 B |
|
Before Width: | Height: | Size: 751 B After Width: | Height: | Size: 751 B |
|
Before Width: | Height: | Size: 834 B After Width: | Height: | Size: 834 B |
|
Before Width: | Height: | Size: 857 B After Width: | Height: | Size: 857 B |
|
Before Width: | Height: | Size: 990 B After Width: | Height: | Size: 990 B |
|
Before Width: | Height: | Size: 842 B After Width: | Height: | Size: 842 B |
|
Before Width: | Height: | Size: 910 B After Width: | Height: | Size: 910 B |