42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/lib/tinylaf/docs/package-list:
--------------------------------------------------------------------------------
1 | de.muntjak.tinylookandfeel
2 | de.muntjak.tinylookandfeel.table
3 |
--------------------------------------------------------------------------------
/lib/tinylaf/docs/resources/inherit.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/lib/tinylaf/docs/resources/inherit.gif
--------------------------------------------------------------------------------
/lib/tinylaf/docs/stylesheet.css:
--------------------------------------------------------------------------------
1 | /* Javadoc style sheet */
2 |
3 | /* Define colors, fonts and other style attributes here to override the defaults */
4 |
5 | /* Page background color */
6 | body { background-color: #FFFFFF }
7 |
8 | /* Headings */
9 | h1 { font-size: 145% }
10 |
11 | /* Table colors */
12 | .TableHeadingColor { background: #CCCCFF } /* Dark mauve */
13 | .TableSubHeadingColor { background: #EEEEFF } /* Light mauve */
14 | .TableRowColor { background: #FFFFFF } /* White */
15 |
16 | /* Font used in left-hand frame lists */
17 | .FrameTitleFont { font-size: 100%; font-family: Helvetica, Arial, sans-serif }
18 | .FrameHeadingFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif }
19 | .FrameItemFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif }
20 |
21 | /* Navigation bar fonts and colors */
22 | .NavBarCell1 { background-color:#EEEEFF;} /* Light mauve */
23 | .NavBarCell1Rev { background-color:#00008B;} /* Dark Blue */
24 | .NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;}
25 | .NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;}
26 |
27 | .NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;}
28 | .NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;}
29 |
30 |
--------------------------------------------------------------------------------
/lib/tinylaf/tinycp.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/lib/tinylaf/tinycp.jar
--------------------------------------------------------------------------------
/lib/tinylaf/tinylaf-1_4_0_src.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/lib/tinylaf/tinylaf-1_4_0_src.zip
--------------------------------------------------------------------------------
/lib/tinylaf/tinylaf.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/lib/tinylaf/tinylaf.jar
--------------------------------------------------------------------------------
/lib/xmlenc-0.52.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/lib/xmlenc-0.52.jar
--------------------------------------------------------------------------------
/license.txt:
--------------------------------------------------------------------------------
1 | darkFunction Editor is a 2D sprite studio that allows you to rapidly define spritesheets and build complex animations, which can be exported as animated GIF's or as XML to be loaded into your game engine. No more messing around in paint programs or manually tweaking coordinates!
2 |
3 | Copyright (C) 2012 Samuel Taylor
4 |
5 | This program is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program. If not, see .
17 |
18 |
--------------------------------------------------------------------------------
/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/nbproject/genfiles.properties:
--------------------------------------------------------------------------------
1 | build.xml.data.CRC32=7c39eed3
2 | build.xml.script.CRC32=7606668b
3 | build.xml.stylesheet.CRC32=28e38971@1.38.2.45
4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
6 | nbproject/build-impl.xml.data.CRC32=2265be8e
7 | nbproject/build-impl.xml.script.CRC32=0b4f5ad7
8 | nbproject/build-impl.xml.stylesheet.CRC32=0ae3a408@1.44.1.45
9 |
--------------------------------------------------------------------------------
/nbproject/private/config.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/nbproject/private/config.properties
--------------------------------------------------------------------------------
/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | #Thu Sep 17 20:45:30 BST 2009
2 | compile.on.save=true
3 | do.depend=false
4 | do.jar=true
5 | javac.debug=false
6 | javadoc.preview=false
7 | jaxbwiz.endorsed.dirs=C:\\Program Files\\NetBeans 6.8\\ide12\\modules\\ext\\jaxb\\api
8 | user.properties.file=/Users/samtaylor/.netbeans/7.0/build.properties
9 |
--------------------------------------------------------------------------------
/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/nbproject/project.properties:
--------------------------------------------------------------------------------
1 | annotation.processing.enabled=true
2 | annotation.processing.enabled.in.editor=false
3 | annotation.processing.run.all.processors=true
4 | application.desc=A sprite tool for 2D game developers.
5 | application.homepage=http://www.darkfunction.com
6 | application.title=darkFunction Editor
7 | application.vendor=darkFunction
8 | build.classes.dir=${build.dir}/classes
9 | build.classes.excludes=**/*.java,**/*.form
10 | # This directory is removed when the project is cleaned:
11 | build.dir=build
12 | build.generated.dir=${build.dir}/generated
13 | build.generated.sources.dir=${build.dir}/generated-sources
14 | # Only compile against the classpath explicitly listed here:
15 | build.sysclasspath=ignore
16 | build.test.classes.dir=${build.dir}/test/classes
17 | build.test.results.dir=${build.dir}/test/results
18 | debug.classpath=\
19 | ${run.classpath}
20 | debug.test.classpath=\
21 | ${run.test.classpath}
22 | # This directory is removed when the project is cleaned:
23 | dist.dir=dist
24 | dist.jar=${dist.dir}/dfEditor.jar
25 | dist.javadoc.dir=${dist.dir}/javadoc
26 | endorsed.classpath=
27 | excludes=
28 | file.reference.isorelax.jar=lib/isorelax.jar
29 | file.reference.org-openide-awt.jar=lib/org-openide-awt.jar
30 | file.reference.org-openide-util.jar=lib/org-openide-util.jar
31 | file.reference.tinylaf.jar=lib/tinylaf/tinylaf.jar
32 | file.reference.xmlenc-0.52.jar=lib/xmlenc-0.52.jar
33 | includes=**
34 | jar.archive.disabled=${jnlp.enabled}
35 | jar.compress=false
36 | jar.index=${jnlp.enabled}
37 | javac.classpath=\
38 | ${libs.swing-app-framework.classpath}:\
39 | ${file.reference.org-openide-awt.jar}:\
40 | ${file.reference.isorelax.jar}:\
41 | ${file.reference.xmlenc-0.52.jar}:\
42 | ${file.reference.org-openide-util.jar}:\
43 | ${file.reference.tinylaf.jar}:\
44 | ${libs.absolutelayout.classpath}:\
45 | ${libs.swing-layout.classpath}
46 | # Space-separated list of extra javac options
47 | javac.compilerargs=
48 | javac.deprecation=false
49 | javac.processorpath=\
50 | ${javac.classpath}
51 | javac.source=1.5
52 | javac.target=1.5
53 | javac.test.classpath=\
54 | ${javac.classpath}:\
55 | ${build.classes.dir}:\
56 | ${libs.junit.classpath}:\
57 | ${libs.junit_4.classpath}
58 | javadoc.additionalparam=
59 | javadoc.author=false
60 | javadoc.encoding=${source.encoding}
61 | javadoc.noindex=true
62 | javadoc.nonavbar=true
63 | javadoc.notree=true
64 | javadoc.private=false
65 | javadoc.splitindex=false
66 | javadoc.use=false
67 | javadoc.version=false
68 | javadoc.windowtitle=
69 | jaxbwiz.endorsed.dirs="${netbeans.home}/../ide12/modules/ext/jaxb/api"
70 | jnlp.codebase.type=local
71 | jnlp.codebase.url=file:/C:/Documents%20and%20Settings/Owner/Desktop/Coding/dfEditor/dist/
72 | jnlp.descriptor=application
73 | jnlp.enabled=false
74 | jnlp.mixed.code=default
75 | jnlp.offline-allowed=false
76 | jnlp.signed=false
77 | jnlp.signing=
78 | jnlp.signing.alias=
79 | jnlp.signing.keystore=
80 | main.class=dfEditor.dfEditorApp
81 | manifest.file=manifest.mf
82 | meta.inf.dir=${src.dir}/META-INF
83 | mkdist.disabled=false
84 | platform.active=JDK_1.6
85 | run.classpath=\
86 | ${javac.classpath}:\
87 | ${build.classes.dir}
88 | # Space-separated list of JVM arguments used when running the project
89 | # (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
90 | # or test-sys-prop.name=value to set system properties for unit tests):
91 | run.jvmargs=
92 | run.test.classpath=\
93 | ${javac.test.classpath}:\
94 | ${build.test.classes.dir}
95 | source.encoding=UTF-8
96 | src.dir=src
97 | test.src.dir=test
98 |
--------------------------------------------------------------------------------
/nbproject/project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.netbeans.modules.java.j2seproject
4 |
5 |
6 | dfEditor
7 | 1.6.5
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | .\lib\nblibraries.properties
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/src/META-INF/services/org.jdesktop.application.Application:
--------------------------------------------------------------------------------
1 | dfEditor.dfEditorApp
--------------------------------------------------------------------------------
/src/com/generationjava/io/xml/AbstractXmlWriter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003, Henri Yandell
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or
6 | * without modification, are permitted provided that the
7 | * following conditions are met:
8 | *
9 | * + Redistributions of source code must retain the above copyright notice,
10 | * this list of conditions and the following disclaimer.
11 | *
12 | * + Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * + Neither the name of XmlWriter nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software
18 | * without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 | * POSSIBILITY OF SUCH DAMAGE.
31 | */
32 | package com.generationjava.io.xml;
33 |
34 | import java.io.IOException;
35 |
36 | /**
37 | * Provides a few method implementations for XmlWriter implementations.
38 | * The method implementations all depend on other methods which must
39 | * be implemented.
40 | */
41 | public abstract class AbstractXmlWriter implements XmlWriter {
42 |
43 | /**
44 | * Makes it easy to output the xml version if such a thing is desired.
45 | * While it usually is desired, it is less surprising not to handle it.
46 | */
47 | public XmlWriter writeXmlVersion() throws IOException {
48 | return this.writeXmlVersion("1.0", null, null);
49 | }
50 | /** @see XmlWriter.writeXmlVersion(String, String, String) */
51 | public XmlWriter writeXmlVersion(String version, String encoding) throws IOException {
52 | return this.writeXmlVersion(version, encoding, null);
53 | }
54 |
55 | /**
56 | * A helper method. It writes out an entity which contains only text.
57 | *
58 | * @param name String name of tag
59 | * @param text String of text to go inside the tag
60 | */
61 | public XmlWriter writeEntityWithText(String name, Object text) throws IOException {
62 | writeEntity(name);
63 | writeText(text);
64 | return endEntity();
65 | }
66 |
67 | /**
68 | * A helper method. It writes out empty entities.
69 | *
70 | * @param name String name of tag
71 | */
72 | public XmlWriter writeEmptyEntity(String name) throws IOException {
73 | writeEntity(name);
74 | return endEntity();
75 | }
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/src/com/generationjava/io/xml/FormattingXmlWriter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003, Henri Yandell
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or
6 | * without modification, are permitted provided that the
7 | * following conditions are met:
8 | *
9 | * + Redistributions of source code must retain the above copyright notice,
10 | * this list of conditions and the following disclaimer.
11 | *
12 | * + Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * + Neither the name of XmlWriter nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software
18 | * without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 | * POSSIBILITY OF SUCH DAMAGE.
31 | */
32 | package com.generationjava.io.xml;
33 |
34 | import java.io.IOException;
35 |
36 | import java.text.NumberFormat;
37 | import java.text.DateFormat;
38 | import java.util.Date;
39 |
40 |
41 | /**
42 | * Formats Numbers and Dates on the fly.
43 | */
44 | public class FormattingXmlWriter extends DelegatingXmlWriter {
45 |
46 | private DateFormat dateFormat;
47 | private NumberFormat numberFormat;
48 |
49 | public FormattingXmlWriter(XmlWriter writer) {
50 | super(writer);
51 | }
52 |
53 |
54 | /**
55 | * When a Number object is written, it will use this to
56 | * format it. If the argument is null then it uses .toString.
57 | */
58 | public FormattingXmlWriter setNumberFormat(NumberFormat format) {
59 | this.numberFormat = format;
60 | return this;
61 | }
62 |
63 | /**
64 | * When a java.util.Date object is written, it will use this to
65 | * format it. If the argument is null then it uses .toString.
66 | */
67 | public FormattingXmlWriter setDateFormat(DateFormat format) {
68 | this.dateFormat = format;
69 | return this;
70 | }
71 |
72 | public XmlWriter writeEntityWithText(String name, Object text) throws IOException {
73 | return super.writeEntityWithText(name, format(text));
74 | }
75 |
76 | public XmlWriter writeText(Object text) throws IOException {
77 | return super.writeText(format(text));
78 | }
79 |
80 | public XmlWriter writeAttribute(String name, Object value) throws IOException {
81 | return super.writeAttribute(name, format(value));
82 | }
83 |
84 | protected String format(Object unknown) {
85 | /// WHICH STRATEGY TO USE FOR NULL???
86 | if(unknown == null) {
87 | return null;
88 | }
89 |
90 | if(unknown instanceof String) {
91 | return (String)unknown;
92 | }
93 |
94 | if(unknown instanceof Date) {
95 | if(dateFormat == null) {
96 | return unknown.toString();
97 | } else {
98 | return dateFormat.format((Date)unknown);
99 | }
100 | } else
101 | if(unknown instanceof Number) {
102 | if(numberFormat == null) {
103 | return unknown.toString();
104 | } else {
105 | return numberFormat.format((Number)unknown);
106 | }
107 | }
108 |
109 | return unknown.toString();
110 | }
111 |
112 | }
113 |
--------------------------------------------------------------------------------
/src/com/generationjava/io/xml/JarvWriter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003, Henri Yandell
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or
6 | * without modification, are permitted provided that the
7 | * following conditions are met:
8 | *
9 | * + Redistributions of source code must retain the above copyright notice,
10 | * this list of conditions and the following disclaimer.
11 | *
12 | * + Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * + Neither the name of XmlWriter nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software
18 | * without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 | * POSSIBILITY OF SUCH DAMAGE.
31 | */
32 | package com.generationjava.io.xml;
33 |
34 | import java.io.IOException;
35 | import org.iso_relax.verifier.*;
36 | import org.xml.sax.SAXException;
37 | import org.xml.sax.SAXParseException;
38 | import org.xml.sax.ErrorHandler;
39 | import org.xml.sax.helpers.AttributesImpl;
40 |
41 | /// TODO: Supply an ErrorHandler in a constructor
42 | /**
43 | * Validates the written XML against a DTD or XML Schema using
44 | * the iso_relax/jarv library.
45 | */
46 | public class JarvWriter extends DelegatingXmlWriter implements ErrorHandler {
47 |
48 | private VerifierHandler verifierHandler;
49 | private String tag;
50 | private AttributesImpl attrs = new AttributesImpl();
51 | private String text;
52 |
53 | public JarvWriter(XmlWriter writer, VerifierHandler verifierHandler) throws IOException {
54 | super(writer);
55 | this.verifierHandler = verifierHandler;
56 | try {
57 | verifierHandler.startDocument();
58 | } catch(SAXException se) {
59 | throw new IOException("Need to wrap the SAX exception in start document. ");
60 | }
61 | // try {
62 | // VerifierFactory vf = new com.sun.msv.verifier.jarv.TheFactoryImpl();
63 | //// VerifierFactory vf = new org.kohsuke.jarv.xerces.XercesVerifierFactory();
64 | // Schema schema = vf.compileSchema("http://lleu.genscape.com/plantfeed.xsd");
65 | // Verifier v = schema.newVerifier();
66 | // v.setErrorHandler(this);
67 | // VerifierHandler vh = v.getVerifierHandler();
68 | }
69 |
70 | /// TODO: Fix this
71 | private String getDefaultNamespace() {
72 | return "";
73 | }
74 |
75 | /// TODO: Change exception type
76 | private void checkSchema() throws IOException {
77 | if(this.tag == null) {
78 | return;
79 | }
80 | // should use this.namespace
81 | try {
82 | verifierHandler.startElement( getDefaultNamespace(), this.tag, this.tag, attrs );
83 | if(this.text != null) {
84 | verifierHandler.characters( this.text.toCharArray(), 0, this.text.length() );
85 | }
86 | verifierHandler.endElement( getDefaultNamespace(), this.tag, this.tag);
87 | } catch(SAXException se) {
88 | throw new IOException("Need to wrap the SAX exception in start element: "+se);
89 | }
90 | this.attrs.clear();
91 | this.tag = null;
92 | this.text = null;
93 | }
94 |
95 | public XmlWriter writeEntity(String name) throws IOException {
96 | this.tag = name;
97 | return super.writeEntity(name);
98 | }
99 |
100 | public XmlWriter endEntity() throws IOException {
101 | checkSchema();
102 | return super.endEntity();
103 | }
104 |
105 | public XmlWriter writeAttribute(String attr, Object value) throws IOException {
106 | if(value != null) {
107 | // this.attrs.addAttribute( getDefaultNamespace(), attr, attr, value.getClass().getName(), toString(value) );
108 | this.attrs.addAttribute( getDefaultNamespace(), attr, attr, value.getClass().getName(), value.toString() );
109 | }
110 | return super.writeAttribute(attr, value);
111 | }
112 |
113 | public XmlWriter writeText(Object text) throws IOException {
114 | this.text = ""+text;
115 | return super.writeText(text);
116 | }
117 |
118 | public void error(SAXParseException spe) {
119 | System.err.println("Error: "+spe);
120 | }
121 | public void fatalError(SAXParseException spe) {
122 | System.err.println("Fatal: "+spe);
123 | }
124 | public void warning(SAXParseException spe) {
125 | System.err.println("Warning: "+spe);
126 | }
127 |
128 | public void close() throws IOException {
129 | try {
130 | verifierHandler.endDocument();
131 | super.close();
132 | } catch(SAXException se) {
133 | throw new IOException("Need to wrap the SAX exception in end document. ");
134 | }
135 | }
136 |
137 | }
138 |
--------------------------------------------------------------------------------
/src/com/generationjava/io/xml/XmlWriter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2003, Henri Yandell
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or
6 | * without modification, are permitted provided that the
7 | * following conditions are met:
8 | *
9 | * + Redistributions of source code must retain the above copyright notice,
10 | * this list of conditions and the following disclaimer.
11 | *
12 | * + Redistributions in binary form must reproduce the above copyright notice,
13 | * this list of conditions and the following disclaimer in the documentation
14 | * and/or other materials provided with the distribution.
15 | *
16 | * + Neither the name of XmlWriter nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software
18 | * without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 | * POSSIBILITY OF SUCH DAMAGE.
31 | */
32 | package com.generationjava.io.xml;
33 |
34 | import java.io.IOException;
35 | import java.io.Writer;
36 |
37 | /**
38 | * Interface for anything which is able to output Xml.
39 | * Implementations of this interface are expected to either be
40 | * filters on other XmlWriters, ie) subclasses of DelegatingXmlWriter,
41 | * or actual outputters themselves, ie) subclasses of AbstractXmlWriter.
42 | */
43 | public interface XmlWriter {
44 |
45 | /**
46 | * Makes it easy to output the xml version if such a thing is desired.
47 | * While it usually is desired, it is less surprising not to handle it.
48 | */
49 | public XmlWriter writeXmlVersion() throws IOException;
50 |
51 | /** @see XmlWriter.writeXmlVersion(String, String, String) */
52 | public XmlWriter writeXmlVersion(String version, String encoding) throws IOException;
53 |
54 | /**
55 | * Output the version, encoding and standalone nature of an xml file.
56 | */
57 | public XmlWriter writeXmlVersion(String version, String encoding, String standalone) throws IOException;
58 |
59 | /**
60 | * A helper method. It writes out an entity which contains only text.
61 | *
62 | * @param name String name of tag
63 | * @param text String of text to go inside the tag
64 | */
65 | public XmlWriter writeEntityWithText(String name, Object text) throws IOException;
66 |
67 | /**
68 | * A helper method. It writes out empty entities.
69 | *
70 | * @param name String name of tag
71 | */
72 | public XmlWriter writeEmptyEntity(String name) throws IOException;
73 |
74 | /**
75 | * Begin to write out an entity. Unlike the helper tags, this tag
76 | * will need to be ended with the endEntity method.
77 | *
78 | * @param name String name of tag
79 | */
80 | public XmlWriter writeEntity(String name) throws IOException;
81 |
82 | /**
83 | * Write an attribute out for the current entity.
84 | * Any xml characters in the value are escaped.
85 | * Currently it does not actually throw the exception, but
86 | * the api is set that way for future changes.
87 | *
88 | * @param String name of attribute.
89 | * @param Object value of attribute.
90 | */
91 | public XmlWriter writeAttribute(String attr, Object value) throws IOException;
92 |
93 | /**
94 | * End the current entity. This will throw an exception
95 | * if it is called when there is not a currently open
96 | * entity.
97 | */
98 | public XmlWriter endEntity() throws IOException;
99 |
100 | /**
101 | * Close this writer. It does not close the underlying
102 | * writer, but does throw an exception if there are
103 | * as yet unclosed tags.
104 | */
105 | public void close() throws IOException;
106 |
107 | /**
108 | * Output body text. Any xml characters are escaped.
109 | */
110 | public XmlWriter writeText(Object text) throws IOException;
111 |
112 | /**
113 | * Write out a chunk of CDATA. This helper method surrounds the
114 | * passed in data with the CDATA tag.
115 | *
116 | * @param String of CDATA text.
117 | */
118 | public XmlWriter writeCData(String cdata) throws IOException;
119 |
120 | /**
121 | * Write out a chunk of comment. This helper method surrounds the
122 | * passed in data with the xml comment tag.
123 | *
124 | * @param String of text to comment.
125 | */
126 | public XmlWriter writeComment(String comment) throws IOException;
127 |
128 | /**
129 | * Obtain the Writer that is at the lowest level of this XmlWriter chain
130 | */
131 | public Writer getWriter();
132 |
133 | }
134 |
--------------------------------------------------------------------------------
/src/dfEditor/CommandManagerListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor;
21 |
22 | import dfEditor.command.CommandManager;
23 |
24 | /**
25 | *
26 | * @author s4m20
27 | */
28 | public interface CommandManagerListener
29 | {
30 | public void commandStackChanged(CommandManager aManager);
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/src/dfEditor/Compass.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor;
21 |
22 | /**
23 | *
24 | * @author s4m20
25 | */
26 | public class Compass
27 | {
28 | public static final int NONE = (0);
29 | public static final int EAST = (1 << 1);
30 | public static final int WEST = (1 << 2);
31 | public static final int NORTH = (1 << 3);
32 | public static final int SOUTH = (1 << 4);
33 |
34 | public static final int NORTH_EAST = NORTH | EAST;
35 | public static final int NORTH_WEST = NORTH | WEST;
36 | public static final int SOUTH_EAST = SOUTH | EAST;
37 | public static final int SOUTH_WEST = SOUTH | WEST;
38 | }
39 |
--------------------------------------------------------------------------------
/src/dfEditor/CustomComponents/DefaultListCellEditor.java:
--------------------------------------------------------------------------------
1 | package dfEditor.CustomComponents;
2 |
3 | import javax.swing.*;
4 | import java.awt.*;
5 |
6 | // @author Santhosh Kumar T - santhosh@in.fiorano.com
7 | public class DefaultListCellEditor extends DefaultCellEditor implements ListCellEditor{
8 | public DefaultListCellEditor(final JCheckBox checkBox){
9 | super(checkBox);
10 | }
11 |
12 | public DefaultListCellEditor(final JComboBox comboBox){
13 | super(comboBox);
14 | }
15 |
16 | public DefaultListCellEditor(final JTextField textField){
17 | super(textField);
18 | }
19 |
20 | public Component getListCellEditorComponent(JList list, Object value, boolean isSelected, int index){
21 | delegate.setValue(value);
22 | return editorComponent;
23 | }
24 | }
--------------------------------------------------------------------------------
/src/dfEditor/CustomComponents/DefaultMutableListModel.java:
--------------------------------------------------------------------------------
1 | package dfEditor.CustomComponents;
2 |
3 | import javax.swing.*;
4 |
5 |
6 | // @author Santhosh Kumar T - santhosh@in.fiorano.com
7 | public class DefaultMutableListModel extends DefaultListModel implements MutableListModel{
8 | public boolean isCellEditable(int index){
9 | return true;
10 | }
11 |
12 | public void setValueAt(Object value, int index){
13 | super.setElementAt(value, index);
14 | }
15 | }
--------------------------------------------------------------------------------
/src/dfEditor/CustomComponents/ListCellEditor.java:
--------------------------------------------------------------------------------
1 | package dfEditor.CustomComponents;
2 |
3 | import javax.swing.*;
4 | import java.awt.*;
5 |
6 | // @author Santhosh Kumar T - santhosh@in.fiorano.com
7 | public interface ListCellEditor extends CellEditor{
8 | Component getListCellEditorComponent(JList list, Object value,
9 | boolean isSelected,
10 | int index);
11 | }
--------------------------------------------------------------------------------
/src/dfEditor/CustomComponents/MutableListModel.java:
--------------------------------------------------------------------------------
1 | package dfEditor.CustomComponents;
2 |
3 | import javax.swing.*;
4 |
5 | // @author Santhosh Kumar T - santhosh@in.fiorano.com
6 | public interface MutableListModel extends ListModel {
7 | public boolean isCellEditable(int index);
8 | public void setValueAt(Object value, int index);
9 | }
--------------------------------------------------------------------------------
/src/dfEditor/CustomComponents/NamedElement.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this template, choose Tools | Templates
3 | * and open the template in the editor.
4 | */
5 | package dfEditor.CustomComponents;
6 |
7 |
8 | public interface NamedElement {
9 | public String getName();
10 | public void setName(String aName);
11 | }
12 |
--------------------------------------------------------------------------------
/src/dfEditor/CustomNode.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor;
21 |
22 | import javax.swing.tree.DefaultMutableTreeNode;
23 | import java.awt.Color;
24 |
25 | public class CustomNode extends DefaultMutableTreeNode
26 | {
27 | private Color colour = Color.BLUE;
28 | private int childDirUniqueID;
29 | private int childLeafUniqueID;
30 | private boolean isLeaf;
31 | private Object _object;
32 |
33 |
34 | public CustomNode(Object userObject, boolean allowsChildren)
35 | {
36 | super(userObject, allowsChildren);
37 |
38 | isLeaf = !allowsChildren;
39 | childDirUniqueID = 0;
40 | childLeafUniqueID = 0;
41 | }
42 |
43 | @Override
44 | public boolean isLeaf()
45 | {
46 | return isLeaf;
47 | }
48 |
49 | public String suggestNameForChildLeaf()
50 | {
51 | return new String(""+childLeafUniqueID++);
52 |
53 | }
54 |
55 | public String suggestNameForChildDir()
56 | {
57 | return new String(""+childDirUniqueID++);
58 |
59 | }
60 |
61 | public Color getColour()
62 | {
63 | return colour;
64 | }
65 |
66 | public void setColour(Color c)
67 | {
68 | //System.out.println("setting colour of " + this + " to " + c);
69 | colour = c;
70 | }
71 |
72 | public void setCustomObject(final Object aObj)
73 | {
74 | _object = aObj;
75 | }
76 |
77 | public final Object getCustomObject()
78 | {
79 | return _object;
80 | }
81 |
82 | public String getFullPathName()
83 | {
84 | String path = new String("");
85 |
86 | Object[] objects = this.getUserObjectPath();
87 |
88 | for (int i=0; i 0 || !this.isLeaf())
92 | path += "/";
93 | }
94 |
95 | return path;
96 | }
97 |
98 | }
99 |
--------------------------------------------------------------------------------
/src/dfEditor/GraphicPanelChangeListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor;
21 | import java.util.ArrayList;
22 | /**
23 | *
24 | * @author s4m20
25 | */
26 | public interface GraphicPanelChangeListener
27 | {
28 | public void graphicAdded(GraphicPanel aPanel, GraphicObject aGraphic);
29 | public void graphicMoved(GraphicPanel aPanel, GraphicObject aGraphic);
30 | public void graphicSelectionChanged(GraphicPanel aPanel, GraphicObject aGraphic);
31 |
32 | public void graphicErased(GraphicPanel aPanel, GraphicObject aGraphic);
33 | // this is a hack for now, should remove the single and just use array version but requires fair bit of refactoring
34 | public void graphicsErased(GraphicPanel aPanel, ArrayList aGraphics);
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/src/dfEditor/GridGraphicPanel.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor;
21 |
22 | import java.awt.Point;
23 | import java.awt.Color;
24 | import java.awt.Graphics;
25 | import java.awt.Dimension;
26 | import java.awt.Rectangle;
27 |
28 |
29 | /**
30 | *
31 | * @author s4m20
32 | */
33 | public class GridGraphicPanel extends GraphicPanel
34 | {
35 | protected Dimension tileSize = null;
36 | protected Dimension padding = null;
37 |
38 | public GridGraphicPanel(final Dimension aTileSize, final Dimension aPadding)
39 | {
40 | super();
41 |
42 | setTileSize(aTileSize);
43 | setPadding(aPadding);
44 | }
45 |
46 | public GridGraphicPanel()
47 | {
48 | super();
49 |
50 | setTileSize(null);
51 | setPadding(null);
52 | }
53 |
54 | public void setTileSize(final Dimension aTileSize)
55 | {
56 | tileSize = aTileSize;
57 | relayout();
58 | }
59 |
60 | public void setPadding(final Dimension aPadding)
61 | {
62 | padding = aPadding;
63 | relayout();
64 | }
65 |
66 | private void relayout()
67 | {
68 | for (int i=0; i<_drawStack.size(); ++i)
69 | {
70 | dropGraphic(_drawStack.get(i), false);
71 | }
72 |
73 | repaint();
74 | }
75 |
76 | @Override
77 | protected void draw(Graphics g)
78 | {
79 | super.draw(g);
80 | drawGridLines(g, Color.GRAY);
81 | }
82 |
83 | private void drawGridLines(Graphics g, Color aColour)
84 | {
85 | if (tileSize == null || tileSize.width == 0 || tileSize.height == 0)
86 | return;
87 |
88 | g.setColor(aColour);
89 |
90 | Rectangle bounds = this.getGraphicsBounds();
91 | if (bounds == null)
92 | {
93 | bounds = new Rectangle(0, 0, this.getSize().width, this.getSize().height);
94 | }
95 |
96 | Dimension padding = this.padding;
97 | if (padding == null)
98 | padding = new Dimension(0,0);
99 |
100 | float totalWidth = (tileSize.width + padding.width) * this.getZoom();
101 | float totalHeight = (tileSize.height + padding.height) * this.getZoom();
102 |
103 | float startX = (_origin.x % totalWidth) - totalWidth - (padding.width * this.getZoom() / 2);
104 | float startY = (_origin.y % totalHeight) - totalHeight - (padding.height * this.getZoom() / 2);
105 |
106 |
107 | float x = startX;
108 | float y = startY;
109 |
110 | while(x + totalWidth <= bounds.width)
111 | {
112 | x += padding.width * this.getZoom();
113 | y = startY;
114 |
115 | while(y + totalWidth <= bounds.height)
116 | {
117 | y += padding.height * this.getZoom();
118 | g.drawRect((int)x, (int)y, (int)(tileSize.width * this.getZoom()), (int)(tileSize.height * this.getZoom()));
119 | y += tileSize.height * this.getZoom();
120 | }
121 |
122 | x += tileSize.width * this.getZoom();
123 | }
124 | }
125 |
126 | @Override
127 | protected void dropGraphic(GraphicObject aGraphic, boolean aUndoable)
128 | {
129 | Rectangle bounds = this.getGraphicsBounds();
130 | if (bounds == null)
131 | {
132 | bounds = new Rectangle(0, 0, this.getSize().width, this.getSize().height);
133 | }
134 |
135 | Dimension padding = this.padding;
136 | if (padding == null)
137 | padding = new Dimension(0,0);
138 |
139 | Rectangle r = aGraphic.getRect();
140 |
141 | if (this.tileSize != null)
142 | {
143 | Dimension total = new Dimension(
144 | tileSize.width + padding.width,
145 | tileSize.height + padding.height);
146 |
147 |
148 | Point currentCentre = new Point(r.x + r.width/2, r.y + r.height/2);
149 | Point closestPoint = new Point(
150 | (currentCentre.x - (Math.abs(currentCentre.x) % total.width)) + (total.width/2),
151 | (currentCentre.y - (Math.abs(currentCentre.y) % total.height)) + (total.height/2) );
152 |
153 | aGraphic.setRect(new Rectangle(
154 | closestPoint.x - r.width/2,
155 | closestPoint.y - r.height/2,
156 | r.width,
157 | r.height));
158 | }
159 |
160 | super.dropGraphic(aGraphic, aUndoable);
161 | }
162 | }
163 |
--------------------------------------------------------------------------------
/src/dfEditor/ImageModifiedListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor;
21 |
22 | /**
23 | *
24 | * @author s4m20
25 | */
26 | public interface ImageModifiedListener
27 | {
28 | public void imageModified();
29 | }
30 |
--------------------------------------------------------------------------------
/src/dfEditor/ImageUtil.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor;
21 |
22 | import java.awt.image.VolatileImage;
23 | import java.awt.image.BufferedImage;
24 | import java.awt.GraphicsEnvironment;
25 | import java.awt.GraphicsConfiguration;
26 | import java.awt.AlphaComposite;
27 | import java.awt.Color;
28 |
29 |
30 | /**
31 | *
32 | * @author s4m20
33 | */
34 | public class ImageUtil
35 | {
36 | public static VolatileImage createVolatileImage(int width, int height, int transparency)
37 | {
38 | if (width == 0 || height == 0)
39 | return null;
40 |
41 | GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
42 | GraphicsConfiguration gc = ge.getDefaultScreenDevice().getDefaultConfiguration();
43 | VolatileImage image = null;
44 |
45 | image = gc.createCompatibleVolatileImage(width, height, transparency);
46 |
47 | int valid = image.validate(gc);
48 |
49 | if (valid == VolatileImage.IMAGE_INCOMPATIBLE)
50 | {
51 | image = createVolatileImage(width, height, transparency);
52 | }
53 |
54 | return image;
55 | }
56 |
57 | public static VolatileImage createVolatileImage(BufferedImage bi)
58 | {
59 | GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
60 | GraphicsConfiguration gc = ge.getDefaultScreenDevice().getDefaultConfiguration();
61 |
62 | VolatileImage vimage = createVolatileImage(bi.getWidth(), bi.getHeight(), java.awt.Transparency.TRANSLUCENT);
63 |
64 | java.awt.Graphics2D g = null;
65 |
66 | try
67 | {
68 | g = vimage.createGraphics();
69 |
70 | // clear to transparent
71 | g.setComposite(AlphaComposite.Src);
72 | g.setColor(new Color(0,0,0,0));
73 | g.fillRect(0, 0, vimage.getWidth(), vimage.getHeight());
74 |
75 | g.drawImage(bi, null, 0, 0);
76 | }
77 | finally
78 | {
79 | g.dispose();
80 | }
81 |
82 | return vimage;
83 | }
84 |
85 | }
86 |
--------------------------------------------------------------------------------
/src/dfEditor/IntegerTextField.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 |
21 | package dfEditor;
22 |
23 | /**
24 | *
25 | * @author s4m20
26 | */
27 | import java.awt.event.KeyEvent;
28 | import javax.swing.JTextField;
29 |
30 |
31 | public class IntegerTextField extends JTextField {
32 |
33 | final static String badchars
34 | = "`~!@#$%^&*()_+=\\|\"':;?/>.<, ";
35 |
36 | public void processKeyEvent(KeyEvent ev) {
37 |
38 | char c = ev.getKeyChar();
39 |
40 | if((Character.isLetter(c) && !ev.isAltDown())
41 | || badchars.indexOf(c) > -1) {
42 | ev.consume();
43 | return;
44 | }
45 | if(c == '-' && getDocument().getLength() > 0)
46 | ev.consume();
47 | else super.processKeyEvent(ev);
48 |
49 | }
50 | public int getNum()
51 | {
52 | try
53 | {
54 | return Integer.parseInt(this.getText());
55 | }
56 | catch (java.lang.NumberFormatException e)
57 | {
58 | return -1;
59 | }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/dfEditor/MathUtil.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor;
21 |
22 | import java.awt.Rectangle;
23 | import java.awt.Point;
24 | import java.awt.geom.*;
25 |
26 | /**
27 | *
28 | * @author s4m20
29 | */
30 | public class MathUtil
31 | {
32 | public static boolean rectCollide(final Rectangle a, final Rectangle b)
33 | {
34 | if ( a.x > b.x + b.width
35 | || a.y > b.y + b.height
36 | || a.x + a.width < b.x
37 | || a.y + a.height < b.y)
38 | {
39 | return false;
40 | }
41 | return true;
42 | }
43 |
44 | public static boolean pointRectCollide(final Point p, final Rectangle r)
45 | {
46 | if ( p.x < r.x
47 | || p.y < r.y
48 | || p.x > r.x + r.width
49 | || p.y > r.y + r.height )
50 | {
51 | return false;
52 | }
53 | return true;
54 | }
55 |
56 | public static Point rotatePoint2D(final Point aPoint, final float aDeg)
57 | {
58 | double a = Math.toRadians(aDeg);
59 | Point p = new Point();
60 | p.x = (int)((aPoint.x * Math.cos(a)) - (aPoint.y * Math.sin(a)));
61 | p.y = (int)((aPoint.y * Math.cos(a)) + (aPoint.x * Math.sin(a)));
62 |
63 | return p;
64 | }
65 |
66 | public static Point multiplyPoint(final Point aVec, float aMult)
67 | {
68 | return new Point ( (int)(aVec.x * aMult), (int)(aVec.y * aMult));
69 | }
70 |
71 | public static Point dividePoint(final Point aVec, float aDiv)
72 | {
73 | return new Point ( (int)(aVec.x / aDiv), (int)(aVec.y / aDiv));
74 | }
75 |
76 | }
77 |
--------------------------------------------------------------------------------
/src/dfEditor/NodeDroppedListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 |
21 | package dfEditor;
22 |
23 | /**
24 | *
25 | * @author s4m20
26 | */
27 | public interface NodeDroppedListener
28 | {
29 | public void nodeDropped(java.awt.Component c, String nodePath, java.awt.Point point);
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/src/dfEditor/SelectionBox.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor;
21 |
22 | import dfEditor.*;
23 | import java.awt.Rectangle;
24 | import java.awt.Graphics;
25 | import java.awt.Color;
26 | import java.awt.Point;
27 |
28 | /**
29 | *
30 | * @author s4m20
31 | */
32 | public class SelectionBox extends GraphicObject
33 | {
34 | private Color _colInner;
35 | private Color _colOuter;
36 | private Color _colSelected;
37 |
38 | // private float _alpha;
39 | // private SpritesheetPanel _panel;
40 |
41 | public SelectionBox(/*SpritesheetPanel aPanel,*/ Rectangle aRect, Color aColour)
42 | {
43 | super(aRect);
44 |
45 | _bResizable = true;
46 | setBounds(_bounds);
47 |
48 | setColour(aColour);
49 |
50 | _colSelected = new Color(255,255,255,128);
51 |
52 | // _panel = aPanel;
53 | // _alpha = 0.0f;
54 | // this.fadeIn();
55 | }
56 |
57 | public void draw(Graphics g, Point aOffset, float aScale, boolean bDrawSelectedMode)
58 | {
59 | Rectangle r = getRect();
60 |
61 | // bit of a hack to minimise jittering when resizing a box ////////////////
62 | // requires further investigation but this is seriously pissing me off
63 | int xmod = 0;
64 | int ymod = 0;
65 | if ((int)Math.round(r.width * aScale) != (int)(r.width * aScale)) // rounded up width
66 | {
67 | if ((int)Math.round(r.x * aScale) == (int)(r.x * aScale)) // didn't round up x
68 | {
69 | xmod = -1;
70 | }
71 | }
72 | if ((int)Math.round(r.height * aScale) != (int)(r.height * aScale)) // rounded up height
73 | {
74 | if ((int)Math.round(r.y * aScale) == (int)(r.y * aScale)) // didn't round up y
75 | {
76 | ymod = -1;
77 | }
78 | }
79 | ///////////////////////////////////////////////////////////////////////////
80 |
81 | Rectangle drawRect = new Rectangle(
82 | aOffset.x + xmod + ((int)(r.x * aScale)),
83 | aOffset.y + ymod + ((int)(r.y * aScale)),
84 | (int)Math.round(r.width * aScale),
85 | (int)Math.round(r.height * aScale));
86 |
87 | if (isSelected() && bDrawSelectedMode)
88 | {
89 | g.setColor(_colSelected);
90 | }
91 | else
92 | g.setColor(_colInner);
93 |
94 | g.fillRect(drawRect.x, drawRect.y, drawRect.width, drawRect.height);
95 | g.setColor(_colOuter);
96 | g.drawRect(drawRect.x, drawRect.y, drawRect.width, drawRect.height);
97 |
98 | }
99 |
100 | public void setColour(Color aColour)
101 | {
102 | _colOuter = aColour;
103 | _colInner = new Color(
104 | aColour.getRed(),
105 | aColour.getGreen(),
106 | aColour.getBlue(),
107 | aColour.getAlpha() / 2);
108 | }
109 |
110 | public GraphicObject copy()
111 | {
112 | // TODO:
113 | return null;
114 | }
115 |
116 |
117 | // public void fadeIn()
118 | // {
119 | // Fader fader = new Fader();
120 | // fader.fade(this, 0.05f);
121 | // fader.start();
122 | // }
123 | //
124 | // public void fadeOut()
125 | // {
126 | // Fader fader = new Fader();
127 | // fader.fade(this, -0.05f);
128 | // fader.start();
129 | // }
130 | //
131 | // private class Fader extends Thread
132 | // {
133 | // private float mod;
134 | // private SelectionBox graphic;
135 | //
136 | // public void fade(final SelectionBox aGraphic, float aMod)
137 | // {
138 | // this.graphic = aGraphic;
139 | // this.mod = aMod;
140 | // }
141 | //
142 | // public void run()
143 | // {
144 | // while (true)
145 | // {
146 | // try
147 | // {
148 | // sleep(1000 / 30);
149 | // boolean bStop = false;
150 | // graphic._alpha += mod;
151 | // if (graphic._alpha > 1.0f)
152 | // {
153 | // graphic._alpha = 1.0f;
154 | // bStop = true;
155 | // }
156 | // else if (graphic._alpha < 0)
157 | // {
158 | // graphic._alpha = 0;
159 | // bStop = true;
160 | // }
161 | //
162 | // graphic._panel.repaint();
163 | // if (bStop)
164 | // return;
165 | // }
166 | // catch (Exception e)
167 | // {
168 | // e.printStackTrace();
169 | // }
170 | // }
171 | // }
172 | // }
173 |
174 | }
175 |
--------------------------------------------------------------------------------
/src/dfEditor/SimpleGraphicPanel.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 |
21 | package dfEditor;
22 | import java.awt.Color;
23 | import java.awt.Graphics;
24 | import java.awt.Point;
25 |
26 | /**
27 | *
28 | * @author Sam
29 | */
30 | public class SimpleGraphicPanel extends javax.swing.JPanel
31 | {
32 | private GraphicObject graphic = null;
33 |
34 | public SimpleGraphicPanel()
35 | {
36 | //this.setBackground(Color.red);
37 | }
38 |
39 | public void setGraphic(GraphicObject aGraphic)
40 | {
41 | graphic = aGraphic;
42 | }
43 |
44 | @Override
45 | public void paintComponent(Graphics g)
46 | {
47 | super.paintComponent(g);
48 |
49 | if (graphic != null)
50 | {
51 | Point p = new Point((this.getSize().width / 2)-(graphic.getRect().width/2),
52 | (this.getSize().height / 2)-(graphic.getRect().height/2));
53 | graphic.draw(g, p, 1.0f, 1.0f, false);
54 | }
55 | }
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/src/dfEditor/SpriteImagePanel.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 |
21 |
22 | package dfEditor;
23 |
24 | /**
25 | *
26 | * @author s4m20
27 | */
28 | import java.awt.Graphics;
29 | import java.awt.Rectangle;
30 | import java.awt.image.BufferedImage;
31 | //import java.awt.Image;
32 |
33 | public class SpriteImagePanel extends GraphicPanel
34 | {
35 | public SpriteImagePanel()
36 | {
37 | _graphicBounds = new Rectangle(0, 0, 0, 0);
38 | }
39 |
40 | public void setTextureArea(int aWidth, int aHeight)
41 | {
42 | Rectangle r = this.getGraphicsBounds();
43 | this.setGraphicsBounds(new Rectangle(r.x, r.y, aWidth, aHeight));
44 | }
45 |
46 | @Override
47 | protected void draw(Graphics g)
48 | {
49 | super.draw(g);
50 |
51 | this.drawCheckerBoardBuffer(g, convertRectToViewRect(_graphicBounds));
52 | }
53 |
54 | @Override
55 | public void drawStack(Graphics g)
56 | {
57 | Rectangle r = convertRectToViewRect(_graphicBounds);
58 | g.clipRect(r.x, r.y, r.width, r.height);
59 | super.drawStack(g);
60 | g.setClip(null);
61 | }
62 |
63 | public BufferedImage getImage()
64 | {
65 | BufferedImage image = new BufferedImage(_graphicBounds.width, _graphicBounds.height, BufferedImage.TYPE_INT_ARGB);
66 |
67 | if (image != null)
68 | {
69 | Graphics gImg = image.getGraphics();
70 | this.unselectAllGraphics();
71 | super.drawStack(gImg, new java.awt.Point(0,0), 1.0f, 1.0f);
72 | }
73 |
74 | return image;
75 | }
76 |
77 |
78 | }
79 |
--------------------------------------------------------------------------------
/src/dfEditor/SpriteInfoPanel.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
78 |
--------------------------------------------------------------------------------
/src/dfEditor/SpriteList.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 |
21 | package dfEditor;
22 | /**
23 | *
24 | * @author s4m20
25 | */
26 |
27 | import javax.swing.JList;
28 | import java.awt.dnd.*;
29 | import java.awt.datatransfer.*;
30 | import java.awt.Component;
31 | import dfEditor.*;
32 | import java.util.ArrayList;
33 |
34 | public class SpriteList extends JList implements DropTargetListener
35 | {
36 | Component dragOrigin = null;
37 | private ArrayList nodeDroppedListeners = new ArrayList();
38 |
39 | public void addNodeDroppedListener(NodeDroppedListener aListener)
40 | {
41 | nodeDroppedListeners.add(aListener);
42 | }
43 |
44 | public void setDragSource(Component aDragSource)
45 | {
46 | dragOrigin = aDragSource;
47 |
48 | DropTarget dropTarget = new DropTarget(this, this);
49 |
50 | }
51 |
52 | public void dragGestureRecognized(DragGestureEvent dge)
53 | {
54 |
55 | }
56 |
57 | public void drop(DropTargetDropEvent dtde)
58 | {
59 | Transferable transferable = dtde.getTransferable();
60 |
61 | //flavor not supported, reject drop
62 | //DataFlavor dataFlavor = new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType + ";class=dfEditor.GraphicObject");
63 | if (!transferable.isDataFlavorSupported(DataFlavor.stringFlavor))
64 | {
65 | dtde.rejectDrop();
66 | return;
67 | }
68 |
69 | if (dtde.getDropAction() == DnDConstants.ACTION_COPY)
70 | {
71 | try {
72 | String data = (String)transferable.getTransferData(DataFlavor.stringFlavor);
73 | for (int i=0; i
2 |
3 |
20 |
--------------------------------------------------------------------------------
/src/dfEditor/SpriteTreeListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor;
21 |
22 | /**
23 | *
24 | * @author s4m20
25 | */
26 | import dfEditor.CustomNode;
27 |
28 | public interface SpriteTreeListener
29 | {
30 | public void spriteTreeDoubleClicked(CustomNode aNode);
31 | }
32 |
--------------------------------------------------------------------------------
/src/dfEditor/TabComponent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor;
21 |
22 | import javax.swing.JPanel;
23 | import java.awt.FlowLayout;
24 | import javax.swing.JTabbedPane;
25 | import javax.swing.JLabel;
26 | import javax.swing.JButton;
27 | import java.awt.Graphics;
28 | import java.awt.event.ActionListener;
29 | import java.awt.event.ActionEvent;
30 | import java.awt.Color;
31 | import java.awt.Dimension;
32 | import javax.swing.BorderFactory;
33 | import javax.swing.JOptionPane;
34 |
35 | /**
36 | *
37 | * @author s4m20
38 | */
39 | public class TabComponent extends JPanel
40 | {
41 | private JTabbedPane tabbedPane;
42 |
43 | public TabComponent(JTabbedPane aPane)
44 | {
45 | super(new FlowLayout(FlowLayout.LEFT, 0, 0));
46 |
47 | tabbedPane = aPane;
48 |
49 | JLabel title = new JLabel()
50 | {
51 | public String getText()
52 | {
53 | int index = tabbedPane.indexOfTabComponent(TabComponent.this);
54 | if (index >= 0)
55 | return tabbedPane.getTitleAt(index);
56 | return null;
57 | }
58 | };
59 | add(title);
60 |
61 | CloseButton closeButton = new CloseButton();
62 | add(closeButton);
63 |
64 | title.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
65 |
66 | setOpaque(false);
67 |
68 | }
69 |
70 | private class CloseButton extends JButton implements ActionListener
71 | {
72 | public CloseButton()
73 | {
74 | super();
75 |
76 | setPreferredSize(new Dimension(15, 15));
77 | addActionListener(this);
78 | setRolloverEnabled(true);
79 | }
80 |
81 | @Override
82 | public void paintComponent(Graphics g)
83 | {
84 | //super.paintComponent(g);
85 |
86 | Dimension size = this.getSize();
87 |
88 | if (getModel().isRollover())
89 | {
90 | g.setColor(Color.RED);
91 | }
92 | else
93 | {
94 | g.setColor(Color.BLACK);
95 | }
96 |
97 | if (getModel().isPressed())
98 | {
99 | g.translate(1,0);
100 | }
101 |
102 | int space = Math.min(size.width, size.height)/3;
103 | g.drawLine(space, space, size.width - space, size.height - space);
104 | g.drawLine(size.width - space, space, space, size.height - space);
105 |
106 | g.drawLine(space + 1, space, size.width - space, size.height - space);
107 | g.drawLine(size.width - space, space-1, space, size.height - space);
108 | }
109 |
110 | public void actionPerformed(ActionEvent e)
111 | {
112 | int index = tabbedPane.indexOfTabComponent(TabComponent.this);
113 | if (index < 0)
114 | return;
115 |
116 | dfEditorTask currentTask = ((dfEditorTask)tabbedPane.getComponentAt((index)));
117 |
118 | if (!currentTask.hasBeenModified())
119 | tabbedPane.remove(index);
120 | else
121 | {
122 | String[] choices = {" Save ", " Discard ", " Cancel "};
123 |
124 | int choice = JOptionPane.showOptionDialog(
125 | tabbedPane // Center in window.
126 | , "Save changes?" // Message
127 | , "Closing tab" // Title in titlebar
128 | , JOptionPane.YES_NO_OPTION // Option type
129 | , JOptionPane.WARNING_MESSAGE // messageType
130 | , null // Icon (none)
131 | , choices // Button text as above.
132 | , " Save " // Default button's label
133 | );
134 |
135 |
136 |
137 | switch(choice)
138 | {
139 | case 0:
140 | // save
141 | if (currentTask.save())
142 | tabbedPane.remove(index);
143 | break;
144 | case 1:
145 | tabbedPane.remove(index);
146 | break;
147 | case 2:
148 | // cancel
149 | break;
150 | }
151 | }
152 |
153 | }
154 | }
155 |
156 | }
157 |
--------------------------------------------------------------------------------
/src/dfEditor/TaskChangeListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor;
21 |
22 | /**
23 | *
24 | * @author s4m20
25 | */
26 | public interface TaskChangeListener
27 | {
28 | public void taskChanged(dfEditorTask aTask);
29 | }
--------------------------------------------------------------------------------
/src/dfEditor/animation/Animation.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor.animation;
21 |
22 | import java.util.ArrayList;
23 | import dfEditor.CustomComponents.NamedElement;
24 |
25 | /**
26 | *
27 | * @author s4m20
28 | */
29 | public class Animation implements NamedElement
30 | {
31 | private String name = null;
32 | private ArrayList cellList;
33 | private int currentIndex;
34 | private ArrayList animationListeners;
35 | private int loops = 0;
36 |
37 | public Animation(String aName)
38 | {
39 | animationListeners = new ArrayList();
40 | setName(aName);
41 | cellList = new ArrayList();
42 | }
43 |
44 | public Animation copy()
45 | {
46 | Animation copy = new Animation(this.getName());
47 |
48 | for (int i=0; i= 0 && aFromIndex < cellList.size()
85 | && aToIndex >= 0 && aToIndex < cellList.size() )
86 | {
87 | // swap
88 | AnimationCell cell = cellList.get(aFromIndex);
89 | cellList.remove(aFromIndex);
90 | if (aToIndex < cellList.size())
91 | cellList.add(aToIndex, cell);
92 | else
93 | cellList.add(cell);
94 |
95 | for (int i=0; i= 0 && index < cellList.size())
120 | {
121 | currentIndex = index;
122 | }
123 | }
124 |
125 | public void setLoops(final int aLoops)
126 | {
127 | this.loops = aLoops;
128 |
129 | if (this.loops < 0)
130 | this.loops = 0;
131 | }
132 |
133 | public int getLoops()
134 | {
135 | return loops;
136 | }
137 |
138 | public int numCells()
139 | {
140 | if (cellList == null)
141 | return 0;
142 |
143 | return cellList.size();
144 | }
145 |
146 | public AnimationCell getCurrentCell()
147 | {
148 | if (currentIndex >= 0 && cellList.size() > 0)
149 | return cellList.get(currentIndex);
150 |
151 | return null;
152 | }
153 |
154 | public AnimationCell getNextCell()
155 | {
156 | if (++currentIndex < cellList.size())
157 | return cellList.get(currentIndex);
158 |
159 | currentIndex--;
160 | return null;
161 | }
162 |
163 | public AnimationCell getCellAtIndex(int aIndex)
164 | {
165 | if (aIndex < 0 || aIndex >= cellList.size())
166 | return null;
167 | return cellList.get(aIndex);
168 | }
169 |
170 | public int indexOfCell(AnimationCell aCell)
171 | {
172 | if (cellList.contains(aCell))
173 | {
174 | return cellList.indexOf(aCell);
175 | }
176 | return -1;
177 | }
178 |
179 | public void addAnimationListener(AnimationDataListener aListener)
180 | {
181 | animationListeners.add(aListener);
182 | }
183 |
184 | public void removeAnimationListener(AnimationDataListener aListener)
185 | {
186 | animationListeners.remove(aListener);
187 | }
188 | }
189 |
--------------------------------------------------------------------------------
/src/dfEditor/animation/AnimationDataListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor.animation;
21 |
22 | /**
23 | *
24 | * @author s4m20
25 | */
26 | public interface AnimationDataListener
27 | {
28 | public void cellAdded(Animation aAnimation, AnimationCell aCell);
29 | public void cellRemoved(Animation aAnimation, AnimationCell aCell);
30 | public void cellOrderChanged(Animation aAnimation);
31 | }
32 |
--------------------------------------------------------------------------------
/src/dfEditor/animation/AnimationStripListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor.animation;
21 |
22 | /**
23 | *
24 | * @author s4m20
25 | */
26 | public interface AnimationStripListener
27 | {
28 | public void animatedToCell(AnimationCell aCell);
29 | }
30 |
--------------------------------------------------------------------------------
/src/dfEditor/animation/resources/AnimationController.properties:
--------------------------------------------------------------------------------
1 | zoomOutButton.toolTipText=Zoom out
2 | zoomInButton.toolTipText=Zoom in
3 | #NOI18N
4 | zoomInButton.icon=/dfEditor/resources/main_icons/ZoomInSmall.png
5 | #NOI18N
6 | zoomOutButton.icon=/dfEditor/resources/main_icons/ZoomOutSmall.png
7 | jPanel1.border.title=Animations
8 | jLabel1.text=Cell delay:
9 | jPanel2.border.title=Animation Preview
10 | addAnimationButton.toolTipText=Add an animation
11 | removeAnimationButton.toolTipText=Remove selected animation
12 | playButton.text=\
13 | #NOI18N
14 | playButton.icon=/dfEditor/resources/main_icons/PlaySmall.png
15 | jPanel3.border.title=Cells
16 | jPanel1.AccessibleContext.accessibleName=Animations
17 | playButton.toolTipText=Play animation
18 | #NOI18N
19 | addAnimationButton.icon=/dfEditor/resources/main_icons/PlusSmall.png
20 | #NOI18N
21 | removeAnimationButton.icon=/dfEditor/resources/main_icons/MinusSmall.png
22 | addCellButton.toolTipText=Add a cell
23 | #NOI18N
24 | addCellButton.icon=/dfEditor/resources/main_icons/PlusSmall.png
25 | removeCellButton.toolTipText=Remove selected cell
26 | #NOI18N
27 | viewPanel.background=255, 204, 204
28 | jPanel4.border.title=Sprites
29 | addToFrameButton.toolTipText=Add to frame
30 | #NOI18N
31 | addToFrameButton.icon=RightAdd.png
32 | loopLabel.text=Loops:
33 | untitled.AccessibleContext.accessibleName=Untitled
34 | spriteTree.toolTipText=Drag a sprite into the frame to add it
35 | rotateACWButton.toolTipText=Rotate sprite anti-clockwise 90 degrees
36 | #NOI18N
37 | rotateACWButton.icon=/dfEditor/resources/main_icons/ACW.png
38 | rotateCWButton.toolTipText=Rotate sprite clockwise 90 degrees
39 | #NOI18N
40 | rotateCWButton.icon=/dfEditor/resources/main_icons/CW.png
41 | removeSpriteButton.toolTipText=Remove sprite from frame
42 | removeSpriteButton.text=
43 | #NOI18N
44 | removeSpriteButton.icon=/dfEditor/resources/main_icons/Cross.png
45 | spritePreviewTitle.text=\
46 | onionSkinsCheckBox.text=Onion skins
47 | zOrderSpinner.toolTipText=Change the depth of the sprite in the cell (higher = deeper)
48 | zOrderLabel.text=Z-Order:
49 | angleSpinner.toolTipText=Change the depth of the sprite in the cell (higher = deeper)
50 | angleLabel.text=Angle:
51 | flipHCheckBox.text=Flip H
52 | flipVCheckBox.text=Flip V
53 | controlPanel.title=Modify sprite
54 | #NOI18N
55 | controlPanel.font=SansSerif-Plain-11
56 | #NOI18N
57 | controlPanel.frameIcon=/dfEditor/resources/main_icons/SingleSmall.png
58 | addAnimationButton.text=\
59 | removeAnimationButton.text=\
60 | zoomInButton.text=\
61 | zoomOutButton.text=\
62 | addToFrameButton.text=\
63 | addCellButton.text=\
64 | removeCellButton.text=\
65 | #NOI18N
66 | spriteListControlPanel.font=SansSerif 11 Plain
67 | spriteListControlPanel.title=Sprite list
68 | spriteListToggle.text=Sprite list
69 | modifySpriteToggle.text=Modify sprite
70 | #NOI18N
71 | animationPanel1.background=236, 233, 216
72 | duplicateAnimationButton.toolTipText=Duplicate selected animation
73 | duplicateAnimationButton.text=\
74 | #NOI18N
75 | duplicateAnimationButton.icon=/dfEditor/resources/main_icons/copy.png
76 | #NOI18N
77 | exportGif.icon=/dfEditor/resources/main_icons/Star.png
78 | exportGifButton.toolTipText=Export GIF...
79 | exportGifButton.text=\
80 |
--------------------------------------------------------------------------------
/src/dfEditor/animation/resources/RightAdd.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/src/dfEditor/animation/resources/RightAdd.png
--------------------------------------------------------------------------------
/src/dfEditor/command/Command.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor.command;
21 |
22 | /**
23 | *
24 | * @author s4m20
25 | */
26 | public abstract class Command
27 | {
28 | public abstract boolean execute();
29 | }
30 |
--------------------------------------------------------------------------------
/src/dfEditor/command/CommandManager.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor.command;
21 |
22 | import java.util.Stack;
23 | import java.awt.Component;
24 | import dfEditor.CommandManagerListener;
25 |
26 | /**
27 | *
28 | * @author s4m20
29 | */
30 | public class CommandManager
31 | {
32 | private Stack undoStack;
33 | private Stack redoStack;
34 |
35 | private Component undoComponent;
36 | private Component redoComponent;
37 |
38 | private CommandManagerListener listener = null;
39 |
40 | public CommandManager()
41 | {
42 | init();
43 | }
44 |
45 | public CommandManager(Component aUndoComponent, Component aRedoComponent)
46 | {
47 | init();
48 | setUndoComponent(aUndoComponent);
49 | setRedoComponent(aRedoComponent);
50 | }
51 |
52 | public void setListener(CommandManagerListener aListener)
53 | {
54 | listener = aListener;
55 | }
56 |
57 | private void init()
58 | {
59 | undoStack = new Stack();
60 | redoStack = new Stack();
61 | }
62 |
63 | public void setUndoComponent(Component aUndoComponent)
64 | {
65 | undoComponent = aUndoComponent;
66 | undoComponent.setEnabled(undoStack.size() > 0);
67 | }
68 |
69 | public void setRedoComponent(Component aRedoComponent)
70 | {
71 | redoComponent = aRedoComponent;
72 | redoComponent.setEnabled(redoStack.size() > 0);
73 | }
74 |
75 | public void execute(Command command)
76 | {
77 | if (command == null)
78 | return;
79 |
80 | execute(command, true);
81 |
82 | }
83 |
84 | public void execute(Command command, boolean bClearRedoStack)
85 | {
86 | if (command.execute())
87 | {
88 | if (bClearRedoStack)
89 | {
90 | redoStack.clear();
91 | redoComponent.setEnabled(false);
92 | }
93 |
94 | if (command instanceof UndoableCommand) // TODO: bad?
95 | {
96 | undoStack.push(command);
97 | if (undoComponent != null)
98 | undoComponent.setEnabled(true);
99 | }
100 | }
101 |
102 | listener.commandStackChanged(this);
103 | }
104 |
105 | public void undo()
106 | {
107 | if (undoStack.size() > 0)
108 | {
109 | UndoableCommand command = (UndoableCommand)undoStack.pop();
110 | command.undo();
111 |
112 | redoStack.push(command);
113 |
114 | if (redoComponent != null)
115 | redoComponent.setEnabled(true);
116 |
117 | if (undoComponent != null && undoStack.size() == 0)
118 | undoComponent.setEnabled(false);
119 | }
120 | listener.commandStackChanged(this);
121 | }
122 |
123 | public void redo()
124 | {
125 | if (redoStack.size() > 0)
126 | {
127 | UndoableCommand command = (UndoableCommand)redoStack.pop();
128 |
129 | execute(command, false);
130 |
131 | if (redoComponent != null && redoStack.size() == 0)
132 | redoComponent.setEnabled(false);
133 | }
134 | }
135 |
136 | public int sizeOfUndoStack()
137 | {
138 | return undoStack.size();
139 | }
140 |
141 | public void clear()
142 | {
143 | undoStack.clear();
144 | redoStack.clear();
145 | undoComponent.setEnabled(false);
146 | redoComponent.setEnabled(false);
147 | listener.commandStackChanged(this);
148 | }
149 |
150 | public void refreshComponents()
151 | {
152 | undoComponent.setEnabled(undoStack.size() > 0);
153 | redoComponent.setEnabled(redoStack.size() > 0);
154 | }
155 | }
156 |
--------------------------------------------------------------------------------
/src/dfEditor/command/UndoableCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor.command;
21 |
22 | /**
23 | *
24 | * @author s4m20
25 | */
26 | public abstract class UndoableCommand extends Command
27 | {
28 | public abstract void undo();
29 | }
30 |
--------------------------------------------------------------------------------
/src/dfEditor/commands/AddAnimationCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor.commands;
21 |
22 | import dfEditor.command.UndoableCommand;
23 | import dfEditor.animation.*;
24 | import javax.swing.JList;
25 | import dfEditor.CustomComponents.DefaultMutableListModel;
26 |
27 | /**
28 | *
29 | * @author s4m20
30 | */
31 | public class AddAnimationCommand extends UndoableCommand
32 | {
33 | Animation _animation;
34 | JList _animationList;
35 |
36 | public AddAnimationCommand(JList aAnimationList, Animation aAnimation)
37 | {
38 | _animation = aAnimation;
39 | _animationList = aAnimationList;
40 | }
41 |
42 | public boolean execute()
43 | {
44 | ((DefaultMutableListModel)_animationList.getModel()).addElement(_animation);
45 | _animationList.setSelectedValue(_animation, true);
46 |
47 | return true;
48 | }
49 |
50 | public void undo()
51 | {
52 | DefaultMutableListModel model = (DefaultMutableListModel)_animationList.getModel();
53 | model.removeElement(_animation);
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/dfEditor/commands/AddCellCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor.commands;
21 |
22 | import dfEditor.command.UndoableCommand;
23 | import dfEditor.animation.*;
24 | import java.util.ArrayList;
25 | import dfEditor.GraphicObject;
26 | import dfEditor.SpriteGraphic;
27 | import dfEditor.CustomNode;
28 |
29 | /**
30 | *
31 | * @author s4m20
32 | */
33 | public class AddCellCommand extends UndoableCommand
34 | {
35 |
36 | Animation _animation;
37 | AnimationCell _animationCell;
38 |
39 | public AddCellCommand(Animation aAnimation, AnimationCell aCellToCopy)
40 | {
41 | _animation = aAnimation;
42 | _animationCell = aCellToCopy.copy();
43 | }
44 |
45 | public boolean execute()
46 | {
47 | _animation.addCell(_animationCell);
48 |
49 | return true;
50 | }
51 |
52 | public void undo()
53 | {
54 | _animation.removeCell(_animationCell);
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/dfEditor/commands/AddDirNodeCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor.commands;
21 |
22 | import dfEditor.CustomNode;
23 | import dfEditor.commands.*;
24 | import dfEditor.*;
25 | import javax.swing.tree.TreePath;
26 | import javax.swing.tree.DefaultTreeModel;
27 | import javax.swing.tree.DefaultMutableTreeNode;
28 | import javax.swing.JTree;
29 |
30 | /**
31 | *
32 | * @author s4m20
33 | */
34 | public class AddDirNodeCommand extends AddNodeCommand
35 | {
36 | public AddDirNodeCommand(JTree aTree, CustomNode aParentNode, CustomNode aNewNode)
37 | {
38 | super(aTree, aParentNode, aNewNode);
39 | }
40 |
41 | public void insertNewNode(CustomNode parentNode, DefaultMutableTreeNode aNewNode)
42 | {
43 | int insertIndex = parentNode.getChildCount();
44 | while(insertIndex > 0)
45 | {
46 | if (parentNode.getChildAt(insertIndex-1).isLeaf())
47 | insertIndex--;
48 | else
49 | break;
50 | }
51 |
52 | ((DefaultTreeModel)nameTree.getModel()).insertNodeInto(newNode, parentNode, insertIndex);
53 |
54 | TreePath newPath = new TreePath(newNode.getPath());
55 | nameTree.scrollPathToVisible(newPath);
56 | nameTree.setSelectionPath(newPath);
57 | nameTree.startEditingAtPath(newPath);
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/dfEditor/commands/AddGraphicListToSheetCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor.commands;
21 |
22 | import java.util.ArrayList;
23 | import dfEditor.command.*;
24 | import dfEditor.commands.*;
25 | import dfEditor.*;
26 |
27 | /**
28 | *
29 | * @author s4m20
30 | */
31 | public class AddGraphicListToSheetCommand extends UndoableCommand
32 | {
33 | private ArrayList _commands = new ArrayList();
34 |
35 | public AddGraphicListToSheetCommand(
36 | final SpriteTree aTree,
37 | final CustomNode aParentNode,
38 | final GraphicPanel aGraphicPanel,
39 | final ArrayList aGraphics)
40 | {
41 | for (int i=0; i.
18 | */
19 |
20 | package dfEditor.commands;
21 |
22 | import dfEditor.commands.*;
23 | import dfEditor.*;
24 | import dfEditor.command.UndoableCommand;
25 | import java.awt.Color;
26 |
27 | /**
28 | *
29 | * @author s4m20
30 | */
31 | public class AddGraphicToSheetCommand extends UndoableCommand
32 | {
33 | private CustomNode _parentNode;
34 | private GraphicPanel _graphicPanel;
35 | private SpriteTree _tree;
36 | private GraphicObject _graphic;
37 |
38 | private UndoableCommand _newNodeCommand;
39 | private CustomNode _newNode;
40 |
41 | public AddGraphicToSheetCommand(
42 | final SpriteTree aTree,
43 | final CustomNode aParentNode,
44 | final GraphicPanel aGraphicPanel,
45 | final GraphicObject aGraphic)
46 | {
47 | _parentNode = aParentNode;
48 | _tree = aTree;
49 | _graphicPanel = aGraphicPanel;
50 |
51 | _newNode = new CustomNode(_parentNode.suggestNameForChildLeaf(), false);
52 | _newNodeCommand = new AddLeafNodeCommand(_tree, _parentNode, _newNode);
53 |
54 | _graphic = aGraphic;
55 | _graphic.addObserver(_tree);
56 | }
57 |
58 | public boolean execute()
59 | {
60 | _graphicPanel.unselectAllGraphics();
61 | _newNode.setCustomObject(_graphic);
62 |
63 | _graphicPanel.addGraphic(_graphic);
64 | _newNodeCommand.execute();
65 |
66 | return true;
67 | }
68 |
69 | public void undo()
70 | {
71 | _graphicPanel.removeGraphic(_graphic);
72 | _newNodeCommand.undo(); //undo add leaf node
73 | }
74 |
75 | }
76 |
--------------------------------------------------------------------------------
/src/dfEditor/commands/AddLeafNodeCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor.commands;
21 |
22 | import dfEditor.CustomNode;
23 | import dfEditor.commands.*;
24 | import dfEditor.*;
25 | import javax.swing.tree.TreePath;
26 | import javax.swing.tree.DefaultTreeModel;
27 | import javax.swing.tree.DefaultMutableTreeNode;
28 | import javax.swing.JTree;
29 |
30 | /**
31 | *
32 | * @author s4m20
33 | */
34 | public class AddLeafNodeCommand extends AddNodeCommand
35 | {
36 | public AddLeafNodeCommand(JTree aTree, CustomNode aParentNode, CustomNode aNewNode)
37 | {
38 | super(aTree, aParentNode, aNewNode);
39 | }
40 |
41 | public void insertNewNode(CustomNode parentNode, DefaultMutableTreeNode newNode)
42 | {
43 | ((DefaultTreeModel)nameTree.getModel()).insertNodeInto(newNode, parentNode, parentNode.getChildCount());
44 |
45 | TreePath newPath = new TreePath(newNode.getPath());
46 | nameTree.scrollPathToVisible(newPath);
47 | nameTree.setSelectionPath(newPath);
48 | nameTree.startEditingAtPath(newPath);
49 | }
50 | }
--------------------------------------------------------------------------------
/src/dfEditor/commands/AddNodeCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor.commands;
21 |
22 | import dfEditor.CustomNode;
23 | import dfEditor.commands.*;
24 | import dfEditor.*;
25 | import javax.swing.JTree;
26 | import javax.swing.tree.DefaultMutableTreeNode;
27 | import javax.swing.tree.TreePath;
28 | import javax.swing.tree.DefaultTreeModel;
29 | import dfEditor.command.UndoableCommand;
30 | /**
31 | *
32 | * @author s4m20
33 | */
34 | public abstract class AddNodeCommand extends UndoableCommand
35 | {
36 | protected JTree nameTree;
37 | protected CustomNode parentNode;
38 | protected CustomNode newNode;
39 | private TreePath prevSelectedPath;
40 |
41 | public AddNodeCommand(JTree aTree, CustomNode parentNode, CustomNode newNode)
42 | {
43 | this.parentNode = parentNode;
44 | this.nameTree = aTree;
45 | this.newNode = newNode;
46 | }
47 |
48 | public boolean execute()
49 | {
50 | if (parentNode != null)
51 | {
52 | DefaultMutableTreeNode selectedNode = null;
53 | TreePath treePath = nameTree.getSelectionPath();
54 | if (treePath != null)
55 | selectedNode = (DefaultMutableTreeNode)treePath.getLastPathComponent();
56 |
57 | if (selectedNode != null)
58 | this.prevSelectedPath = new TreePath (selectedNode.getPath());
59 | else
60 | this.prevSelectedPath = null;
61 |
62 | insertNewNode(parentNode, newNode);
63 | return true;
64 | }
65 | return false;
66 | }
67 |
68 | public abstract void insertNewNode(CustomNode parentNode, DefaultMutableTreeNode newNode);
69 |
70 | public void undo()
71 | {
72 | ((DefaultTreeModel)nameTree.getModel()).removeNodeFromParent(newNode);
73 | nameTree.setSelectionPath(prevSelectedPath);
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/src/dfEditor/commands/AddSpriteToCellCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor.commands;
21 |
22 | import dfEditor.commands.*;
23 | import dfEditor.animation.*;
24 | import dfEditor.*;
25 | import dfEditor.command.UndoableCommand;
26 | import java.util.ArrayList;
27 | import java.awt.Point;
28 |
29 | /**
30 | *
31 | * @author s4m20
32 | */
33 | public class AddSpriteToCellCommand extends UndoableCommand
34 | {
35 | private CustomNode _spriteNode;
36 | private AnimationController _animationController;
37 | private AnimationCell _cell;
38 | private Point _point;
39 | private ArrayList _graphics = null;
40 |
41 | public AddSpriteToCellCommand(
42 | final CustomNode aSpriteNode,
43 | final AnimationController aController,
44 | final Point aPoint
45 | )
46 | {
47 | _spriteNode = aSpriteNode;
48 | _animationController = aController;
49 | _point = aPoint;
50 | _cell = aController.getWorkingCell();
51 | }
52 |
53 | public boolean execute()
54 | {
55 | if (_graphics == null)
56 | {
57 | ArrayList graphics = _animationController.addNodeToCell(_spriteNode, _cell, _point);
58 | _graphics = graphics;
59 | }
60 | else
61 | {
62 | for (int i=0; i<_graphics.size(); ++i)
63 | _cell.addSprite(_spriteNode, _graphics.get(i));
64 | }
65 |
66 | _animationController.setWorkingCell(_cell);
67 |
68 | return true;
69 | }
70 |
71 | public void undo()
72 | {
73 | for (int i=0; i<_graphics.size(); ++i)
74 | {
75 | _cell.removeGraphic(_graphics.get(i));
76 | }
77 | _animationController.setWorkingCell(_cell);
78 | }
79 |
80 | }
81 |
--------------------------------------------------------------------------------
/src/dfEditor/commands/FlipSpriteCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor.commands;
21 |
22 | import dfEditor.*;
23 | import dfEditor.command.UndoableCommand;
24 |
25 | /**
26 | *
27 | * @author Sam
28 | */
29 | public class FlipSpriteCommand extends UndoableCommand
30 | {
31 | private boolean _bHoriz;
32 | private SpriteGraphic _graphic;
33 | private GraphicPanel _panel;
34 |
35 | public FlipSpriteCommand(final SpriteGraphic aGraphic, final boolean aHoriz, final GraphicPanel aPanel)
36 | {
37 | _graphic = aGraphic;
38 | _bHoriz = aHoriz;
39 | _panel = aPanel;
40 | }
41 |
42 | public boolean execute()
43 | {
44 | _graphic.flip(_bHoriz);
45 |
46 | _panel.notifyGraphicMoved(_graphic);
47 |
48 | return true;
49 | }
50 |
51 | public void undo()
52 | {
53 | _graphic.flip(_bHoriz);
54 | _panel.notifyGraphicMoved(_graphic);
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/dfEditor/commands/FlipSpriteListCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor.commands;
21 |
22 | import java.util.ArrayList;
23 | import dfEditor.command.*;
24 | import dfEditor.commands.*;
25 | import dfEditor.*;
26 |
27 | public class FlipSpriteListCommand extends UndoableCommand
28 | {
29 | private ArrayList _commands = new ArrayList();
30 |
31 | public FlipSpriteListCommand(ArrayList aGraphics, boolean bHoriz, final GraphicPanel aPanel)
32 | {
33 | if (aGraphics != null)
34 | {
35 | for (int i=0; i=0; --i)
56 | _commands.get(i).undo();
57 | }
58 | }
59 |
60 |
--------------------------------------------------------------------------------
/src/dfEditor/commands/GroupedUndoableCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor.commands;
21 |
22 | import java.util.ArrayList;
23 | import dfEditor.command.*;
24 |
25 | public class GroupedUndoableCommand extends UndoableCommand
26 | {
27 | private ArrayList _commands = new ArrayList();
28 |
29 | public GroupedUndoableCommand(ArrayList aCommands)
30 | {
31 | for (int i=0; i=0; --i)
51 | {
52 | UndoableCommand c = _commands.get(i);
53 | c.undo();
54 | }
55 | }
56 | }
57 |
58 |
--------------------------------------------------------------------------------
/src/dfEditor/commands/MoveGraphicCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor.commands;
21 |
22 | import dfEditor.command.UndoableCommand;
23 | import java.awt.Rectangle;
24 | import dfEditor.GraphicObject;
25 | import dfEditor.GraphicPanel;
26 | import java.util.ArrayList;
27 |
28 | /**
29 | *
30 | * @author s4m20
31 | */
32 | public class MoveGraphicCommand extends UndoableCommand
33 | {
34 | private GraphicObject graphic;
35 | private Rectangle newRect;
36 | private Rectangle oldRect;
37 | private GraphicPanel panel;
38 |
39 | public MoveGraphicCommand(final GraphicPanel aPanel, final GraphicObject aGraphic, final Rectangle aDestRect)
40 | {
41 | graphic = aGraphic;
42 | newRect = aDestRect;
43 | oldRect = aGraphic.getSavedRect();
44 | oldRect = new Rectangle(oldRect.x, oldRect.y, oldRect.width, oldRect.height);
45 | panel = aPanel;
46 | }
47 |
48 | public boolean execute()
49 | {
50 | graphic.setRect(newRect);
51 | graphic.saveRect();
52 |
53 | panel.notifyGraphicMoved(graphic);
54 | panel.repaint();
55 |
56 | return true;
57 | }
58 |
59 | public void undo()
60 | {
61 | graphic.setRect(oldRect);
62 | graphic.saveRect();
63 |
64 | panel.notifyGraphicMoved(graphic);
65 | panel.repaint();
66 | }
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/src/dfEditor/commands/RemoveAnimGraphicCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor.commands;
21 |
22 | import dfEditor.command.UndoableCommand;
23 | import dfEditor.animation.*;
24 | import java.util.ArrayList;
25 | import dfEditor.*;
26 | /**
27 | *
28 | * @author s4m20
29 | */
30 | public class RemoveAnimGraphicCommand extends UndoableCommand
31 | {
32 | private Animation _animation;
33 | private AnimationCell _animationCell;
34 | private GraphicObject _graphic;
35 | private CustomNode _node;
36 | private int _zOrder;
37 | private GraphicPanel _panel;
38 |
39 | public RemoveAnimGraphicCommand(
40 | final Animation aAnimation,
41 | final AnimationCell aCell,
42 | final GraphicObject aGraphic,
43 | final GraphicPanel aPanel)
44 | {
45 | _animation = aAnimation;
46 | _animationCell = aCell;
47 | _graphic = aGraphic;
48 | _panel = aPanel;
49 | _zOrder = 0;
50 | }
51 |
52 | public boolean execute()
53 | {
54 | if (_animation == null || _animationCell == null || _graphic == null)
55 | return false;
56 |
57 | _zOrder = _animationCell.zOrderOfGraphic(_graphic);
58 | _node = (_animationCell.nodeForGraphic(_graphic));
59 | _animationCell.removeGraphic(_graphic);
60 | _panel.removeGraphic(_graphic);
61 |
62 | return true;
63 | }
64 |
65 | public void undo()
66 | {
67 | if (_animation == null || _animationCell == null || _graphic == null)
68 | return ;
69 |
70 | _animationCell.addSprite(_node, _graphic);
71 | _animationCell.setZOrder(_graphic, _zOrder);
72 | _panel.addGraphic(_graphic);
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/src/dfEditor/commands/RemoveAnimationCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor.commands;
21 |
22 | import dfEditor.command.UndoableCommand;
23 | import dfEditor.animation.*;
24 | import java.util.ArrayList;
25 | import dfEditor.*;
26 | import javax.swing.JList;
27 | import dfEditor.CustomComponents.DefaultMutableListModel;
28 |
29 |
30 | /**
31 | *
32 | * @author s4m20
33 | */
34 | public class RemoveAnimationCommand extends UndoableCommand
35 | {
36 | private Animation _animation;
37 | JList _animationList;
38 | int index = -1;
39 |
40 | public RemoveAnimationCommand(JList aAnimationList, Animation aAnimation)
41 | {
42 | _animation = aAnimation;
43 | _animationList = aAnimationList;
44 | }
45 |
46 | public boolean execute()
47 | {
48 | if (_animation == null)
49 | return false;
50 |
51 | index = getIndexOfObjectInList(_animation, _animationList);
52 | if (index >= 0 && index < _animationList.getModel().getSize())
53 | {
54 | ((DefaultMutableListModel)_animationList.getModel()).removeElement(_animation);
55 | return true;
56 | }
57 |
58 | return false;
59 | }
60 |
61 | public void undo()
62 | {
63 | if (_animation == null)
64 | return;
65 |
66 | ((DefaultMutableListModel)_animationList.getModel()).add(index, _animation);
67 | }
68 |
69 | private int getIndexOfObjectInList(Object aObj, JList aList)
70 | {
71 | for (int i=0; i.
18 | */
19 |
20 | package dfEditor.commands;
21 |
22 | import dfEditor.command.UndoableCommand;
23 | import dfEditor.animation.*;
24 | /**
25 | *
26 | * @author s4m20
27 | */
28 | public class RemoveCellCommand extends UndoableCommand
29 | {
30 | Animation _animation;
31 | AnimationCell _animationCell;
32 |
33 | public RemoveCellCommand(Animation aAnimation, AnimationCell aCell)
34 | {
35 | _animation = aAnimation;
36 | _animationCell = aCell;
37 | }
38 |
39 | public boolean execute()
40 | {
41 | _animation.removeCell(_animationCell);
42 | return true;
43 | }
44 |
45 | public void undo()
46 | {
47 | _animation.addCell(_animationCell);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/dfEditor/commands/RemoveDirCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor.commands;
21 |
22 | import dfEditor.commands.*;
23 | import dfEditor.CustomNode;
24 | import dfEditor.SpriteTree;
25 | import dfEditor.GraphicPanel;
26 | import dfEditor.command.UndoableCommand;
27 | import java.util.Stack;
28 |
29 | /**
30 | *
31 | * @author s4m20
32 | */
33 | public class RemoveDirCommand extends UndoableCommand
34 | {
35 | CustomNode node;
36 | GraphicPanel panel;
37 | SpriteTree tree;
38 |
39 | Stack commandStack;
40 |
41 | public RemoveDirCommand(final SpriteTree aTree, final GraphicPanel aPanel, final CustomNode aNode)
42 | {
43 | tree = aTree;
44 | panel = aPanel;
45 | node = aNode;
46 |
47 | commandStack = new Stack();
48 | }
49 |
50 | public boolean execute()
51 | {
52 | if (!node.isLeaf())
53 | remove(node);
54 |
55 |
56 | UndoableCommand command = new RemoveNodeCommand(tree, node);//aNode);
57 | commandStack.push(command);
58 | command.execute();
59 |
60 | return true;
61 | }
62 |
63 | private void remove(CustomNode aNode)
64 | {
65 | while (aNode.getChildCount() > 0)
66 | {
67 | CustomNode childNode = (CustomNode)aNode.getLastChild();
68 | UndoableCommand command;
69 |
70 | if (childNode.isLeaf())
71 | {
72 | command = new RemoveGraphicCommand(tree, panel, childNode);
73 | }
74 | else
75 | {
76 | remove(childNode);
77 | command = new RemoveNodeCommand(tree, childNode);
78 |
79 | }
80 | commandStack.push(command);
81 | command.execute();
82 | }
83 |
84 | }
85 |
86 | public void undo()
87 | {
88 | while (commandStack.size() > 0)
89 | {
90 | UndoableCommand command = commandStack.pop();
91 |
92 | command.undo();
93 | }
94 | }
95 |
96 | }
97 |
--------------------------------------------------------------------------------
/src/dfEditor/commands/RemoveGraphicCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor.commands;
21 |
22 | import dfEditor.commands.*;
23 | import dfEditor.CustomNode;
24 | import dfEditor.GraphicObject;
25 | import dfEditor.SpriteTree;
26 | import dfEditor.GraphicPanel;
27 | import dfEditor.command.UndoableCommand;
28 |
29 | /**
30 | *
31 | * @author s4m20
32 | */
33 | public class RemoveGraphicCommand extends UndoableCommand
34 | {
35 | UndoableCommand _removeNodeCommand;
36 | CustomNode _node;
37 | GraphicPanel _panel;
38 |
39 | public RemoveGraphicCommand(SpriteTree aTree, GraphicPanel aPanel, CustomNode aNode)
40 | {
41 | _panel = aPanel;
42 | _node = aNode;
43 | _removeNodeCommand = new RemoveNodeCommand(aTree, _node);
44 | }
45 |
46 | public boolean execute()
47 | {
48 | _panel.removeGraphic((GraphicObject)_node.getCustomObject());
49 | _removeNodeCommand.execute();
50 | return true;
51 | }
52 |
53 | public void undo()
54 | {
55 | _panel.addGraphic((GraphicObject)_node.getCustomObject());
56 | _removeNodeCommand.undo();
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/src/dfEditor/commands/RemoveGraphicListCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor.commands;
21 |
22 | /**
23 | *
24 | * @author s4m20
25 | */
26 |
27 | import java.util.ArrayList;
28 | import dfEditor.command.*;
29 | import dfEditor.commands.*;
30 | import javax.swing.tree.DefaultMutableTreeNode;
31 | import dfEditor.*;
32 |
33 | public class RemoveGraphicListCommand extends UndoableCommand
34 | {
35 | private ArrayList _commands = new ArrayList();
36 |
37 | public RemoveGraphicListCommand(
38 | SpriteTree aTree, GraphicPanel aPanel, CustomNode[] aNodes)
39 | {
40 | for (int i=0; i=0; --i)
60 | _commands.get(i).undo();
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/src/dfEditor/commands/RemoveNodeCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor.commands;
21 |
22 | import dfEditor.commands.*;
23 | import dfEditor.CustomNode;
24 | import dfEditor.command.UndoableCommand;
25 | import javax.swing.tree.DefaultMutableTreeNode;
26 | import javax.swing.tree.TreePath;
27 | import javax.swing.tree.DefaultTreeModel;
28 | import javax.swing.JTree;
29 |
30 | /**
31 | *
32 | * @author s4m20
33 | */
34 | public class RemoveNodeCommand extends UndoableCommand
35 | {
36 | private DefaultMutableTreeNode node = null;
37 | private DefaultMutableTreeNode nodeParent = null;
38 | private int nodeIndex = 0;
39 | private TreePath prevSelectedPath;
40 | private JTree tree;
41 |
42 |
43 | public RemoveNodeCommand(JTree aTree, DefaultMutableTreeNode node)
44 | {
45 | this.tree = aTree;
46 | this.node = node;
47 | }
48 |
49 | public boolean execute()
50 | {
51 | if(null == node)
52 | return false;
53 |
54 | this.prevSelectedPath = new TreePath(node.getPath());
55 |
56 | // select previous sibling
57 | DefaultMutableTreeNode siblingNode = node.getPreviousSibling();
58 | if (null != siblingNode)
59 | tree.setSelectionPath(new TreePath(siblingNode.getPath()));
60 | else if (! node.isRoot())
61 | tree.setSelectionPath(new TreePath(((DefaultMutableTreeNode)node.getParent()).getPath()));
62 |
63 | // then remove the node
64 | if (!node.isRoot())
65 | {
66 | this.nodeParent = (CustomNode)node.getParent();
67 | this.nodeIndex = nodeParent.getIndex(node);
68 |
69 | ((DefaultTreeModel)tree.getModel()).removeNodeFromParent(node);
70 |
71 | return true;
72 | }
73 | return false;
74 | }
75 |
76 | public void undo()
77 | {
78 | DefaultTreeModel model = (DefaultTreeModel)tree.getModel();
79 | if (nodeParent != null)
80 | model.insertNodeInto(node, nodeParent, nodeIndex);
81 | tree.setSelectionPath(prevSelectedPath);
82 | }
83 |
84 | }
85 |
--------------------------------------------------------------------------------
/src/dfEditor/commands/RotateGraphicListCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor.commands;
21 |
22 | import java.util.ArrayList;
23 | import dfEditor.command.*;
24 | import dfEditor.commands.*;
25 | import dfEditor.*;
26 |
27 | public class RotateGraphicListCommand extends UndoableCommand
28 | {
29 | private ArrayList _commands = new ArrayList();
30 |
31 | public RotateGraphicListCommand(ArrayList aGraphics, float aAngle, final GraphicPanel aPanel)
32 | {
33 | if (aGraphics != null)
34 | {
35 | for (int i=0; i=0; --i)
60 | _commands.get(i).undo();
61 | }
62 | }
63 |
64 |
--------------------------------------------------------------------------------
/src/dfEditor/commands/SetGraphicAngleCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor.commands;
21 |
22 | import dfEditor.*;
23 | import dfEditor.command.UndoableCommand;
24 |
25 | /**
26 | *
27 | * @author Sam
28 | */
29 | public class SetGraphicAngleCommand extends UndoableCommand
30 | {
31 | private float _angle;
32 | private float _oldAngle;
33 | private GraphicObject _graphic;
34 | private GraphicPanel _panel;
35 |
36 | public SetGraphicAngleCommand(final GraphicObject aGraphic, final float aAngle, final GraphicPanel aPanel)
37 | {
38 | _graphic = aGraphic;
39 | _angle = aAngle;
40 | _oldAngle = _graphic.getSavedAngle();
41 | _panel = aPanel;
42 | }
43 |
44 | public boolean execute()
45 | {
46 | _graphic.setAngle(_angle);
47 | _graphic.saveAngle();
48 |
49 | _panel.notifyGraphicMoved(_graphic);
50 |
51 | return true;
52 | }
53 |
54 | public void undo()
55 | {
56 | _graphic.setAngle(_oldAngle);
57 | _graphic.saveAngle();
58 |
59 | _panel.notifyGraphicMoved(_graphic);
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/dfEditor/commands/SetGraphicZOrderCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor.commands;
21 | import dfEditor.command.*;
22 | import dfEditor.*;
23 | import dfEditor.animation.*;
24 |
25 | public class SetGraphicZOrderCommand extends UndoableCommand
26 | {
27 | private GraphicObject graphic;
28 | private AnimationController controller;
29 | private AnimationCell cell;
30 | private int zValue;
31 | private int oldValue;
32 |
33 | public SetGraphicZOrderCommand(
34 | final AnimationCell aCell,
35 | final GraphicObject aGraphic,
36 | final AnimationController aController,
37 | final int aValue)
38 | {
39 | graphic = aGraphic;
40 | controller = aController;
41 | cell = aCell;
42 | zValue = aValue;
43 | oldValue = aCell.zOrderOfGraphic(aGraphic);
44 | }
45 |
46 | public boolean execute()
47 | {
48 | cell.setZOrder(graphic, zValue);
49 | controller.zOrdersChanged(cell);
50 |
51 | return true;
52 | }
53 |
54 | public void undo()
55 | {
56 | cell.setZOrder(graphic, oldValue);
57 | controller.zOrdersChanged(cell);
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/src/dfEditor/dfEditorApp.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 |
21 | package dfEditor;
22 |
23 | import org.jdesktop.application.Application;
24 | import org.jdesktop.application.SingleFrameApplication;
25 | import java.io.File;
26 | import javax.swing.UIManager;
27 | import java.awt.Toolkit;
28 | import de.muntjak.tinylookandfeel.*;
29 |
30 |
31 | public class dfEditorApp extends SingleFrameApplication
32 | {
33 | private dfEditorView sv;
34 | /**
35 | * At startup create and show the main frame of the application.
36 | */
37 | @Override protected void startup()
38 | {
39 | final String userDir = dfEditorApp.getUserDataDirectory();
40 | final dfEditorApp self = this;
41 | java.awt.EventQueue.invokeLater(new Runnable()
42 | {
43 | public void run()
44 | {
45 | Toolkit.getDefaultToolkit().setDynamicLayout(true);
46 | System.setProperty("sun.awt.noerasebackground", "true");
47 |
48 | try {
49 | TinyLookAndFeel tiny = new TinyLookAndFeel();
50 | UIManager.setLookAndFeel("de.muntjak.tinylookandfeel.TinyLookAndFeel");
51 | } catch(Exception ex) {
52 | ex.printStackTrace();
53 | }
54 |
55 | self.showMainView();
56 | }
57 | });
58 | }
59 |
60 | private void showMainView()
61 | {
62 | sv = new dfEditorView(this);
63 | this.addExitListener(sv);
64 | show(sv);
65 | }
66 |
67 | private static String getUserDataDirectory()
68 | {
69 | String dir = System.getProperty("user.home") + File.separator + ".dfEditor" + File.separator;
70 | File test = new File(dir);
71 | if (!test.exists())
72 | test.mkdir();
73 | return dir;
74 | }
75 |
76 |
77 | /**
78 | * This method is to initialize the specified window by injecting resources.
79 | * Windows shown in our application come fully initialized from the GUI
80 | * builder, so this additional configuration is not needed.
81 | */
82 | @Override protected void configureWindow(java.awt.Window root) {
83 | }
84 |
85 | /**
86 | * A convenient static getter for the application instance.
87 | * @return the instance of dfEditorApp
88 | */
89 | public static dfEditorApp getApplication() {
90 | return Application.getInstance(dfEditorApp.class);
91 | }
92 |
93 | /**
94 | * Main method launching the application.
95 | */
96 | public static void main(String[] args) {
97 | launch(dfEditorApp.class, args);
98 | }
99 |
100 | @Override
101 | public void shutdown()
102 | {
103 | super.shutdown();
104 | }
105 | }
106 |
--------------------------------------------------------------------------------
/src/dfEditor/dfEditorPanel.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 |
21 | package dfEditor;
22 |
23 |
24 | import dfEditor.command.CommandManager;
25 | import javax.swing.*;
26 | import java.io.File;
27 |
28 |
29 | /**
30 | *
31 | * @author s4m20
32 | */
33 | public abstract class dfEditorPanel extends javax.swing.JPanel implements dfEditorTask, CommandManagerListener
34 | {
35 | protected CommandManager cmdManager = null;
36 | protected JLabel helpLabel = null;
37 | protected TaskChangeListener taskChangeListener = null;
38 | protected boolean bModified = false;
39 | protected File savedFile = null;
40 | protected JFileChooser fileChooser = null;
41 |
42 | public dfEditorPanel(CommandManager aCmdManager, JLabel aHelpLabel, TaskChangeListener aListener, JFileChooser aChooser)
43 | {
44 | this.cmdManager = aCmdManager;
45 | this.helpLabel = aHelpLabel;
46 | this.taskChangeListener = aListener;
47 | this.fileChooser = aChooser;
48 |
49 | aCmdManager.setListener(this);
50 | }
51 |
52 | public void postInit()
53 | {
54 |
55 | }
56 |
57 | public abstract boolean saveAs();
58 | public abstract boolean save();
59 |
60 | @Override
61 | public String getName()
62 | {
63 | return super.getName();
64 | }
65 |
66 | public File getSavedFile()
67 | {
68 | return savedFile;
69 | }
70 |
71 | public void setSavedFile(File aFile)
72 | {
73 | savedFile = aFile;
74 | this.setName(aFile.getName());
75 | }
76 |
77 | public void refreshCommandManagerButtons()
78 | {
79 | cmdManager.refreshComponents();
80 | }
81 |
82 | public void undo()
83 | {
84 | cmdManager.undo();
85 | }
86 |
87 | public void redo()
88 | {
89 | cmdManager.redo();
90 | }
91 |
92 | protected void setModified(boolean aModified)
93 | {
94 | bModified = aModified;
95 | }
96 |
97 | public boolean hasBeenModified()
98 | {
99 | return bModified;
100 | }
101 |
102 | public void commandStackChanged(CommandManager aCmdManager)
103 | {
104 | this.setModified(aCmdManager.sizeOfUndoStack() > 0);
105 | taskChangeListener.taskChanged(this);
106 | }
107 |
108 | }
109 |
--------------------------------------------------------------------------------
/src/dfEditor/dfEditorTask.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor;
21 | import java.io.File;
22 |
23 | /**
24 | *
25 | * @author s4m20
26 | */
27 | public interface dfEditorTask
28 | {
29 | public boolean save();
30 | public boolean saveAs();
31 | public boolean hasBeenModified();
32 | public void refreshCommandManagerButtons();
33 | public void undo();
34 | public void redo();
35 | public File getSavedFile();
36 | public void setSavedFile(File aFile);
37 | public String getName();
38 | }
39 |
--------------------------------------------------------------------------------
/src/dfEditor/io/AnimationSetWriter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Samuel Taylor
3 | *
4 | * This file is part of darkFunction Editor
5 | *
6 | * darkFunction Editor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * darkFunction Editor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 |
16 | * You should have received a copy of the GNU General Public License
17 | * along with darkFunction Editor. If not, see .
18 | */
19 |
20 | package dfEditor.io;
21 |
22 | import dfEditor.*;
23 | import java.io.File;
24 | import dfEditor.animation.*;
25 | import com.generationjava.io.xml.*;
26 | import java.io.BufferedWriter;
27 | import java.io.IOException;
28 | import java.io.FileWriter;
29 | import java.util.ArrayList;
30 | /**
31 | * Interface between the editors and the file system.
32 | * Also encapsulates the format.
33 | *
34 | * @author s4m20
35 | */
36 | public class AnimationSetWriter
37 | {
38 | public AnimationSetWriter()
39 | {
40 |
41 | }
42 |
43 | public void createAnimationSet(File aSaveFile, String aSpritesheetName, ArrayList aAnimList)
44 | {
45 | try
46 | {
47 | BufferedWriter out = new BufferedWriter(new FileWriter(aSaveFile));
48 |
49 | PrettyPrinterXmlWriter xmlwriter = new PrettyPrinterXmlWriter(new SimpleXmlWriter(out));
50 |
51 | xmlwriter.writeXmlVersion();
52 | String comment = "Generated by darkFunction Editor (www.darkfunction.com)";
53 | xmlwriter.writeComment(comment);
54 |
55 | xmlwriter.writeEntity("animations");
56 | xmlwriter.writeAttribute("spriteSheet", aSpritesheetName);
57 | xmlwriter.writeAttribute("ver", "1.2");
58 |
59 | for (int i=0; i graphicList = cell.getGraphicList();
93 | for (int i=0; i.
18 | */
19 |
20 | package dfEditor.io;
21 |
22 | import java.util.ArrayList;
23 | import java.io.File;
24 | import javax.swing.filechooser.*;
25 |
26 |
27 | public class CustomFilter extends FileFilter
28 | {
29 | public final static String EXT_ANIM = "anim";
30 | public final static String EXT_SPRITE = "sprites";
31 | public final static String EXT_GIF = "gif";
32 |
33 | private ArrayList ext = null;
34 |
35 | public CustomFilter()
36 | {
37 | ext = new ArrayList();
38 | }
39 |
40 | public String getExtension()
41 | {
42 | return ext.get(0);
43 | }
44 |
45 | public void addExtension(String aExt)
46 | {
47 | if (!aExt.isEmpty())
48 | {
49 | ext.add(aExt);
50 | }
51 | }
52 |
53 | public boolean accept(File f) {
54 | if (f.isDirectory()) {
55 | return true;
56 | }
57 |
58 | String extension = Utils.getExtension(f);
59 | if (extension != null)
60 | {
61 | for (int i=0; i.
18 | */
19 |
20 | package dfEditor.io;
21 |
22 | import java.io.File;
23 | import javax.xml.parsers.*;
24 | import org.w3c.dom.*;
25 | import javax.swing.tree.DefaultTreeModel;
26 | import dfEditor.CustomNode;
27 | import dfEditor.SelectionBox;
28 | import java.awt.Rectangle;
29 |
30 | /**
31 | *
32 | * @author s4m20
33 | *
34 | * TODO: This file has fuck-all error handling
35 | */
36 | public class SpritesheetReader
37 | {
38 | private Document doc = null;
39 | private File file = null;
40 |
41 | public SpritesheetReader(File aFile)
42 | {
43 | try
44 | {
45 | DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
46 | DocumentBuilder builder = factory.newDocumentBuilder();
47 |
48 | doc = builder.parse(aFile);
49 |
50 | file = aFile;
51 | }
52 | catch (Exception e)
53 | {
54 | // TODO
55 | }
56 | }
57 |
58 | public String getImagePath()
59 | {
60 | NodeList imgList = doc.getElementsByTagName("img");
61 |
62 | if (imgList.getLength() == 0)
63 | return null;
64 |
65 | String imgName = ((Element)imgList.item(0)).getAttribute("name");
66 |
67 | String fullFileName = file.getParentFile().getPath() + "/" + imgName;
68 |
69 | return fullFileName;
70 | }
71 |
72 | public DefaultTreeModel getTreeModel()
73 | {
74 | DefaultTreeModel retTree = null;
75 |
76 | NodeList defList = doc.getElementsByTagName("definitions");
77 |
78 | // only support one bunch of definitions, use the first
79 | if (defList.getLength() > 0)
80 | {
81 | Element first = (Element)defList.item(0);
82 |
83 | if (first != null)
84 | {
85 | NodeList children = first.getChildNodes();
86 | Element firstChild = null;
87 |
88 | for (int i=0; i.
18 | */
19 |
20 | package dfEditor.io;
21 |
22 | import dfEditor.*;
23 | import java.io.File;
24 | import javax.swing.JTree;
25 | import com.generationjava.io.xml.*;
26 | import java.io.BufferedWriter;
27 | import java.io.IOException;
28 | import java.io.FileWriter;
29 |
30 | /**
31 | * Interface between the editors and the file system.
32 | * Also encapsulates the format.
33 | *
34 | * @author s4m20
35 | */
36 | public class SpritesheetWriter
37 | {
38 | public SpritesheetWriter()
39 | {
40 |
41 | }
42 |
43 | public void createSpriteSheet(File aSaveFile, String aImageName, JTree aTree, int aImageWidth, int aImageHeight) throws IOException
44 | {
45 | BufferedWriter out = new BufferedWriter(new FileWriter(aSaveFile));
46 |
47 | PrettyPrinterXmlWriter xmlwriter = new PrettyPrinterXmlWriter(new SimpleXmlWriter(out));
48 |
49 | xmlwriter.writeXmlVersion();
50 | String comment = "Generated by darkFunction Editor (www.darkfunction.com)";
51 | xmlwriter.writeComment(comment);
52 |
53 | xmlwriter.writeEntity("img");
54 | xmlwriter.writeAttribute("name", aImageName);
55 | xmlwriter.writeAttribute("w", aImageWidth);
56 | xmlwriter.writeAttribute("h", aImageHeight);
57 | xmlwriter.writeEntity("definitions");
58 | writeNodeToXml(xmlwriter, (CustomNode)aTree.getModel().getRoot());
59 | xmlwriter.endEntity();
60 | xmlwriter.endEntity();
61 |
62 | xmlwriter.close();
63 | //System.err.println(out.toString());
64 | out.close();
65 | }
66 |
67 | private void writeNodeToXml(XmlWriter xmlwriter, CustomNode node) throws IOException
68 | {
69 | if (node.isLeaf())
70 | {
71 | java.awt.Rectangle r = ((GraphicObject)node.getCustomObject()).getRect();
72 |
73 | xmlwriter.writeEntity("spr");
74 | xmlwriter.writeAttribute("name", node.getUserObject());
75 | xmlwriter.writeAttribute("x", r.x);
76 | xmlwriter.writeAttribute("y", r.y);
77 | xmlwriter.writeAttribute("w", r.width);
78 | xmlwriter.writeAttribute("h", r.height);
79 | xmlwriter.endEntity();
80 | }
81 | else
82 | {
83 | xmlwriter.writeEntity("dir");
84 | xmlwriter.writeAttribute("name", node.getUserObject());
85 |
86 | for (int i=0; i.
18 | */
19 |
20 | package dfEditor.io;
21 |
22 | import java.io.*;
23 |
24 | public class Utils {
25 |
26 | public final static String jpeg = "jpeg";
27 | public final static String jpg = "jpg";
28 | public final static String gif = "gif";
29 | public final static String tiff = "tiff";
30 | public final static String tif = "tif";
31 | public final static String png = "png";
32 | public final static String bmp = "bmp";
33 |
34 | /*
35 | * Get the extension of a file.
36 | */
37 | public static String getExtension(File f) {
38 | String ext = null;
39 | String s = f.getName();
40 | int i = s.lastIndexOf('.');
41 |
42 | if (i > 0 && i < s.length() - 1) {
43 | ext = s.substring(i+1).toLowerCase();
44 | }
45 | return ext;
46 | }
47 |
48 | public static String contentsOfFileWithPath(String path) throws IOException
49 | {
50 | FileInputStream input = new FileInputStream(path);
51 |
52 | StringBuffer strContent = new StringBuffer();
53 |
54 | int ch;
55 | while( (ch = input.read()) != -1)
56 | strContent.append((char)ch);
57 | input.close();
58 |
59 | return strContent.toString();
60 | }
61 |
62 |
63 | }
--------------------------------------------------------------------------------
/src/dfEditor/resources/FeedbackDialog.properties:
--------------------------------------------------------------------------------
1 | # To change this template, choose Tools | Templates
2 | # and open the template in the editor.
3 |
4 | Form.title=Send feedback to darkFunction Software
5 | emailField.text=Email address (optional)
6 | sendButton.text=Send
7 | feedbackField.text=Is there something you want to see in a future release? Do you like a feature or have you spotted a bug? Let me know!
8 |
--------------------------------------------------------------------------------
/src/dfEditor/resources/SingleOrMultiDialog.properties:
--------------------------------------------------------------------------------
1 | jLabel1.text=
My sprites are saved as seperate image files, and I need to combine them into a single sprite sheet.
2 | jLabel2.text=
My sprites are on a single large image, and I need to define their coordinates inside this image.
3 | #NOI18N
4 | jLabel2.font=Tahoma-Plain-12
5 | #NOI18N
6 | jLabel1.font=Tahoma-Plain-12
7 | Form.title=Select editing mode
8 | singleButton.text=Define sprites
9 | #NOI18N
10 | singleButton.icon=main_icons/Single.png
11 | #NOI18N
12 | singleButton.font=Tahoma-Bold-12
13 | multiButton.text=Combine images
14 | #NOI18N
15 | multiButton.icon=main_icons/Multi.png
16 | #NOI18N
17 | multiButton.font=Tahoma-Bold-12
18 |
--------------------------------------------------------------------------------
/src/dfEditor/resources/SpriteImageController.properties:
--------------------------------------------------------------------------------
1 |
2 | addSpriteButton.toolTipText=Add a sprite image
3 | #NOI18N
4 | zoomInButton.icon=main_icons/ZoomIn.png
5 | #NOI18N
6 | zoomOutButton.icon=main_icons/ZoomOut.png
7 | #NOI18N
8 | addSpriteButton.icon=main_icons/Plus.png
9 | #NOI18N
10 | addFolderButton.icon=main_icons/Folder.png
11 | #NOI18N
12 | removeSpriteButton.icon=main_icons/Minus.png
13 | removeSpriteButton.toolTipText=Remove selected sprite image
14 | addFolderButton.toolTipText=Add a new category
15 | zoomInButton.toolTipText=Zoom in
16 | zoomOutButton.toolTipText=Zoom out
17 | removeDirItem.text=Remove
18 | addDirItem.text=Category
19 | addSpriteItem.text=Sprite
20 | newMenu.text=New
21 | removeSpriteItem.text=Remove
22 | jPanel1.border.title=Options
23 | jLabel1.text=Texture size:
24 | jLabel2.text=x
25 | jLabel3.text=Min spacing:
26 | textureWidthField.text=1024
27 | textureHeightField.text=1024
28 | minSpacingField.text=1
29 | Form.AccessibleContext.accessibleName=Untitled
30 | packButton.text=Pack
31 | trimButton.text=Trim selected images
32 | untrimButton.text=Untrim selected images
33 |
--------------------------------------------------------------------------------
/src/dfEditor/resources/SpriteInfoPanel.properties:
--------------------------------------------------------------------------------
1 | spriteName.text=
2 | spriteDimensions.text=
3 |
--------------------------------------------------------------------------------
/src/dfEditor/resources/SpritesheetController.properties:
--------------------------------------------------------------------------------
1 |
2 | addSpriteButton.toolTipText=Add a sprite
3 | removeSpriteItem.text=Remove
4 | removeDirItem.text=Remove
5 | addDirItem.text=Category
6 | addSpriteItem.text=Sprite
7 | newMenu.text=New
8 | #NOI18N
9 | addSpriteButton.icon=main_icons/Plus.png
10 | #NOI18N
11 | removeSpriteButton.icon=main_icons/Minus.png
12 | #NOI18N
13 | zoomInButton.icon=main_icons/ZoomIn.png
14 | #NOI18N
15 | zoomOutButton.icon=main_icons/ZoomOut.png
16 | addFolderButton.toolTipText=Add a folder
17 | #NOI18N
18 | addFolderButton.icon=main_icons/Folder.png
19 | imageButton.toolTipText=Change image...
20 | zoomInButton.toolTipText=Zoom in
21 | zoomOutButton.toolTipText=Zoom out
22 | removeSpriteButton.toolTipText=Remove selected
23 | untitled.AccessibleContext.accessibleName=Untitled
24 |
--------------------------------------------------------------------------------
/src/dfEditor/resources/about.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/src/dfEditor/resources/about.png
--------------------------------------------------------------------------------
/src/dfEditor/resources/dfEditorAboutBox.properties:
--------------------------------------------------------------------------------
1 | title = About: darkFunction Editor
2 |
3 | closeAboutBox.Action.text = &Close
4 |
5 | appDescLabel.text=A 2D sprite & animation tool for game developers
6 |
7 | versionLabel.text=Version\:
8 |
9 | vendorLabel.text=Vendor\:
10 |
11 | homepageLabel.text=Homepage\:
12 | #NOI18N
13 | imageLabel.icon=logo_trans_small.png
14 | jTextArea1.text=End User License Agreement (EULA)\n\n-=General=-\nBy using darkFunction Editor you agree with the points described below.\n\n-=Warranty=-\nThe author shall not be held responsible for any damages, direct or indirect, that may arise from the use of darkFunction Editor.\n\n-=Registration=-\nAnyone may use this software during a trial period of 30 days. Following this test period of 30 days or less, if you wish to continue to use darkFunction Editor, you must purchase a license. The vendor will email you a unique license key on receipt of payment which can be used to register the software.\n\nIf you're using darkFunction Editor for personal use such as self-employed, independent contractors, or hobbyists you are free to use a single license on any computer that you own and are the primary user of. If you're using darkFunction Editor for professional use such as at a company you work for each user will need a license of their own that they are free to use for themselves at work or home.\n\nPurchasing a license grants you rights to use darkFunction Editor for commercial or non-commercial endeavors. While updates are likely to be regularly provided to ensure quality there are no guarantees at time of purchase that additional features beyond what are in the current downloadable version will be available at a later date.\n\n-=Copyright=-\nThe author retains all rights, present and future, to darkFunction Editor.\nCopyright (c) 2010 darkFunction / Samuel Taylor.
15 | #NOI18N
16 | jTextArea1.font=Verdana-Plain-10
17 | CloseButton.text=Continue
18 | registerButton.text=Register
19 | daysLeftLabel.text=30 days remaining in trial period.
20 | #NOI18N
21 | daysLeftLabel.font=Tahoma-Plain-12
22 | licenseTextField.text=Enter License Key
23 | #NOI18N
24 | licenseTextField.font=Tahoma-Bold-14
25 | buyButton.text=Buy license
26 |
--------------------------------------------------------------------------------
/src/dfEditor/resources/dfEditorAboutBoxFree.properties:
--------------------------------------------------------------------------------
1 | title = darkFunction Editor
2 |
3 | closeAboutBox.Action.text = &Close
4 |
5 | appDescLabel.text=A 2D sprite & animation tool for game developers
6 |
7 | versionLabel.text=Version\:
8 |
9 | vendorLabel.text=Vendor\:
10 |
11 | homepageLabel.text=Homepage\:
12 | #NOI18N
13 | imageLabel.icon=logo_trans_small.png
14 | CloseButton.text=Close
15 | licenseArea.text=
16 | #NOI18N
17 | licenseArea.font=Verdana 10 Plain
18 |
--------------------------------------------------------------------------------
/src/dfEditor/resources/dfEditorApp.properties:
--------------------------------------------------------------------------------
1 | # Application global resources
2 |
3 | Application.name = darkFunction darkFunction Editor
4 | Application.title = darkFunction Editor
5 | Application.version = 1.3
6 | Application.vendor = darkFunction Software
7 | Application.homepage=http://www.darkfunction.com
8 | http://www.darkfunction.com
9 | Application.description = A sprite tool for 2D game developers.
10 | Application.vendorId = darkfunction.com
11 | Application.id = dfEditor
12 | Application.lookAndFeel = system
13 | #NOI18N
14 | Plus.icon=main_icons/Plus.png
15 | #NOI18N
16 | Minus.icon=main_icons/Minus.png
17 | #NOI18N
18 | ZoomOut.icon=main_icons/ZoomOut.png
19 | #NOI18N
20 | ZoomIn.icon=main_icons/ZoomIn.png
21 |
--------------------------------------------------------------------------------
/src/dfEditor/resources/dfEditorView.properties:
--------------------------------------------------------------------------------
1 | # Resources for the dfEditorView class
2 |
3 | # top-level menus
4 |
5 | fileMenu.text = File
6 | helpMenu.text = Help
7 |
8 | # @Action resources
9 |
10 | showAboutBox.Action.text = &About...
11 | showAboutBox.Action.shortDescription = Show the application's information dialog
12 |
13 | # status bar resources
14 |
15 | StatusBar.messageTimeout = 5000
16 | StatusBar.busyAnimationRate = 30
17 | StatusBar.idleIcon = busyicons/idle-icon.png
18 | StatusBar.busyIcons[0] = busyicons/busy-icon0.png
19 | StatusBar.busyIcons[1] = busyicons/busy-icon1.png
20 | StatusBar.busyIcons[2] = busyicons/busy-icon2.png
21 | StatusBar.busyIcons[3] = busyicons/busy-icon3.png
22 | StatusBar.busyIcons[4] = busyicons/busy-icon4.png
23 | StatusBar.busyIcons[5] = busyicons/busy-icon5.png
24 | StatusBar.busyIcons[6] = busyicons/busy-icon6.png
25 | StatusBar.busyIcons[7] = busyicons/busy-icon7.png
26 | StatusBar.busyIcons[8] = busyicons/busy-icon8.png
27 | StatusBar.busyIcons[9] = busyicons/busy-icon9.png
28 | StatusBar.busyIcons[10] = busyicons/busy-icon10.png
29 | StatusBar.busyIcons[11] = busyicons/busy-icon11.png
30 | StatusBar.busyIcons[12] = busyicons/busy-icon12.png
31 | StatusBar.busyIcons[13] = busyicons/busy-icon13.png
32 | StatusBar.busyIcons[14] = busyicons/busy-icon14.png
33 | #NOI18N
34 | Main\ view\ panel.background=255, 255, 255
35 | helpLabel.text=
36 | menuItemSaveAs.text=Save as...
37 | editMenu.text=Edit
38 | undoMenuItem.text=Undo
39 | redoMenuItem.text=Redo
40 | jPanel1.TabConstraints.tabTitle=Spritesheet1
41 | #NOI18N
42 | mainPanel.background=212, 208, 200
43 | jMenu2.text=New
44 | newSpritesheetItem.text=Spritesheet
45 | exitMenuItem.text=Quit
46 | loadMenuItem.text=Open...
47 | newAnimationItem.text=Animation set
48 | aboutMenuItem.text=About...
49 | helpLabel.AccessibleContext.accessibleName=
50 | menuItemSave.text=Save
51 |
--------------------------------------------------------------------------------
/src/dfEditor/resources/logo_trans_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/src/dfEditor/resources/logo_trans_small.png
--------------------------------------------------------------------------------
/src/dfEditor/resources/main_icons/ACW.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/src/dfEditor/resources/main_icons/ACW.png
--------------------------------------------------------------------------------
/src/dfEditor/resources/main_icons/CW.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/src/dfEditor/resources/main_icons/CW.png
--------------------------------------------------------------------------------
/src/dfEditor/resources/main_icons/Cross.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/src/dfEditor/resources/main_icons/Cross.png
--------------------------------------------------------------------------------
/src/dfEditor/resources/main_icons/Doc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/src/dfEditor/resources/main_icons/Doc.png
--------------------------------------------------------------------------------
/src/dfEditor/resources/main_icons/DownSmall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/src/dfEditor/resources/main_icons/DownSmall.png
--------------------------------------------------------------------------------
/src/dfEditor/resources/main_icons/Edit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/src/dfEditor/resources/main_icons/Edit.png
--------------------------------------------------------------------------------
/src/dfEditor/resources/main_icons/Folder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/src/dfEditor/resources/main_icons/Folder.png
--------------------------------------------------------------------------------
/src/dfEditor/resources/main_icons/Left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/src/dfEditor/resources/main_icons/Left.png
--------------------------------------------------------------------------------
/src/dfEditor/resources/main_icons/Magnifier.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/src/dfEditor/resources/main_icons/Magnifier.png
--------------------------------------------------------------------------------
/src/dfEditor/resources/main_icons/Minus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/src/dfEditor/resources/main_icons/Minus.png
--------------------------------------------------------------------------------
/src/dfEditor/resources/main_icons/MinusSmall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/src/dfEditor/resources/main_icons/MinusSmall.png
--------------------------------------------------------------------------------
/src/dfEditor/resources/main_icons/Multi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/src/dfEditor/resources/main_icons/Multi.png
--------------------------------------------------------------------------------
/src/dfEditor/resources/main_icons/Play.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/src/dfEditor/resources/main_icons/Play.png
--------------------------------------------------------------------------------
/src/dfEditor/resources/main_icons/PlaySmall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/src/dfEditor/resources/main_icons/PlaySmall.png
--------------------------------------------------------------------------------
/src/dfEditor/resources/main_icons/Plus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/src/dfEditor/resources/main_icons/Plus.png
--------------------------------------------------------------------------------
/src/dfEditor/resources/main_icons/PlusSmall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/src/dfEditor/resources/main_icons/PlusSmall.png
--------------------------------------------------------------------------------
/src/dfEditor/resources/main_icons/Right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/src/dfEditor/resources/main_icons/Right.png
--------------------------------------------------------------------------------
/src/dfEditor/resources/main_icons/RightAdd.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/src/dfEditor/resources/main_icons/RightAdd.png
--------------------------------------------------------------------------------
/src/dfEditor/resources/main_icons/Single.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/src/dfEditor/resources/main_icons/Single.png
--------------------------------------------------------------------------------
/src/dfEditor/resources/main_icons/SingleSmall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/src/dfEditor/resources/main_icons/SingleSmall.png
--------------------------------------------------------------------------------
/src/dfEditor/resources/main_icons/Star.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/src/dfEditor/resources/main_icons/Star.png
--------------------------------------------------------------------------------
/src/dfEditor/resources/main_icons/UpSmall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/src/dfEditor/resources/main_icons/UpSmall.png
--------------------------------------------------------------------------------
/src/dfEditor/resources/main_icons/ZoomIn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/src/dfEditor/resources/main_icons/ZoomIn.png
--------------------------------------------------------------------------------
/src/dfEditor/resources/main_icons/ZoomInSmall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/src/dfEditor/resources/main_icons/ZoomInSmall.png
--------------------------------------------------------------------------------
/src/dfEditor/resources/main_icons/ZoomOut.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/src/dfEditor/resources/main_icons/ZoomOut.png
--------------------------------------------------------------------------------
/src/dfEditor/resources/main_icons/ZoomOutSmall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/src/dfEditor/resources/main_icons/ZoomOutSmall.png
--------------------------------------------------------------------------------
/src/dfEditor/resources/main_icons/copy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/src/dfEditor/resources/main_icons/copy.png
--------------------------------------------------------------------------------
/src/dfEditor/resources/main_icons/pack.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/src/dfEditor/resources/main_icons/pack.png
--------------------------------------------------------------------------------
/src/dfEditor/resources/main_icons/paint.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/src/dfEditor/resources/main_icons/paint.png
--------------------------------------------------------------------------------
/src/dfEditor/resources/splash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/src/dfEditor/resources/splash.png
--------------------------------------------------------------------------------
/win_dist/jsmooth_proj.jsmooth:
--------------------------------------------------------------------------------
1 |
2 |
3 | registry
4 | javahome
5 | jrepath
6 | jdkpath
7 | exepath
8 | jview
9 |
10 | ..\dist\dfEditor.jar
11 | ..\dist\lib\appframework-1.0.3.jar
12 | ..\dist\lib\isorelax.jar
13 | ..\dist\lib\swing-worker-1.1.jar
14 | ..\dist\lib\xmlenc-0.52.jar
15 | ${EXECUTABLEPATH}
16 | false
17 | dfEditor.exe
18 | ..\src\dfEditor\resources\main_icons\Star.png
19 | -1
20 | dfEditor.dfEditorApp
21 | -1
22 |
23 | 1.4.2
24 | Autodownload Wrapper
25 |
26 | Message
27 | Java has not been found on your computer. Do you want to download it?
28 |
29 |
30 | DownloadURL
31 | http://java.sun.com/update/1.6.0/jinstall-6-windows-i586.cab
32 |
33 |
34 | SingleProcess
35 | 1
36 |
37 |
38 | SingleInstance
39 | 0
40 |
41 |
42 | JniSmooth
43 | 0
44 |
45 |
46 | Debug
47 | 0
48 |
49 |
50 |
--------------------------------------------------------------------------------
/yguard/yguard.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/darkFunction/darkFunction-Editor/9c1376f6cdc665a8bda0202ff44197994b6a48ef/yguard/yguard.jar
--------------------------------------------------------------------------------