SDK : Texture Editor: fixed save feature.
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8004 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
91477b73f5
commit
d87e69d97f
@ -1,8 +1,8 @@
|
|||||||
build.xml.data.CRC32=3b9326db
|
build.xml.data.CRC32=4da634b7
|
||||||
build.xml.script.CRC32=8ff5ca92
|
build.xml.script.CRC32=8ff5ca92
|
||||||
build.xml.stylesheet.CRC32=a56c6a5b@1.42.2
|
build.xml.stylesheet.CRC32=a56c6a5b@2.45
|
||||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||||
nbproject/build-impl.xml.data.CRC32=3b9326db
|
nbproject/build-impl.xml.data.CRC32=4da634b7
|
||||||
nbproject/build-impl.xml.script.CRC32=512d1004
|
nbproject/build-impl.xml.script.CRC32=512d1004
|
||||||
nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.42.2
|
nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.45
|
||||||
|
@ -63,6 +63,14 @@
|
|||||||
<specification-version>7.31.2.1</specification-version>
|
<specification-version>7.31.2.1</specification-version>
|
||||||
</run-dependency>
|
</run-dependency>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<code-name-base>org.openide.util.lookup</code-name-base>
|
||||||
|
<build-prerequisite/>
|
||||||
|
<compile-dependency/>
|
||||||
|
<run-dependency>
|
||||||
|
<specification-version>8.10</specification-version>
|
||||||
|
</run-dependency>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<code-name-base>org.openide.windows</code-name-base>
|
<code-name-base>org.openide.windows</code-name-base>
|
||||||
<build-prerequisite/>
|
<build-prerequisite/>
|
||||||
|
@ -47,15 +47,18 @@ import org.openide.DialogDisplayer;
|
|||||||
import org.openide.NotifyDescriptor;
|
import org.openide.NotifyDescriptor;
|
||||||
import org.openide.NotifyDescriptor.Confirmation;
|
import org.openide.NotifyDescriptor.Confirmation;
|
||||||
import org.openide.NotifyDescriptor.Message;
|
import org.openide.NotifyDescriptor.Message;
|
||||||
|
import org.openide.awt.UndoRedo;
|
||||||
import org.openide.cookies.SaveCookie;
|
import org.openide.cookies.SaveCookie;
|
||||||
import org.openide.filesystems.FileChooserBuilder;
|
import org.openide.filesystems.FileChooserBuilder;
|
||||||
import org.openide.filesystems.FileObject;
|
import org.openide.filesystems.FileObject;
|
||||||
import org.openide.nodes.AbstractNode;
|
import org.openide.nodes.AbstractNode;
|
||||||
import org.openide.nodes.Children;
|
import org.openide.nodes.Children;
|
||||||
import org.openide.nodes.Node;
|
import org.openide.nodes.Node;
|
||||||
|
import org.openide.util.lookup.InstanceContent;
|
||||||
|
|
||||||
public class ImageEditorComponent implements EditorToolTarget {
|
public class ImageEditorComponent implements EditorToolTarget {
|
||||||
|
|
||||||
|
|
||||||
private static ImageIcon Icon(String name) {
|
private static ImageIcon Icon(String name) {
|
||||||
return new ImageIcon(ImageEditorComponent.class.getResource("/com/jme3/gde/textureeditor/resources/" + name));
|
return new ImageIcon(ImageEditorComponent.class.getResource("/com/jme3/gde/textureeditor/resources/" + name));
|
||||||
}
|
}
|
||||||
@ -84,6 +87,7 @@ public class ImageEditorComponent implements EditorToolTarget {
|
|||||||
private EditorTool currentTool;
|
private EditorTool currentTool;
|
||||||
private SaveNode saveNode = new SaveNode();
|
private SaveNode saveNode = new SaveNode();
|
||||||
private boolean newFile = false;
|
private boolean newFile = false;
|
||||||
|
private final InstanceContent content;
|
||||||
|
|
||||||
private void doPaint(Graphics2D g) {
|
private void doPaint(Graphics2D g) {
|
||||||
if (editedImage != null) {
|
if (editedImage != null) {
|
||||||
@ -92,6 +96,7 @@ public class ImageEditorComponent implements EditorToolTarget {
|
|||||||
if (currentTool != null) {
|
if (currentTool != null) {
|
||||||
currentTool.drawTrack(g, imageScreen.getWidth(), imageScreen.getHeight(), scaleX, scaleY);
|
currentTool.drawTrack(g, imageScreen.getWidth(), imageScreen.getHeight(), scaleX, scaleY);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImageEditorComponent() {
|
public ImageEditorComponent() {
|
||||||
@ -108,6 +113,13 @@ public class ImageEditorComponent implements EditorToolTarget {
|
|||||||
COMPONENT.add(scroller);
|
COMPONENT.add(scroller);
|
||||||
COMPONENT.add(topContainer, BorderLayout.NORTH);
|
COMPONENT.add(topContainer, BorderLayout.NORTH);
|
||||||
COMPONENT.add(bottomBar, BorderLayout.SOUTH);
|
COMPONENT.add(bottomBar, BorderLayout.SOUTH);
|
||||||
|
//Create a new instance of our dynamic object:
|
||||||
|
content = new InstanceContent();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public InstanceContent getContent() {
|
||||||
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCurrentTool(EditorTool t) {
|
public void setCurrentTool(EditorTool t) {
|
||||||
@ -229,6 +241,7 @@ public class ImageEditorComponent implements EditorToolTarget {
|
|||||||
} else if (source == imageCrop) {
|
} else if (source == imageCrop) {
|
||||||
setCurrentTool(CropTool.create());
|
setCurrentTool(CropTool.create());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
for (AbstractButton b : Arrays.asList(zoomIn, zoomOut, resize, /*save, saveAs,*/
|
for (AbstractButton b : Arrays.asList(zoomIn, zoomOut, resize, /*save, saveAs,*/
|
||||||
@ -253,6 +266,7 @@ public class ImageEditorComponent implements EditorToolTarget {
|
|||||||
Exceptions.printStackTrace(ex);
|
Exceptions.printStackTrace(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void requestFileAndSave() {
|
private void requestFileAndSave() {
|
||||||
@ -303,6 +317,7 @@ public class ImageEditorComponent implements EditorToolTarget {
|
|||||||
Exceptions.printStackTrace(ex);
|
Exceptions.printStackTrace(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void querySizeAndResize() {
|
private void querySizeAndResize() {
|
||||||
@ -372,6 +387,7 @@ public class ImageEditorComponent implements EditorToolTarget {
|
|||||||
} else if (source == spheremap) {
|
} else if (source == spheremap) {
|
||||||
spawnEditor(SphereMappedFilter.create().filter(editedImage));
|
spawnEditor(SphereMappedFilter.create().filter(editedImage));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -435,9 +451,9 @@ public class ImageEditorComponent implements EditorToolTarget {
|
|||||||
|
|
||||||
public void fire(boolean modified) {
|
public void fire(boolean modified) {
|
||||||
if (modified) {
|
if (modified) {
|
||||||
getCookieSet().assign(SaveCookie.class, impl);
|
content.add(impl);
|
||||||
} else {
|
} else {
|
||||||
getCookieSet().assign(SaveCookie.class);
|
content.remove(impl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.1" encoding="UTF-8" ?>
|
||||||
|
|
||||||
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
<Form version="1.4" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||||
<AuxValues>
|
<AuxValues>
|
||||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
|
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
|
||||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||||
@ -11,6 +11,7 @@
|
|||||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||||
|
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/>
|
||||||
</AuxValues>
|
</AuxValues>
|
||||||
|
|
||||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/>
|
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/>
|
||||||
|
@ -15,6 +15,7 @@ import org.openide.windows.WindowManager;
|
|||||||
import org.openide.util.ImageUtilities;
|
import org.openide.util.ImageUtilities;
|
||||||
import org.netbeans.api.settings.ConvertAsProperties;
|
import org.netbeans.api.settings.ConvertAsProperties;
|
||||||
import org.openide.filesystems.FileObject;
|
import org.openide.filesystems.FileObject;
|
||||||
|
import org.openide.util.lookup.AbstractLookup;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Top component which displays something.
|
* Top component which displays something.
|
||||||
@ -35,6 +36,9 @@ public final class ImageEditorTopComponent extends TopComponent {
|
|||||||
setToolTipText(NbBundle.getMessage(ImageEditorTopComponent.class, "HINT_ImageEditorTopComponent"));
|
setToolTipText(NbBundle.getMessage(ImageEditorTopComponent.class, "HINT_ImageEditorTopComponent"));
|
||||||
setIcon(ImageUtilities.loadImage(ICON_PATH, true));
|
setIcon(ImageUtilities.loadImage(ICON_PATH, true));
|
||||||
add(EDITOR.getComponent());
|
add(EDITOR.getComponent());
|
||||||
|
|
||||||
|
//Add the dynamic object to the TopComponent Lookup:
|
||||||
|
associateLookup(new AbstractLookup(EDITOR.getContent()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This method is called from within the constructor to
|
/** This method is called from within the constructor to
|
||||||
|
Loading…
x
Reference in New Issue
Block a user