[Patchanim-commit] SF.net SVN: patchanim:[252] trunk/patchanim/src/com/mebigfatguy/patchanim
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2008-12-25 18:12:35
|
Revision: 252
http://patchanim.svn.sourceforge.net/patchanim/?rev=252&view=rev
Author: dbrosius
Date: 2008-12-25 18:12:33 +0000 (Thu, 25 Dec 2008)
Log Message:
-----------
add TweenStyle setting (not impled yet)
Modified Paths:
--------------
trunk/patchanim/src/com/mebigfatguy/patchanim/PatchAnimDocument.java
trunk/patchanim/src/com/mebigfatguy/patchanim/TweenStyle.java
trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchControlPanel.java
trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsd
trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsl
trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimExtension.java
trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java
trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java
trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/PatchAnimDocument.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/PatchAnimDocument.java 2008-12-25 18:00:20 UTC (rev 251)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/PatchAnimDocument.java 2008-12-25 18:12:33 UTC (rev 252)
@@ -32,14 +32,15 @@
private static final long serialVersionUID = -7412254429829665944L;
private boolean dirty;
- private int order;
- private boolean useAlpha;
+ private final int order;
+ private final boolean useAlpha;
private List<CombinedPatch> patches;
private int width;
private int height;
private AnimationType animationType;
private OutOfBoundsColor outOfBoundsColor;
private int tweenCount;
+ private TweenStyle tweenStyle;
/**
* constructs a new document for the New menu item
@@ -55,6 +56,7 @@
animationType = AnimationType.Wave;
outOfBoundsColor = OutOfBoundsColor.Clip;
tweenCount = 10;
+ tweenStyle = TweenStyle.Linear;
}
/**
@@ -184,4 +186,20 @@
public void setTweenCount(int tweenCount) {
this.tweenCount = tweenCount;
}
+
+ /**
+ * gets the algorithm used to tween between one patch and another
+ * @return the tween algorithm
+ */
+ public TweenStyle getTweenStyle() {
+ return tweenStyle;
+ }
+
+ /**
+ * sets the algorithm used to tween between one patch and another
+ * @param tweenStyle the tween algorithm
+ */
+ public void setTweenStyle(TweenStyle tweenStyle) {
+ this.tweenStyle = tweenStyle;
+ }
}
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/TweenStyle.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/TweenStyle.java 2008-12-25 18:00:20 UTC (rev 251)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/TweenStyle.java 2008-12-25 18:12:33 UTC (rev 252)
@@ -33,7 +33,7 @@
Linear,
Radial;
- private static final String TWEEN = "tween.";
+ private static final String TWEEN = "tweenstyle.";
/**
* returns the localized value of the enum
* @return the localized display value
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchControlPanel.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchControlPanel.java 2008-12-25 18:00:20 UTC (rev 251)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchControlPanel.java 2008-12-25 18:12:33 UTC (rev 252)
@@ -42,6 +42,7 @@
import com.mebigfatguy.patchanim.AnimationType;
import com.mebigfatguy.patchanim.OutOfBoundsColor;
import com.mebigfatguy.patchanim.PatchAnimDocument;
+import com.mebigfatguy.patchanim.TweenStyle;
import com.mebigfatguy.patchanim.gui.events.DocumentChangedEvent;
import com.mebigfatguy.patchanim.gui.events.DocumentChangedListener;
import com.mebigfatguy.patchanim.main.PatchAnimBundle;
@@ -56,6 +57,7 @@
private JComboBox animationCB;
private JComboBox outOfBoundsColorCB;
private JTextField tweenFramesField;
+ private JComboBox tweenStyleCB;
private JButton testButton;
public JPatchControlPanel() {
@@ -73,6 +75,7 @@
JLabel animationLabel;
JLabel outOfBoundsLabel;
JLabel tweenFramesLabel;
+ JLabel tweenStyleLabel;
{
widthLabel = new JLabel(rb.getString(PatchAnimBundle.WIDTH));
@@ -132,13 +135,23 @@
add(p);
}
add(Box.createVerticalStrut(5));
+ {
+ tweenStyleLabel = new JLabel(rb.getString(PatchAnimBundle.TWEENSTYLE));
+ tweenStyleCB = new JComboBox(new Object[] { TweenStyle.Linear,
+ TweenStyle.Radial });
+ tweenStyleCB.setToolTipText(rb.getString(PatchAnimBundle.TWEENSTYLE_TT));
+ outOfBoundsLabel.setLabelFor(tweenStyleCB);
+ JPanel p = Utils.createFormPanel(tweenStyleLabel, tweenStyleCB);
+ Utils.limitPanelHeight(p, tweenStyleCB);
+ add(p);
+ }
testButton = new JButton(rb.getString(PatchAnimBundle.TEST));
testButton.setToolTipText(rb.getString(PatchAnimBundle.TEST_TT));
add(testButton);
- Utils.sizeUniformly(Utils.Sizing.Both, widthLabel, heightLabel, animationLabel, outOfBoundsLabel, tweenFramesLabel);
- Utils.sizeUniformly(Utils.Sizing.Width, new JComponent[] { widthField, heightField, animationCB, outOfBoundsColorCB, tweenFramesField });
+ Utils.sizeUniformly(Utils.Sizing.Both, widthLabel, heightLabel, animationLabel, outOfBoundsLabel, tweenFramesLabel, tweenStyleLabel);
+ Utils.sizeUniformly(Utils.Sizing.Width, new JComponent[] { widthField, heightField, animationCB, outOfBoundsColorCB, tweenFramesField, tweenStyleCB });
add(Box.createVerticalGlue());
@@ -160,6 +173,7 @@
animationCB.setSelectedIndex(document.getAnimationType().ordinal());
outOfBoundsColorCB.setSelectedIndex(document.getOutOfBoundsColor().ordinal());
tweenFramesField.setText(String.valueOf(document.getTweenCount()));
+ tweenStyleCB.setSelectedIndex(document.getTweenStyle().ordinal());
}
});
}
@@ -263,6 +277,17 @@
}
});
+ tweenStyleCB.addItemListener(new ItemListener() {
+
+ public void itemStateChanged(ItemEvent ie) {
+ if (ie.getStateChange() == ItemEvent.SELECTED) {
+ document.setTweenStyle((TweenStyle)ie.getItem());
+ PatchPanelMediator mediator = PatchPanelMediator.getMediator();
+ mediator.fireSettingsChanged();
+ }
+ }
+ });
+
testButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
JTestFrame tf = new JTestFrame();
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsd
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsd 2008-12-25 18:00:20 UTC (rev 251)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsd 2008-12-25 18:12:33 UTC (rev 252)
@@ -34,6 +34,7 @@
<xsd:attribute name="outOfBoundsColor" type="OutOfBoundsColorClass" use="required"/>
<xsd:attribute name="tweenCount" type="xsd:integer" use="required"/>
<xsd:attribute name="width" type="xsd:integer" use="required"/>
+ <xsd:attribute name="tweenStyle" type="xsd:TweenStyleClass" use="required"/>
</xsd:complexType>
<xsd:simpleType name="AnimationTypeClass">
<xsd:restriction base="xsd:string">
@@ -57,6 +58,12 @@
<xsd:enumeration value="Alpha"/>
</xsd:restriction>
</xsd:simpleType>
+ <xsd:simpleType name="TweenStyleClass">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="Linear"/>
+ <xsd:enumeration value="Radial"/>
+ </xsd:restriction>
+ </xsd:simpleType>
<xsd:complexType name="CoordinateClass">
<xsd:attribute name="color" type="xsd:double" use="required"/>
<xsd:attribute name="x" type="xsd:double" use="required"/>
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsl
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsl 2008-12-25 18:00:20 UTC (rev 251)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsl 2008-12-25 18:12:33 UTC (rev 252)
@@ -58,6 +58,9 @@
<xsl:attribute name="tweenCount">
<xsl:value-of select="pae:getTweenCount($ext)"/>
</xsl:attribute>
+ <xsl:attribute name="tweenStyle">
+ <xsl:value-of select="pae:getTweenStyle($ext)"/>
+ </xsl:attribute>
</Settings>
<Patches>
<xsl:for-each select="pae:getPatches($ext)">
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimExtension.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimExtension.java 2008-12-25 18:00:20 UTC (rev 251)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimExtension.java 2008-12-25 18:12:33 UTC (rev 252)
@@ -37,8 +37,8 @@
public class PatchAnimExtension {
private static final String VERSION_URL = "/com/mebigfatguy/patchanim/io/Version.txt";
- private PatchAnimDocument paDoc;
- private Document d;
+ private final PatchAnimDocument paDoc;
+ private final Document d;
public PatchAnimExtension(PatchAnimDocument doc) throws ParserConfigurationException {
paDoc = doc;
@@ -82,6 +82,10 @@
public String getTweenCount(@SuppressWarnings("unused") ExpressionContext context) {
return String.valueOf(paDoc.getTweenCount());
}
+
+ public String getTweenStyle(@SuppressWarnings("unused") ExpressionContext context) {
+ return String.valueOf(paDoc.getTweenStyle());
+ }
public String useAlpha(@SuppressWarnings("unused") ExpressionContext context) {
return String.valueOf(paDoc.useAlpha());
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java 2008-12-25 18:00:20 UTC (rev 251)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchAnimIO.java 2008-12-25 18:12:33 UTC (rev 252)
@@ -46,6 +46,7 @@
import com.mebigfatguy.patchanim.OutOfBoundsColor;
import com.mebigfatguy.patchanim.PatchAnimDocument;
import com.mebigfatguy.patchanim.PatchColor;
+import com.mebigfatguy.patchanim.TweenStyle;
import com.mebigfatguy.patchanim.surface.CombinedPatch;
import com.mebigfatguy.patchanim.surface.Coordinate;
import com.mebigfatguy.patchanim.surface.PatchCoords;
@@ -121,6 +122,7 @@
private static final String ANIMATIONTYPE = "animationType";
private static final String OUTOFBOUNDSCOLOR = "outOfBoundsColor";
private static final String TWEENCOUNT = "tweenCount";
+ private static final String TWEENSTYLE = "tweenStyle";
private static final String COMBINEDPATCH = "CombinedPatch";
private static final String PATCH = "Patch";
private static final String COLOR = "color";
@@ -147,6 +149,7 @@
doc.setAnimationType(AnimationType.valueOf(AnimationType.class, atts.getValue(ANIMATIONTYPE)));
doc.setOutOfBoundsColor(OutOfBoundsColor.valueOf(OutOfBoundsColor.class, atts.getValue(OUTOFBOUNDSCOLOR)));
doc.setTweenCount(Integer.parseInt(atts.getValue(TWEENCOUNT)));
+ doc.setTweenStyle(TweenStyle.valueOf(TweenStyle.class, atts.getValue(TWEENSTYLE)));
} else if (COMBINEDPATCH.equals(localName)) {
cPatch = new CombinedPatch(doc.getOrder(), false);
} else if (PATCH.equals(localName)) {
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2008-12-25 18:00:20 UTC (rev 251)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2008-12-25 18:12:33 UTC (rev 252)
@@ -70,6 +70,8 @@
public static final String OOBWAVE = "patchanim.oob.wave";
public static final String TWEENFRAMES = "patchanim.tween";
public static final String TWEENFRAMES_TT = "patchanim.tooltip.tween";
+ public static final String TWEENSTYLE = "patchanim.tweenstyle";
+ public static final String TWEENSTYLE_TT = "patchanim.tooltip.tweenstyle";
public static final String TEST = "patchanim.test";
public static final String TEST_TT = "patchanim.tooltip.test";
public static final String STOP = "patchanim.stop";
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties 2008-12-25 18:00:20 UTC (rev 251)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties 2008-12-25 18:12:33 UTC (rev 252)
@@ -63,6 +63,10 @@
patchanim.oob.wave = Wave
patchanim.tween = In-between frames
patchanim.tooltip.tween = How many frames are generated as transitions from one patch to the next
+patchanim.tweenstyle = Tween Style
+patchanim.tooltip.tweenstyle = The algorithm used to transition from one patch to another
+patchanim.tweenstyle.linear = Linear
+patchanim.tweenstyle.radial = Radial
patchanim.test = Test
patchanim.tooltip.test = Test the animation using the export settings
patchanim.stop = Stop
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|