mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-25 22:40:49 +00:00
Checkstyle fix
This commit is contained in:
@@ -132,8 +132,8 @@ import com.jpexs.decompiler.flash.importers.SpriteImporter;
|
||||
import com.jpexs.decompiler.flash.importers.SwfXmlImporter;
|
||||
import com.jpexs.decompiler.flash.importers.SymbolClassImporter;
|
||||
import com.jpexs.decompiler.flash.importers.TextImporter;
|
||||
import com.jpexs.decompiler.flash.importers.amf.amf3.Amf3Importer;
|
||||
import com.jpexs.decompiler.flash.importers.amf.AmfParseException;
|
||||
import com.jpexs.decompiler.flash.importers.amf.amf3.Amf3Importer;
|
||||
import com.jpexs.decompiler.flash.importers.svg.SvgImporter;
|
||||
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
|
||||
import com.jpexs.decompiler.flash.tags.DefineBinaryDataTag;
|
||||
@@ -361,7 +361,7 @@ public class CommandLineArgumentParser {
|
||||
if (filter == null) {
|
||||
out.println(PREFIX + "myfile.swf");
|
||||
exampleFound = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (filter == null || filter.equals("export") || filter.equals("format") || filter.equals("selectclass") || filter.equals("onerror")) {
|
||||
out.println(PREFIX + "-export script \"C:\\decompiled\" myfile.swf");
|
||||
@@ -1741,7 +1741,7 @@ public class CommandLineArgumentParser {
|
||||
System.err.println("Process affinity setting is only available on Windows platform.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void parseChangeImport(Stack<String> args, Map<String, String> changedImports) {
|
||||
if (args.size() < 2) {
|
||||
System.err.println("source and target of import expected");
|
||||
@@ -1749,7 +1749,7 @@ public class CommandLineArgumentParser {
|
||||
}
|
||||
changedImports.put(args.pop(), args.pop());
|
||||
}
|
||||
|
||||
|
||||
private static UrlResolver parseImportAssets(Stack<String> args, Map<String, String> changedImports) {
|
||||
if (args.isEmpty()) {
|
||||
System.err.println("importassets options expected");
|
||||
@@ -1760,7 +1760,7 @@ public class CommandLineArgumentParser {
|
||||
boolean doResolve = false;
|
||||
boolean doAsk = false;
|
||||
boolean localOnly = false;
|
||||
for (String impOption:impOptionsArr) {
|
||||
for (String impOption : impOptionsArr) {
|
||||
switch (impOption) {
|
||||
case "yes":
|
||||
doResolve = true;
|
||||
@@ -2068,7 +2068,7 @@ public class CommandLineArgumentParser {
|
||||
startTimeSwf = System.currentTimeMillis();
|
||||
System.out.println("Start exporting " + inFile.getName());
|
||||
}
|
||||
|
||||
|
||||
OpenableSourceInfo sourceInfo = new OpenableSourceInfo(null, inFile.getAbsolutePath(), inFile.getName());
|
||||
SWF swf;
|
||||
try {
|
||||
@@ -2247,7 +2247,7 @@ public class CommandLineArgumentParser {
|
||||
boolean exportAs3Script = exportAllScript || exportFormats.contains("script_as3");
|
||||
if (exportAs2Script || exportAs3Script) {
|
||||
System.out.println("Exporting scripts...");
|
||||
|
||||
|
||||
String scriptsFolder = Path.combine(outDir, ScriptExportSettings.EXPORT_FOLDER_NAME);
|
||||
Path.createDirectorySafe(new File(scriptsFolder));
|
||||
String singleFileName = Path.combine(scriptsFolder, swf.getShortFileName() + scriptExportSettings.getFileExtension());
|
||||
@@ -3516,7 +3516,7 @@ public class CommandLineArgumentParser {
|
||||
if (format == null) {
|
||||
format = "html";
|
||||
}
|
||||
|
||||
|
||||
if (!format.equals("html")) {
|
||||
badArguments("doc");
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import java.util.Scanner;
|
||||
|
||||
/**
|
||||
* Console Url resolver
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class ConsoleUrlResolver implements UrlResolver {
|
||||
@@ -42,7 +43,7 @@ public class ConsoleUrlResolver implements UrlResolver {
|
||||
|
||||
private boolean ignoredInfoPrinted = false;
|
||||
private Character toAll = null;
|
||||
|
||||
|
||||
private Map<String, String> importSources = new HashMap<>();
|
||||
|
||||
/**
|
||||
@@ -64,14 +65,14 @@ public class ConsoleUrlResolver implements UrlResolver {
|
||||
|
||||
Character choice = toAll;
|
||||
String currentUrl = url;
|
||||
|
||||
|
||||
if (importSources.containsKey(url)) {
|
||||
currentUrl = importSources.get(url);
|
||||
if (currentUrl.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
choice = 'y';
|
||||
} else {
|
||||
} else {
|
||||
if (choice == null && doResolve) {
|
||||
choice = 'y';
|
||||
}
|
||||
@@ -86,9 +87,8 @@ public class ConsoleUrlResolver implements UrlResolver {
|
||||
choice = ask(url);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
while(choice != 'n') {
|
||||
|
||||
while (choice != 'n') {
|
||||
if (choice == 'c') {
|
||||
System.out.println("Enter new location instead (empty to cancel):");
|
||||
Scanner sc = new Scanner(System.in);
|
||||
@@ -115,7 +115,7 @@ public class ConsoleUrlResolver implements UrlResolver {
|
||||
File swf = new File(new File(basePath).getParentFile(), currentUrl);
|
||||
if (swf.exists()) {
|
||||
try {
|
||||
SWF ret = open(new FileInputStream(swf), swf.getAbsolutePath(), swf.getName());
|
||||
SWF ret = open(new FileInputStream(swf), swf.getAbsolutePath(), swf.getName());
|
||||
return ret;
|
||||
} catch (Exception ex) {
|
||||
//ignore
|
||||
@@ -144,10 +144,10 @@ public class ConsoleUrlResolver implements UrlResolver {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private SWF open(InputStream is, String file, String fileTitle) throws Exception {
|
||||
OpenableSourceInfo sourceInfo = new OpenableSourceInfo(is, file, fileTitle);
|
||||
return new SWF(new BufferedInputStream(is), sourceInfo.getFile(), sourceInfo.getFileTitle(), null, Configuration.parallelSpeedUp.get(), false, true, this, null /*??*/);
|
||||
return new SWF(new BufferedInputStream(is), sourceInfo.getFile(), sourceInfo.getFileTitle(), null, Configuration.parallelSpeedUp.get(), false, true, this, null /*??*/);
|
||||
}
|
||||
|
||||
private String prompt() {
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package com.jpexs.decompiler.flash.easygui;
|
||||
|
||||
import com.jpexs.decompiler.flash.tags.DefineSpriteTag;
|
||||
import com.jpexs.decompiler.flash.tags.Tag;
|
||||
import com.jpexs.decompiler.flash.tags.base.ButtonTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.CharacterTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.ShapeTag;
|
||||
@@ -32,29 +31,30 @@ import javax.swing.tree.DefaultMutableTreeNode;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
class CharacterTagTransferHandler extends TransferHandler {
|
||||
class CharacterTagTransferHandler extends TransferHandler {
|
||||
|
||||
@Override
|
||||
protected Transferable createTransferable(JComponent c) {
|
||||
JTreeTable table = (JTreeTable) c;
|
||||
int selectedRow = table.getSelectedRow();
|
||||
@Override
|
||||
protected Transferable createTransferable(JComponent c) {
|
||||
JTreeTable table = (JTreeTable) c;
|
||||
int selectedRow = table.getSelectedRow();
|
||||
|
||||
if (selectedRow >= 0) {
|
||||
DefaultMutableTreeNode mn = (DefaultMutableTreeNode) table.getModel().getValueAt(selectedRow, 0);
|
||||
Object o = mn.getUserObject();
|
||||
if ((o instanceof DefineSpriteTag)
|
||||
|| (o instanceof ShapeTag)
|
||||
|| (o instanceof TextTag)
|
||||
|| (o instanceof ButtonTag)
|
||||
) {
|
||||
return new CharacterTagTransferable((CharacterTag) o);
|
||||
}
|
||||
if (selectedRow >= 0) {
|
||||
DefaultMutableTreeNode mn = (DefaultMutableTreeNode) table.getModel().getValueAt(selectedRow, 0);
|
||||
Object o = mn.getUserObject();
|
||||
if (
|
||||
(o instanceof DefineSpriteTag)
|
||||
|| (o instanceof ShapeTag)
|
||||
|| (o instanceof TextTag)
|
||||
|| (o instanceof ButtonTag)
|
||||
) {
|
||||
return new CharacterTagTransferable((CharacterTag) o);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSourceActions(JComponent c) {
|
||||
return COPY;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSourceActions(JComponent c) {
|
||||
return COPY;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,15 +29,16 @@ import javax.swing.JPanel;
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class EasyPanel extends JPanel {
|
||||
|
||||
|
||||
/**
|
||||
* TODO: switch to true when Easy mode is released.
|
||||
* I think it's not production ready yet.
|
||||
* TODO: switch to true when Easy mode is released. I think it's not
|
||||
* production ready yet.
|
||||
*/
|
||||
public static final boolean EASY_AVAILABLE = true;
|
||||
|
||||
|
||||
private TabSwitcher<SWF> tabSwitcher;
|
||||
private EasySwfPanel easySwfPanel;
|
||||
|
||||
public EasyPanel(MainPanel mainPanel) {
|
||||
easySwfPanel = new EasySwfPanel(mainPanel);
|
||||
tabSwitcher = new TabSwitcher<>(easySwfPanel);
|
||||
@@ -47,30 +48,30 @@ public class EasyPanel extends JPanel {
|
||||
@Override
|
||||
public void tabSwitched(SWF value) {
|
||||
easySwfPanel.setTimelined(value);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void setSwfs(List<SWF> swfs) {
|
||||
tabSwitcher.clear();
|
||||
for (SWF swf : swfs) {
|
||||
tabSwitcher.addTab(swf, swf.getShortPathTitle(), View.getIcon("flash16"));
|
||||
}
|
||||
}
|
||||
easySwfPanel.clearUndos();
|
||||
}
|
||||
|
||||
|
||||
public void setSwf(SWF swf) {
|
||||
tabSwitcher.setValue(swf);
|
||||
}
|
||||
|
||||
|
||||
public void setNoSwf() {
|
||||
easySwfPanel.setTimelined(null);
|
||||
}
|
||||
|
||||
|
||||
public SWF getSwf() {
|
||||
return tabSwitcher.getSelectedValue();
|
||||
}
|
||||
|
||||
|
||||
public void dispose() {
|
||||
setSwfs(new ArrayList<>());
|
||||
easySwfPanel.dispose();
|
||||
|
||||
@@ -100,7 +100,7 @@ public class EasySwfPanel extends JPanel {
|
||||
private JLabel timelineLabel;
|
||||
private JButton closeTimelineButton;
|
||||
private JPanel propertiesPanel;
|
||||
|
||||
|
||||
private static final String PROPERTIES_DOCUMENT = "Document";
|
||||
private static final String PROPERTIES_INSTANCE = "Instance";
|
||||
private DocumentPropertiesPanel documentPropertiesPanel;
|
||||
@@ -115,7 +115,7 @@ public class EasySwfPanel extends JPanel {
|
||||
stagePanel.setShowAllDepthLevelsInfo(false);
|
||||
stagePanel.setSelectionMode(true);
|
||||
stagePanel.setMultiSelect(true);
|
||||
|
||||
|
||||
stagePanel.addEventListener(new MediaDisplayListener() {
|
||||
@Override
|
||||
public void mediaDisplayStateChanged(MediaDisplay source) {
|
||||
@@ -124,9 +124,9 @@ public class EasySwfPanel extends JPanel {
|
||||
@Override
|
||||
public void run() {
|
||||
setTimelined(stagePanel.getTimelined(), false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,9 +136,9 @@ public class EasySwfPanel extends JPanel {
|
||||
|
||||
@Override
|
||||
public void statusChanged(String status) {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
stagePanel.addPlaceObjectSelectedListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -160,24 +160,24 @@ public class EasySwfPanel extends JPanel {
|
||||
final RegistrationPointPosition regPointPos = stagePanel.getRegistrationPointPosition();
|
||||
|
||||
final List<MATRIX> fpreviousMatrices = new ArrayList<>();
|
||||
|
||||
|
||||
{
|
||||
List<DepthState> dss = getSelectedDepthStates();
|
||||
for (DepthState ds : dss) {
|
||||
if (ds == null) {
|
||||
fpreviousMatrices.add(null);
|
||||
} else {
|
||||
fpreviousMatrices.add(ds.matrix);
|
||||
}
|
||||
List<DepthState> dss = getSelectedDepthStates();
|
||||
for (DepthState ds : dss) {
|
||||
if (ds == null) {
|
||||
fpreviousMatrices.add(null);
|
||||
} else {
|
||||
fpreviousMatrices.add(ds.matrix);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
final boolean transformEnabled = transformEnabled();
|
||||
undoManager.doOperation(new DoableOperation() {
|
||||
|
||||
private final List<Boolean> wasModified = new ArrayList<>();
|
||||
Timelined timelined = stagePanel.getTimelined();
|
||||
|
||||
|
||||
@Override
|
||||
public void doOperation() {
|
||||
if (timelined != EasySwfPanel.this.timelined) {
|
||||
@@ -187,13 +187,13 @@ public class EasySwfPanel extends JPanel {
|
||||
for (int i = 0; i < depths.size(); i++) {
|
||||
int depth = depths.get(i);
|
||||
DepthState ds = stagePanel.getTimelined().getTimeline().getFrame(frame).layers.get(depth);
|
||||
wasModified.add(ds.placeObjectTag.isModified());
|
||||
|
||||
wasModified.add(ds.placeObjectTag.isModified());
|
||||
|
||||
Matrix contMat = newMatrix.concatenate(new Matrix(fpreviousMatrices.get(i)));
|
||||
|
||||
|
||||
ds.placeObjectTag.setMatrix(contMat.toMATRIX());
|
||||
ds.placeObjectTag.setPlaceFlagHasMatrix(newMatrix != null);
|
||||
ds.placeObjectTag.setModified(true);
|
||||
ds.placeObjectTag.setModified(true);
|
||||
}
|
||||
timelined.resetTimeline();
|
||||
stagePanel.repaint();
|
||||
@@ -260,24 +260,23 @@ public class EasySwfPanel extends JPanel {
|
||||
if ((tag instanceof DefineSpriteTag)
|
||||
|| (tag instanceof ShapeTag)
|
||||
|| (tag instanceof TextTag)
|
||||
|| (tag instanceof ButtonTag)
|
||||
) {
|
||||
|| (tag instanceof ButtonTag)) {
|
||||
|
||||
undoManager.doOperation(new TimelinedTagListDoableOperation(EasySwfPanel.this, stagePanel.getTimelined()) {
|
||||
|
||||
|
||||
private List<Tag> swfTags;
|
||||
|
||||
|
||||
@Override
|
||||
public void doOperation() {
|
||||
super.doOperation();
|
||||
CharacterTag ch = (CharacterTag) tag;
|
||||
int maxDepth = timelined.getTimeline().getMaxDepth();
|
||||
int newDepth = maxDepth + 1;
|
||||
|
||||
|
||||
if (timelined.getSwf() != timelined) {
|
||||
swfTags = timelined.getSwf().getTags().toArrayList();
|
||||
}
|
||||
|
||||
|
||||
ShowFrameTag showFrameTag = timelined.getTimeline().getFrame(fframe).showFrameTag;
|
||||
PlaceObject2Tag place = new PlaceObject2Tag(timelined.getSwf());
|
||||
place.depth = newDepth;
|
||||
@@ -290,21 +289,20 @@ public class EasySwfPanel extends JPanel {
|
||||
timelined.addTag(place);
|
||||
} else {
|
||||
timelined.addTag(timelined.indexOfTag(showFrameTag), place);
|
||||
|
||||
|
||||
RemoveObject2Tag remove = new RemoveObject2Tag(timelined.getSwf());
|
||||
remove.depth = newDepth;
|
||||
timelined.addTag(timelined.indexOfTag(showFrameTag) + 1, remove);
|
||||
timelined.addTag(timelined.indexOfTag(showFrameTag) + 1, remove);
|
||||
}
|
||||
|
||||
|
||||
|
||||
DefineBeforeUsageFixer fixer = new DefineBeforeUsageFixer();
|
||||
boolean tagOrderChanged = fixer.fixDefineBeforeUsage(timelined.getSwf());
|
||||
if (!tagOrderChanged) {
|
||||
swfTags = null;
|
||||
}
|
||||
|
||||
|
||||
timelined.resetTimeline();
|
||||
stagePanel.repaint();
|
||||
stagePanel.repaint();
|
||||
timelinePanel.refresh();
|
||||
timelinePanel.setDepth(newDepth);
|
||||
}
|
||||
@@ -313,7 +311,7 @@ public class EasySwfPanel extends JPanel {
|
||||
public void undoOperation() {
|
||||
super.undoOperation();
|
||||
timelined.resetTimeline();
|
||||
|
||||
|
||||
//Tag order changed, put the original tags back
|
||||
if (swfTags != null) {
|
||||
SWF swf = timelined.getSwf();
|
||||
@@ -322,11 +320,11 @@ public class EasySwfPanel extends JPanel {
|
||||
for (int i = 0; i < size; i++) {
|
||||
swf.removeTag(0);
|
||||
}
|
||||
for (int i = 0; i < swfTags.size(); i++) {
|
||||
for (int i = 0; i < swfTags.size(); i++) {
|
||||
swf.addTag(swfTags.get(i));
|
||||
}
|
||||
swf.resetTimeline();
|
||||
}
|
||||
}
|
||||
stagePanel.repaint();
|
||||
timelinePanel.refresh();
|
||||
timelinePanel.setFrame(fframe, fdepths);
|
||||
@@ -354,8 +352,6 @@ public class EasySwfPanel extends JPanel {
|
||||
|
||||
JPanel topPanel = new JPanel(new BorderLayout());
|
||||
|
||||
|
||||
|
||||
undoButton = new JButton(View.getIcon("rotateanticlockwise16"));
|
||||
//undoButton.setToolTipText("Undo");
|
||||
undoButton.setMargin(new Insets(5, 5, 5, 5));
|
||||
@@ -380,7 +376,7 @@ public class EasySwfPanel extends JPanel {
|
||||
redoButton.setEnabled(false);
|
||||
undoButton.setToolTipText(EasyStrings.translate("undo.cannot"));
|
||||
redoButton.setToolTipText(EasyStrings.translate("redo.cannot"));
|
||||
|
||||
|
||||
Runnable undoChangeListener = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -390,7 +386,6 @@ public class EasySwfPanel extends JPanel {
|
||||
|
||||
undoManager.addChangeListener(undoChangeListener);
|
||||
|
||||
|
||||
JPanel toolbarPanel = new JPanel(new BorderLayout());
|
||||
JPanel leftToolbar = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
|
||||
leftToolbar.add(undoButton);
|
||||
@@ -400,31 +395,31 @@ public class EasySwfPanel extends JPanel {
|
||||
leftToolbar.add(timelineLabel);
|
||||
leftToolbar.add(Box.createHorizontalStrut(5));
|
||||
closeTimelineButton = new JButton(View.getIcon("cancel16"));
|
||||
closeTimelineButton.setMargin(new Insets(5, 5, 5, 5));
|
||||
closeTimelineButton.setMargin(new Insets(5, 5, 5, 5));
|
||||
leftToolbar.add(closeTimelineButton);
|
||||
closeTimelineButton.setToolTipText(EasyStrings.translate("timeline.item.cancel"));
|
||||
closeTimelineButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
setTimelined(timelined.getSwf());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
toolbarPanel.add(leftToolbar, BorderLayout.WEST);
|
||||
|
||||
|
||||
ZoomPanel zoomPanel = new ZoomPanel(stagePanel);
|
||||
toolbarPanel.add(zoomPanel, BorderLayout.EAST);
|
||||
|
||||
|
||||
topPanel.add(toolbarPanel, BorderLayout.NORTH);
|
||||
topPanel.add(stagePanel, BorderLayout.CENTER);
|
||||
|
||||
timelinePanel = new TimelinePanel(this, undoManager);
|
||||
|
||||
|
||||
timelinePanel.addChangeListener(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
stagePanel.repaint();
|
||||
}
|
||||
}
|
||||
});
|
||||
timelinePanel.addFrameSelectionListener(new FrameSelectionListener() {
|
||||
@Override
|
||||
@@ -435,12 +430,12 @@ public class EasySwfPanel extends JPanel {
|
||||
if (transformEnabled()) {
|
||||
stagePanel.freeTransformDepths(depths);
|
||||
}
|
||||
|
||||
|
||||
transformPanel.setVisible(!depths.isEmpty());
|
||||
updatePropertiesPanel();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
verticalSplitPane = new JPersistentSplitPane(JSplitPane.VERTICAL_SPLIT, topPanel, timelinePanel, Configuration.guiSplitPaneEasyVerticalDividerLocationPercent);
|
||||
|
||||
libraryTreeTable = new LibraryTreeTable(this);
|
||||
@@ -457,17 +452,15 @@ public class EasySwfPanel extends JPanel {
|
||||
libraryPreviewPanel.setPreferredSize(new Dimension(200, 200));
|
||||
|
||||
rightTabbedPane = new JTabbedPane();
|
||||
|
||||
|
||||
|
||||
propertiesPanel = new JPanel();
|
||||
documentPropertiesPanel = new DocumentPropertiesPanel(undoManager);
|
||||
propertiesPanel.setLayout(new CardLayout());
|
||||
|
||||
|
||||
instancePropertiesPanel = new InstancePropertiesPanel(this, undoManager);
|
||||
propertiesPanel.add(documentPropertiesPanel, PROPERTIES_DOCUMENT);
|
||||
propertiesPanel.add(instancePropertiesPanel, PROPERTIES_INSTANCE);
|
||||
|
||||
|
||||
|
||||
rightTabbedPane.addTab(EasyStrings.translate("properties"), propertiesPanel);
|
||||
|
||||
rightTabbedPane.addTab(EasyStrings.translate("library"), libraryPanel);
|
||||
@@ -482,12 +475,12 @@ public class EasySwfPanel extends JPanel {
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
if (stagePanel.getTimelined() == null) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
List<Integer> depths = stagePanel.getSelectedDepths();
|
||||
if (stagePanel.getFrame() >= stagePanel.getTimelined().getFrameCount()) {
|
||||
depths.clear();
|
||||
}
|
||||
if (!depths.isEmpty()) {
|
||||
if (!depths.isEmpty()) {
|
||||
Frame frame = stagePanel.getTimelined().getTimeline().getFrame(stagePanel.getFrame());
|
||||
if (frame == null) {
|
||||
depths.clear();
|
||||
@@ -498,7 +491,7 @@ public class EasySwfPanel extends JPanel {
|
||||
depths.remove(i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
transformPanel.setVisible(!depths.isEmpty());
|
||||
@@ -552,17 +545,18 @@ public class EasySwfPanel extends JPanel {
|
||||
return;
|
||||
}
|
||||
instancePropertiesPanel.update();
|
||||
cl.show(propertiesPanel, PROPERTIES_INSTANCE);
|
||||
cl.show(propertiesPanel, PROPERTIES_INSTANCE);
|
||||
}
|
||||
|
||||
|
||||
private boolean transformEnabled() {
|
||||
return rightTabbedPane.getSelectedIndex() == 2;
|
||||
}
|
||||
|
||||
public void setTimelined(Timelined timelined) {
|
||||
|
||||
public void setTimelined(Timelined timelined) {
|
||||
setTimelined(timelined, true);
|
||||
}
|
||||
private void setTimelined(Timelined timelined, boolean updateStage) {
|
||||
|
||||
private void setTimelined(Timelined timelined, boolean updateStage) {
|
||||
if (this.timelined == timelined) {
|
||||
return;
|
||||
}
|
||||
@@ -589,7 +583,7 @@ public class EasySwfPanel extends JPanel {
|
||||
stagePanel.pause();
|
||||
stagePanel.gotoFrame(0);
|
||||
}
|
||||
timelinePanel.setTimelined(timelined);
|
||||
timelinePanel.setTimelined(timelined);
|
||||
if (timelined instanceof SWF) {
|
||||
timelineLabel.setText(EasyStrings.translate("timeline.main"));
|
||||
closeTimelineButton.setVisible(false);
|
||||
@@ -606,16 +600,16 @@ public class EasySwfPanel extends JPanel {
|
||||
public Openable getOpenable() {
|
||||
return timelined.getSwf();
|
||||
}
|
||||
|
||||
|
||||
public void clearUndos() {
|
||||
undoManager.clear();
|
||||
}
|
||||
|
||||
|
||||
private void updateUndos() {
|
||||
undoButton.setEnabled(timelined != null && undoManager.canUndo(timelined.getSwf()));
|
||||
redoButton.setEnabled(timelined != null && undoManager.canRedo(timelined.getSwf()));
|
||||
if (timelined != null && undoManager.canUndo(timelined.getSwf())) {
|
||||
undoButton.setToolTipText(EasyStrings.translate("undo").replace("%action%",undoManager.getUndoName(timelined.getSwf())));
|
||||
undoButton.setToolTipText(EasyStrings.translate("undo").replace("%action%", undoManager.getUndoName(timelined.getSwf())));
|
||||
} else {
|
||||
undoButton.setToolTipText(EasyStrings.translate("undo.cannot"));
|
||||
}
|
||||
@@ -629,28 +623,28 @@ public class EasySwfPanel extends JPanel {
|
||||
}
|
||||
Main.getMainFrame().getPanel().updateUiWithCurrentOpenable();
|
||||
}
|
||||
|
||||
|
||||
public void dispose() {
|
||||
setTimelined(null);
|
||||
undoManager.clear();
|
||||
}
|
||||
|
||||
|
||||
public List<Integer> getDepths() {
|
||||
return stagePanel.getSelectedDepths();
|
||||
}
|
||||
|
||||
|
||||
public int getFrame() {
|
||||
return stagePanel.getFrame();
|
||||
}
|
||||
|
||||
public ImagePanel getStagePanel() {
|
||||
return stagePanel;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public SWF getSwf() {
|
||||
return timelined == null ? null : timelined.getSwf();
|
||||
}
|
||||
|
||||
|
||||
public List<DepthState> getSelectedDepthStates() {
|
||||
if (timelined == null) {
|
||||
return null;
|
||||
@@ -663,6 +657,7 @@ public class EasySwfPanel extends JPanel {
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public List<PlaceObjectTypeTag> getSelectedPlaceTags() {
|
||||
List<DepthState> dss = getSelectedDepthStates();
|
||||
if (dss == null) {
|
||||
@@ -675,15 +670,15 @@ public class EasySwfPanel extends JPanel {
|
||||
} else {
|
||||
ret.add(ds.placeObjectTag);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public Timelined getTimelined() {
|
||||
return timelined;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setFrame(int frame, List<Integer> depths) {
|
||||
timelinePanel.setFrame(frame, depths);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,15 +56,15 @@ public class LibraryTreeTable extends JTreeTable {
|
||||
|
||||
private final EasySwfPanel easySwfPanel;
|
||||
private SWF swf;
|
||||
|
||||
|
||||
public LibraryTreeTable(EasySwfPanel easySwfPanel) {
|
||||
super(new LibraryTreeTableModel(null));
|
||||
super(new LibraryTreeTableModel(null));
|
||||
getTree().setCellRenderer(new LibraryTreeCellRenderer());
|
||||
getTree().setRootVisible(false);
|
||||
getTree().setShowsRootHandles(true);
|
||||
addKeyListener(new KeyAdapter() {
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
public void keyPressed(KeyEvent e) {
|
||||
int selectedRow = getSelectedRow();
|
||||
JTree tree = getTree();
|
||||
|
||||
@@ -72,7 +72,7 @@ public class LibraryTreeTable extends JTreeTable {
|
||||
TreePath path = tree.getPathForRow(selectedRow);
|
||||
if (path != null && tree.isExpanded(path)) {
|
||||
tree.collapsePath(path);
|
||||
|
||||
|
||||
int parentRow = tree.getRowForPath(path);
|
||||
changeSelection(parentRow, 0, false, false);
|
||||
} else if (path != null) {
|
||||
@@ -106,16 +106,16 @@ public class LibraryTreeTable extends JTreeTable {
|
||||
setDragEnabled(true);
|
||||
setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
setUI(new BasicTableUI());
|
||||
|
||||
|
||||
setRowHeight(18);
|
||||
getTree().setRowHeight(18);
|
||||
|
||||
|
||||
if (View.isOceanic()) {
|
||||
setBackground(Color.WHITE);
|
||||
getTree().setBackground(Color.WHITE);
|
||||
}
|
||||
this.easySwfPanel = easySwfPanel;
|
||||
|
||||
|
||||
addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
@@ -130,11 +130,11 @@ public class LibraryTreeTable extends JTreeTable {
|
||||
easySwfPanel.setTimelined((Timelined) obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void setSwf(SWF swf) {
|
||||
if (swf == this.swf) {
|
||||
return;
|
||||
@@ -142,13 +142,12 @@ public class LibraryTreeTable extends JTreeTable {
|
||||
this.swf = swf;
|
||||
setTreeTableModel(new LibraryTreeTableModel(swf));
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static class LibraryTreeCellRenderer extends DefaultTreeCellRenderer {
|
||||
|
||||
@Override
|
||||
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
|
||||
JLabel label = (JLabel) super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
|
||||
JLabel label = (JLabel) super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
|
||||
if (!leaf) {
|
||||
if (expanded) {
|
||||
label.setIcon(View.getIcon("folderopen16"));
|
||||
@@ -161,7 +160,7 @@ public class LibraryTreeTable extends JTreeTable {
|
||||
Object object = node.getUserObject();
|
||||
if (object instanceof ImageTag) {
|
||||
ImageTag it = (ImageTag) object;
|
||||
label.setIcon(View.getIcon("image16"));
|
||||
label.setIcon(View.getIcon("image16"));
|
||||
}
|
||||
if (object instanceof ShapeTag) {
|
||||
ShapeTag st = (ShapeTag) object;
|
||||
@@ -209,16 +208,16 @@ public class LibraryTreeTable extends JTreeTable {
|
||||
label.setOpaque(true);
|
||||
}
|
||||
return label;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class LibraryTreeTableModel implements TreeTableModel {
|
||||
|
||||
private DefaultMutableTreeNode root;
|
||||
|
||||
public LibraryTreeTableModel(SWF swf) {
|
||||
DefaultMutableTreeNode root = new DefaultMutableTreeNode("SWF");
|
||||
|
||||
|
||||
DefaultMutableTreeNode imagesNode = new DefaultMutableTreeNode(EasyStrings.translate("library.folder.images"));
|
||||
DefaultMutableTreeNode graphicsNode = new DefaultMutableTreeNode(EasyStrings.translate("library.folder.graphics"));
|
||||
DefaultMutableTreeNode shapeTweensNode = new DefaultMutableTreeNode(EasyStrings.translate("library.folder.shapeTweens"));
|
||||
@@ -229,10 +228,9 @@ public class LibraryTreeTable extends JTreeTable {
|
||||
DefaultMutableTreeNode soundsNode = new DefaultMutableTreeNode(EasyStrings.translate("library.folder.sounds"));
|
||||
DefaultMutableTreeNode videosNode = new DefaultMutableTreeNode(EasyStrings.translate("library.folder.videos"));
|
||||
|
||||
|
||||
this.root = root;
|
||||
|
||||
if (swf == null) {
|
||||
|
||||
if (swf == null) {
|
||||
return;
|
||||
}
|
||||
for (Tag t : swf.getTags()) {
|
||||
@@ -257,13 +255,13 @@ public class LibraryTreeTable extends JTreeTable {
|
||||
}
|
||||
if (t instanceof ButtonTag) {
|
||||
buttonsNode.add(node);
|
||||
}
|
||||
}
|
||||
if (t instanceof SoundTag) {
|
||||
soundsNode.add(node);
|
||||
}
|
||||
if (t instanceof DefineVideoStreamTag) {
|
||||
videosNode.add(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!imagesNode.isLeaf()) {
|
||||
@@ -292,11 +290,9 @@ public class LibraryTreeTable extends JTreeTable {
|
||||
}
|
||||
if (!videosNode.isLeaf()) {
|
||||
root.add(videosNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int getColumnCount() {
|
||||
return 2;
|
||||
@@ -318,11 +314,11 @@ public class LibraryTreeTable extends JTreeTable {
|
||||
public Class<?> getColumnClass(int column) {
|
||||
switch (column) {
|
||||
case 0:
|
||||
return TreeTableModel.class;
|
||||
return TreeTableModel.class;
|
||||
default:
|
||||
return String.class;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -332,7 +328,7 @@ public class LibraryTreeTable extends JTreeTable {
|
||||
switch (column) {
|
||||
case 0:
|
||||
return node;
|
||||
case 1:
|
||||
case 1:
|
||||
if (o instanceof CharacterTag) {
|
||||
CharacterTag ct = (CharacterTag) o;
|
||||
if (!ct.getClassNames().isEmpty()) {
|
||||
@@ -359,7 +355,7 @@ public class LibraryTreeTable extends JTreeTable {
|
||||
|
||||
@Override
|
||||
public void setValueAt(Object value, Object node, int column) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -389,7 +385,7 @@ public class LibraryTreeTable extends JTreeTable {
|
||||
|
||||
@Override
|
||||
public int getIndexOfChild(Object parent, Object child) {
|
||||
return ((DefaultMutableTreeNode) parent).getIndex((DefaultMutableTreeNode)child);
|
||||
return ((DefaultMutableTreeNode) parent).getIndex((DefaultMutableTreeNode) child);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -399,6 +395,6 @@ public class LibraryTreeTable extends JTreeTable {
|
||||
@Override
|
||||
public void removeTreeModelListener(TreeModelListener l) {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,7 +119,6 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe
|
||||
private int depth = 0;
|
||||
|
||||
private int endDepth = 0;*/
|
||||
|
||||
private final UndoManager undoManager;
|
||||
|
||||
private boolean ctrlDown = false;
|
||||
@@ -390,19 +389,17 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe
|
||||
/*if (cursor != null && cursor.contains(frame, depth) && !cursor.contains(frame + num_frames, depth)) {//frame <= cursor.x && (frame + num_frames) > cursor.x && depth == cursor.y) {
|
||||
selected = true;
|
||||
}*/
|
||||
|
||||
for (int n = frame + 1; n < frame + num_frames; n++) {
|
||||
g.setColor(getSelectedColor());
|
||||
if (cursor.contains(new Point(n, depth))) {
|
||||
g.fillRect(n * frameWidth + 1, depth * frameHeight + 1, frameWidth, frameHeight);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*if (selected) {
|
||||
g.setColor(getSelectedColor());
|
||||
g.fillRect(cursor.x * frameWidth + 1, depth * frameHeight + 1, (cursor.width * frameWidth) - 1, frameHeight - 1);
|
||||
}*/
|
||||
|
||||
boolean isTween = blockType == BlockType.MOTION_TWEEN || blockType == BlockType.SHAPE_TWEEN;
|
||||
|
||||
g.setColor(KEY_COLOR);
|
||||
@@ -468,11 +465,11 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe
|
||||
public void depthSelect(int depth) {
|
||||
frameSelect(getFirstFrame(), Arrays.asList(depth));
|
||||
}
|
||||
|
||||
|
||||
public void depthsSelect(List<Integer> depths) {
|
||||
frameSelect(getFirstFrame(), depths);
|
||||
}
|
||||
|
||||
|
||||
public int getFirstFrame() {
|
||||
if (cursor.isEmpty()) {
|
||||
return 0;
|
||||
@@ -487,7 +484,6 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe
|
||||
return cursor.iterator().next().y;
|
||||
}
|
||||
|
||||
|
||||
public void rectSelect(int frame, int depth, int endFrame, int endDepth) {
|
||||
int x1 = Math.min(frame, endFrame);
|
||||
int x2 = Math.max(frame, endFrame);
|
||||
@@ -504,7 +500,7 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe
|
||||
}
|
||||
cursor.clear();
|
||||
cursor.addAll(newCursor);
|
||||
|
||||
|
||||
/*cursor = new Rectangle(
|
||||
x1,
|
||||
y1,
|
||||
@@ -523,11 +519,11 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe
|
||||
fireFrameSelected(frame, depths);
|
||||
}
|
||||
|
||||
public void frameSelect(int frame, int depth) {
|
||||
public void frameSelect(int frame, int depth) {
|
||||
frameSelect(frame, Arrays.asList(depth));
|
||||
}
|
||||
|
||||
public void frameSelect(int frame, List<Integer> depths) {
|
||||
|
||||
public void frameSelect(int frame, List<Integer> depths) {
|
||||
/*if (cursor != null && cursor.width == 1 && cursor.height == 1 && (cursor.contains(frame, depth) || (depth == -1 && cursor.contains(frame, cursor.y)))) {
|
||||
return;
|
||||
}
|
||||
@@ -535,27 +531,26 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe
|
||||
depth = cursor.y;
|
||||
}*/
|
||||
//rectSelect(frame, depth, frame, depth);
|
||||
|
||||
|
||||
Set<Point> newCursor = new LinkedHashSet<>();
|
||||
|
||||
|
||||
for (int d : depths) {
|
||||
newCursor.add(new Point(frame, d));
|
||||
}
|
||||
if (depths.isEmpty()) {
|
||||
newCursor.add(new Point(frame, 0));
|
||||
}
|
||||
|
||||
|
||||
cursor.clear();
|
||||
cursor.addAll(newCursor);
|
||||
|
||||
|
||||
repaint();
|
||||
|
||||
|
||||
/*
|
||||
this.frame = frame;
|
||||
this.depth = depths.isEmpty() ? 0 : depths.get(0);
|
||||
this.endFrame = frame;
|
||||
*/
|
||||
|
||||
*/
|
||||
fireFrameSelected(frame, depths);
|
||||
}
|
||||
|
||||
@@ -585,7 +580,7 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe
|
||||
} else if (ctrlDown) {
|
||||
int frame = getFirstFrame();
|
||||
if (cursor.contains(p)) {
|
||||
cursor.remove(p);
|
||||
cursor.remove(p);
|
||||
} else {
|
||||
cursor.add(p);
|
||||
}
|
||||
@@ -594,8 +589,8 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe
|
||||
if (t.x == frame) {
|
||||
newDepths.add(t.y);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
repaint();
|
||||
fireFrameSelected(frame, newDepths);
|
||||
} else {
|
||||
@@ -610,7 +605,7 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe
|
||||
|
||||
int frame = getFirstFrame();
|
||||
int depth = getFirstDepth();
|
||||
|
||||
|
||||
Frame fr = timeline.getFrame(frame);
|
||||
DepthState ds = fr == null ? null : fr.layers.get(depth);
|
||||
boolean thisEmpty = ds == null || ds.getCharacter() == null;
|
||||
@@ -676,7 +671,7 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe
|
||||
}
|
||||
|
||||
private Set<Point> getBackOrderedCursor() {
|
||||
Set<Point> orderedCursor = new TreeSet<>(new Comparator<Point>() {
|
||||
Set<Point> orderedCursor = new TreeSet<>(new Comparator<Point>() {
|
||||
@Override
|
||||
public int compare(Point o1, Point o2) {
|
||||
int dx = o2.x - o1.x; //later frames first
|
||||
@@ -684,14 +679,14 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe
|
||||
return dx;
|
||||
}
|
||||
return o1.y - o2.y;
|
||||
}
|
||||
}
|
||||
});
|
||||
orderedCursor.addAll(cursor);
|
||||
return orderedCursor;
|
||||
}
|
||||
|
||||
private void removeFrame(ActionEvent e) {
|
||||
|
||||
|
||||
private void removeFrame(ActionEvent e) {
|
||||
|
||||
Set<Point> orderedCursor = getBackOrderedCursor();
|
||||
undoManager.doOperation(new TimelinedTagListDoableOperation(swfPanel, timeline.timelined) {
|
||||
|
||||
@@ -703,7 +698,7 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe
|
||||
|
||||
for (Point p : orderedCursor) {
|
||||
int nf = p.x;
|
||||
int nd = p.y;
|
||||
int nd = p.y;
|
||||
|
||||
int f = timelined.getFrameCount();
|
||||
List<Tag> lastFrameDepthTags = new ArrayList<>();
|
||||
@@ -786,7 +781,7 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe
|
||||
timelined.addTag(lt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
timelined.resetTimeline();
|
||||
|
||||
@@ -878,7 +873,7 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe
|
||||
//timelined.addTag(pos++, rm);
|
||||
|
||||
timelined.addTag(pos++, place);
|
||||
}
|
||||
}
|
||||
|
||||
timelined.resetTimeline();
|
||||
timeline = timelined.getTimeline();
|
||||
@@ -911,11 +906,10 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe
|
||||
@Override
|
||||
public void doOperation() {
|
||||
super.doOperation();
|
||||
Timelined timelined = timeline.timelined;
|
||||
|
||||
|
||||
Timelined timelined = timeline.timelined;
|
||||
|
||||
DepthState ds = null;
|
||||
|
||||
|
||||
if (fframe >= timelined.getFrameCount()) {
|
||||
int lastFrame = timelined.getFrameCount() - 1;
|
||||
for (int d = 1; d <= timeline.maxDepth; d++) {
|
||||
@@ -924,10 +918,10 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe
|
||||
RemoveTag rt = new RemoveObject2Tag(timelined.getSwf());
|
||||
rt.setTimelined(timelined);
|
||||
rt.setDepth(d);
|
||||
timelined.addTag(rt);
|
||||
timelined.addTag(rt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (int f = timelined.getFrameCount(); f <= fframe; f++) {
|
||||
ShowFrameTag sf = new ShowFrameTag(timelined.getSwf());
|
||||
sf.setTimelined(timelined);
|
||||
@@ -936,8 +930,7 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe
|
||||
}
|
||||
timelined.resetTimeline();
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (int f = fframe - 1; f >= 0; f--) {
|
||||
ds = timeline.getDepthState(f, fdepth);
|
||||
if (ds != null && ds.getCharacter() != null) {
|
||||
@@ -996,14 +989,13 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe
|
||||
super.doOperation();
|
||||
DepthState ds;
|
||||
Timelined timelined = timeline.timelined;
|
||||
|
||||
|
||||
//for (int nf = 0; nf < fendFrame - fframe + 1; nf++) {
|
||||
// for (int nd = fdepth; nd <= fendDepth; nd++)
|
||||
for (Point p : orderedCursor) {
|
||||
int nf = p.x;
|
||||
int nd = p.y;
|
||||
|
||||
|
||||
if (nf >= timelined.getFrameCount()) {
|
||||
|
||||
ReadOnlyTagList tags = timelined.getTags();
|
||||
@@ -1022,8 +1014,8 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int lastFrame = timelined.getFrameCount() - 1;
|
||||
//Add removeTag to other layers
|
||||
for (int d = 1; d <= timeline.maxDepth; d++) {
|
||||
@@ -1035,7 +1027,7 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe
|
||||
RemoveTag rt = new RemoveObject2Tag(timelined.getSwf());
|
||||
rt.setTimelined(timelined);
|
||||
rt.setDepth(d);
|
||||
timelined.addTag(rt);
|
||||
timelined.addTag(rt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1047,8 +1039,7 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe
|
||||
}
|
||||
timelined.resetTimeline();
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
boolean somethingAfter = false;
|
||||
for (int f = nf + 1; f < timeline.getFrameCount(); f++) {
|
||||
@@ -1063,7 +1054,7 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe
|
||||
for (int f = nf; f >= 0; f--) {
|
||||
ds = timeline.getDepthState(f, nd);
|
||||
boolean empty = ds == null || ds.getCharacter() == null;
|
||||
if (!empty || somethingAfter) {
|
||||
if (!empty || somethingAfter) {
|
||||
int moveFrameCount = somethingAfter ? 1 : nf - f;
|
||||
for (int mf = 0; mf < moveFrameCount; mf++) {
|
||||
int pos = timelined.indexOfTag(timeline.getFrame(f).showFrameTag);
|
||||
@@ -1121,7 +1112,7 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe
|
||||
f2++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((!removeOnly && !lastFrameDepthTags.isEmpty()) || !endsWithRemove) {
|
||||
//Add removeTag to other layers
|
||||
for (int d = 1; d <= timeline.maxDepth; d++) {
|
||||
@@ -1142,11 +1133,11 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe
|
||||
timelined.addTag(sf);
|
||||
timelined.setFrameCount(timelined.getFrameCount() + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
timelined.resetTimeline();
|
||||
timelined.setFrameCount(timelined.getTimeline().getFrameCount());
|
||||
@@ -1192,8 +1183,8 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
Point firstCursorItem = cursor.isEmpty() ? new Point(1,1) : cursor.iterator().next();
|
||||
public void keyPressed(KeyEvent e) {
|
||||
Point firstCursorItem = cursor.isEmpty() ? new Point(1, 1) : cursor.iterator().next();
|
||||
switch (e.getKeyCode()) {
|
||||
case 37: //left
|
||||
if (firstCursorItem.x > 0) {
|
||||
@@ -1246,5 +1237,5 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe
|
||||
public void setTimeline(Timeline timeline) {
|
||||
this.timeline = timeline;
|
||||
refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.easygui;
|
||||
|
||||
import static com.jpexs.decompiler.flash.easygui.TimelineDepthPanel.FONT_SIZE;
|
||||
import static com.jpexs.decompiler.flash.easygui.TimelineDepthPanel.PADDING;
|
||||
import com.jpexs.decompiler.flash.timeline.Timeline;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
@@ -61,9 +59,9 @@ public class TimelineTimePanel extends JPanel implements MouseListener {
|
||||
public void setTimeline(Timeline timeline) {
|
||||
int maxDepth = timeline == null ? 0 : timeline.getMaxDepth();
|
||||
String maxDepthStr = Integer.toString(maxDepth);
|
||||
setFont(getFont().deriveFont(FONT_SIZE));
|
||||
setFont(getFont().deriveFont(TimelineDepthPanel.FONT_SIZE));
|
||||
int maxDepthW = getFontMetrics(getFont()).stringWidth(maxDepthStr);
|
||||
leftPos = maxDepthW + 2 * PADDING;
|
||||
leftPos = maxDepthW + 2 * TimelineDepthPanel.PADDING;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -27,62 +27,63 @@ import java.util.WeakHashMap;
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class UndoManager {
|
||||
|
||||
private final Map<SWF, Integer> historyPosMap = new WeakHashMap<>();
|
||||
private final Map<SWF, List<DoableOperation>> historyMap = new WeakHashMap<>();
|
||||
|
||||
|
||||
private final List<Runnable> changeListeners = new ArrayList<>();
|
||||
|
||||
|
||||
public void addChangeListener(Runnable listener) {
|
||||
changeListeners.add(listener);
|
||||
}
|
||||
|
||||
|
||||
public void removeChangeListener(Runnable listener) {
|
||||
changeListeners.remove(listener);
|
||||
}
|
||||
|
||||
|
||||
private void fireChange() {
|
||||
for (Runnable listener : changeListeners) {
|
||||
listener.run();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void doOperation(DoableOperation doableOperation, SWF swf) {
|
||||
if (!historyMap.containsKey(swf)) {
|
||||
historyMap.put(swf, new ArrayList<>());
|
||||
}
|
||||
if (!historyPosMap.containsKey(swf)) {
|
||||
historyPosMap.put(swf, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int historyPos = historyPosMap.get(swf);
|
||||
|
||||
|
||||
List<DoableOperation> history = historyMap.get(swf);
|
||||
|
||||
|
||||
//drop redos
|
||||
while(history.size() > historyPos) {
|
||||
while (history.size() > historyPos) {
|
||||
history.remove(historyPos);
|
||||
}
|
||||
|
||||
historyMap.get(swf).add(doableOperation);
|
||||
|
||||
historyMap.get(swf).add(doableOperation);
|
||||
historyPosMap.put(swf, historyPosMap.get(swf) + 1);
|
||||
doableOperation.doOperation();
|
||||
fireChange();
|
||||
}
|
||||
|
||||
|
||||
public boolean canUndo(SWF swf) {
|
||||
if (!historyPosMap.containsKey(swf)) {
|
||||
return false;
|
||||
}
|
||||
return historyPosMap.get(swf) > 0;
|
||||
}
|
||||
|
||||
|
||||
public String getUndoName(SWF swf) {
|
||||
if (!canUndo(swf)) {
|
||||
return null;
|
||||
}
|
||||
return historyMap.get(swf).get(historyPosMap.get(swf) - 1).getDescription();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void undo(SWF swf) {
|
||||
if (!canUndo(swf)) {
|
||||
return;
|
||||
@@ -91,7 +92,7 @@ public class UndoManager {
|
||||
historyMap.get(swf).get(historyPosMap.get(swf)).undoOperation();
|
||||
fireChange();
|
||||
}
|
||||
|
||||
|
||||
public void redo(SWF swf) {
|
||||
if (!canRedo(swf)) {
|
||||
return;
|
||||
@@ -100,26 +101,27 @@ public class UndoManager {
|
||||
historyPosMap.put(swf, historyPosMap.get(swf) + 1);
|
||||
fireChange();
|
||||
}
|
||||
|
||||
|
||||
public String getRedoName(SWF swf) {
|
||||
if (!canRedo(swf)) {
|
||||
return null;
|
||||
}
|
||||
return historyMap.get(swf).get(historyPosMap.get(swf)).getDescription();
|
||||
}
|
||||
|
||||
|
||||
public boolean canRedo(SWF swf) {
|
||||
if (!historyMap.containsKey(swf)) {
|
||||
return false;
|
||||
}
|
||||
return historyMap.get(swf).size() > historyPosMap.get(swf);
|
||||
}
|
||||
|
||||
|
||||
public void clear() {
|
||||
historyMap.clear();
|
||||
historyPosMap.clear();
|
||||
fireChange();
|
||||
}
|
||||
|
||||
public void clear(SWF swf) {
|
||||
if (!historyMap.containsKey(swf)) {
|
||||
return;
|
||||
|
||||
@@ -17,14 +17,8 @@
|
||||
package com.jpexs.decompiler.flash.easygui.properties;
|
||||
|
||||
import java.awt.AWTEvent;
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.CardLayout;
|
||||
import java.awt.Cursor;
|
||||
import java.awt.Font;
|
||||
import java.awt.FontMetrics;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Stroke;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.event.AWTEventListener;
|
||||
import java.awt.event.FocusAdapter;
|
||||
@@ -33,7 +27,6 @@ import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.geom.Line2D;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -49,71 +42,72 @@ import javax.swing.event.ChangeListener;
|
||||
* @author JPEXS
|
||||
*/
|
||||
public abstract class AbstractPropertyField<E> extends JPanel {
|
||||
|
||||
private static final String CARD_READ = "Read";
|
||||
private static final String CARD_WRITE = "Write";
|
||||
|
||||
|
||||
protected JLabel readLabel;
|
||||
protected JTextField writeField;
|
||||
|
||||
|
||||
private final List<PropertyValidationInterface<E>> validations = new ArrayList<>();
|
||||
private final List<ChangeListener> changeListeners = new ArrayList<>();
|
||||
|
||||
|
||||
private AWTEventListener aeListener;
|
||||
|
||||
|
||||
private boolean undetermined = false;
|
||||
private boolean editing = false;
|
||||
|
||||
|
||||
public void addValidation(PropertyValidationInterface<E> validation) {
|
||||
validations.add(validation);
|
||||
}
|
||||
|
||||
|
||||
public void removeValidation(PropertyValidationInterface<E> validation) {
|
||||
validations.remove(validation);
|
||||
}
|
||||
|
||||
|
||||
public void addChangeListener(ChangeListener changeListener) {
|
||||
changeListeners.add(changeListener);
|
||||
}
|
||||
|
||||
|
||||
public void removeChangeListener(ChangeListener changeListener) {
|
||||
changeListeners.remove(changeListener);
|
||||
}
|
||||
|
||||
|
||||
private void fireChange() {
|
||||
for (ChangeListener listener : changeListeners) {
|
||||
listener.stateChanged(new ChangeEvent(this));
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public AbstractPropertyField(String text) {
|
||||
setLayout(new CardLayout());
|
||||
readLabel = new DottedUnderlineLabel(text);
|
||||
|
||||
readLabel = new DottedUnderlineLabel(text);
|
||||
|
||||
readLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
||||
writeField = new JTextField(text);
|
||||
add(readLabel, CARD_READ);
|
||||
add(writeField, CARD_WRITE);
|
||||
|
||||
|
||||
readLabel.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
if (e.getClickCount() == 1) {
|
||||
((CardLayout)AbstractPropertyField.this.getLayout()).show(AbstractPropertyField.this, CARD_WRITE);
|
||||
if (e.getClickCount() == 1) {
|
||||
((CardLayout) AbstractPropertyField.this.getLayout()).show(AbstractPropertyField.this, CARD_WRITE);
|
||||
writeField.requestFocus();
|
||||
writeField.selectAll();
|
||||
|
||||
|
||||
Toolkit.getDefaultToolkit().addAWTEventListener(aeListener, AWTEvent.MOUSE_EVENT_MASK);
|
||||
editing = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
writeField.addFocusListener(new FocusAdapter() {
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
finishEdit();
|
||||
}
|
||||
}
|
||||
});
|
||||
writeField.addKeyListener(new KeyAdapter() {
|
||||
@Override
|
||||
@@ -121,14 +115,14 @@ public abstract class AbstractPropertyField<E> extends JPanel {
|
||||
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
|
||||
e.consume();
|
||||
finishEdit();
|
||||
}
|
||||
}
|
||||
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
|
||||
e.consume();
|
||||
cancelEdit();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
aeListener = new AWTEventListener() {
|
||||
@Override
|
||||
public void eventDispatched(AWTEvent event) {
|
||||
@@ -142,33 +136,33 @@ public abstract class AbstractPropertyField<E> extends JPanel {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected abstract E textToValue(String text);
|
||||
|
||||
protected abstract String valueToText(E value);
|
||||
|
||||
|
||||
private synchronized void finishEdit() {
|
||||
if (!editing) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
String textBefore = readLabel.getText();
|
||||
String textAfter = writeField.getText();
|
||||
|
||||
|
||||
if (textBefore.equals(textAfter)) {
|
||||
cancelEdit();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Toolkit.getDefaultToolkit().removeAWTEventListener(aeListener);
|
||||
|
||||
|
||||
boolean ok = true;
|
||||
E value = textToValue(textAfter);
|
||||
if (value == null) {
|
||||
ok = false;
|
||||
} else {
|
||||
} else {
|
||||
for (PropertyValidationInterface<E> validation : validations) {
|
||||
if (!validation.validate(value)) {
|
||||
ok = false;
|
||||
@@ -176,42 +170,43 @@ public abstract class AbstractPropertyField<E> extends JPanel {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!ok) {
|
||||
cancelEdit();
|
||||
return;
|
||||
}
|
||||
undetermined = false;
|
||||
readLabel.setText(valueToText(value));
|
||||
((CardLayout)AbstractPropertyField.this.getLayout()).show(AbstractPropertyField.this, CARD_READ);
|
||||
editing = false;
|
||||
((CardLayout) AbstractPropertyField.this.getLayout()).show(AbstractPropertyField.this, CARD_READ);
|
||||
editing = false;
|
||||
fireChange();
|
||||
}
|
||||
|
||||
|
||||
private void cancelEdit() {
|
||||
if (!editing) {
|
||||
return;
|
||||
}
|
||||
Toolkit.getDefaultToolkit().removeAWTEventListener(aeListener);
|
||||
Toolkit.getDefaultToolkit().removeAWTEventListener(aeListener);
|
||||
if (undetermined) {
|
||||
writeField.setText("");
|
||||
} else {
|
||||
writeField.setText(readLabel.getText());
|
||||
}
|
||||
((CardLayout)AbstractPropertyField.this.getLayout()).show(AbstractPropertyField.this, CARD_READ);
|
||||
((CardLayout) AbstractPropertyField.this.getLayout()).show(AbstractPropertyField.this, CARD_READ);
|
||||
editing = false;
|
||||
}
|
||||
|
||||
public E getValue() {
|
||||
|
||||
public E getValue() {
|
||||
if (undetermined) {
|
||||
return null;
|
||||
}
|
||||
return textToValue(writeField.getText());
|
||||
}
|
||||
|
||||
|
||||
public void setValue(Set<E> value) {
|
||||
setValue(value, false);
|
||||
}
|
||||
|
||||
public void setValue(Set<E> value, boolean silent) {
|
||||
if (value.size() != 1) {
|
||||
setValue((E) null, silent);
|
||||
@@ -219,11 +214,11 @@ public abstract class AbstractPropertyField<E> extends JPanel {
|
||||
setValue(value.iterator().next(), silent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setValue(E value) {
|
||||
setValue(value, false);
|
||||
}
|
||||
|
||||
|
||||
public void setValue(E value, boolean silent) {
|
||||
if (value == null) {
|
||||
readLabel.setText("-");
|
||||
@@ -241,34 +236,4 @@ public abstract class AbstractPropertyField<E> extends JPanel {
|
||||
fireChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class DottedUnderlineLabel extends JLabel {
|
||||
|
||||
public DottedUnderlineLabel(String text) {
|
||||
super(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintComponent(Graphics g) {
|
||||
super.paintComponent(g);
|
||||
Graphics2D g2d = (Graphics2D) g;
|
||||
Font font = getFont();
|
||||
FontMetrics metrics = getFontMetrics(font);
|
||||
String text = getText();
|
||||
|
||||
int x = 0;
|
||||
int y = metrics.getAscent();
|
||||
|
||||
g2d.setPaint(getForeground());
|
||||
|
||||
int textWidth = metrics.stringWidth(text);
|
||||
int underlineY = y + 6;
|
||||
|
||||
float[] dash = {1f, 1f};
|
||||
Stroke dotted = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 1f, dash, 0f);
|
||||
g2d.setStroke(dotted);
|
||||
|
||||
g2d.draw(new Line2D.Float(x, underlineY, x + textWidth, underlineY));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (C) 2025 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.easygui.properties;
|
||||
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Font;
|
||||
import java.awt.FontMetrics;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Stroke;
|
||||
import java.awt.geom.Line2D;
|
||||
import javax.swing.JLabel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
class DottedUnderlineLabel extends JLabel {
|
||||
|
||||
public DottedUnderlineLabel(String text) {
|
||||
super(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintComponent(Graphics g) {
|
||||
super.paintComponent(g);
|
||||
Graphics2D g2d = (Graphics2D) g;
|
||||
Font font = getFont();
|
||||
FontMetrics metrics = getFontMetrics(font);
|
||||
String text = getText();
|
||||
|
||||
int x = 0;
|
||||
int y = metrics.getAscent();
|
||||
|
||||
g2d.setPaint(getForeground());
|
||||
|
||||
int textWidth = metrics.stringWidth(text);
|
||||
int underlineY = y + 6;
|
||||
|
||||
float[] dash = {1f, 1f};
|
||||
Stroke dotted = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 1f, dash, 0f);
|
||||
g2d.setStroke(dotted);
|
||||
|
||||
g2d.draw(new Line2D.Float(x, underlineY, x + textWidth, underlineY));
|
||||
}
|
||||
}
|
||||
@@ -21,20 +21,20 @@ package com.jpexs.decompiler.flash.easygui.properties;
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class FloatPropertyField extends AbstractPropertyField<Float> {
|
||||
|
||||
|
||||
private PropertyValidationInterface<Float> minValidation = null;
|
||||
private PropertyValidationInterface<Float> maxValidation = null;
|
||||
|
||||
|
||||
public FloatPropertyField(float value, float min, float max) {
|
||||
super("" + value);
|
||||
setMin(min);
|
||||
setMax(max);
|
||||
}
|
||||
|
||||
|
||||
public FloatPropertyField(float value) {
|
||||
super("" + value);
|
||||
super("" + value);
|
||||
}
|
||||
|
||||
|
||||
public void setMax(float max) {
|
||||
if (maxValidation != null) {
|
||||
removeValidation(maxValidation);
|
||||
@@ -43,11 +43,11 @@ public class FloatPropertyField extends AbstractPropertyField<Float> {
|
||||
@Override
|
||||
public boolean validate(Float value) {
|
||||
return value <= max;
|
||||
}
|
||||
}
|
||||
};
|
||||
addValidation(maxValidation);
|
||||
}
|
||||
|
||||
|
||||
public void setMin(float min) {
|
||||
if (minValidation != null) {
|
||||
removeValidation(minValidation);
|
||||
@@ -56,16 +56,16 @@ public class FloatPropertyField extends AbstractPropertyField<Float> {
|
||||
@Override
|
||||
public boolean validate(Float value) {
|
||||
return value >= min;
|
||||
}
|
||||
}
|
||||
};
|
||||
addValidation(minValidation);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Float textToValue(String text) {
|
||||
try{
|
||||
try {
|
||||
return Float.parseFloat(text);
|
||||
}catch(NumberFormatException nfe){
|
||||
} catch (NumberFormatException nfe) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,18 +16,19 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.easygui.properties;
|
||||
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.event.ActionEvent;
|
||||
import javax.swing.JCheckBox;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
public class JTriStateCheckBox extends JCheckBox {
|
||||
|
||||
final static boolean MID_AS_SELECTED = true; //consider mid-state as selected ?
|
||||
private static final boolean MID_AS_SELECTED = true; //consider mid-state as selected ?
|
||||
|
||||
public JTriStateCheckBox() {
|
||||
this("");
|
||||
@@ -44,8 +45,6 @@ public class JTriStateCheckBox extends JCheckBox {
|
||||
super.fireActionPerformed(event);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public JTriStateCheckBox(String text, int sel) {
|
||||
/* tri-state checkbox has 3 selection states:
|
||||
* 0 unselected
|
||||
@@ -57,6 +56,7 @@ public class JTriStateCheckBox extends JCheckBox {
|
||||
switch (sel) {
|
||||
case 2:
|
||||
setSelected(true);
|
||||
//fallthrough
|
||||
case 1:
|
||||
case 0:
|
||||
putClientProperty("SelectionState", sel);
|
||||
@@ -100,8 +100,6 @@ public class JTriStateCheckBox extends JCheckBox {
|
||||
super.setSelected(b);
|
||||
putClientProperty("SelectionState", b ? 2 : 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void paintComponent(Graphics g) {
|
||||
@@ -109,10 +107,11 @@ public class JTriStateCheckBox extends JCheckBox {
|
||||
if (getSelectionState() == 1) {
|
||||
int w = 12;
|
||||
if (Configuration.useRibbonInterface.get()) {
|
||||
/*SubstanceColorScheme baseMarkColorScheme = SubstanceColorSchemeUtilities
|
||||
.getColorScheme(this, ColorSchemeAssociationKind.MARK,
|
||||
ComponentState.getState(this));
|
||||
|
||||
/*
|
||||
SubstanceColorScheme baseMarkColorScheme = SubstanceColorSchemeUtilities
|
||||
.getColorScheme(this, ColorSchemeAssociationKind.MARK,
|
||||
ComponentState.getState(this));
|
||||
|
||||
g.setColor(baseMarkColorScheme.getSelectionForegroundColor());*/
|
||||
w = 14;
|
||||
} else {
|
||||
|
||||
@@ -20,18 +20,18 @@ package com.jpexs.decompiler.flash.easygui.properties;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class TextPropertyField extends AbstractPropertyField<String> {
|
||||
|
||||
public class TextPropertyField extends AbstractPropertyField<String> {
|
||||
|
||||
public TextPropertyField(String text, int maxLength) {
|
||||
super(text);
|
||||
|
||||
|
||||
writeField.setColumns(maxLength);
|
||||
|
||||
addValidation(new PropertyValidationInterface<String>(){
|
||||
|
||||
addValidation(new PropertyValidationInterface<String>() {
|
||||
@Override
|
||||
public boolean validate(String value) {
|
||||
return value.length() <= maxLength;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -44,5 +44,5 @@ public class TextPropertyField extends AbstractPropertyField<String> {
|
||||
protected String valueToText(String value) {
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+9
-11
@@ -41,24 +41,24 @@ import javax.swing.border.BevelBorder;
|
||||
* @author JPEXS
|
||||
*/
|
||||
public abstract class AbstractPropertiesPanel extends JPanel {
|
||||
|
||||
|
||||
protected String titleIdentifier;
|
||||
|
||||
|
||||
private final Map<String, JPanel> cardContents = new LinkedHashMap<>();
|
||||
private final Map<String, JLabel> cardPlusMinusLabels = new LinkedHashMap<>();
|
||||
|
||||
|
||||
private static final char PLUS_CHAR = '\u2BC8';
|
||||
private static final char MINUS_CHAR = '\u2BC6';
|
||||
|
||||
|
||||
public AbstractPropertiesPanel(String titleIdentifier) {
|
||||
this.titleIdentifier = titleIdentifier;
|
||||
this.titleIdentifier = titleIdentifier;
|
||||
}
|
||||
|
||||
|
||||
protected String formatPropertyName(String id) {
|
||||
String item = EasyStrings.translate("property."+titleIdentifier+"." + id);
|
||||
String item = EasyStrings.translate("property." + titleIdentifier + "." + id);
|
||||
return EasyStrings.translate("property.label").replace("%item%", item);
|
||||
}
|
||||
|
||||
|
||||
protected JPanel makeCard(String id, String icon, JPanel contents) {
|
||||
JPanel cardPanel = new JPanel();
|
||||
|
||||
@@ -118,9 +118,7 @@ public abstract class AbstractPropertiesPanel extends JPanel {
|
||||
plusMinusLabel.setText("" + PLUS_CHAR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
protected void addToGrid(GridBagLayout layout, Container parent, Component component, int x, int y) {
|
||||
addToGrid(layout, parent, component, x, y, 1, 1);
|
||||
}
|
||||
|
||||
@@ -18,11 +18,7 @@ package com.jpexs.decompiler.flash.easygui.properties.panels;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.SWFCompression;
|
||||
import static com.jpexs.decompiler.flash.SWFCompression.LZMA;
|
||||
import static com.jpexs.decompiler.flash.SWFCompression.NONE;
|
||||
import static com.jpexs.decompiler.flash.SWFCompression.ZLIB;
|
||||
import com.jpexs.decompiler.flash.easygui.ChangeDoableOperation;
|
||||
import com.jpexs.decompiler.flash.easygui.DoableOperation;
|
||||
import com.jpexs.decompiler.flash.easygui.EasyStrings;
|
||||
import com.jpexs.decompiler.flash.easygui.UndoManager;
|
||||
import com.jpexs.decompiler.flash.easygui.properties.FloatPropertyField;
|
||||
@@ -32,17 +28,12 @@ import com.jpexs.decompiler.flash.gui.ComboBoxItem;
|
||||
import com.jpexs.decompiler.flash.gui.View;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ItemEvent;
|
||||
import java.awt.event.ItemListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.swing.BorderFactory;
|
||||
|
||||
+151
-155
@@ -22,23 +22,30 @@ import com.jpexs.decompiler.flash.easygui.EasyTagNameResolver;
|
||||
import com.jpexs.decompiler.flash.easygui.UndoManager;
|
||||
import com.jpexs.decompiler.flash.easygui.properties.FloatPropertyField;
|
||||
import com.jpexs.decompiler.flash.easygui.properties.IntegerPropertyField;
|
||||
import com.jpexs.decompiler.flash.easygui.properties.JTriStateCheckBox;
|
||||
import com.jpexs.decompiler.flash.easygui.properties.PropertyChangeDoableOperation;
|
||||
import com.jpexs.decompiler.flash.easygui.properties.PropertyValidationInterface;
|
||||
import com.jpexs.decompiler.flash.exporters.commonshape.Matrix;
|
||||
import com.jpexs.decompiler.flash.gui.BoundsChangeListener;
|
||||
import com.jpexs.decompiler.flash.gui.RegistrationPointPosition;
|
||||
import com.jpexs.decompiler.flash.gui.ViewMessages;
|
||||
import com.jpexs.decompiler.flash.tags.base.PlaceObjectTypeTag;
|
||||
import com.jpexs.decompiler.flash.tags.converters.PlaceObjectTypeConverter;
|
||||
import com.jpexs.decompiler.flash.timeline.DepthState;
|
||||
import com.jpexs.decompiler.flash.timeline.Timelined;
|
||||
import com.jpexs.decompiler.flash.types.CXFORMWITHALPHA;
|
||||
import com.jpexs.decompiler.flash.types.ColorTransform;
|
||||
import com.jpexs.decompiler.flash.types.RGBA;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.util.ArrayList;
|
||||
@@ -47,22 +54,14 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.border.BevelBorder;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import com.jpexs.decompiler.flash.easygui.properties.JTriStateCheckBox;
|
||||
import com.jpexs.decompiler.flash.easygui.properties.PropertyChangeDoableOperation;
|
||||
import com.jpexs.decompiler.flash.gui.ViewMessages;
|
||||
import com.jpexs.decompiler.flash.types.RGBA;
|
||||
import java.awt.Color;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.Arrays;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -74,7 +73,7 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
private final FloatPropertyField yPropertyField = new FloatPropertyField(0, -8192, 8192);
|
||||
private final FloatPropertyField wPropertyField = new FloatPropertyField(0, -8192, 8192);
|
||||
private final FloatPropertyField hPropertyField = new FloatPropertyField(0, -8192, 8192);
|
||||
|
||||
|
||||
private final IntegerPropertyField alphaPercentPropertyField = new IntegerPropertyField(100, -100, 100);
|
||||
private final IntegerPropertyField redPercentPropertyField = new IntegerPropertyField(100, -100, 100);
|
||||
private final IntegerPropertyField greenPercentPropertyField = new IntegerPropertyField(100, -100, 100);
|
||||
@@ -86,21 +85,20 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
private final EasySwfPanel swfPanel;
|
||||
|
||||
private final JPanel propertiesPanel;
|
||||
|
||||
|
||||
private Rectangle2D lastBounds = null;
|
||||
|
||||
|
||||
private JLabel instanceLabel;
|
||||
|
||||
|
||||
private final JTriStateCheckBox visibleCheckBox = new JTriStateCheckBox();
|
||||
private final JComboBox<String> blendingComboBox = new JComboBox<>();
|
||||
private final JTriStateCheckBox cacheAsBitmapCheckBox = new JTriStateCheckBox();
|
||||
private final JComboBox<String> backgroundComboBox = new JComboBox<>();
|
||||
private final JPanel backgroundColorPanel = new JPanel();
|
||||
private final JLabel backgroundColorLabel = new JLabel();
|
||||
|
||||
|
||||
private boolean updating = false;
|
||||
|
||||
|
||||
|
||||
public InstancePropertiesPanel(EasySwfPanel swfPanel, UndoManager undoManager) {
|
||||
super("instance");
|
||||
setLayout(new BorderLayout());
|
||||
@@ -108,11 +106,11 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
instanceLabel = new JLabel(EasyStrings.translate("properties.instance.none"));
|
||||
instanceLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
|
||||
add(instanceLabel, BorderLayout.NORTH);
|
||||
|
||||
|
||||
GridBagLayout gridBag;
|
||||
GridBagConstraints gbc;
|
||||
|
||||
JPanel positionSizePanel = new JPanel();
|
||||
|
||||
JPanel positionSizePanel = new JPanel();
|
||||
gridBag = new GridBagLayout();
|
||||
positionSizePanel.setLayout(gridBag);
|
||||
gbc = new GridBagConstraints();
|
||||
@@ -126,34 +124,34 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
gbc.anchor = GridBagConstraints.WEST;
|
||||
positionSizePanel.add(xPropertyField, gbc);
|
||||
gbc.gridx++;
|
||||
gbc.anchor = GridBagConstraints.EAST;
|
||||
gbc.anchor = GridBagConstraints.EAST;
|
||||
positionSizePanel.add(new JLabel(formatPropertyName("positionSize.y")), gbc);
|
||||
gbc.gridx++;
|
||||
gbc.anchor = GridBagConstraints.WEST;
|
||||
positionSizePanel.add(yPropertyField, gbc);
|
||||
gbc.gridy++;
|
||||
gbc.gridx = 0;
|
||||
gbc.anchor = GridBagConstraints.EAST;
|
||||
gbc.anchor = GridBagConstraints.EAST;
|
||||
positionSizePanel.add(new JLabel(formatPropertyName("positionSize.width")), gbc);
|
||||
gbc.gridx++;
|
||||
gbc.anchor = GridBagConstraints.WEST;
|
||||
gbc.anchor = GridBagConstraints.WEST;
|
||||
positionSizePanel.add(wPropertyField, gbc);
|
||||
gbc.gridx++;
|
||||
gbc.anchor = GridBagConstraints.EAST;
|
||||
gbc.anchor = GridBagConstraints.EAST;
|
||||
positionSizePanel.add(new JLabel(formatPropertyName("positionSize.height")), gbc);
|
||||
gbc.gridx++;
|
||||
gbc.anchor = GridBagConstraints.WEST;
|
||||
positionSizePanel.add(hPropertyField, gbc);
|
||||
|
||||
positionSizePanel.add(hPropertyField, gbc);
|
||||
|
||||
gbc.gridx++;
|
||||
gbc.gridy = 0;
|
||||
gbc.gridheight = 2;
|
||||
gbc.weightx = 1;
|
||||
gbc.fill = GridBagConstraints.HORIZONTAL;
|
||||
positionSizePanel.add(new JPanel(), gbc);
|
||||
|
||||
JPanel colorEffectPanel = new JPanel();
|
||||
|
||||
|
||||
JPanel colorEffectPanel = new JPanel();
|
||||
|
||||
gridBag = new GridBagLayout();
|
||||
colorEffectPanel.setLayout(gridBag);
|
||||
|
||||
@@ -174,7 +172,7 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
|
||||
gbc.gridx = 0;
|
||||
gbc.gridy++;
|
||||
gbc.anchor = GridBagConstraints.EAST;
|
||||
gbc.anchor = GridBagConstraints.EAST;
|
||||
colorEffectPanel.add(new JLabel(formatPropertyName("colorEffect.red")), gbc);
|
||||
gbc.anchor = GridBagConstraints.WEST;
|
||||
gbc.gridx++;
|
||||
@@ -186,7 +184,7 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
|
||||
gbc.gridx = 0;
|
||||
gbc.gridy++;
|
||||
gbc.anchor = GridBagConstraints.EAST;
|
||||
gbc.anchor = GridBagConstraints.EAST;
|
||||
colorEffectPanel.add(new JLabel(formatPropertyName("colorEffect.green")), gbc);
|
||||
gbc.anchor = GridBagConstraints.WEST;
|
||||
gbc.gridx++;
|
||||
@@ -198,7 +196,7 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
|
||||
gbc.gridx = 0;
|
||||
gbc.gridy++;
|
||||
gbc.anchor = GridBagConstraints.EAST;
|
||||
gbc.anchor = GridBagConstraints.EAST;
|
||||
colorEffectPanel.add(new JLabel(formatPropertyName("colorEffect.blue")), gbc);
|
||||
gbc.anchor = GridBagConstraints.WEST;
|
||||
gbc.gridx++;
|
||||
@@ -207,7 +205,7 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
colorEffectPanel.add(new JLabel("% \u00D7 B + "), gbc);
|
||||
gbc.gridx++;
|
||||
colorEffectPanel.add(blueAddPropertyField, gbc);
|
||||
|
||||
|
||||
gbc.gridx++;
|
||||
gbc.gridy = 0;
|
||||
gbc.gridheight = 4;
|
||||
@@ -215,35 +213,31 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
gbc.fill = GridBagConstraints.HORIZONTAL;
|
||||
colorEffectPanel.add(new JPanel(), gbc);
|
||||
|
||||
|
||||
JPanel displayPanel = new JPanel();
|
||||
gridBag = new GridBagLayout();
|
||||
displayPanel.setLayout(gridBag);
|
||||
gbc = new GridBagConstraints();
|
||||
|
||||
gbc.insets = new Insets(3, 3, 3, 3);
|
||||
|
||||
displayPanel.setLayout(gridBag);
|
||||
gbc = new GridBagConstraints();
|
||||
|
||||
gbc.insets = new Insets(3, 3, 3, 3);
|
||||
|
||||
gbc.gridx = 0;
|
||||
gbc.gridy = 0;
|
||||
gbc.gridwidth = 1;
|
||||
gbc.gridwidth = 1;
|
||||
gbc.anchor = GridBagConstraints.EAST;
|
||||
displayPanel.add(new JLabel(formatPropertyName("display.visible")), gbc);
|
||||
|
||||
|
||||
|
||||
gbc.gridx++;
|
||||
gbc.gridwidth = 2;
|
||||
gbc.gridwidth = 2;
|
||||
gbc.anchor = GridBagConstraints.WEST;
|
||||
|
||||
|
||||
|
||||
displayPanel.add(visibleCheckBox, gbc);
|
||||
|
||||
|
||||
gbc.gridy++;
|
||||
gbc.gridx = 0;
|
||||
gbc.gridwidth = 1;
|
||||
gbc.anchor = GridBagConstraints.EAST;
|
||||
gbc.gridwidth = 1;
|
||||
gbc.anchor = GridBagConstraints.EAST;
|
||||
displayPanel.add(new JLabel(formatPropertyName("display.blending")), gbc);
|
||||
|
||||
|
||||
|
||||
blendingComboBox.addItem(EasyStrings.translate("property.instance.display.blending.normal"));
|
||||
blendingComboBox.addItem(EasyStrings.translate("property.instance.display.blending.layer"));
|
||||
blendingComboBox.addItem(EasyStrings.translate("property.instance.display.blending.multiply"));
|
||||
@@ -258,42 +252,40 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
blendingComboBox.addItem(EasyStrings.translate("property.instance.display.blending.erase"));
|
||||
blendingComboBox.addItem(EasyStrings.translate("property.instance.display.blending.overlay"));
|
||||
blendingComboBox.addItem(EasyStrings.translate("property.instance.display.blending.hardlight"));
|
||||
|
||||
|
||||
gbc.gridx++;
|
||||
gbc.anchor = GridBagConstraints.WEST;
|
||||
gbc.gridwidth = 2;
|
||||
gbc.gridwidth = 2;
|
||||
displayPanel.add(blendingComboBox, gbc);
|
||||
|
||||
|
||||
gbc.gridy++;
|
||||
|
||||
|
||||
gbc.gridx = 0;
|
||||
gbc.gridwidth = 1;
|
||||
gbc.gridwidth = 1;
|
||||
gbc.anchor = GridBagConstraints.EAST;
|
||||
displayPanel.add(new JLabel(formatPropertyName("display.cacheAsBitmap")), gbc);
|
||||
|
||||
|
||||
gbc.gridx++;
|
||||
gbc.gridwidth = 2;
|
||||
gbc.anchor = GridBagConstraints.WEST;
|
||||
|
||||
gbc.gridwidth = 2;
|
||||
gbc.anchor = GridBagConstraints.WEST;
|
||||
|
||||
displayPanel.add(cacheAsBitmapCheckBox, gbc);
|
||||
|
||||
|
||||
backgroundComboBox.addItem(EasyStrings.translate("property.instance.display.cacheAsBitmap.transparent"));
|
||||
backgroundComboBox.addItem(EasyStrings.translate("property.instance.display.cacheAsBitmap.opaque"));
|
||||
|
||||
|
||||
|
||||
backgroundColorPanel.setLayout(new BorderLayout());
|
||||
backgroundColorPanel.add(backgroundColorLabel, BorderLayout.CENTER);
|
||||
backgroundColorPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
|
||||
backgroundColorPanel.setPreferredSize(new Dimension(16,16));
|
||||
|
||||
|
||||
gbc.gridy++;
|
||||
backgroundColorPanel.setPreferredSize(new Dimension(16, 16));
|
||||
|
||||
gbc.gridy++;
|
||||
gbc.gridx = 1;
|
||||
gbc.gridwidth = 1;
|
||||
gbc.gridwidth = 1;
|
||||
displayPanel.add(backgroundComboBox, gbc);
|
||||
gbc.gridx++;
|
||||
gbc.gridx++;
|
||||
displayPanel.add(backgroundColorPanel, gbc);
|
||||
|
||||
|
||||
cacheAsBitmapCheckBox.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -303,28 +295,28 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
backgroundComboBox.setVisible(cacheAsBitmapCheckBox.isSelected());
|
||||
backgroundColorPanel.setVisible(cacheAsBitmapCheckBox.isSelected() && backgroundComboBox.getSelectedIndex() == backgroundComboBox.getItemCount() - 1);
|
||||
revalidate();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
backgroundComboBox.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (updating) {
|
||||
return;
|
||||
}
|
||||
backgroundColorPanel.setVisible(backgroundComboBox.getSelectedIndex() == backgroundComboBox.getItemCount() - 1);
|
||||
backgroundColorPanel.setVisible(backgroundComboBox.getSelectedIndex() == backgroundComboBox.getItemCount() - 1);
|
||||
revalidate();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
gbc.gridy++;
|
||||
gbc.gridx=0;
|
||||
gbc.gridwidth=3;
|
||||
gbc.gridx = 0;
|
||||
gbc.gridwidth = 3;
|
||||
gbc.weightx = 0;
|
||||
gbc.weighty = 1;
|
||||
gbc.fill = GridBagConstraints.VERTICAL;
|
||||
displayPanel.add(new JPanel(), gbc);
|
||||
|
||||
|
||||
gbc.gridx = 3;
|
||||
gbc.gridy = 0;
|
||||
gbc.gridheight = 4;
|
||||
@@ -332,20 +324,18 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
gbc.weightx = 1;
|
||||
gbc.fill = GridBagConstraints.HORIZONTAL;
|
||||
displayPanel.add(new JPanel(), gbc);
|
||||
|
||||
|
||||
|
||||
|
||||
propertiesPanel = new JPanel();
|
||||
propertiesPanel.setLayout(new BoxLayout(propertiesPanel, BoxLayout.Y_AXIS));
|
||||
|
||||
|
||||
propertiesPanel.add(makeCard("positionSize", null, positionSizePanel));
|
||||
|
||||
|
||||
setCardOpened("positionSize", true);
|
||||
|
||||
|
||||
propertiesPanel.add(makeCard("colorEffect", null, colorEffectPanel));
|
||||
|
||||
|
||||
propertiesPanel.add(makeCard("display", null, displayPanel));
|
||||
|
||||
|
||||
this.swfPanel = swfPanel;
|
||||
|
||||
alphaPercentPropertyField.addChangeListener(new ChangeListener() {
|
||||
@@ -353,6 +343,7 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
undoManager.doOperation(new ColorEffectChangeDoableOperation("alpha") {
|
||||
int value = alphaPercentPropertyField.getValue();
|
||||
|
||||
@Override
|
||||
public void doColorEffectOperation(CXFORMWITHALPHA colorTransform) {
|
||||
colorTransform.alphaMultTerm = Math.round(value * 256 / 100f);
|
||||
@@ -364,8 +355,9 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
alphaAddPropertyField.addChangeListener(new ChangeListener() {
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
undoManager.doOperation(new ColorEffectChangeDoableOperation("alpha") {
|
||||
int value = alphaAddPropertyField.getValue();
|
||||
undoManager.doOperation(new ColorEffectChangeDoableOperation("alpha") {
|
||||
int value = alphaAddPropertyField.getValue();
|
||||
|
||||
@Override
|
||||
public void doColorEffectOperation(CXFORMWITHALPHA colorTransform) {
|
||||
colorTransform.alphaAddTerm = value;
|
||||
@@ -380,6 +372,7 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
undoManager.doOperation(new ColorEffectChangeDoableOperation("red") {
|
||||
int value = redPercentPropertyField.getValue();
|
||||
|
||||
@Override
|
||||
public void doColorEffectOperation(CXFORMWITHALPHA colorTransform) {
|
||||
colorTransform.redMultTerm = Math.round(value * 256 / 100f);
|
||||
@@ -393,6 +386,7 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
undoManager.doOperation(new ColorEffectChangeDoableOperation("red") {
|
||||
int value = redAddPropertyField.getValue();
|
||||
|
||||
@Override
|
||||
public void doColorEffectOperation(CXFORMWITHALPHA colorTransform) {
|
||||
colorTransform.redAddTerm = value;
|
||||
@@ -407,6 +401,7 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
undoManager.doOperation(new ColorEffectChangeDoableOperation("green") {
|
||||
int value = greenPercentPropertyField.getValue();
|
||||
|
||||
@Override
|
||||
public void doColorEffectOperation(CXFORMWITHALPHA colorTransform) {
|
||||
colorTransform.greenMultTerm = Math.round(value * 256 / 100f);
|
||||
@@ -420,6 +415,7 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
undoManager.doOperation(new ColorEffectChangeDoableOperation("green") {
|
||||
int value = greenAddPropertyField.getValue();
|
||||
|
||||
@Override
|
||||
public void doColorEffectOperation(CXFORMWITHALPHA colorTransform) {
|
||||
colorTransform.greenAddTerm = value;
|
||||
@@ -434,6 +430,7 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
undoManager.doOperation(new ColorEffectChangeDoableOperation("blue") {
|
||||
int value = bluePercentPropertyField.getValue();
|
||||
|
||||
@Override
|
||||
public void doColorEffectOperation(CXFORMWITHALPHA colorTransform) {
|
||||
colorTransform.blueMultTerm = Math.round(value * 256 / 100f);
|
||||
@@ -447,6 +444,7 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
undoManager.doOperation(new ColorEffectChangeDoableOperation("blue") {
|
||||
int value = blueAddPropertyField.getValue();
|
||||
|
||||
@Override
|
||||
public void doColorEffectOperation(CXFORMWITHALPHA colorTransform) {
|
||||
colorTransform.blueAddTerm = value;
|
||||
@@ -455,7 +453,7 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
}, swfPanel.getSwf());
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
xPropertyField.addChangeListener(new ChangeListener() {
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
@@ -465,7 +463,7 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
swfPanel.getStagePanel().applyTransformMatrix(Matrix.getTranslateInstance(xDelta, 0));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
yPropertyField.addChangeListener(new ChangeListener() {
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
@@ -475,17 +473,17 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
swfPanel.getStagePanel().applyTransformMatrix(Matrix.getTranslateInstance(0, yDelta));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
PropertyValidationInterface<Float> nonZeroFloatValidation = new PropertyValidationInterface<Float>() {
|
||||
@Override
|
||||
public boolean validate(Float value) {
|
||||
return value != 0f;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
wPropertyField.addChangeListener(new ChangeListener() {
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
double wBefore = lastBounds.getWidth();
|
||||
if (wBefore == 0) {
|
||||
return;
|
||||
@@ -500,10 +498,10 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
}
|
||||
});
|
||||
wPropertyField.addValidation(nonZeroFloatValidation);
|
||||
|
||||
|
||||
hPropertyField.addChangeListener(new ChangeListener() {
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
double hBefore = lastBounds.getHeight();
|
||||
if (hBefore == 0) {
|
||||
return;
|
||||
@@ -518,7 +516,7 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
}
|
||||
});
|
||||
hPropertyField.addValidation(nonZeroFloatValidation);
|
||||
|
||||
|
||||
visibleCheckBox.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -527,14 +525,15 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
}
|
||||
undoManager.doOperation(new PlaceChangeDoableOperation("instance.display.visible", 3) {
|
||||
int visible = visibleCheckBox.isSelected() ? 1 : 0;
|
||||
|
||||
@Override
|
||||
public void doPlaceOperation(PlaceObjectTypeTag placeObject, DepthState depthState) {
|
||||
placeObject.setVisible(visible);
|
||||
}
|
||||
}
|
||||
}, swfPanel.getSwf());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
blendingComboBox.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -543,14 +542,15 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
}
|
||||
undoManager.doOperation(new PlaceChangeDoableOperation("instance.display.blending", 3) {
|
||||
int blendMode = blendingComboBox.getSelectedIndex() + 1;
|
||||
|
||||
@Override
|
||||
public void doPlaceOperation(PlaceObjectTypeTag placeObject, DepthState depthState) {
|
||||
placeObject.setBlendMode(blendMode);
|
||||
}
|
||||
}, swfPanel.getSwf());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
cacheAsBitmapCheckBox.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -559,6 +559,7 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
}
|
||||
undoManager.doOperation(new PlaceChangeDoableOperation("instance.display.cacheAsBitmap", 3) {
|
||||
int bitmapCache = cacheAsBitmapCheckBox.isSelected() ? 1 : 0;
|
||||
|
||||
@Override
|
||||
public void doPlaceOperation(PlaceObjectTypeTag placeObject, DepthState depthState) {
|
||||
placeObject.setBitmapCache(bitmapCache);
|
||||
@@ -567,11 +568,11 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
placeObject.setBackgroundColor(null);
|
||||
placeObject.setPlaceFlagOpaqueBackground(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, swfPanel.getSwf());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
backgroundComboBox.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -581,19 +582,20 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
boolean isOpaque = backgroundComboBox.getSelectedIndex() == backgroundComboBox.getItemCount() - 1;
|
||||
undoManager.doOperation(new PlaceChangeDoableOperation("instance.display.cacheAsBitmap", 3) {
|
||||
RGBA color = isOpaque ? new RGBA(backgroundColorPanel.getBackground()) : null;
|
||||
|
||||
@Override
|
||||
public void doPlaceOperation(PlaceObjectTypeTag placeObject, DepthState depthState) {
|
||||
public void doPlaceOperation(PlaceObjectTypeTag placeObject, DepthState depthState) {
|
||||
if (color != null) {
|
||||
backgroundColorLabel.setText("");
|
||||
placeObject.setBackgroundColor(color);
|
||||
} else {
|
||||
placeObject.setPlaceFlagOpaqueBackground(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, swfPanel.getSwf());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
backgroundColorPanel.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
@@ -602,21 +604,22 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
if (newColor != null) {
|
||||
backgroundColorPanel.setBackground(newColor);
|
||||
backgroundColorLabel.setText("");
|
||||
|
||||
|
||||
undoManager.doOperation(new PlaceChangeDoableOperation("instance.display.cacheAsBitmap", 3) {
|
||||
RGBA color = new RGBA(newColor);
|
||||
|
||||
@Override
|
||||
public void doPlaceOperation(PlaceObjectTypeTag placeObject, DepthState depthState) {
|
||||
public void doPlaceOperation(PlaceObjectTypeTag placeObject, DepthState depthState) {
|
||||
placeObject.setBackgroundColor(color);
|
||||
}
|
||||
}
|
||||
}, swfPanel.getSwf());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
add(propertiesPanel, BorderLayout.CENTER);
|
||||
|
||||
|
||||
swfPanel.getStagePanel().addBoundsChangeListener(new BoundsChangeListener() {
|
||||
@Override
|
||||
public void boundsChanged(Rectangle2D newBounds, Point2D registrationPoint, RegistrationPointPosition registrationPointPosition) {
|
||||
@@ -625,7 +628,7 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
yPropertyField.setValue(twipToPixelValue(newBounds.getY()), true);
|
||||
wPropertyField.setValue(twipToPixelValue(newBounds.getWidth()), true);
|
||||
hPropertyField.setValue(twipToPixelValue(newBounds.getHeight()), true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
@@ -636,7 +639,7 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
ret = ret / 20;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
public void update() {
|
||||
updating = true;
|
||||
List<DepthState> dss = swfPanel.getSelectedDepthStates();
|
||||
@@ -646,7 +649,7 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
return;
|
||||
}
|
||||
propertiesPanel.setVisible(true);
|
||||
|
||||
|
||||
if (dss.size() == 1) {
|
||||
EasyTagNameResolver resolver = new EasyTagNameResolver();
|
||||
DepthState ds = dss.get(0);
|
||||
@@ -658,9 +661,8 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
} else {
|
||||
instanceLabel.setText(EasyStrings.translate("properties.instance.multiple").replace("%count%", "" + dss.size()));
|
||||
}
|
||||
|
||||
|
||||
//swfPanel.getStagePanel().get
|
||||
|
||||
Set<Integer> alphaPercent = new HashSet<>();
|
||||
Set<Integer> alphaAdd = new HashSet<>();
|
||||
Set<Integer> redPercent = new HashSet<>();
|
||||
@@ -673,7 +675,7 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
Set<Integer> blendMode = new HashSet<>();
|
||||
Set<Boolean> cacheAsBitmap = new HashSet<>();
|
||||
Set<RGBA> backgroundColor = new HashSet<>();
|
||||
|
||||
|
||||
for (DepthState ds : dss) {
|
||||
if (ds == null) {
|
||||
continue;
|
||||
@@ -707,12 +709,11 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
cacheAsBitmap.add(ds.cacheAsBitmap);
|
||||
backgroundColor.add(ds.backGroundColor);
|
||||
}
|
||||
|
||||
|
||||
if (visible.size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
alphaPercentPropertyField.setValue(alphaPercent, true);
|
||||
alphaAddPropertyField.setValue(alphaAdd, true);
|
||||
redPercentPropertyField.setValue(redPercent, true);
|
||||
@@ -721,15 +722,14 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
greenAddPropertyField.setValue(greenAdd, true);
|
||||
bluePercentPropertyField.setValue(bluePercent, true);
|
||||
blueAddPropertyField.setValue(blueAdd, true);
|
||||
|
||||
|
||||
|
||||
if (visible.size() > 1) {
|
||||
visibleCheckBox.setSelectionState(1);
|
||||
} else {
|
||||
visibleCheckBox.setSelected(visible.iterator().next());
|
||||
}
|
||||
|
||||
DefaultComboBoxModel<String> model = (DefaultComboBoxModel<String>) blendingComboBox.getModel();
|
||||
}
|
||||
|
||||
DefaultComboBoxModel<String> model = (DefaultComboBoxModel<String>) blendingComboBox.getModel();
|
||||
if (blendMode.size() > 1) {
|
||||
if (!model.getElementAt(0).equals("")) {
|
||||
model.insertElementAt("", 0);
|
||||
@@ -738,9 +738,9 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
} else {
|
||||
if (model.getElementAt(0).equals("")) {
|
||||
model.removeElementAt(0);
|
||||
}
|
||||
}
|
||||
int bm = blendMode.iterator().next();
|
||||
|
||||
|
||||
bm--;
|
||||
blendingComboBox.setSelectedIndex(bm);
|
||||
}
|
||||
@@ -749,13 +749,12 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
} else {
|
||||
cacheAsBitmapCheckBox.setSelected(cacheAsBitmap.iterator().next());
|
||||
}
|
||||
|
||||
|
||||
backgroundComboBox.setVisible(cacheAsBitmapCheckBox.getSelectionState() == 2);
|
||||
|
||||
|
||||
|
||||
DefaultComboBoxModel<String> backgroundModel = (DefaultComboBoxModel<String>) backgroundComboBox.getModel();
|
||||
if (backgroundColor.size() > 1) {
|
||||
|
||||
|
||||
if (backgroundColor.contains(null)) {
|
||||
if (backgroundModel.getSize() == 2) {
|
||||
backgroundModel.insertElementAt("", 0);
|
||||
@@ -767,12 +766,12 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
backgroundModel.removeElementAt(0);
|
||||
}
|
||||
backgroundComboBox.setSelectedIndex(1);
|
||||
|
||||
|
||||
backgroundColorPanel.setVisible(true);
|
||||
backgroundColorLabel.setText("--");
|
||||
backgroundColorPanel.setBackground(Color.WHITE);
|
||||
backgroundColorPanel.setOpaque(true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (backgroundModel.getSize() == 3) {
|
||||
backgroundModel.removeElementAt(0);
|
||||
@@ -780,19 +779,18 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
RGBA bgColor = backgroundColor.iterator().next();
|
||||
backgroundComboBox.setSelectedIndex(bgColor == null ? 0 : 1);
|
||||
backgroundColorLabel.setText("");
|
||||
|
||||
|
||||
if (bgColor == null) {
|
||||
backgroundColorPanel.setVisible(false);
|
||||
} else {
|
||||
backgroundColorPanel.setVisible(true);
|
||||
backgroundColorPanel.setBackground(bgColor.toColor());
|
||||
backgroundColorPanel.setOpaque(true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
updating = false;
|
||||
revalidate();
|
||||
revalidate();
|
||||
}
|
||||
|
||||
abstract class PlaceChangeDoableOperation extends PropertyChangeDoableOperation {
|
||||
@@ -803,21 +801,19 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
List<DepthState> depthStatesBefore = swfPanel.getSelectedDepthStates();
|
||||
List<PlaceObjectTypeTag> placeObjectsBefore = swfPanel.getSelectedPlaceTags();
|
||||
List<PlaceObjectTypeTag> placeObjectsAfter = new ArrayList<>();
|
||||
|
||||
|
||||
private final boolean timelinedModifiedBefore = swfPanel.getTimelined().isModified();
|
||||
|
||||
|
||||
private final Timelined timelined = swfPanel.getTimelined();
|
||||
|
||||
|
||||
|
||||
|
||||
public PlaceChangeDoableOperation(String propertyIdentifier, int minPlace) {
|
||||
super(propertyIdentifier);
|
||||
|
||||
|
||||
for (int i = 0; i < fdepths.size(); i++) {
|
||||
PlaceObjectTypeTag placeObjectBefore = placeObjectsBefore.get(i);
|
||||
int convNum = placeObjectBefore.getPlaceObjectNum() < minPlace ? minPlace : placeObjectBefore.getPlaceObjectNum();
|
||||
PlaceObjectTypeConverter conv = new PlaceObjectTypeConverter();
|
||||
PlaceObjectTypeTag placeObjectAfter = conv.convertTagType(placeObjectBefore, timelined.getSwf(), convNum, false);
|
||||
PlaceObjectTypeTag placeObjectAfter = conv.convertTagType(placeObjectBefore, timelined.getSwf(), convNum, false);
|
||||
placeObjectsAfter.add(placeObjectAfter);
|
||||
}
|
||||
}
|
||||
@@ -826,20 +822,20 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
public final void doOperation() {
|
||||
swfPanel.getStagePanel().gotoFrame(fframe + 1);
|
||||
swfPanel.getStagePanel().selectDepths(fdepths);
|
||||
|
||||
|
||||
for (int i = 0; i < fdepths.size(); i++) {
|
||||
PlaceObjectTypeTag placeObjectBefore = placeObjectsBefore.get(i);
|
||||
PlaceObjectTypeTag placeObjectAfter = placeObjectsAfter.get(i);
|
||||
|
||||
|
||||
int index = timelined.indexOfTag(placeObjectBefore);
|
||||
timelined.removeTag(index);
|
||||
timelined.addTag(index, placeObjectAfter);
|
||||
timelined.setModified(true);
|
||||
DepthState depthStateBefore = depthStatesBefore.get(i);
|
||||
DepthState depthStateBefore = depthStatesBefore.get(i);
|
||||
doPlaceOperation(placeObjectAfter, depthStateBefore);
|
||||
}
|
||||
|
||||
timelined.resetTimeline();
|
||||
|
||||
timelined.resetTimeline();
|
||||
update();
|
||||
}
|
||||
|
||||
@@ -849,7 +845,7 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
swfPanel.getStagePanel().selectDepths(fdepths);
|
||||
for (int i = 0; i < placeObjectsAfter.size(); i++) {
|
||||
PlaceObjectTypeTag placeObjectAfter = placeObjectsAfter.get(i);
|
||||
PlaceObjectTypeTag placeObjectBefore = placeObjectsBefore.get(i);
|
||||
PlaceObjectTypeTag placeObjectBefore = placeObjectsBefore.get(i);
|
||||
int index = timelined.indexOfTag(placeObjectAfter);
|
||||
timelined.removeTag(index);
|
||||
timelined.addTag(index, placeObjectBefore);
|
||||
@@ -858,7 +854,7 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
timelined.setModified(false);
|
||||
}
|
||||
timelined.resetTimeline();
|
||||
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
@@ -874,7 +870,7 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void doPlaceOperation(PlaceObjectTypeTag placeObject, DepthState depthState) {
|
||||
public final void doPlaceOperation(PlaceObjectTypeTag placeObject, DepthState depthState) {
|
||||
colorTransformAfter = depthState.colorTransForm == null ? new CXFORMWITHALPHA() : new CXFORMWITHALPHA(depthState.colorTransForm);
|
||||
doColorEffectOperation(colorTransformAfter);
|
||||
placeObject.setColorTransform(colorTransformAfter);
|
||||
|
||||
@@ -37,20 +37,20 @@ import javax.swing.JRadioButton;
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class ConvertPlaceObjectTypeDialog extends AppDialog {
|
||||
|
||||
|
||||
private List<JRadioButton> radios = new ArrayList<>();
|
||||
|
||||
|
||||
private int result = 0;
|
||||
|
||||
|
||||
public ConvertPlaceObjectTypeDialog(Window owner, int currentPlaceObjectNum, int min) {
|
||||
super(owner);
|
||||
setTitle(translate("dialog.title"));
|
||||
JPanel radioPanel = new JPanel();
|
||||
radioPanel.setLayout(new BoxLayout(radioPanel, BoxLayout.Y_AXIS));
|
||||
ButtonGroup radioGroup = new ButtonGroup();
|
||||
|
||||
|
||||
JButton okButton = new JButton(translate("button.ok"));
|
||||
|
||||
|
||||
for (int i = 1; i <= 4; i++) {
|
||||
String text = "PlaceObject" + (i > 1 ? "" + i : "");
|
||||
if (i == min) {
|
||||
@@ -63,39 +63,38 @@ public class ConvertPlaceObjectTypeDialog extends AppDialog {
|
||||
radio.setSelected(true);
|
||||
}
|
||||
final int fi = i;
|
||||
radio.addActionListener(new ActionListener(){
|
||||
radio.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
okButton.setEnabled(fi != currentPlaceObjectNum);
|
||||
}
|
||||
}
|
||||
});
|
||||
radioPanel.add(radio);
|
||||
radioPanel.add(radio);
|
||||
radioGroup.add(radio);
|
||||
radios.add(radio);
|
||||
radios.add(radio);
|
||||
}
|
||||
|
||||
Container cnt = getContentPane();
|
||||
|
||||
Container cnt = getContentPane();
|
||||
cnt.setLayout(new BorderLayout());
|
||||
|
||||
|
||||
cnt.add(radioPanel, BorderLayout.CENTER);
|
||||
|
||||
|
||||
JPanel buttonsPanel = new JPanel(new FlowLayout());
|
||||
|
||||
|
||||
okButton.setEnabled(false);
|
||||
okButton.addActionListener(this::okButtonActionPerformed);
|
||||
JButton cancelButton = new JButton(translate("button.cancel"));
|
||||
cancelButton.addActionListener(this::cancelButtonActionPerformed);
|
||||
buttonsPanel.add(okButton);
|
||||
buttonsPanel.add(cancelButton);
|
||||
|
||||
|
||||
cnt.add(buttonsPanel, BorderLayout.SOUTH);
|
||||
pack();
|
||||
View.centerScreen(this);
|
||||
View.setWindowIcon(this, "placeobject");
|
||||
setModal(true);
|
||||
}
|
||||
|
||||
|
||||
private void okButtonActionPerformed(ActionEvent evt) {
|
||||
result = 0;
|
||||
for (int i = 0; i < radios.size(); i++) {
|
||||
@@ -106,16 +105,16 @@ public class ConvertPlaceObjectTypeDialog extends AppDialog {
|
||||
}
|
||||
setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
private void cancelButtonActionPerformed(ActionEvent evt) {
|
||||
setVisible(false);
|
||||
}
|
||||
|
||||
public int getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public int showDialog() {
|
||||
}
|
||||
|
||||
public int showDialog() {
|
||||
setVisible(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -36,20 +36,20 @@ import javax.swing.JRadioButton;
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class ConvertShapeTypeDialog extends AppDialog {
|
||||
|
||||
|
||||
private List<JRadioButton> radios = new ArrayList<>();
|
||||
|
||||
|
||||
private int result = 0;
|
||||
|
||||
|
||||
public ConvertShapeTypeDialog(Window owner, int currentShapeNum, int minForced, int min) {
|
||||
super(owner);
|
||||
setTitle(translate("dialog.title"));
|
||||
JPanel radioPanel = new JPanel();
|
||||
radioPanel.setLayout(new BoxLayout(radioPanel, BoxLayout.Y_AXIS));
|
||||
ButtonGroup radioGroup = new ButtonGroup();
|
||||
|
||||
|
||||
JButton okButton = new JButton(translate("button.ok"));
|
||||
|
||||
|
||||
for (int i = 1; i <= 4; i++) {
|
||||
String text = "DefineShape" + (i > 1 ? "" + i : "");
|
||||
if (i < minForced) {
|
||||
@@ -68,39 +68,38 @@ public class ConvertShapeTypeDialog extends AppDialog {
|
||||
radio.setSelected(true);
|
||||
}
|
||||
final int fi = i;
|
||||
radio.addActionListener(new ActionListener(){
|
||||
radio.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
okButton.setEnabled(fi != currentShapeNum);
|
||||
}
|
||||
}
|
||||
});
|
||||
radioPanel.add(radio);
|
||||
radioPanel.add(radio);
|
||||
radioGroup.add(radio);
|
||||
radios.add(radio);
|
||||
radios.add(radio);
|
||||
}
|
||||
|
||||
Container cnt = getContentPane();
|
||||
|
||||
Container cnt = getContentPane();
|
||||
cnt.setLayout(new BorderLayout());
|
||||
|
||||
|
||||
cnt.add(radioPanel, BorderLayout.CENTER);
|
||||
|
||||
|
||||
JPanel buttonsPanel = new JPanel(new FlowLayout());
|
||||
|
||||
|
||||
okButton.setEnabled(false);
|
||||
okButton.addActionListener(this::okButtonActionPerformed);
|
||||
JButton cancelButton = new JButton(translate("button.cancel"));
|
||||
cancelButton.addActionListener(this::cancelButtonActionPerformed);
|
||||
buttonsPanel.add(okButton);
|
||||
buttonsPanel.add(cancelButton);
|
||||
|
||||
|
||||
cnt.add(buttonsPanel, BorderLayout.SOUTH);
|
||||
pack();
|
||||
View.centerScreen(this);
|
||||
View.setWindowIcon(this, "shape");
|
||||
setModal(true);
|
||||
}
|
||||
|
||||
|
||||
private void okButtonActionPerformed(ActionEvent evt) {
|
||||
result = 0;
|
||||
for (int i = 0; i < radios.size(); i++) {
|
||||
@@ -111,16 +110,16 @@ public class ConvertShapeTypeDialog extends AppDialog {
|
||||
}
|
||||
setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
private void cancelButtonActionPerformed(ActionEvent evt) {
|
||||
setVisible(false);
|
||||
}
|
||||
|
||||
public int getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public int showDialog() {
|
||||
}
|
||||
|
||||
public int showDialog() {
|
||||
setVisible(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -132,9 +132,8 @@ import org.pushingpixels.substance.api.SubstanceSkin;
|
||||
*/
|
||||
public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
|
||||
|
||||
private static final int MAX_SOUND_CHANNELS = 8; //TODO: Maybe add to Advanced settings
|
||||
|
||||
|
||||
private static final Logger logger = Logger.getLogger(ImagePanel.class.getName());
|
||||
|
||||
private final List<MediaDisplayListener> listeners = new ArrayList<>();
|
||||
@@ -182,7 +181,6 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
private int time = 0;
|
||||
|
||||
//private int selectedDepth = -1;
|
||||
|
||||
//private int freeTransformDepth = -1;
|
||||
private boolean doFreeTransform = false;
|
||||
|
||||
@@ -208,10 +206,10 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
|
||||
private Point2D registrationPoint = null;
|
||||
private Point2D registrationPointUpdated = null;
|
||||
|
||||
|
||||
private int mode = Cursor.DEFAULT_CURSOR;
|
||||
private Rectangle2D bounds;
|
||||
|
||||
|
||||
private Matrix transform;
|
||||
private AffineTransform transformUpdated;
|
||||
|
||||
@@ -262,7 +260,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
private boolean autoPlayed = false;
|
||||
|
||||
private boolean frozen = false;
|
||||
|
||||
|
||||
private boolean frozenButtons = false;
|
||||
|
||||
private boolean muted = false;
|
||||
@@ -308,57 +306,57 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
private List<java.awt.Point> showPoints2 = new ArrayList<>();
|
||||
|
||||
private int displayedFrame = 0;
|
||||
|
||||
|
||||
private JPanel topPanel;
|
||||
|
||||
|
||||
private TagNameResolverInterface tagNameResolver = new DefaultTagNameResolver();
|
||||
|
||||
|
||||
private boolean showAllDepthLevelsInfo = true;
|
||||
|
||||
|
||||
private boolean selectionMode = false;
|
||||
|
||||
|
||||
private boolean transformSelectionMode = false;
|
||||
|
||||
|
||||
private boolean multiSelect = false;
|
||||
|
||||
|
||||
private boolean inMoving = false;
|
||||
|
||||
|
||||
private List<Integer> selectedDepths = new ArrayList<>();
|
||||
|
||||
|
||||
private final List<Integer> parentFrames = new ArrayList<>();
|
||||
|
||||
|
||||
private final List<Integer> parentDepths = new ArrayList<>();
|
||||
|
||||
private final List<Timelined> parentTimelineds = new ArrayList<>();
|
||||
|
||||
public void setFrozenButtons(boolean frozenButtons) {
|
||||
this.frozenButtons = frozenButtons;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean isMultiSelect() {
|
||||
return multiSelect;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setMultiSelect(boolean multiSelect) {
|
||||
this.multiSelect = multiSelect;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setSelectionMode(boolean selectionMode) {
|
||||
this.selectionMode = selectionMode;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setTransformSelectionMode(boolean transformSelectionMode) {
|
||||
this.transformSelectionMode = transformSelectionMode;
|
||||
}
|
||||
}
|
||||
|
||||
public void setTagNameResolver(TagNameResolverInterface tagNameResolver) {
|
||||
this.tagNameResolver = tagNameResolver;
|
||||
}
|
||||
}
|
||||
|
||||
public void setShowAllDepthLevelsInfo(boolean showAllDepthLevelsInfo) {
|
||||
this.showAllDepthLevelsInfo = showAllDepthLevelsInfo;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setTopPanelVisible(boolean visible) {
|
||||
topPanel.setVisible(visible);
|
||||
}
|
||||
@@ -391,17 +389,17 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
private List<BoundsChangeListener> boundsChangeListeners = new ArrayList<>();
|
||||
|
||||
private List<PointUpdateListener> pointUpdateListeners = new ArrayList<>();
|
||||
|
||||
|
||||
private List<Runnable> transformChangeListeners = new ArrayList<>();
|
||||
|
||||
public void addTransformChangeListener(Runnable listener) {
|
||||
transformChangeListeners.add(listener);
|
||||
}
|
||||
|
||||
|
||||
public void removeTransformChangeListener(Runnable listener) {
|
||||
transformChangeListeners.remove(listener);
|
||||
}
|
||||
|
||||
|
||||
public void addPointUpdateListener(PointUpdateListener listener) {
|
||||
pointUpdateListeners.add(listener);
|
||||
}
|
||||
@@ -415,7 +413,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
listener.pointsUpdated(points);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void fireTransformChanged() {
|
||||
for (Runnable listener : transformChangeListeners) {
|
||||
listener.run();
|
||||
@@ -639,8 +637,9 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
}
|
||||
selectDepths(depths);
|
||||
}
|
||||
|
||||
public synchronized void selectDepths(List<Integer> depths) {
|
||||
|
||||
|
||||
depths = new ArrayList<>(depths);
|
||||
for (int i = 0; i < depths.size(); i++) {
|
||||
int depth = depths.get(i);
|
||||
@@ -650,11 +649,11 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
transformUpdated = null;
|
||||
registrationPointUpdated = null;
|
||||
transform = null;
|
||||
|
||||
|
||||
selectedDepths = new ArrayList<>(depths);
|
||||
doFreeTransform = false;
|
||||
|
||||
@@ -667,27 +666,23 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
|
||||
public List<Integer> getSelectedDepths() {
|
||||
return new ArrayList<>(selectedDepths);
|
||||
}
|
||||
|
||||
public synchronized int getFrame() {
|
||||
return frame;
|
||||
}
|
||||
}
|
||||
|
||||
private void calculateFreeOrSelectionTransform() {
|
||||
if (!(doFreeTransform || selectionMode)) {
|
||||
return;
|
||||
}
|
||||
if (selectedDepths.isEmpty()) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
DepthState ds = null;
|
||||
Timeline timeline = timelined.getTimeline();
|
||||
|
||||
|
||||
if (timeline.getFrameCount() <= frame) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (selectedDepths.size() == 1) {
|
||||
ds = timeline.getFrame(frame).layers.get(selectedDepths.get(0));
|
||||
}
|
||||
@@ -712,10 +707,10 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
}
|
||||
}
|
||||
} else {*/
|
||||
transform = new Matrix();
|
||||
Rectangle2D transformBounds = getTransformBounds();
|
||||
registrationPointPosition = RegistrationPointPosition.CENTER;
|
||||
fireBoundsChange(transformBounds, new Point2D.Double(transformBounds.getCenterX(), transformBounds.getCenterY()), registrationPointPosition);
|
||||
transform = new Matrix();
|
||||
Rectangle2D transformBounds = getTransformBounds();
|
||||
registrationPointPosition = RegistrationPointPosition.CENTER;
|
||||
fireBoundsChange(transformBounds, new Point2D.Double(transformBounds.getCenterX(), transformBounds.getCenterY()), registrationPointPosition);
|
||||
//}
|
||||
}
|
||||
|
||||
@@ -726,7 +721,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
}
|
||||
freeTransformDepths(depths);
|
||||
}
|
||||
|
||||
|
||||
public synchronized void freeTransformDepths(List<Integer> depths) {
|
||||
selectedDepths = new ArrayList<>(depths);
|
||||
doFreeTransform = !depths.isEmpty();
|
||||
@@ -739,7 +734,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
redraw();
|
||||
iconPanel.requestFocusInWindow();
|
||||
}
|
||||
|
||||
|
||||
private void centerImage() {
|
||||
Timelined tim = timelined;
|
||||
if (tim == null) {
|
||||
@@ -1184,14 +1179,14 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
MouseInputAdapter mouseInputAdapter = new MouseInputAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
|
||||
if (e.getClickCount() == 2 && selectionMode && !transformSelectionMode) {
|
||||
|
||||
|
||||
if (e.getClickCount() == 2 && selectionMode && !transformSelectionMode) {
|
||||
|
||||
DepthState ds = depthStateUnderCursor;
|
||||
if (ds != null) {
|
||||
CharacterTag cht = ds.getCharacter();
|
||||
if (cht instanceof Timelined) {
|
||||
synchronized(lock) {
|
||||
synchronized (lock) {
|
||||
parentTimelineds.add(timelined);
|
||||
parentDepths.add(ds.depth);
|
||||
parentFrames.add(ds.frame.frame);
|
||||
@@ -1202,10 +1197,10 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
fireMediaDisplayStateChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (shiftDown) {
|
||||
List<Integer> newSelectedPoints = new ArrayList<>(pointsUnderCursor);
|
||||
for (int i : selectedPoints) {
|
||||
@@ -1220,10 +1215,10 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
selectedPoints = new ArrayList<>(pointsUnderCursor);
|
||||
}
|
||||
calculatePointsXY();
|
||||
|
||||
|
||||
if (altDown || selectionMode) {
|
||||
if (depthStateUnderCursor != null) {
|
||||
|
||||
|
||||
List<Integer> newSelectedDepths = new ArrayList<>();
|
||||
if (ctrlDown) {
|
||||
newSelectedDepths.addAll(selectedDepths);
|
||||
@@ -1241,7 +1236,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
freeTransformDepths(newSelectedDepths);
|
||||
firePlaceObjectSelected();
|
||||
}
|
||||
} else if ((altDown && !selectionMode) || selectionMode){
|
||||
} else if ((altDown && !selectionMode) || selectionMode) {
|
||||
selectDepths(newSelectedDepths);
|
||||
firePlaceObjectSelected();
|
||||
}
|
||||
@@ -1256,27 +1251,27 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
selectDepths(new ArrayList<>());
|
||||
firePlaceObjectSelected();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
if (SwingUtilities.isLeftMouseButton(e)) {
|
||||
|
||||
if (SwingUtilities.isLeftMouseButton(e)) {
|
||||
|
||||
if (altDown || selectionMode) {
|
||||
if (depthStateUnderCursor != null && selectedDepths.contains(depthStateUnderCursor.depth)) {
|
||||
inMoving = selectionMode;
|
||||
calculateFreeOrSelectionTransform();
|
||||
calculateFreeOrSelectionTransform();
|
||||
}
|
||||
if (!selectionMode) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
mouseMoved(e); //to correctly calculate mode, because mouseMoved event is not called during dragging
|
||||
setDragStart(e.getPoint());
|
||||
|
||||
setDragStart(e.getPoint());
|
||||
|
||||
if (!shiftDown) {
|
||||
boolean selectedUnderCursor = false;
|
||||
for (int p : pointsUnderCursor) {
|
||||
@@ -1351,7 +1346,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
}
|
||||
updateScrollBarMinMax();
|
||||
}
|
||||
|
||||
|
||||
if (dragStart != null && !inMoving && multiSelect) {
|
||||
Rectangle2D selectionRect = getSelectionRect();
|
||||
if (selectionRect != null) {
|
||||
@@ -1431,7 +1426,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
registrationPointPosition = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
calcRect(); //do not put this inside synchronized block, it cause deadlock
|
||||
fireBoundsChange(getTransformBounds(), registrationPoint, registrationPointPosition);
|
||||
fireTransformChanged();
|
||||
@@ -1451,7 +1446,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
@Override
|
||||
public void mouseDragged(MouseEvent e) {
|
||||
List<DisplayPoint> points = hilightedPoints;
|
||||
|
||||
|
||||
if (dragStart != null && multiSelect && !inMoving && mode == Cursor.DEFAULT_CURSOR) {
|
||||
selectionEnd = e.getPoint();
|
||||
repaint();
|
||||
@@ -1533,21 +1528,21 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
repaint();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//move in selection mode
|
||||
if (dragStart != null && selectionMode && !doFreeTransform) {
|
||||
if (transform == null) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
Matrix parentMatrix = getParentMatrix();
|
||||
|
||||
|
||||
Point2D mouseTransPoint = toTransformPoint(new Point2D.Double(e.getX(), e.getY()));
|
||||
double ex = mouseTransPoint.getX();
|
||||
double ey = mouseTransPoint.getY();
|
||||
Point2D dragStartTransPoint = toTransformPoint(dragStart);
|
||||
double dsx = dragStartTransPoint.getX();
|
||||
double dsy = dragStartTransPoint.getY();
|
||||
|
||||
|
||||
double deltaX = ex - dsx;
|
||||
double deltaY = ey - dsy;
|
||||
|
||||
@@ -1556,7 +1551,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
t.translate(deltaX, deltaY);
|
||||
t.concatenate(parentMatrix.inverse().toTransform());
|
||||
newTransform.preConcatenate(t);
|
||||
|
||||
|
||||
Point2D newRegistrationPoint = new Matrix(t).preConcatenate(parentMatrix.inverse()).concatenate(parentMatrix).transform(registrationPoint);
|
||||
|
||||
transformUpdated = newTransform;
|
||||
@@ -1570,10 +1565,10 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
return;
|
||||
}
|
||||
|
||||
Matrix parentMatrix = getParentMatrix();
|
||||
Matrix parentMatrix = getParentMatrix();
|
||||
Point2D mouseTransPoint = toTransformPoint(new Point2D.Double(e.getX(), e.getY()));
|
||||
//mouseTransPoint = parentMatrix.inverse().transform(mouseTransPoint);
|
||||
|
||||
|
||||
double ex = mouseTransPoint.getX();
|
||||
double ey = mouseTransPoint.getY();
|
||||
Point2D dragStartTransPoint = toTransformPoint(dragStart);
|
||||
@@ -1608,7 +1603,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
AffineTransform newTransform = new AffineTransform(transform.toTransform());
|
||||
AffineTransform t = new AffineTransform();
|
||||
Point2D bStart = parentMatrix.transform(new Point2D.Double(bounds.getX(), bounds.getY()));
|
||||
|
||||
|
||||
t.translate(bStart.getX(), bStart.getY());
|
||||
t.shear(shearX, 0);
|
||||
t.translate(-bStart.getX(), -bStart.getY());
|
||||
@@ -1627,7 +1622,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
|
||||
AffineTransform newTransform = new AffineTransform(transform.toTransform());
|
||||
AffineTransform t = new AffineTransform();
|
||||
Point2D bStart = parentMatrix.transform(new Point2D.Double(bounds.getX(), bounds.getY()));
|
||||
Point2D bStart = parentMatrix.transform(new Point2D.Double(bounds.getX(), bounds.getY()));
|
||||
t.translate(bStart.getX(), bStart.getY());
|
||||
t.shear(0, shearY);
|
||||
t.translate(-bStart.getX(), -bStart.getY());
|
||||
@@ -1646,7 +1641,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
|
||||
AffineTransform newTransform = new AffineTransform(transform.toTransform());
|
||||
AffineTransform t = new AffineTransform();
|
||||
Point2D bStart = parentMatrix.transform(new Point2D.Double(bounds.getX(), bounds.getY()));
|
||||
Point2D bStart = parentMatrix.transform(new Point2D.Double(bounds.getX(), bounds.getY()));
|
||||
t.translate(bStart.getX(), bStart.getY());
|
||||
t.shear(0, shearY);
|
||||
t.translate(-bStart.getX(), -bStart.getY());
|
||||
@@ -1838,7 +1833,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
t.translate(deltaX, deltaY);
|
||||
t.concatenate(parentMatrix.inverse().toTransform());
|
||||
newTransform.preConcatenate(t);
|
||||
|
||||
|
||||
Point2D newRegistrationPoint = new Matrix(t).preConcatenate(parentMatrix.inverse()).concatenate(parentMatrix).transform(registrationPoint);
|
||||
|
||||
transformUpdated = newTransform;
|
||||
@@ -1858,7 +1853,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
newTransform.preConcatenate(t);
|
||||
|
||||
Point2D newRegistrationPoint = new Matrix(t).preConcatenate(parentMatrix.inverse()).concatenate(parentMatrix).transform(registrationPoint);
|
||||
|
||||
|
||||
transformUpdated = newTransform;
|
||||
registrationPointUpdated = newRegistrationPoint;
|
||||
repaint();
|
||||
@@ -2274,8 +2269,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
|
||||
private void calcRect(Zoom z) {
|
||||
synchronized (ImagePanel.this) {
|
||||
|
||||
|
||||
|
||||
Timelined topTimelined = getTopTimelined();
|
||||
if (_img != null || topTimelined != null) {
|
||||
//int w1 = (int) (_img.getWidth() * (lowQuality ? LQ_FACTOR : 1));
|
||||
@@ -2337,7 +2331,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
if (h < h2 && w < w2) {
|
||||
offsetPoint.setLocation(iconPanel.getWidth() / 2 - w / 2 - dx, iconPanel.getHeight() / 2 - h / 2 - dy);
|
||||
updateScrollBars();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
boolean doMove = h > h2 || w > w2;
|
||||
if (zoom.fit) {
|
||||
@@ -2670,8 +2664,8 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
@Override
|
||||
public void run() {
|
||||
drawFrame(thisTimer, true);
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2804,14 +2798,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
@Override
|
||||
public synchronized void zoom(Zoom zoom) {
|
||||
zoom(zoom, false, false);
|
||||
}
|
||||
|
||||
public void zoomFit() {
|
||||
Zoom z = new Zoom();
|
||||
z.value = 1.0;
|
||||
z.fit = true;
|
||||
zoom(z, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void zoom(Zoom zoom, boolean useCursor, boolean forced) {
|
||||
if (!zoomAvailable) {
|
||||
@@ -2839,8 +2826,8 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
|
||||
int dx = (int) (((cursorTransAfter.getX() - cursorTransBefore.getX()) * zoomDouble) / SWF.unitDivisor);
|
||||
int dy = (int) (((cursorTransAfter.getY() - cursorTransBefore.getY()) * zoomDouble) / SWF.unitDivisor);
|
||||
|
||||
offsetPoint.setLocation(offsetPoint.getX() + dx, offsetPoint.getY() + dy);
|
||||
|
||||
offsetPoint.setLocation(offsetPoint.getX() + dx, offsetPoint.getY() + dy);
|
||||
|
||||
updateScrollBars();
|
||||
|
||||
@@ -2861,6 +2848,13 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
}
|
||||
}
|
||||
|
||||
public void zoomFit() {
|
||||
Zoom z = new Zoom();
|
||||
z.value = 1.0;
|
||||
z.fit = true;
|
||||
zoom(z, false, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized BufferedImage printScreen() {
|
||||
return iconPanel.getLastImage();
|
||||
@@ -2874,7 +2868,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
double h1 = bounds.getHeight() / SWF.unitDivisor;
|
||||
|
||||
double w2 = iconPanel.getWidth();
|
||||
double h2 = iconPanel.getHeight();
|
||||
double h2 = iconPanel.getHeight();
|
||||
|
||||
double w;
|
||||
double h;
|
||||
@@ -2971,7 +2965,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
this.timelined = drawable;
|
||||
this.parentTimelineds.clear();
|
||||
this.parentFrames.clear();
|
||||
this.parentDepths.clear();
|
||||
this.parentDepths.clear();
|
||||
centerImage();
|
||||
this.swf = swf;
|
||||
zoomAvailable = allowZoom;
|
||||
@@ -3195,7 +3189,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
}
|
||||
fireMediaDisplayStateChanged();
|
||||
}
|
||||
|
||||
|
||||
public Matrix getParentMatrix() {
|
||||
synchronized (lock) {
|
||||
Matrix parentMatrix = new Matrix();
|
||||
@@ -3205,13 +3199,17 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
parentMatrix = parentMatrix.concatenate(new Matrix(parentDepthState.matrix));
|
||||
}
|
||||
return parentMatrix;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized int getFrame() {
|
||||
return frame;
|
||||
}
|
||||
|
||||
private static SerializableImage getFrame(Rectangle realRect, RECT rect, ExportRectangle viewRect, SWF swf, int frame, int time, Timelined drawable, RenderContext renderContext, List<Integer> selectedDepths, boolean doFreeTransform, double zoom, Reference<Point2D> registrationPointRef, Reference<Rectangle2D> boundsRef, Matrix transform, Matrix temporaryMatrix, Matrix newMatrix, boolean selectionMode,
|
||||
List<Timelined> parentTimelineds, List<Integer> parentDepths, List<Integer> parentFrames,
|
||||
Matrix parentMatrix
|
||||
) {
|
||||
) {
|
||||
Timeline timeline = drawable.getTimeline();
|
||||
SerializableImage img;
|
||||
|
||||
@@ -3232,24 +3230,24 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
m.scale(zoom);
|
||||
|
||||
Matrix fullM = m.clone();
|
||||
|
||||
|
||||
for (int i = 0; i < selectedDepths.size(); i++) {
|
||||
if (newMatrix != null) {
|
||||
DepthState ds = timeline.getFrame(frame).layers.get(selectedDepths.get(i));
|
||||
if (ds != null) {
|
||||
ds.temporaryMatrix = newMatrix.concatenate(new Matrix(ds.matrix)).toMATRIX();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Frame fr = timeline.getFrame(frame);
|
||||
|
||||
|
||||
Frame bgFr = timeline.getFrame(frame);
|
||||
|
||||
|
||||
if (!parentTimelineds.isEmpty()) {
|
||||
bgFr = parentTimelineds.get(0).getTimeline().getFrame(parentFrames.get(0));
|
||||
}
|
||||
|
||||
|
||||
if (bgFr == null || fr == null) {
|
||||
return image;
|
||||
}
|
||||
@@ -3258,36 +3256,35 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
Graphics2D g = (Graphics2D) image.getBufferedImage().getGraphics();
|
||||
g.setPaint(backgroundColor.toColor());
|
||||
g.fillRect(realRect.x, realRect.y, realRect.width, realRect.height);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
parentMatrix = new Matrix();
|
||||
List<Integer> ignoreDepths = new ArrayList<>();
|
||||
for (int i = 0; i < parentTimelineds.size(); i++) {
|
||||
Timelined parentTimelined = parentTimelineds.get(i);
|
||||
Timelined parentTimelined = parentTimelineds.get(i);
|
||||
DepthState parentDepthState = parentTimelineds.get(i).getTimeline().getDepthState(parentFrames.get(i), parentDepths.get(i));
|
||||
|
||||
|
||||
ignoreDepths.add(parentDepthState.depth);
|
||||
parentTimelined.getTimeline().toImage(parentFrames.get(i), 0, new RenderContext(), image, image, false,
|
||||
parentMatrix.preConcatenate(m), new Matrix(), parentMatrix.preConcatenate(m), null, zoom, true, viewRect, parentMatrix.preConcatenate(m), true, Timeline.DRAW_MODE_ALL, 0, !Configuration.disableBitmapSmoothing.get(),
|
||||
ignoreDepths);
|
||||
parentMatrix = parentMatrix.concatenate(new Matrix(parentDepthState.matrix));
|
||||
ignoreDepths.clear();
|
||||
ignoreDepths.clear();
|
||||
}
|
||||
|
||||
|
||||
if (!parentTimelineds.isEmpty()) {
|
||||
Graphics2D g = (Graphics2D) image.getBufferedImage().getGraphics();
|
||||
g.setPaint(new Color(255, 255, 255, 128));
|
||||
g.fillRect(realRect.x, realRect.y, realRect.width, realRect.height);
|
||||
}
|
||||
|
||||
|
||||
timeline.toImage(frame, time, renderContext, image, image, false, parentMatrix.preConcatenate(m), new Matrix(), parentMatrix.preConcatenate(m), null, zoom, true, viewRect, parentMatrix.preConcatenate(m), true, Timeline.DRAW_MODE_ALL, 0, !Configuration.disableBitmapSmoothing.get(), ignoreDepths);
|
||||
|
||||
Graphics2D gg = (Graphics2D) image.getGraphics();
|
||||
gg.setStroke(new BasicStroke(3));
|
||||
gg.setPaint(Color.green);
|
||||
gg.setTransform(AffineTransform.getTranslateInstance(0, 0));
|
||||
|
||||
gg.setTransform(AffineTransform.getTranslateInstance(0, 0));
|
||||
|
||||
if (!doFreeTransform) {
|
||||
for (int selectedDepth : selectedDepths) {
|
||||
DepthState ds = null;
|
||||
@@ -3343,11 +3340,11 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
|
||||
int dframe = time % drawableFrameCount;
|
||||
//Matrix finalMatrix = Matrix.getScaleInstance(1 / SWF.unitDivisor).concatenate(m).concatenate(new Matrix(ds.matrix));
|
||||
|
||||
|
||||
Matrix transform2 = transform;
|
||||
|
||||
|
||||
transform2 = transform.concatenate(new Matrix(ds.matrix));
|
||||
|
||||
|
||||
Shape outline = dt.getOutline(true, dframe, time, ds.ratio, renderContext, transform2, true, viewRect, zoom);
|
||||
|
||||
if (temporaryMatrix != null) {
|
||||
@@ -3371,29 +3368,29 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
}
|
||||
|
||||
if (totalBounds == null) {
|
||||
totalBounds = new Rectangle(0,0,1,1);
|
||||
totalBounds = new Rectangle(0, 0, 1, 1);
|
||||
}
|
||||
|
||||
|
||||
boundsRef.setVal(totalBounds);
|
||||
gg.setStroke(new BasicStroke(1));
|
||||
gg.setPaint(Color.black);
|
||||
if (doFreeTransform) {
|
||||
gg.draw(totalBounds);
|
||||
drawHandles(gg, totalBounds);
|
||||
drawHandles(gg, totalBounds);
|
||||
Point2D regPoint = registrationPointRef.getVal();
|
||||
if (regPoint == null) {
|
||||
regPoint = new Point2D.Double(totalBounds.getCenterX(), totalBounds.getCenterY());
|
||||
}
|
||||
drawRegistrationPoint(gg, regPoint);
|
||||
}
|
||||
|
||||
|
||||
if (timeline != null && timeline.getFrameCount() > frame) {
|
||||
for (int i = 0; i < selectedDepths.size(); i++) {
|
||||
int selectedDepth = selectedDepths.get(i);
|
||||
DepthState ds = timeline.getDepthState(frame, selectedDepth);
|
||||
if (ds != null) {
|
||||
ds.temporaryMatrix = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
img = image;
|
||||
@@ -3628,7 +3625,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
RECT rect = getTopTimelined().getRect();
|
||||
|
||||
synchronized (ImagePanel.this) {
|
||||
synchronized (lock) {
|
||||
synchronized (lock) {
|
||||
_viewRect = getViewRect();
|
||||
}
|
||||
}
|
||||
@@ -3656,18 +3653,18 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
realRect.x += offsetPoint.getX();
|
||||
realRect.y += offsetPoint.getY();
|
||||
|
||||
Point2D rawRegistrationPoint = registrationPoint == null ? null : toImagePoint(registrationPoint);
|
||||
Point2D rawRegistrationPoint = registrationPoint == null ? null : toImagePoint(registrationPoint);
|
||||
Reference<Point2D> registrationPointRef = new Reference<>(rawRegistrationPoint);
|
||||
if (!autoPlayed) {
|
||||
img = getImagePlay();
|
||||
} else if (_viewRect.getHeight() < 0 || _viewRect.getWidth() < 0) {
|
||||
img = new SerializableImage(1, 1, BufferedImage.TYPE_4BYTE_ABGR);
|
||||
} else {
|
||||
img = getFrame(realRect, rect, _viewRect, swf, frame, frozen ? 0 : time, timelined, renderContext, selectedDepths, doFreeTransform, zoomDouble, registrationPointRef, boundsRef, trans2, tempTrans2 == null ? null : new Matrix(tempTrans2), transform, selectionMode, parentTimelineds, parentDepths, parentFrames, getParentMatrix());
|
||||
img = getFrame(realRect, rect, _viewRect, swf, frame, frozen ? 0 : time, timelined, renderContext, selectedDepths, doFreeTransform, zoomDouble, registrationPointRef, boundsRef, trans2, tempTrans2 == null ? null : new Matrix(tempTrans2), transform, selectionMode, parentTimelineds, parentDepths, parentFrames, getParentMatrix());
|
||||
}
|
||||
|
||||
synchronized (ImagePanel.this) {
|
||||
synchronized (lock) {
|
||||
synchronized (lock) {
|
||||
|
||||
Rectangle2D newBounds = getTransformBounds();
|
||||
if (newBounds != null) {
|
||||
@@ -3678,9 +3675,9 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
newBounds.getCenterY());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sw.stop();
|
||||
if (sw.getElapsedMilliseconds() > 100) {
|
||||
if (Configuration.showSlowRenderingWarning.get()) {
|
||||
@@ -3764,7 +3761,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
|
||||
first = false;
|
||||
CharacterTag c = ds.getCharacter();
|
||||
|
||||
|
||||
ret.append(tagNameResolver.getTagName(c));
|
||||
if (ds.depth > -1) {
|
||||
ret.append(" ");
|
||||
@@ -3864,7 +3861,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
}
|
||||
}
|
||||
|
||||
drawReady = true;
|
||||
drawReady = true;
|
||||
}
|
||||
}
|
||||
synchronized (delayObject) {
|
||||
@@ -3888,15 +3885,15 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (soundInfo.syncStop) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (soundPlayers.size() > MAX_SOUND_CHANNELS) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
final SoundTagPlayer sp;
|
||||
try {
|
||||
@@ -3904,7 +3901,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
if (soundInfo != null && soundInfo.hasLoops) {
|
||||
loopCount = Math.max(1, soundInfo.loopCount);
|
||||
}
|
||||
|
||||
|
||||
sp = new SoundTagPlayer(soundInfo, st, loopCount, false, resample);
|
||||
sp.addEventListener(new MediaDisplayListener() {
|
||||
@Override
|
||||
@@ -4037,7 +4034,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
long delay = getMsPerFrame();
|
||||
if (isSingleFrame) {
|
||||
drawFrame(thisTimer, true);
|
||||
|
||||
|
||||
fireMediaDisplayStateChanged();
|
||||
} else {
|
||||
//Time before drawing current frame
|
||||
@@ -4165,6 +4162,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
|
||||
/**
|
||||
* Goto frame
|
||||
*
|
||||
* @param frame 1-based frame
|
||||
*/
|
||||
@Override
|
||||
@@ -4174,15 +4172,15 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
}
|
||||
Timeline timeline = timelined.getTimeline();
|
||||
if (frame > timeline.getFrameCount()) {
|
||||
frame = timeline.getFrameCount();
|
||||
frame = timeline.getFrameCount();
|
||||
}
|
||||
if (frame < 1) {
|
||||
frame = 1;
|
||||
frame = 1;
|
||||
}
|
||||
|
||||
this.autoPlayed = true;
|
||||
this.frame = frame - 1;
|
||||
this.prevFrame = -1;
|
||||
this.prevFrame = -1;
|
||||
stopInternal();
|
||||
redraw();
|
||||
fireMediaDisplayStateChanged();
|
||||
@@ -4265,8 +4263,8 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
|
||||
public RegistrationPointPosition getRegistrationPointPosition() {
|
||||
return registrationPointPosition;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setRegistrationPoint(Point2D registrationPoint) {
|
||||
this.registrationPoint = registrationPoint;
|
||||
this.registrationPointPosition = null;
|
||||
@@ -4300,7 +4298,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
fireTransformChanged();
|
||||
}
|
||||
|
||||
private Point2D toTransformPoint(Point2D point) {
|
||||
private Point2D toTransformPoint(Point2D point) {
|
||||
double zoomDouble = zoom.fit ? getZoomToFit() : zoom.value;
|
||||
if (lowQuality) {
|
||||
zoomDouble /= LQ_FACTOR;
|
||||
@@ -4345,12 +4343,12 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
Point2D bottomRight = toImagePoint(new Point2D.Double(rect.getMaxX(), rect.getMaxY()));
|
||||
return new Rectangle2D.Double(topLeft.getX(), topLeft.getY(), bottomRight.getX() - topLeft.getX(), bottomRight.getY() - topLeft.getY());
|
||||
}
|
||||
|
||||
|
||||
private Point2D toParentPoint(Point2D point) {
|
||||
point = getParentMatrix().transform(point);
|
||||
return point;
|
||||
}
|
||||
|
||||
|
||||
private Rectangle2D toParentRect(Rectangle2D rect) {
|
||||
Point2D topLeft = toParentPoint(new Point2D.Double(rect.getMinX(), rect.getMinY()));
|
||||
Point2D bottomRight = toParentPoint(new Point2D.Double(rect.getMaxX(), rect.getMaxY()));
|
||||
@@ -4370,16 +4368,16 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
if (freeTransformDepth == -1 && selectionMode && transform != null && selectedDepth != -1 && timeline.getFrameCount() > frame) {
|
||||
ds = timeline.getFrame(frame).layers.get(selectedDepth);
|
||||
}*/
|
||||
|
||||
|
||||
if (timeline.getFrameCount() <= frame) {
|
||||
return new Rectangle2D.Double(0,0,1,1);
|
||||
return new Rectangle2D.Double(0, 0, 1, 1);
|
||||
}
|
||||
|
||||
|
||||
Matrix newMatrix = getNewMatrix();
|
||||
|
||||
|
||||
if (newMatrix == null) {
|
||||
return new Rectangle2D.Double(0,0,1,1);
|
||||
}
|
||||
return new Rectangle2D.Double(0, 0, 1, 1);
|
||||
}
|
||||
RenderContext renderContext = new RenderContext();
|
||||
renderContext.displayObjectCache = displayObjectCache;
|
||||
if (cursorPosition != null && !doFreeTransform) {
|
||||
@@ -4438,8 +4436,8 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
this.pathPosition = pathPosition;
|
||||
this.closestPoint = closestPoint;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Timelined getTopTimelined() {
|
||||
synchronized (lock) {
|
||||
if (!parentTimelineds.isEmpty()) {
|
||||
|
||||
@@ -665,7 +665,7 @@ public class Main {
|
||||
|
||||
private static void deleteCookiesAfterRun(File tempFile) {
|
||||
SharedObjectsStorage.removeChangedListener(tempFile, runCookieListener);
|
||||
File solDir = SharedObjectsStorage.getSolDirectoryForLocalFile(tempFile);
|
||||
File solDir = SharedObjectsStorage.getSolDirectoryForLocalFile(tempFile);
|
||||
File origSolDir = runningSWF.getFile() == null ? null : SharedObjectsStorage.getSolDirectoryForLocalFile(new File(runningSWF.getFile()));
|
||||
if (solDir != null) {
|
||||
WatchKey foundKey = null;
|
||||
@@ -674,20 +674,20 @@ public class Main {
|
||||
foundKey = key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (foundKey != null) {
|
||||
SharedObjectsStorage.watchedCookieDirectories.remove(foundKey);
|
||||
}
|
||||
|
||||
|
||||
View.execInEventDispatchLater(new Runnable() {
|
||||
public void run() {
|
||||
public void run() {
|
||||
if (solDir.exists()) {
|
||||
|
||||
if (origSolDir != null && origSolDir.exists()) {
|
||||
|
||||
if (origSolDir != null && origSolDir.exists()) {
|
||||
for (File f : origSolDir.listFiles()) {
|
||||
f.delete();
|
||||
}
|
||||
|
||||
|
||||
for (File f : solDir.listFiles()) {
|
||||
try {
|
||||
Files.copy(f.toPath(), origSolDir.toPath().resolve(f.getName()), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.COPY_ATTRIBUTES);
|
||||
@@ -696,12 +696,12 @@ public class Main {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (File f : solDir.listFiles()) {
|
||||
f.delete();
|
||||
}
|
||||
solDir.delete();
|
||||
}
|
||||
solDir.delete();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -730,7 +730,7 @@ public class Main {
|
||||
} catch (IOException ex) {
|
||||
//ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
runCookieListener = new CookiesChangedListener() {
|
||||
@@ -753,7 +753,7 @@ public class Main {
|
||||
} catch (IOException ex) {
|
||||
//ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
SharedObjectsStorage.addChangedListener(tempFile, runCookieListener);
|
||||
@@ -1344,7 +1344,7 @@ public class Main {
|
||||
@Override
|
||||
public boolean accept(File f) {
|
||||
return (f.getName().toLowerCase(Locale.ENGLISH).endsWith(".swf"))
|
||||
|| (f.getName().toLowerCase(Locale.ENGLISH).endsWith(".spl"))
|
||||
|| (f.getName().toLowerCase(Locale.ENGLISH).endsWith(".spl"))
|
||||
|| (f.isDirectory());
|
||||
}
|
||||
|
||||
@@ -2014,30 +2014,30 @@ public class Main {
|
||||
if (fileName != null) {
|
||||
Configuration.addRecentFile(fileName);
|
||||
SharedObjectsStorage.addChangedListener(new File(fileName), new CookiesChangedListener() {
|
||||
|
||||
|
||||
Timer timer;
|
||||
|
||||
|
||||
@Override
|
||||
public void cookiesChanged(File swfFile, List<File> cookies) {
|
||||
public void cookiesChanged(File swfFile, List<File> cookies) {
|
||||
if (timer != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
timer = new Timer();
|
||||
timer.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
View.execInEventDispatchLater(new Runnable(){
|
||||
View.execInEventDispatchLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
getMainFrame().getPanel().refreshTree();
|
||||
timer = null;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}, 500);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
if (watcher != null && Configuration.checkForModifications.get()) {
|
||||
@@ -2151,8 +2151,8 @@ public class Main {
|
||||
FileFilter swfFilter = new FileFilter() {
|
||||
@Override
|
||||
public boolean accept(File f) {
|
||||
return (f.getName().toLowerCase(Locale.ENGLISH).endsWith(".swf"))
|
||||
|| (f.getName().toLowerCase(Locale.ENGLISH).endsWith(".spl"))
|
||||
return (f.getName().toLowerCase(Locale.ENGLISH).endsWith(".swf"))
|
||||
|| (f.getName().toLowerCase(Locale.ENGLISH).endsWith(".spl"))
|
||||
|| (f.isDirectory());
|
||||
}
|
||||
|
||||
@@ -2396,8 +2396,8 @@ public class Main {
|
||||
FileFilter swfFilter = new FileFilter() {
|
||||
@Override
|
||||
public boolean accept(File f) {
|
||||
return (f.getName().toLowerCase(Locale.ENGLISH).endsWith(".swf"))
|
||||
|| (f.getName().toLowerCase(Locale.ENGLISH).endsWith(".spl"))
|
||||
return (f.getName().toLowerCase(Locale.ENGLISH).endsWith(".swf"))
|
||||
|| (f.getName().toLowerCase(Locale.ENGLISH).endsWith(".spl"))
|
||||
|| (f.isDirectory());
|
||||
}
|
||||
|
||||
@@ -2583,10 +2583,10 @@ public class Main {
|
||||
File dir = SharedObjectsStorage.watchedCookieDirectories.get(key);
|
||||
java.nio.file.Path child = dir.toPath().resolve(filename);
|
||||
File fullPath = child.toFile();
|
||||
|
||||
|
||||
View.execInEventDispatchLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
public void run() {
|
||||
SharedObjectsStorage.watchedDirectoryChanged(fullPath);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -158,11 +158,11 @@ public final class MainFrameRibbon extends AppRibbonFrame {
|
||||
|
||||
SWF easySwf = panel.getEasyPanel().getSwf();
|
||||
if (easySwf != null) {
|
||||
Configuration.lastSessionEasySwf.set(easySwf.getFile()+ "|" + easySwf.getFileTitle());
|
||||
Configuration.lastSessionEasySwf.set(easySwf.getFile() + "|" + easySwf.getFileTitle());
|
||||
} else {
|
||||
Configuration.lastSessionEasySwf.set("");
|
||||
}
|
||||
|
||||
|
||||
String pathResources = panel.tagTree.getSelectionPathString();
|
||||
if (pathResources != null) {
|
||||
Configuration.lastSessionSelection.set(pathResources);
|
||||
|
||||
@@ -500,7 +500,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
public void replaceItemPin(TreeItem oldItem, TreeItem newItem) {
|
||||
pinsPanel.replaceItem(oldItem, newItem);
|
||||
}
|
||||
|
||||
|
||||
public void refreshPinnedScriptPacks() {
|
||||
pinsPanel.refreshScriptPacks();
|
||||
}
|
||||
@@ -1473,7 +1473,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
}
|
||||
}
|
||||
|
||||
List<List<String>> expandedNodes = View.getExpandedNodes(tagTree);
|
||||
List<List<String>> expandedNodes = View.getExpandedNodes(tagTree);
|
||||
previewPanel.clear();
|
||||
openables.set(index, newSwfs);
|
||||
|
||||
@@ -1482,7 +1482,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
Main.searchResultsStorage.destroySwf(s);
|
||||
}
|
||||
Openable openable = newSwfs.size() > 0 ? newSwfs.get(0) : null;
|
||||
|
||||
|
||||
easyPanel.setSwfs(new ArrayList<>(getAllSwfs()));
|
||||
if (openable instanceof SWF) {
|
||||
easyPanel.setSwf((SWF) openable);
|
||||
@@ -1505,9 +1505,9 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
previewPanel.clear();
|
||||
|
||||
openables.add(newOpenables);
|
||||
|
||||
|
||||
easyPanel.setSwfs(new ArrayList<>(getAllSwfs()));
|
||||
|
||||
|
||||
Openable openable = newOpenables.size() > 0 ? newOpenables.get(0) : null;
|
||||
if (openable != null) {
|
||||
updateUi(openable);
|
||||
@@ -1831,7 +1831,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
|
||||
mainMenu.updateComponents(null);
|
||||
previewPanel.clear();
|
||||
dumpPreviewPanel.clear();
|
||||
dumpPreviewPanel.clear();
|
||||
doFilter();
|
||||
return true;
|
||||
}
|
||||
@@ -1901,14 +1901,12 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
List<String> newFoldersFilter = findPanel.getFolders();
|
||||
|
||||
if (isFilterEmpty(oldFilter) && oldFoldersFilter.isEmpty()) {
|
||||
unfilteredExpandedNodes.clear();
|
||||
unfilteredExpandedNodes.clear();
|
||||
unfilteredExpandedNodes.addAll(View.getExpandedNodes(tree));
|
||||
}
|
||||
|
||||
if (
|
||||
oldFilter.trim().equals(newFilter.trim())
|
||||
&& oldFoldersFilter.equals(newFoldersFilter)
|
||||
) {
|
||||
if (oldFilter.trim().equals(newFilter.trim())
|
||||
&& oldFoldersFilter.equals(newFoldersFilter)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3161,7 +3159,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
}
|
||||
}
|
||||
List<TreeItem> items = getSelected();
|
||||
|
||||
|
||||
String selected;
|
||||
if (scopeTextTags.isEmpty()) {
|
||||
selected = null;
|
||||
@@ -5043,6 +5041,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
public boolean replace(List<TreeItem> items, boolean create) {
|
||||
return replace(items, create, true);
|
||||
}
|
||||
|
||||
public boolean replace(List<TreeItem> items, boolean create, boolean fill) {
|
||||
if (items.isEmpty()) {
|
||||
return false;
|
||||
@@ -5250,14 +5249,14 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
|
||||
public void replaceNoFillButtonActionPerformed(List<TreeItem> items) {
|
||||
replace(items, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean replaceNoFill(TreeItem item) {
|
||||
List<TreeItem> items = new ArrayList<>();
|
||||
items.add(item);
|
||||
return replace(items, false, false);
|
||||
}
|
||||
|
||||
|
||||
private void showSvgImportWarning() {
|
||||
ViewMessages.showMessageDialog(this, AppStrings.translate("message.warning.svgImportExperimental"), AppStrings.translate("message.warning"), JOptionPane.WARNING_MESSAGE, Configuration.warningSvgImport);
|
||||
}
|
||||
@@ -5684,11 +5683,11 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
|
||||
public boolean showView(int view) {
|
||||
View.checkAccess();
|
||||
|
||||
|
||||
if (view == VIEW_EASY && !EasyPanel.EASY_AVAILABLE) {
|
||||
view = VIEW_RESOURCES;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
setTreeModel(view);
|
||||
switch (view) {
|
||||
case VIEW_DUMP:
|
||||
@@ -5731,8 +5730,8 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
reload(true);
|
||||
updateUiWithCurrentOpenable();
|
||||
return true;
|
||||
case VIEW_EASY:
|
||||
SWF swf = getCurrentSwf();
|
||||
case VIEW_EASY:
|
||||
SWF swf = getCurrentSwf();
|
||||
pinsPanel.setVisible(false);
|
||||
currentView = view;
|
||||
Configuration.lastView.set(currentView);
|
||||
@@ -5741,7 +5740,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
easyPanel.setSwf(swf);
|
||||
if (!isWelcomeScreen) {
|
||||
showContentPanelCard(EASY_PANEL);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
case VIEW_TAGLIST:
|
||||
easyPanel.setNoSwf();
|
||||
@@ -5978,7 +5977,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
@Override
|
||||
public boolean isModified() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReadOnlyTagList getTags() {
|
||||
@@ -6097,7 +6096,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
if (currentView == VIEW_DUMP) {
|
||||
dumpViewReload(forceReload);
|
||||
return;
|
||||
}
|
||||
}
|
||||
/*else if (currentView == VIEW_TAGLIST) {
|
||||
tagListViewReload(forceReload);
|
||||
return;
|
||||
@@ -6109,7 +6108,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
if (treePath != null && tree.getFullModel().treePathExists(treePath)) {
|
||||
treeItem = (TreeItem) treePath.getLastPathComponent();
|
||||
}
|
||||
|
||||
|
||||
if (currentView == VIEW_EASY) {
|
||||
if (treeItem != null) {
|
||||
Openable op = treeItem.getOpenable();
|
||||
@@ -6512,8 +6511,8 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
|
||||
public void setErrorState(ErrorState errorState) {
|
||||
statusPanel.setErrorState(errorState);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void disposeInner(Container container) {
|
||||
for (Component c : container.getComponents()) {
|
||||
if (c instanceof Container) {
|
||||
@@ -6736,5 +6735,5 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
|
||||
public EasyPanel getEasyPanel() {
|
||||
return easyPanel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,8 +33,8 @@ import javax.swing.SwingConstants;
|
||||
* customize the scrollable features by using newly provided setter methods so
|
||||
* you don't have to extend this class every time.
|
||||
* <p>
|
||||
* Scrollable amounts can be specified as a percentage of the viewport size or as
|
||||
* an actual pixel value. The amount can be changed for both unit and block
|
||||
* Scrollable amounts can be specified as a percentage of the viewport size or
|
||||
* as an actual pixel value. The amount can be changed for both unit and block
|
||||
* scrolling for both horizontal and vertical scrollbars.
|
||||
* <p>
|
||||
* The Scrollable interface only provides a boolean value for determining
|
||||
@@ -175,13 +175,13 @@ public class ScrollablePanel extends JPanel implements Scrollable, SwingConstant
|
||||
*
|
||||
* @param orientation specify the scrolling orientation. Must be either:
|
||||
* SwingConstants.HORIZONTAL or SwingConstants.VERTICAL.
|
||||
* @param type
|
||||
* @param amount a value used with the IncrementType to determine the
|
||||
* scrollable amount
|
||||
* @param type specify how the amount parameter in the calculation of the
|
||||
* scrollable amount. Valid values are: IncrementType.PERCENT - treat the
|
||||
* amount as a % of the viewport size IncrementType.PIXEL - treat the amount
|
||||
* as the scrollable amount
|
||||
* @param amount a value used with the IncrementType to determine the
|
||||
* scrollable amount
|
||||
|
||||
*/
|
||||
public void setScrollableBlockIncrement(int orientation, IncrementType type, int amount) {
|
||||
IncrementInfo info = new IncrementInfo(type, amount);
|
||||
|
||||
@@ -63,7 +63,7 @@ import java.util.Set;
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class TimelinedMaker {
|
||||
|
||||
|
||||
public static SWF makeTimelinedImage(ImageTag imageTag) {
|
||||
SWF swf = new SWF();
|
||||
swf.gfx = imageTag.getSwf().gfx;
|
||||
@@ -191,7 +191,7 @@ public class TimelinedMaker {
|
||||
}
|
||||
return swf;
|
||||
}
|
||||
|
||||
|
||||
public static Timelined makeTimelined(final Tag tag) {
|
||||
if (tag instanceof ImageTag) {
|
||||
return makeTimelinedImage((ImageTag) tag);
|
||||
@@ -267,7 +267,7 @@ public class TimelinedMaker {
|
||||
timeline.addFrame(f);
|
||||
timeline.fontFrameNum = frame;
|
||||
} else if (tag instanceof SoundTag) {
|
||||
|
||||
//empty
|
||||
} else {
|
||||
Frame f = new Frame(timeline, 0);
|
||||
DepthState ds = new DepthState(tag.getSwf(), f, f);
|
||||
@@ -287,7 +287,7 @@ public class TimelinedMaker {
|
||||
@Override
|
||||
public RECT getRect(Set<BoundedTag> added) {
|
||||
if (!(tag instanceof BoundedTag)) {
|
||||
return new RECT(0,1,0,1);
|
||||
return new RECT(0, 1, 0, 1);
|
||||
}
|
||||
BoundedTag bt = (BoundedTag) tag;
|
||||
if (!added.contains(bt)) {
|
||||
@@ -308,7 +308,7 @@ public class TimelinedMaker {
|
||||
@Override
|
||||
public boolean isModified() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReadOnlyTagList getTags() {
|
||||
|
||||
@@ -124,7 +124,7 @@ public class TransformPanel extends JPanel {
|
||||
|
||||
private Map<String, JPanel> cardContents = new LinkedHashMap<>();
|
||||
private Map<String, JLabel> cardPlusMinusLabels = new LinkedHashMap<>();
|
||||
|
||||
|
||||
private static final char PLUS_CHAR = '\u2BC8';
|
||||
private static final char MINUS_CHAR = '\u2BC6';
|
||||
|
||||
@@ -175,6 +175,7 @@ public class TransformPanel extends JPanel {
|
||||
public TransformPanel(ImagePanel imagePanel) {
|
||||
this(imagePanel, true);
|
||||
}
|
||||
|
||||
public TransformPanel(ImagePanel imagePanel, boolean headerLabel) {
|
||||
|
||||
imagePanel.addBoundsChangeListener(new BoundsChangeListener() {
|
||||
|
||||
@@ -0,0 +1,327 @@
|
||||
/*
|
||||
* Copyright (C) 2025 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui.colordialog;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
class MainSwatchPanel extends MySwatchPanel {
|
||||
|
||||
protected void initValues() {
|
||||
swatchSize = UIManager.getDimension("ColorChooser.swatchesSwatchSize", getLocale());
|
||||
numSwatches = new Dimension(31, 9);
|
||||
gap = new Dimension(1, 1);
|
||||
}
|
||||
|
||||
protected void initColors() {
|
||||
int[] rawValues = initRawValues();
|
||||
int numColors = rawValues.length / 3;
|
||||
colors = new Color[numColors];
|
||||
for (int i = 0; i < numColors; i++) {
|
||||
colors[i] = new Color(rawValues[(i * 3)], rawValues[(i * 3) + 1], rawValues[(i * 3) + 2]);
|
||||
}
|
||||
}
|
||||
|
||||
private int[] initRawValues() {
|
||||
int[] rawValues = {
|
||||
255, 255, 255, // first row.
|
||||
204, 255, 255,
|
||||
204, 204, 255,
|
||||
204, 204, 255,
|
||||
204, 204, 255,
|
||||
204, 204, 255,
|
||||
204, 204, 255,
|
||||
204, 204, 255,
|
||||
204, 204, 255,
|
||||
204, 204, 255,
|
||||
204, 204, 255,
|
||||
255, 204, 255,
|
||||
255, 204, 204,
|
||||
255, 204, 204,
|
||||
255, 204, 204,
|
||||
255, 204, 204,
|
||||
255, 204, 204,
|
||||
255, 204, 204,
|
||||
255, 204, 204,
|
||||
255, 204, 204,
|
||||
255, 204, 204,
|
||||
255, 255, 204,
|
||||
204, 255, 204,
|
||||
204, 255, 204,
|
||||
204, 255, 204,
|
||||
204, 255, 204,
|
||||
204, 255, 204,
|
||||
204, 255, 204,
|
||||
204, 255, 204,
|
||||
204, 255, 204,
|
||||
204, 255, 204,
|
||||
204, 204, 204, // second row.
|
||||
153, 255, 255,
|
||||
153, 204, 255,
|
||||
153, 153, 255,
|
||||
153, 153, 255,
|
||||
153, 153, 255,
|
||||
153, 153, 255,
|
||||
153, 153, 255,
|
||||
153, 153, 255,
|
||||
153, 153, 255,
|
||||
204, 153, 255,
|
||||
255, 153, 255,
|
||||
255, 153, 204,
|
||||
255, 153, 153,
|
||||
255, 153, 153,
|
||||
255, 153, 153,
|
||||
255, 153, 153,
|
||||
255, 153, 153,
|
||||
255, 153, 153,
|
||||
255, 153, 153,
|
||||
255, 204, 153,
|
||||
255, 255, 153,
|
||||
204, 255, 153,
|
||||
153, 255, 153,
|
||||
153, 255, 153,
|
||||
153, 255, 153,
|
||||
153, 255, 153,
|
||||
153, 255, 153,
|
||||
153, 255, 153,
|
||||
153, 255, 153,
|
||||
153, 255, 204,
|
||||
204, 204, 204, // third row
|
||||
102, 255, 255,
|
||||
102, 204, 255,
|
||||
102, 153, 255,
|
||||
102, 102, 255,
|
||||
102, 102, 255,
|
||||
102, 102, 255,
|
||||
102, 102, 255,
|
||||
102, 102, 255,
|
||||
153, 102, 255,
|
||||
204, 102, 255,
|
||||
255, 102, 255,
|
||||
255, 102, 204,
|
||||
255, 102, 153,
|
||||
255, 102, 102,
|
||||
255, 102, 102,
|
||||
255, 102, 102,
|
||||
255, 102, 102,
|
||||
255, 102, 102,
|
||||
255, 153, 102,
|
||||
255, 204, 102,
|
||||
255, 255, 102,
|
||||
204, 255, 102,
|
||||
153, 255, 102,
|
||||
102, 255, 102,
|
||||
102, 255, 102,
|
||||
102, 255, 102,
|
||||
102, 255, 102,
|
||||
102, 255, 102,
|
||||
102, 255, 153,
|
||||
102, 255, 204,
|
||||
153, 153, 153, // fourth row
|
||||
51, 255, 255,
|
||||
51, 204, 255,
|
||||
51, 153, 255,
|
||||
51, 102, 255,
|
||||
51, 51, 255,
|
||||
51, 51, 255,
|
||||
51, 51, 255,
|
||||
102, 51, 255,
|
||||
153, 51, 255,
|
||||
204, 51, 255,
|
||||
255, 51, 255,
|
||||
255, 51, 204,
|
||||
255, 51, 153,
|
||||
255, 51, 102,
|
||||
255, 51, 51,
|
||||
255, 51, 51,
|
||||
255, 51, 51,
|
||||
255, 102, 51,
|
||||
255, 153, 51,
|
||||
255, 204, 51,
|
||||
255, 255, 51,
|
||||
204, 255, 51,
|
||||
153, 255, 51,
|
||||
102, 255, 51,
|
||||
51, 255, 51,
|
||||
51, 255, 51,
|
||||
51, 255, 51,
|
||||
51, 255, 102,
|
||||
51, 255, 153,
|
||||
51, 255, 204,
|
||||
153, 153, 153, // Fifth row
|
||||
0, 255, 255,
|
||||
0, 204, 255,
|
||||
0, 153, 255,
|
||||
0, 102, 255,
|
||||
0, 51, 255,
|
||||
0, 0, 255,
|
||||
51, 0, 255,
|
||||
102, 0, 255,
|
||||
153, 0, 255,
|
||||
204, 0, 255,
|
||||
255, 0, 255,
|
||||
255, 0, 204,
|
||||
255, 0, 153,
|
||||
255, 0, 102,
|
||||
255, 0, 51,
|
||||
255, 0, 0,
|
||||
255, 51, 0,
|
||||
255, 102, 0,
|
||||
255, 153, 0,
|
||||
255, 204, 0,
|
||||
255, 255, 0,
|
||||
204, 255, 0,
|
||||
153, 255, 0,
|
||||
102, 255, 0,
|
||||
51, 255, 0,
|
||||
0, 255, 0,
|
||||
0, 255, 51,
|
||||
0, 255, 102,
|
||||
0, 255, 153,
|
||||
0, 255, 204,
|
||||
102, 102, 102, // sixth row
|
||||
0, 204, 204,
|
||||
0, 204, 204,
|
||||
0, 153, 204,
|
||||
0, 102, 204,
|
||||
0, 51, 204,
|
||||
0, 0, 204,
|
||||
51, 0, 204,
|
||||
102, 0, 204,
|
||||
153, 0, 204,
|
||||
204, 0, 204,
|
||||
204, 0, 204,
|
||||
204, 0, 204,
|
||||
204, 0, 153,
|
||||
204, 0, 102,
|
||||
204, 0, 51,
|
||||
204, 0, 0,
|
||||
204, 51, 0,
|
||||
204, 102, 0,
|
||||
204, 153, 0,
|
||||
204, 204, 0,
|
||||
204, 204, 0,
|
||||
204, 204, 0,
|
||||
153, 204, 0,
|
||||
102, 204, 0,
|
||||
51, 204, 0,
|
||||
0, 204, 0,
|
||||
0, 204, 51,
|
||||
0, 204, 102,
|
||||
0, 204, 153,
|
||||
0, 204, 204,
|
||||
102, 102, 102, // seventh row
|
||||
0, 153, 153,
|
||||
0, 153, 153,
|
||||
0, 153, 153,
|
||||
0, 102, 153,
|
||||
0, 51, 153,
|
||||
0, 0, 153,
|
||||
51, 0, 153,
|
||||
102, 0, 153,
|
||||
153, 0, 153,
|
||||
153, 0, 153,
|
||||
153, 0, 153,
|
||||
153, 0, 153,
|
||||
153, 0, 153,
|
||||
153, 0, 102,
|
||||
153, 0, 51,
|
||||
153, 0, 0,
|
||||
153, 51, 0,
|
||||
153, 102, 0,
|
||||
153, 153, 0,
|
||||
153, 153, 0,
|
||||
153, 153, 0,
|
||||
153, 153, 0,
|
||||
153, 153, 0,
|
||||
102, 153, 0,
|
||||
51, 153, 0,
|
||||
0, 153, 0,
|
||||
0, 153, 51,
|
||||
0, 153, 102,
|
||||
0, 153, 153,
|
||||
0, 153, 153,
|
||||
51, 51, 51, // eighth row
|
||||
0, 102, 102,
|
||||
0, 102, 102,
|
||||
0, 102, 102,
|
||||
0, 102, 102,
|
||||
0, 51, 102,
|
||||
0, 0, 102,
|
||||
51, 0, 102,
|
||||
102, 0, 102,
|
||||
102, 0, 102,
|
||||
102, 0, 102,
|
||||
102, 0, 102,
|
||||
102, 0, 102,
|
||||
102, 0, 102,
|
||||
102, 0, 102,
|
||||
102, 0, 51,
|
||||
102, 0, 0,
|
||||
102, 51, 0,
|
||||
102, 102, 0,
|
||||
102, 102, 0,
|
||||
102, 102, 0,
|
||||
102, 102, 0,
|
||||
102, 102, 0,
|
||||
102, 102, 0,
|
||||
102, 102, 0,
|
||||
51, 102, 0,
|
||||
0, 102, 0,
|
||||
0, 102, 51,
|
||||
0, 102, 102,
|
||||
0, 102, 102,
|
||||
0, 102, 102,
|
||||
0, 0, 0, // ninth row
|
||||
0, 51, 51,
|
||||
0, 51, 51,
|
||||
0, 51, 51,
|
||||
0, 51, 51,
|
||||
0, 51, 51,
|
||||
0, 0, 51,
|
||||
51, 0, 51,
|
||||
51, 0, 51,
|
||||
51, 0, 51,
|
||||
51, 0, 51,
|
||||
51, 0, 51,
|
||||
51, 0, 51,
|
||||
51, 0, 51,
|
||||
51, 0, 51,
|
||||
51, 0, 51,
|
||||
51, 0, 0,
|
||||
51, 51, 0,
|
||||
51, 51, 0,
|
||||
51, 51, 0,
|
||||
51, 51, 0,
|
||||
51, 51, 0,
|
||||
51, 51, 0,
|
||||
51, 51, 0,
|
||||
51, 51, 0,
|
||||
0, 51, 0,
|
||||
0, 51, 51,
|
||||
0, 51, 51,
|
||||
0, 51, 51,
|
||||
0, 51, 51,
|
||||
51, 51, 51};
|
||||
return rawValues;
|
||||
}
|
||||
}
|
||||
@@ -31,17 +31,19 @@ import javax.swing.UIManager;
|
||||
* @author JPEXS
|
||||
*/
|
||||
class MyRecentSwatchPanel extends MySwatchPanel {
|
||||
|
||||
protected void initValues() {
|
||||
swatchSize = UIManager.getDimension("ColorChooser.swatchesRecentSwatchSize", getLocale());
|
||||
numSwatches = new Dimension( 5, 7 );
|
||||
numSwatches = new Dimension(5, 7);
|
||||
gap = new Dimension(1, 1);
|
||||
}
|
||||
|
||||
protected void initColors() {
|
||||
Color defaultRecentColor = UIManager.getColor("ColorChooser.swatchesDefaultRecentColor", getLocale());
|
||||
int numColors = numSwatches.width * numSwatches.height;
|
||||
colors = new Color[numColors];
|
||||
String recentColorsStr = Configuration.recentColors.get();
|
||||
for (int i = 0; i < numColors ; i++) {
|
||||
for (int i = 0; i < numColors; i++) {
|
||||
colors[i] = defaultRecentColor;
|
||||
}
|
||||
Pattern hexColorPattern = Pattern.compile("^#(?<a>[a-fA-F0-9]{2})(?<r>[a-fA-F0-9]{2})(?<g>[a-fA-F0-9]{2})(?<b>[a-fA-F0-9]{2})$");
|
||||
@@ -50,24 +52,25 @@ class MyRecentSwatchPanel extends MySwatchPanel {
|
||||
for (int i = 0; i < colorsHex.length; i++) {
|
||||
Matcher m = hexColorPattern.matcher(colorsHex[i]);
|
||||
if (m.matches()) {
|
||||
colors[i] = new Color(Integer.parseInt(m.group("r"), 16),Integer.parseInt(m.group("g"), 16),Integer.parseInt(m.group("b"), 16), Integer.parseInt(m.group("a"), 16));
|
||||
colors[i] = new Color(Integer.parseInt(m.group("r"), 16), Integer.parseInt(m.group("g"), 16), Integer.parseInt(m.group("b"), 16), Integer.parseInt(m.group("a"), 16));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setMostRecentColor(Color c) {
|
||||
if (colors[0].equals(c)) {
|
||||
return;
|
||||
}
|
||||
System.arraycopy( colors, 0, colors, 1, colors.length-1);
|
||||
System.arraycopy(colors, 0, colors, 1, colors.length - 1);
|
||||
colors[0] = c;
|
||||
|
||||
|
||||
List<String> colorsAsStr = new ArrayList<>();
|
||||
for (int i = 0; i < colors.length; i++) {
|
||||
colorsAsStr.add(new RGBA(colors[i]).toHexARGB());
|
||||
}
|
||||
Configuration.recentColors.set(String.join(",", colorsAsStr));
|
||||
|
||||
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,108 +15,132 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui.colordialog;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.KeyListener;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.io.Serializable;
|
||||
import javax.accessibility.*;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.*;
|
||||
import javax.accessibility.AccessibleContext;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JColorChooser;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.border.CompoundBorder;
|
||||
import javax.swing.border.LineBorder;
|
||||
import javax.swing.colorchooser.AbstractColorChooserPanel;
|
||||
import javax.swing.colorchooser.ColorSelectionModel;
|
||||
|
||||
/**
|
||||
* The standard color swatch chooser.
|
||||
* Modified Java version
|
||||
* The standard color swatch chooser. Modified Java version
|
||||
*/
|
||||
public class MySwatchChooserPanel extends AbstractColorChooserPanel {
|
||||
|
||||
MySwatchPanel swatchPanel;
|
||||
//RecentSwatchPanel recentSwatchPanel;
|
||||
MouseListener mainSwatchListener;
|
||||
MouseListener recentSwatchListener;
|
||||
private KeyListener mainSwatchKeyListener;
|
||||
private KeyListener recentSwatchKeyListener;
|
||||
|
||||
public MySwatchChooserPanel() {
|
||||
super();
|
||||
setInheritsPopupMenu(true);
|
||||
}
|
||||
|
||||
|
||||
void setSelectedColor(Color color) {
|
||||
ColorSelectionModel model = getColorSelectionModel();
|
||||
if (model != null) {
|
||||
model.setSelectedColor(color);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int getInt(Object key, int defaultValue) {
|
||||
Object value = UIManager.get(key, getLocale());
|
||||
if (value instanceof Integer) {
|
||||
return ((Integer)value).intValue();
|
||||
return ((Integer) value).intValue();
|
||||
}
|
||||
if (value instanceof String) {
|
||||
try {
|
||||
return Integer.parseInt((String)value);
|
||||
} catch (NumberFormatException nfe) {}
|
||||
return Integer.parseInt((String) value);
|
||||
} catch (NumberFormatException nfe) {
|
||||
//ignore
|
||||
}
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
|
||||
public String getDisplayName() {
|
||||
return UIManager.getString("ColorChooser.swatchesNameText", getLocale());
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a hint to the look and feel as to the
|
||||
* <code>KeyEvent.VK</code> constant that can be used as a mnemonic to
|
||||
* access the panel. A return value <= 0 indicates there is no mnemonic.
|
||||
* <p>
|
||||
* The return value here is a hint, it is ultimately up to the look
|
||||
* and feel to honor the return value in some meaningful way.
|
||||
* Provides a hint to the look and feel as to the <code>KeyEvent.VK</code>
|
||||
* constant that can be used as a mnemonic to access the panel. A return
|
||||
* value <= 0 indicates there is no mnemonic. <p>
|
||||
* The return value here is a hint, it is ultimately up to the look and feel
|
||||
* to honor the return value in some meaningful way.
|
||||
* <p>
|
||||
* This implementation looks up the value from the default
|
||||
* <code>ColorChooser.swatchesMnemonic</code>, or if it
|
||||
* isn't available (or not an <code>Integer</code>) returns -1.
|
||||
* The lookup for the default is done through the <code>UIManager</code>:
|
||||
* <code>ColorChooser.swatchesMnemonic</code>, or if it isn't available (or
|
||||
* not an <code>Integer</code>) returns -1. The lookup for the default is
|
||||
* done through the <code>UIManager</code>:
|
||||
* <code>UIManager.get("ColorChooser.swatchesMnemonic");</code>.
|
||||
*
|
||||
* @return KeyEvent.VK constant identifying the mnemonic; <= 0 for no
|
||||
* mnemonic
|
||||
* @see #getDisplayedMnemonicIndex
|
||||
* mnemonic @see #getDisplayedMnemonicI
|
||||
* ndex
|
||||
* @since 1.4
|
||||
*/
|
||||
public int getMnemonic() {
|
||||
return getInt("ColorChooser.swatchesMnemonic", -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a hint to the look and feel as to the index of the character in
|
||||
* <code>getDisplayName</code> that should be visually identified as the
|
||||
* mnemonic. The look and feel should only use this if
|
||||
* <code>getMnemonic</code> returns a value > 0.
|
||||
* <p>
|
||||
* The return value here is a hint, it is ultimately up to the look
|
||||
* and feel to honor the return value in some meaningful way. For example,
|
||||
* a look and feel may wish to render each
|
||||
* <code>AbstractColorChooserPanel</code> in a <code>JTabbedPane</code>,
|
||||
* and further use this return value to underline a character in
|
||||
* the <code>getDisplayName</code>.
|
||||
* The return value here is a hint, it is ultimately up to the look and feel
|
||||
* to honor the return value in some meaningful way. For example, a look and
|
||||
* feel may wish to render each <code>AbstractColorChooserPanel</code> in a
|
||||
* <code>JTabbedPane</code>, and further use this return value to underline
|
||||
* a character in the <code>getDisplayName</code>.
|
||||
* <p>
|
||||
* This implementation looks up the value from the default
|
||||
* <code>ColorChooser.rgbDisplayedMnemonicIndex</code>, or if it
|
||||
* isn't available (or not an <code>Integer</code>) returns -1.
|
||||
* The lookup for the default is done through the <code>UIManager</code>:
|
||||
* <code>ColorChooser.rgbDisplayedMnemonicIndex</code>, or if it isn't
|
||||
* available (or not an <code>Integer</code>) returns -1. The lookup for the
|
||||
* default is done through the <code>UIManager</code>:
|
||||
* <code>UIManager.get("ColorChooser.swatchesDisplayedMnemonicIndex");</code>.
|
||||
*
|
||||
* @return Character index to render mnemonic for; -1 to provide no
|
||||
* visual identifier for this panel.
|
||||
* @return Character index to render mnemonic for; -1 to provide no visual
|
||||
* identifier for this panel.
|
||||
* @see #getMnemonic
|
||||
* @since 1.4
|
||||
*/
|
||||
public int getDisplayedMnemonicIndex() {
|
||||
return getInt("ColorChooser.swatchesDisplayedMnemonicIndex", -1);
|
||||
}
|
||||
|
||||
public Icon getSmallDisplayIcon() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Icon getLargeDisplayIcon() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The background color, foreground color, and font are already set to the
|
||||
* defaults from the defaults table before this method is called.
|
||||
@@ -124,14 +148,15 @@ public class MySwatchChooserPanel extends AbstractColorChooserPanel {
|
||||
public void installChooserPanel(JColorChooser enclosingChooser) {
|
||||
super.installChooserPanel(enclosingChooser);
|
||||
}
|
||||
|
||||
protected void buildChooser() {
|
||||
String recentStr = UIManager.getString("ColorChooser.swatchesRecentText", getLocale());
|
||||
GridBagLayout gb = new GridBagLayout();
|
||||
GridBagConstraints gbc = new GridBagConstraints();
|
||||
JPanel superHolder = new JPanel(gb);
|
||||
swatchPanel = new MainSwatchPanel();
|
||||
swatchPanel = new MainSwatchPanel();
|
||||
swatchPanel.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY,
|
||||
getDisplayName());
|
||||
getDisplayName());
|
||||
swatchPanel.setInheritsPopupMenu(true);
|
||||
//recentSwatchPanel = new RecentSwatchPanel();
|
||||
/*recentSwatchPanel.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY,
|
||||
@@ -145,8 +170,8 @@ public class MySwatchChooserPanel extends AbstractColorChooserPanel {
|
||||
//recentSwatchPanel.addMouseListener(recentSwatchListener);
|
||||
//recentSwatchPanel.addKeyListener(recentSwatchKeyListener);
|
||||
JPanel mainHolder = new JPanel(new BorderLayout());
|
||||
Border border = new CompoundBorder( new LineBorder(Color.black),
|
||||
new LineBorder(Color.white) );
|
||||
Border border = new CompoundBorder(new LineBorder(Color.black),
|
||||
new LineBorder(Color.white));
|
||||
mainHolder.setBorder(border);
|
||||
mainHolder.add(swatchPanel, BorderLayout.CENTER);
|
||||
gbc.anchor = GridBagConstraints.LAST_LINE_START;
|
||||
@@ -157,7 +182,7 @@ public class MySwatchChooserPanel extends AbstractColorChooserPanel {
|
||||
superHolder.add(mainHolder, gbc);
|
||||
gbc.insets = oldInsets;
|
||||
//recentSwatchPanel.setInheritsPopupMenu(true);
|
||||
JPanel recentHolder = new JPanel( new BorderLayout() );
|
||||
JPanel recentHolder = new JPanel(new BorderLayout());
|
||||
recentHolder.setBorder(border);
|
||||
recentHolder.setInheritsPopupMenu(true);
|
||||
//recentHolder.add(recentSwatchPanel, BorderLayout.CENTER);
|
||||
@@ -174,6 +199,7 @@ public class MySwatchChooserPanel extends AbstractColorChooserPanel {
|
||||
superHolder.setInheritsPopupMenu(true);
|
||||
add(superHolder);
|
||||
}
|
||||
|
||||
public void uninstallChooserPanel(JColorChooser enclosingChooser) {
|
||||
super.uninstallChooserPanel(enclosingChooser);
|
||||
swatchPanel.removeMouseListener(mainSwatchListener);
|
||||
@@ -188,9 +214,12 @@ public class MySwatchChooserPanel extends AbstractColorChooserPanel {
|
||||
recentSwatchKeyListener = null;
|
||||
removeAll(); // strip out all the sub-components
|
||||
}
|
||||
|
||||
public void updateChooser() {
|
||||
}
|
||||
|
||||
private class RecentSwatchKeyListener extends KeyAdapter {
|
||||
|
||||
public void keyPressed(KeyEvent e) {
|
||||
if (KeyEvent.VK_SPACE == e.getKeyCode()) {
|
||||
/*Color color = recentSwatchPanel.getSelectedColor();
|
||||
@@ -198,7 +227,9 @@ public class MySwatchChooserPanel extends AbstractColorChooserPanel {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class MainSwatchKeyListener extends KeyAdapter {
|
||||
|
||||
public void keyPressed(KeyEvent e) {
|
||||
if (KeyEvent.VK_SPACE == e.getKeyCode()) {
|
||||
Color color = swatchPanel.getSelectedColor();
|
||||
@@ -207,7 +238,9 @@ public class MySwatchChooserPanel extends AbstractColorChooserPanel {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class RecentSwatchListener extends MouseAdapter implements Serializable {
|
||||
|
||||
public void mousePressed(MouseEvent e) {
|
||||
if (isEnabled()) {
|
||||
/*Color color = recentSwatchPanel.getColorForLocation(e.getX(), e.getY());
|
||||
@@ -217,7 +250,9 @@ public class MySwatchChooserPanel extends AbstractColorChooserPanel {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class MainSwatchListener extends MouseAdapter implements Serializable {
|
||||
|
||||
public void mousePressed(MouseEvent e) {
|
||||
if (isEnabled()) {
|
||||
Color color = swatchPanel.getColorForLocation(e.getX(), e.getY());
|
||||
@@ -229,303 +264,3 @@ public class MySwatchChooserPanel extends AbstractColorChooserPanel {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class MainSwatchPanel extends MySwatchPanel {
|
||||
protected void initValues() {
|
||||
swatchSize = UIManager.getDimension("ColorChooser.swatchesSwatchSize", getLocale());
|
||||
numSwatches = new Dimension( 31, 9 );
|
||||
gap = new Dimension(1, 1);
|
||||
}
|
||||
protected void initColors() {
|
||||
int[] rawValues = initRawValues();
|
||||
int numColors = rawValues.length / 3;
|
||||
colors = new Color[numColors];
|
||||
for (int i = 0; i < numColors ; i++) {
|
||||
colors[i] = new Color( rawValues[(i*3)], rawValues[(i*3)+1], rawValues[(i*3)+2] );
|
||||
}
|
||||
}
|
||||
private int[] initRawValues() {
|
||||
int[] rawValues = {
|
||||
255, 255, 255, // first row.
|
||||
204, 255, 255,
|
||||
204, 204, 255,
|
||||
204, 204, 255,
|
||||
204, 204, 255,
|
||||
204, 204, 255,
|
||||
204, 204, 255,
|
||||
204, 204, 255,
|
||||
204, 204, 255,
|
||||
204, 204, 255,
|
||||
204, 204, 255,
|
||||
255, 204, 255,
|
||||
255, 204, 204,
|
||||
255, 204, 204,
|
||||
255, 204, 204,
|
||||
255, 204, 204,
|
||||
255, 204, 204,
|
||||
255, 204, 204,
|
||||
255, 204, 204,
|
||||
255, 204, 204,
|
||||
255, 204, 204,
|
||||
255, 255, 204,
|
||||
204, 255, 204,
|
||||
204, 255, 204,
|
||||
204, 255, 204,
|
||||
204, 255, 204,
|
||||
204, 255, 204,
|
||||
204, 255, 204,
|
||||
204, 255, 204,
|
||||
204, 255, 204,
|
||||
204, 255, 204,
|
||||
204, 204, 204, // second row.
|
||||
153, 255, 255,
|
||||
153, 204, 255,
|
||||
153, 153, 255,
|
||||
153, 153, 255,
|
||||
153, 153, 255,
|
||||
153, 153, 255,
|
||||
153, 153, 255,
|
||||
153, 153, 255,
|
||||
153, 153, 255,
|
||||
204, 153, 255,
|
||||
255, 153, 255,
|
||||
255, 153, 204,
|
||||
255, 153, 153,
|
||||
255, 153, 153,
|
||||
255, 153, 153,
|
||||
255, 153, 153,
|
||||
255, 153, 153,
|
||||
255, 153, 153,
|
||||
255, 153, 153,
|
||||
255, 204, 153,
|
||||
255, 255, 153,
|
||||
204, 255, 153,
|
||||
153, 255, 153,
|
||||
153, 255, 153,
|
||||
153, 255, 153,
|
||||
153, 255, 153,
|
||||
153, 255, 153,
|
||||
153, 255, 153,
|
||||
153, 255, 153,
|
||||
153, 255, 204,
|
||||
204, 204, 204, // third row
|
||||
102, 255, 255,
|
||||
102, 204, 255,
|
||||
102, 153, 255,
|
||||
102, 102, 255,
|
||||
102, 102, 255,
|
||||
102, 102, 255,
|
||||
102, 102, 255,
|
||||
102, 102, 255,
|
||||
153, 102, 255,
|
||||
204, 102, 255,
|
||||
255, 102, 255,
|
||||
255, 102, 204,
|
||||
255, 102, 153,
|
||||
255, 102, 102,
|
||||
255, 102, 102,
|
||||
255, 102, 102,
|
||||
255, 102, 102,
|
||||
255, 102, 102,
|
||||
255, 153, 102,
|
||||
255, 204, 102,
|
||||
255, 255, 102,
|
||||
204, 255, 102,
|
||||
153, 255, 102,
|
||||
102, 255, 102,
|
||||
102, 255, 102,
|
||||
102, 255, 102,
|
||||
102, 255, 102,
|
||||
102, 255, 102,
|
||||
102, 255, 153,
|
||||
102, 255, 204,
|
||||
153, 153, 153, // fourth row
|
||||
51, 255, 255,
|
||||
51, 204, 255,
|
||||
51, 153, 255,
|
||||
51, 102, 255,
|
||||
51, 51, 255,
|
||||
51, 51, 255,
|
||||
51, 51, 255,
|
||||
102, 51, 255,
|
||||
153, 51, 255,
|
||||
204, 51, 255,
|
||||
255, 51, 255,
|
||||
255, 51, 204,
|
||||
255, 51, 153,
|
||||
255, 51, 102,
|
||||
255, 51, 51,
|
||||
255, 51, 51,
|
||||
255, 51, 51,
|
||||
255, 102, 51,
|
||||
255, 153, 51,
|
||||
255, 204, 51,
|
||||
255, 255, 51,
|
||||
204, 255, 51,
|
||||
153, 255, 51,
|
||||
102, 255, 51,
|
||||
51, 255, 51,
|
||||
51, 255, 51,
|
||||
51, 255, 51,
|
||||
51, 255, 102,
|
||||
51, 255, 153,
|
||||
51, 255, 204,
|
||||
153, 153, 153, // Fifth row
|
||||
0, 255, 255,
|
||||
0, 204, 255,
|
||||
0, 153, 255,
|
||||
0, 102, 255,
|
||||
0, 51, 255,
|
||||
0, 0, 255,
|
||||
51, 0, 255,
|
||||
102, 0, 255,
|
||||
153, 0, 255,
|
||||
204, 0, 255,
|
||||
255, 0, 255,
|
||||
255, 0, 204,
|
||||
255, 0, 153,
|
||||
255, 0, 102,
|
||||
255, 0, 51,
|
||||
255, 0 , 0,
|
||||
255, 51, 0,
|
||||
255, 102, 0,
|
||||
255, 153, 0,
|
||||
255, 204, 0,
|
||||
255, 255, 0,
|
||||
204, 255, 0,
|
||||
153, 255, 0,
|
||||
102, 255, 0,
|
||||
51, 255, 0,
|
||||
0, 255, 0,
|
||||
0, 255, 51,
|
||||
0, 255, 102,
|
||||
0, 255, 153,
|
||||
0, 255, 204,
|
||||
102, 102, 102, // sixth row
|
||||
0, 204, 204,
|
||||
0, 204, 204,
|
||||
0, 153, 204,
|
||||
0, 102, 204,
|
||||
0, 51, 204,
|
||||
0, 0, 204,
|
||||
51, 0, 204,
|
||||
102, 0, 204,
|
||||
153, 0, 204,
|
||||
204, 0, 204,
|
||||
204, 0, 204,
|
||||
204, 0, 204,
|
||||
204, 0, 153,
|
||||
204, 0, 102,
|
||||
204, 0, 51,
|
||||
204, 0, 0,
|
||||
204, 51, 0,
|
||||
204, 102, 0,
|
||||
204, 153, 0,
|
||||
204, 204, 0,
|
||||
204, 204, 0,
|
||||
204, 204, 0,
|
||||
153, 204, 0,
|
||||
102, 204, 0,
|
||||
51, 204, 0,
|
||||
0, 204, 0,
|
||||
0, 204, 51,
|
||||
0, 204, 102,
|
||||
0, 204, 153,
|
||||
0, 204, 204,
|
||||
102, 102, 102, // seventh row
|
||||
0, 153, 153,
|
||||
0, 153, 153,
|
||||
0, 153, 153,
|
||||
0, 102, 153,
|
||||
0, 51, 153,
|
||||
0, 0, 153,
|
||||
51, 0, 153,
|
||||
102, 0, 153,
|
||||
153, 0, 153,
|
||||
153, 0, 153,
|
||||
153, 0, 153,
|
||||
153, 0, 153,
|
||||
153, 0, 153,
|
||||
153, 0, 102,
|
||||
153, 0, 51,
|
||||
153, 0, 0,
|
||||
153, 51, 0,
|
||||
153, 102, 0,
|
||||
153, 153, 0,
|
||||
153, 153, 0,
|
||||
153, 153, 0,
|
||||
153, 153, 0,
|
||||
153, 153, 0,
|
||||
102, 153, 0,
|
||||
51, 153, 0,
|
||||
0, 153, 0,
|
||||
0, 153, 51,
|
||||
0, 153, 102,
|
||||
0, 153, 153,
|
||||
0, 153, 153,
|
||||
51, 51, 51, // eighth row
|
||||
0, 102, 102,
|
||||
0, 102, 102,
|
||||
0, 102, 102,
|
||||
0, 102, 102,
|
||||
0, 51, 102,
|
||||
0, 0, 102,
|
||||
51, 0, 102,
|
||||
102, 0, 102,
|
||||
102, 0, 102,
|
||||
102, 0, 102,
|
||||
102, 0, 102,
|
||||
102, 0, 102,
|
||||
102, 0, 102,
|
||||
102, 0, 102,
|
||||
102, 0, 51,
|
||||
102, 0, 0,
|
||||
102, 51, 0,
|
||||
102, 102, 0,
|
||||
102, 102, 0,
|
||||
102, 102, 0,
|
||||
102, 102, 0,
|
||||
102, 102, 0,
|
||||
102, 102, 0,
|
||||
102, 102, 0,
|
||||
51, 102, 0,
|
||||
0, 102, 0,
|
||||
0, 102, 51,
|
||||
0, 102, 102,
|
||||
0, 102, 102,
|
||||
0, 102, 102,
|
||||
0, 0, 0, // ninth row
|
||||
0, 51, 51,
|
||||
0, 51, 51,
|
||||
0, 51, 51,
|
||||
0, 51, 51,
|
||||
0, 51, 51,
|
||||
0, 0, 51,
|
||||
51, 0, 51,
|
||||
51, 0, 51,
|
||||
51, 0, 51,
|
||||
51, 0, 51,
|
||||
51, 0, 51,
|
||||
51, 0, 51,
|
||||
51, 0, 51,
|
||||
51, 0, 51,
|
||||
51, 0, 51,
|
||||
51, 0, 0,
|
||||
51, 51, 0,
|
||||
51, 51, 0,
|
||||
51, 51, 0,
|
||||
51, 51, 0,
|
||||
51, 51, 0,
|
||||
51, 51, 0,
|
||||
51, 51, 0,
|
||||
51, 51, 0,
|
||||
0, 51, 0,
|
||||
0, 51, 51,
|
||||
0, 51, 51,
|
||||
0, 51, 51,
|
||||
0, 51, 51,
|
||||
51, 51, 51 };
|
||||
return rawValues;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,12 +31,14 @@ import javax.swing.JPanel;
|
||||
* @author JPEXS
|
||||
*/
|
||||
class MySwatchPanel extends JPanel {
|
||||
|
||||
protected Color[] colors;
|
||||
protected Dimension swatchSize;
|
||||
protected Dimension numSwatches;
|
||||
protected Dimension gap;
|
||||
private int selRow;
|
||||
private int selCol;
|
||||
|
||||
public MySwatchPanel() {
|
||||
initValues();
|
||||
initColors();
|
||||
@@ -49,6 +51,7 @@ class MySwatchPanel extends JPanel {
|
||||
public void focusGained(FocusEvent e) {
|
||||
repaint();
|
||||
}
|
||||
|
||||
public void focusLost(FocusEvent e) {
|
||||
repaint();
|
||||
}
|
||||
@@ -103,15 +106,18 @@ class MySwatchPanel extends JPanel {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public Color getSelectedColor() {
|
||||
return getColorForCell(selCol, selRow);
|
||||
}
|
||||
|
||||
protected void initValues() {
|
||||
}
|
||||
|
||||
public void paintComponent(Graphics g) {
|
||||
g.setColor(getBackground());
|
||||
g.fillRect(0,0,getWidth(), getHeight());
|
||||
for (int row = 0; row < numSwatches.height; row++) {
|
||||
g.setColor(getBackground());
|
||||
g.fillRect(0, 0, getWidth(), getHeight());
|
||||
for (int row = 0; row < numSwatches.height; row++) {
|
||||
int y = row * (swatchSize.height + gap.height);
|
||||
for (int column = 0; column < numSwatches.width; column++) {
|
||||
Color c = getColorForCell(column, row);
|
||||
@@ -122,10 +128,10 @@ class MySwatchPanel extends JPanel {
|
||||
} else {
|
||||
x = column * (swatchSize.width + gap.width);
|
||||
}
|
||||
g.fillRect( x, y, swatchSize.width, swatchSize.height);
|
||||
g.fillRect(x, y, swatchSize.width, swatchSize.height);
|
||||
g.setColor(Color.black);
|
||||
g.drawLine( x+swatchSize.width-1, y, x+swatchSize.width-1, y+swatchSize.height-1);
|
||||
g.drawLine( x, y+swatchSize.height-1, x+swatchSize.width-1, y+swatchSize.height-1);
|
||||
g.drawLine(x + swatchSize.width - 1, y, x + swatchSize.width - 1, y + swatchSize.height - 1);
|
||||
g.drawLine(x, y + swatchSize.height - 1, x + swatchSize.width - 1, y + swatchSize.height - 1);
|
||||
if (selRow == row && selCol == column && this.isFocusOwner()) {
|
||||
Color c2 = new Color(c.getRed() < 125 ? 255 : 0,
|
||||
c.getGreen() < 125 ? 255 : 0,
|
||||
@@ -139,19 +145,23 @@ class MySwatchPanel extends JPanel {
|
||||
g.drawLine(x, y + swatchSize.height - 1, x + swatchSize.width - 1, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Dimension getPreferredSize() {
|
||||
int x = numSwatches.width * (swatchSize.width + gap.width) - 1;
|
||||
int y = numSwatches.height * (swatchSize.height + gap.height) - 1;
|
||||
return new Dimension( x, y );
|
||||
return new Dimension(x, y);
|
||||
}
|
||||
|
||||
protected void initColors() {
|
||||
}
|
||||
|
||||
public String getToolTipText(MouseEvent e) {
|
||||
Color color = getColorForLocation(e.getX(), e.getY());
|
||||
return color.getRed()+", "+ color.getGreen() + ", " + color.getBlue();
|
||||
return color.getRed() + ", " + color.getGreen() + ", " + color.getBlue();
|
||||
}
|
||||
|
||||
public void setSelectedColorFromLocation(int x, int y) {
|
||||
if (!this.getComponentOrientation().isLeftToRight()) {
|
||||
selCol = numSwatches.width - x / (swatchSize.width + gap.width) - 1;
|
||||
@@ -161,7 +171,8 @@ class MySwatchPanel extends JPanel {
|
||||
selRow = y / (swatchSize.height + gap.height);
|
||||
repaint();
|
||||
}
|
||||
public Color getColorForLocation( int x, int y ) {
|
||||
|
||||
public Color getColorForLocation(int x, int y) {
|
||||
int column;
|
||||
if (!this.getComponentOrientation().isLeftToRight()) {
|
||||
column = numSwatches.width - x / (swatchSize.width + gap.width) - 1;
|
||||
@@ -171,7 +182,8 @@ class MySwatchPanel extends JPanel {
|
||||
int row = y / (swatchSize.height + gap.height);
|
||||
return getColorForCell(column, row);
|
||||
}
|
||||
private Color getColorForCell( int column, int row) {
|
||||
return colors[ (row * numSwatches.width) + column ]; // (STEVE) - change data orientation here
|
||||
|
||||
private Color getColorForCell(int column, int row) {
|
||||
return colors[(row * numSwatches.width) + column]; // (STEVE) - change data orientation here
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ import com.jpexs.decompiler.flash.gui.FasterScrollPane;
|
||||
import com.jpexs.decompiler.flash.gui.View;
|
||||
import com.jpexs.decompiler.flash.gui.ViewMessages;
|
||||
import com.jpexs.decompiler.flash.gui.editor.LineMarkedEditorPane;
|
||||
import com.jpexs.decompiler.flash.importers.amf.amf3.Amf3Importer;
|
||||
import com.jpexs.decompiler.flash.importers.amf.AmfParseException;
|
||||
import com.jpexs.decompiler.flash.importers.amf.amf3.Amf3Importer;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import com.jpexs.helpers.ReflectionTools;
|
||||
import java.awt.BorderLayout;
|
||||
|
||||
@@ -97,7 +97,6 @@ public class PlayerControls extends JPanel implements MediaDisplayListener {
|
||||
private static final Icon resampleIcon = View.getIcon("resample16");
|
||||
|
||||
//private final JLabel percentLabel = new JLabel("100%");
|
||||
|
||||
private final ZoomPanel zoomPanel;
|
||||
|
||||
private final JPanel graphicControls;
|
||||
@@ -106,12 +105,9 @@ public class PlayerControls extends JPanel implements MediaDisplayListener {
|
||||
|
||||
private final JPanel frameControls;
|
||||
|
||||
// private boolean zoomToFit = false;
|
||||
|
||||
// private double realZoom = 1.0;
|
||||
|
||||
//private boolean zoomToFit = false;
|
||||
//private double realZoom = 1.0;
|
||||
//private final JButton zoomFitButton;
|
||||
|
||||
private final JButton snapshotButton;
|
||||
|
||||
private final JToggleButton showButton;
|
||||
@@ -134,10 +130,10 @@ public class PlayerControls extends JPanel implements MediaDisplayListener {
|
||||
|
||||
private static Font notUnderlinedFont = null;
|
||||
|
||||
private final int zeroCharacterWidth;
|
||||
|
||||
private final int zeroCharacterWidth;
|
||||
|
||||
private JButton selectColorButton;
|
||||
|
||||
|
||||
static {
|
||||
Font font = new JLabel().getFont();
|
||||
notUnderlinedFont = font;
|
||||
@@ -166,14 +162,12 @@ public class PlayerControls extends JPanel implements MediaDisplayListener {
|
||||
|
||||
zoomPanel = new ZoomPanel(display);
|
||||
zoomPanel.setVisible(false);
|
||||
|
||||
|
||||
snapshotButton = new JButton(View.getIcon("snapshot16"));
|
||||
snapshotButton.addActionListener(this::snapShotButtonActionPerformed);
|
||||
snapshotButton.setToolTipText(AppStrings.translate("button.snapshot.hint"));
|
||||
snapshotButton.setVisible(false);
|
||||
|
||||
|
||||
|
||||
graphicButtonsPanel.add(zoomPanel);
|
||||
graphicButtonsPanel.add(selectColorButton);
|
||||
graphicButtonsPanel.add(snapshotButton);
|
||||
@@ -436,7 +430,7 @@ public class PlayerControls extends JPanel implements MediaDisplayListener {
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void pauseButtonActionPerformed(ActionEvent evt) {
|
||||
if (display.isPlaying()) {
|
||||
@@ -521,8 +515,6 @@ public class PlayerControls extends JPanel implements MediaDisplayListener {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void snapShotButtonActionPerformed(ActionEvent evt) {
|
||||
putImageToClipBoard(display.printScreen());
|
||||
}
|
||||
@@ -549,8 +541,6 @@ public class PlayerControls extends JPanel implements MediaDisplayListener {
|
||||
Configuration.playFrameSounds.set(!muteButton.isSelected());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void mediaDisplayStateChanged(MediaDisplay source) {
|
||||
if (display != source) {
|
||||
|
||||
@@ -43,18 +43,17 @@ import java.util.regex.Pattern;
|
||||
public class SharedObjectsStorage {
|
||||
|
||||
public static boolean watchingPaused = false;
|
||||
|
||||
|
||||
public static Map<WatchKey, File> watchedCookieDirectories = new HashMap<>();
|
||||
|
||||
|
||||
|
||||
private static Map<File, List<CookiesChangedListener>> swfFileToListeners = new LinkedHashMap<>();
|
||||
|
||||
|
||||
public static void addChangedListener(File file, CookiesChangedListener listener) {
|
||||
if (!swfFileToListeners.containsKey(file)) {
|
||||
swfFileToListeners.put(file, new ArrayList<>());
|
||||
}
|
||||
swfFileToListeners.get(file).add(listener);
|
||||
|
||||
|
||||
File solDir = getSolDirectoryForLocalFile(file);
|
||||
if (solDir == null) {
|
||||
return;
|
||||
@@ -74,7 +73,6 @@ public class SharedObjectsStorage {
|
||||
swfFileToListeners.get(file).remove(listener);
|
||||
}
|
||||
|
||||
|
||||
private static void watchDir(File dir) {
|
||||
try {
|
||||
WatchKey key = dir.toPath().register(Main.getWatcher(), StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_DELETE, StandardWatchEventKinds.ENTRY_MODIFY);
|
||||
@@ -82,9 +80,9 @@ public class SharedObjectsStorage {
|
||||
} catch (IOException ex) {
|
||||
//ignored
|
||||
//ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private enum OSId {
|
||||
WINDOWS, OSX, UNIX
|
||||
}
|
||||
@@ -347,18 +345,18 @@ public class SharedObjectsStorage {
|
||||
|
||||
return subDirs[0];
|
||||
}
|
||||
|
||||
public static void watchedDirectoryChanged(File file) {
|
||||
|
||||
public static void watchedDirectoryChanged(File file) {
|
||||
if (watchingPaused) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
List<File> swfFiles = new ArrayList<>(swfFileToListeners.keySet());
|
||||
for (File swfFile : swfFiles) {
|
||||
File solDir = getSolDirectoryForLocalFile(swfFile);
|
||||
if (file.equals(solDir) || file.getParentFile().equals(solDir)) {
|
||||
fireChanged(swfFile, getSolFilesForLocalFile(swfFile));
|
||||
} else {
|
||||
} else {
|
||||
if (solDir.exists()) {
|
||||
continue;
|
||||
}
|
||||
@@ -373,13 +371,13 @@ public class SharedObjectsStorage {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void fireChanged(File swfFile, List<File> files) {
|
||||
//System.err.println("- firing changed " + swfFile.getAbsolutePath());
|
||||
List<CookiesChangedListener> listeners = swfFileToListeners.get(swfFile);
|
||||
if (listeners != null) {
|
||||
listeners = new ArrayList<>(listeners);
|
||||
for (CookiesChangedListener l:listeners) {
|
||||
for (CookiesChangedListener l : listeners) {
|
||||
l.cookiesChanged(swfFile, files);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,9 +25,9 @@ import com.jpexs.decompiler.flash.gui.FasterScrollPane;
|
||||
import com.jpexs.decompiler.flash.gui.View;
|
||||
import com.jpexs.decompiler.flash.gui.ViewMessages;
|
||||
import com.jpexs.decompiler.flash.gui.editor.LineMarkedEditorPane;
|
||||
import com.jpexs.decompiler.flash.importers.amf.AmfParseException;
|
||||
import com.jpexs.decompiler.flash.importers.amf.amf0.Amf0Importer;
|
||||
import com.jpexs.decompiler.flash.importers.amf.amf3.Amf3Importer;
|
||||
import com.jpexs.decompiler.flash.importers.amf.AmfParseException;
|
||||
import com.jpexs.decompiler.flash.sol.SolFile;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import java.awt.BorderLayout;
|
||||
|
||||
@@ -184,7 +184,7 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
private final MainPanel mainPanel;
|
||||
|
||||
private JMenuItem gotoDocumentClassMenuItem;
|
||||
|
||||
|
||||
private JMenuItem configurePathResolvingMenuItem;
|
||||
|
||||
private JMenuItem setAsLinkageMenuItem;
|
||||
@@ -224,7 +224,7 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
private JMenuItem exportFlashDevelopMenuItem;
|
||||
|
||||
private JMenuItem exportIdeaMenuItem;
|
||||
|
||||
|
||||
private JMenuItem exportVsCodeMenuItem;
|
||||
|
||||
private JMenuItem exportSwfXmlMenuItem;
|
||||
@@ -342,9 +342,9 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
private JMenuItem replaceWithGifMenuItem;
|
||||
|
||||
private JMenuItem collectDepthAsSpritesMenuItem;
|
||||
|
||||
|
||||
private JMenuItem convertShapeTypeMenuItem;
|
||||
|
||||
|
||||
private JMenuItem convertPlaceObjectTypeMenuItem;
|
||||
|
||||
private List<TreeItem> items = new ArrayList<>();
|
||||
@@ -405,7 +405,7 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
configurePathResolvingMenuItem.setIcon(View.getIcon("settings16"));
|
||||
add(configurePathResolvingMenuItem);
|
||||
|
||||
addSeparator();
|
||||
addSeparator();
|
||||
jumpToCharacterMenuItem = new JMenuItem(mainPanel.translate("contextmenu.jumpToCharacter"));
|
||||
jumpToCharacterMenuItem.addActionListener(this::jumpToCharacterActionPerformed);
|
||||
jumpToCharacterMenuItem.setIcon(View.getIcon("jumpto16"));
|
||||
@@ -467,7 +467,7 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
exportIdeaMenuItem.addActionListener(this::exportIdeaActionPerformed);
|
||||
exportIdeaMenuItem.setIcon(View.getIcon("exportidea16"));
|
||||
add(exportIdeaMenuItem);
|
||||
|
||||
|
||||
exportVsCodeMenuItem = new JMenuItem(mainPanel.translate("contextmenu.exportVsCode"));
|
||||
exportVsCodeMenuItem.addActionListener(this::exportVsCodeActionPerformed);
|
||||
exportVsCodeMenuItem.setIcon(View.getIcon("exportvscode16"));
|
||||
@@ -544,19 +544,19 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
replaceRefsWithTagMenuItem.addActionListener(this::replaceRefsWithTagActionPerformed);
|
||||
replaceRefsWithTagMenuItem.setIcon(View.getIcon("replacewithtag16"));
|
||||
add(replaceRefsWithTagMenuItem);
|
||||
|
||||
|
||||
convertShapeTypeMenuItem = new JMenuItem(mainPanel.translate("contextmenu.convertShapeType"));
|
||||
convertShapeTypeMenuItem.addActionListener(this::convertShapeTypeActionPerformed);
|
||||
convertShapeTypeMenuItem.setIcon(View.getIcon("shape16"));
|
||||
add(convertShapeTypeMenuItem);
|
||||
|
||||
|
||||
convertPlaceObjectTypeMenuItem = new JMenuItem(mainPanel.translate("contextmenu.convertPlaceObjectType"));
|
||||
convertPlaceObjectTypeMenuItem.addActionListener(this::convertPlaceObjectTypeActionPerformed);
|
||||
convertPlaceObjectTypeMenuItem.setIcon(View.getIcon("placeobject16"));
|
||||
add(convertPlaceObjectTypeMenuItem);
|
||||
|
||||
addSeparator();
|
||||
|
||||
|
||||
gotoDocumentClassMenuItem = new JMenuItem(mainPanel.translate("menu.tools.gotoDocumentClass"));
|
||||
gotoDocumentClassMenuItem.addActionListener(this::gotoDocumentClassActionPerformed);
|
||||
gotoDocumentClassMenuItem.setIcon(View.getIcon("gotomainclass16"));
|
||||
@@ -920,7 +920,7 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
if (item instanceof Cookie) {
|
||||
if (wasFrame) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
wasNotFrame = true;
|
||||
} else if (item instanceof Tag) {
|
||||
if (wasFrame) {
|
||||
@@ -1089,24 +1089,24 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
}
|
||||
tim = fr.timeline.timelined;
|
||||
}
|
||||
|
||||
|
||||
boolean allSelectedIsShape = true;
|
||||
boolean allSelectedIsPlaceObject = true;
|
||||
|
||||
|
||||
if (items.isEmpty()) {
|
||||
allSelectedIsShape = false;
|
||||
allSelectedIsPlaceObject = false;
|
||||
}
|
||||
|
||||
|
||||
for (TreeItem item : items) {
|
||||
|
||||
|
||||
if (!(item instanceof ShapeTag)) {
|
||||
allSelectedIsShape = false;
|
||||
}
|
||||
if (!(item instanceof PlaceObjectTypeTag)) {
|
||||
allSelectedIsPlaceObject = false;
|
||||
}
|
||||
|
||||
|
||||
if (item instanceof Tag) {
|
||||
Tag tag = (Tag) item;
|
||||
if (tag.isReadOnly()) {
|
||||
@@ -1424,13 +1424,13 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
exportABCMenuItem.setVisible(true);
|
||||
gotoDocumentClassMenuItem.setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
if (firstItem instanceof ScriptPack) {
|
||||
if (firstItem.getOpenable() instanceof SWF) {
|
||||
gotoDocumentClassMenuItem.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (firstItem instanceof SWF) {
|
||||
if (((SWF) firstItem).isAS3()) {
|
||||
gotoDocumentClassMenuItem.setVisible(true);
|
||||
@@ -1455,7 +1455,7 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
replaceRefsWithTagMenuItem.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (firstItem instanceof DefineSpriteTag) {
|
||||
replaceWithGifMenuItem.setVisible(true);
|
||||
}
|
||||
@@ -1481,7 +1481,7 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
addInsideAddAllTags = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
boolean isCookie = firstItem instanceof Cookie;
|
||||
|
||||
addTagInsideMenu.removeAll();
|
||||
@@ -1682,11 +1682,11 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (allSelectedIsShape) {
|
||||
convertShapeTypeMenuItem.setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
if (allSelectedIsPlaceObject) {
|
||||
convertPlaceObjectTypeMenuItem.setVisible(true);
|
||||
}
|
||||
@@ -2600,7 +2600,7 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
mainPanel.refreshTree(swf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void convertShapeTypeActionPerformed(ActionEvent evt) {
|
||||
List<TreeItem> itemr = getSelectedItems();
|
||||
if (itemr.isEmpty()) {
|
||||
@@ -2609,25 +2609,24 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
int currentShapeNum = 0;
|
||||
int min = 0;
|
||||
int minForced = 0;
|
||||
|
||||
|
||||
ShapeTypeConverter converter = new ShapeTypeConverter();
|
||||
|
||||
|
||||
|
||||
if (itemr.size() == 1) {
|
||||
ShapeTag sh = (ShapeTag) itemr.get(0);
|
||||
currentShapeNum = sh.getShapeNum();
|
||||
min = converter.getMinShapeNum(sh);
|
||||
minForced = converter.getForcedMinShapeNum(sh);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ConvertShapeTypeDialog dialog = new ConvertShapeTypeDialog(Main.getDefaultDialogsOwner(), currentShapeNum, minForced, min);
|
||||
|
||||
|
||||
int shapeNum = dialog.showDialog();
|
||||
|
||||
|
||||
if (shapeNum == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
for (TreeItem item : itemr) {
|
||||
ShapeTag sh = (ShapeTag) item;
|
||||
int newShapeNum = shapeNum;
|
||||
@@ -2640,14 +2639,14 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
}
|
||||
converter.convertCharacter(sh.getSwf(), sh.getCharacterId(), newShapeNum);
|
||||
}
|
||||
|
||||
|
||||
mainPanel.refreshTree();
|
||||
if (itemr.size() == 1) {
|
||||
ShapeTag sh = (ShapeTag) itemr.get(0);
|
||||
mainPanel.setTagTreeSelectedNode(mainPanel.getCurrentTree(), sh.getSwf().getCharacter(sh.getCharacterId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void convertPlaceObjectTypeActionPerformed(ActionEvent evt) {
|
||||
List<TreeItem> itemr = getSelectedItems();
|
||||
if (itemr.isEmpty()) {
|
||||
@@ -2655,37 +2654,36 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
}
|
||||
int currentPlaceObjectNum = 0;
|
||||
int min = 0;
|
||||
|
||||
|
||||
PlaceObjectTypeConverter converter = new PlaceObjectTypeConverter();
|
||||
|
||||
|
||||
|
||||
if (itemr.size() == 1) {
|
||||
PlaceObjectTypeTag sh = (PlaceObjectTypeTag) itemr.get(0);
|
||||
currentPlaceObjectNum = sh.getPlaceObjectNum();
|
||||
min = converter.getMinPlaceNum(sh);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ConvertPlaceObjectTypeDialog dialog = new ConvertPlaceObjectTypeDialog(Main.getDefaultDialogsOwner(), currentPlaceObjectNum, min);
|
||||
|
||||
|
||||
int placeNum = dialog.showDialog();
|
||||
|
||||
|
||||
if (placeNum == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
PlaceObjectTypeTag lastConverted = null;
|
||||
for (TreeItem item : itemr) {
|
||||
PlaceObjectTypeTag pl = (PlaceObjectTypeTag) item;
|
||||
if (pl.getPlaceObjectNum()== placeNum) {
|
||||
if (pl.getPlaceObjectNum() == placeNum) {
|
||||
continue;
|
||||
}
|
||||
lastConverted = converter.convertTagType(pl, placeNum);
|
||||
}
|
||||
|
||||
|
||||
mainPanel.refreshTree();
|
||||
if (itemr.size() == 1) {
|
||||
mainPanel.setTagTreeSelectedNode(mainPanel.getCurrentTree(), lastConverted);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void replaceRefsWithTagActionPerformed(ActionEvent evt) {
|
||||
@@ -2828,7 +2826,7 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
item.getOpenable();
|
||||
mainPanel.gotoDocumentClass((SWF) item.getOpenable());
|
||||
}
|
||||
|
||||
|
||||
private void jumpToCharacterActionPerformed(ActionEvent evt) {
|
||||
TreeItem itemj = getCurrentItem();
|
||||
if (itemj == null || !(itemj instanceof HasCharacterId)) {
|
||||
@@ -2988,7 +2986,7 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
}
|
||||
if (!identifier.isEmpty() && !found) {
|
||||
ea.tags.add(ch.getCharacterId());
|
||||
ea.names.add(identifier);
|
||||
ea.names.add(identifier);
|
||||
}
|
||||
ea.setModified(true);
|
||||
if (ea.names.isEmpty()) {
|
||||
@@ -4046,7 +4044,7 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
Cookie cookie = (Cookie) item;
|
||||
((Cookie) item).getSolFile().delete();
|
||||
}
|
||||
|
||||
|
||||
if (item instanceof BUTTONRECORD) {
|
||||
ButtonTag button = (ButtonTag) parent;
|
||||
button.getRecords().remove((BUTTONRECORD) item);
|
||||
@@ -5708,7 +5706,7 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
SWF swf = (SWF) getCurrentItem().getOpenable();
|
||||
mainPanel.exportIdea(swf);
|
||||
}
|
||||
|
||||
|
||||
public void exportVsCodeActionPerformed(ActionEvent evt) {
|
||||
SWF swf = (SWF) getCurrentItem().getOpenable();
|
||||
mainPanel.exportVsCode(swf);
|
||||
|
||||
Reference in New Issue
Block a user