mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-04 22:25:42 +00:00
frame display fix
This commit is contained in:
@@ -81,7 +81,7 @@ public class Main {
|
||||
return commandLineMode;
|
||||
}
|
||||
|
||||
public static final boolean DISPLAY_FILENAME=true;
|
||||
public static final boolean DISPLAY_FILENAME=false;
|
||||
public static boolean DEBUG_COPY = false;
|
||||
/**
|
||||
* Debug mode = throwing an error when comparing original file and recompiled
|
||||
|
||||
@@ -58,6 +58,9 @@ import com.jpexs.decompiler.flash.tags.EndTag;
|
||||
import com.jpexs.decompiler.flash.tags.ExportAssetsTag;
|
||||
import com.jpexs.decompiler.flash.tags.JPEGTablesTag;
|
||||
import com.jpexs.decompiler.flash.tags.PlaceObject2Tag;
|
||||
import com.jpexs.decompiler.flash.tags.PlaceObject3Tag;
|
||||
import com.jpexs.decompiler.flash.tags.PlaceObjectTag;
|
||||
import com.jpexs.decompiler.flash.tags.PlaceObjectTypeTag;
|
||||
import com.jpexs.decompiler.flash.tags.SetBackgroundColorTag;
|
||||
import com.jpexs.decompiler.flash.tags.ShowFrameTag;
|
||||
import com.jpexs.decompiler.flash.tags.Tag;
|
||||
@@ -217,7 +220,7 @@ public class MainFrame extends JFrame implements ActionListener, TreeSelectionLi
|
||||
Main.exit();
|
||||
}
|
||||
});
|
||||
setTitle(Main.applicationName +(Main.DISPLAY_FILENAME?" - " + Main.getFileTitle():""));
|
||||
setTitle(Main.applicationName + (Main.DISPLAY_FILENAME ? " - " + Main.getFileTitle() : ""));
|
||||
JMenuBar menuBar = new JMenuBar();
|
||||
|
||||
JMenu menuFile = new JMenu("File");
|
||||
@@ -335,7 +338,7 @@ public class MainFrame extends JFrame implements ActionListener, TreeSelectionLi
|
||||
miDonate.setActionCommand("DONATE");
|
||||
miDonate.setIcon(View.getIcon("donate16"));
|
||||
miDonate.addActionListener(this);
|
||||
|
||||
|
||||
JMenuItem miHomepage = new JMenuItem("Visit homepage");
|
||||
miHomepage.setActionCommand("HOMEPAGE");
|
||||
miHomepage.setIcon(View.getIcon("homepage16"));
|
||||
@@ -366,7 +369,7 @@ public class MainFrame extends JFrame implements ActionListener, TreeSelectionLi
|
||||
CardLayout cl2 = (CardLayout) (detailPanel.getLayout());
|
||||
cl2.show(detailPanel, DETAILCARDEMPTYPANEL);
|
||||
|
||||
|
||||
|
||||
abcList = new ArrayList<DoABCTag>();
|
||||
getActionScript3(objs, abcList);
|
||||
if (!abcList.isEmpty()) {
|
||||
@@ -468,16 +471,14 @@ public class MainFrame extends JFrame implements ActionListener, TreeSelectionLi
|
||||
searchPanel.setLayout(new BorderLayout());
|
||||
searchPanel.add(filterField, BorderLayout.CENTER);
|
||||
searchPanel.add(new JLabel(View.getIcon("search16")), BorderLayout.WEST);
|
||||
JLabel closeSearchButton=new JLabel(View.getIcon("cancel16"));
|
||||
JLabel closeSearchButton = new JLabel(View.getIcon("cancel16"));
|
||||
closeSearchButton.addMouseListener(new MouseAdapter() {
|
||||
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
filterField.setText("");
|
||||
doFilter();
|
||||
searchPanel.setVisible(false);
|
||||
}
|
||||
|
||||
});
|
||||
searchPanel.add(closeSearchButton, BorderLayout.EAST);
|
||||
JPanel pan1 = new JPanel(new BorderLayout());
|
||||
@@ -517,15 +518,13 @@ public class MainFrame extends JFrame implements ActionListener, TreeSelectionLi
|
||||
splitPane1.setDividerLocation(0.5);
|
||||
View.centerScreen(this);
|
||||
tagTree.addKeyListener(new KeyAdapter() {
|
||||
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
if((e.getKeyCode()=='F')&&(e.isControlDown())){
|
||||
if ((e.getKeyCode() == 'F') && (e.isControlDown())) {
|
||||
searchPanel.setVisible(true);
|
||||
filterField.requestFocusInWindow();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
detailPanel.setVisible(false);
|
||||
|
||||
@@ -551,9 +550,9 @@ public class MainFrame extends JFrame implements ActionListener, TreeSelectionLi
|
||||
if (actionPanel != null) {
|
||||
actionPanel.initSplits();
|
||||
}
|
||||
splitPane1.setDividerLocation(getWidth() / 3);
|
||||
splitPane1.setDividerLocation(getWidth() / 3);
|
||||
splitPane2.setDividerLocation(splitPane2.getHeight() * 3 / 5);
|
||||
splitPos=splitPane2.getDividerLocation();
|
||||
splitPos = splitPane2.getDividerLocation();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1024,7 +1023,7 @@ public class MainFrame extends JFrame implements ActionListener, TreeSelectionLi
|
||||
}
|
||||
if (e.getActionCommand().equals("SAVEAS")) {
|
||||
if (Main.saveFileDialog()) {
|
||||
setTitle(Main.applicationName + (Main.DISPLAY_FILENAME?" - " + Main.getFileTitle():""));
|
||||
setTitle(Main.applicationName + (Main.DISPLAY_FILENAME ? " - " + Main.getFileTitle() : ""));
|
||||
}
|
||||
}
|
||||
if (e.getActionCommand().equals("OPEN")) {
|
||||
@@ -1156,7 +1155,7 @@ public class MainFrame extends JFrame implements ActionListener, TreeSelectionLi
|
||||
JOptionPane.showMessageDialog(null, "Please visit\r\n" + donateURL + "\r\nfor details.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (e.getActionCommand().equals("HOMEPAGE")) {
|
||||
String homePageURL = Main.projectPage;
|
||||
if (java.awt.Desktop.isDesktopSupported()) {
|
||||
@@ -1322,23 +1321,23 @@ public class MainFrame extends JFrame implements ActionListener, TreeSelectionLi
|
||||
}
|
||||
}
|
||||
}
|
||||
private int splitPos = 0;
|
||||
|
||||
private int splitPos=0;
|
||||
public void showDetail(String card) {
|
||||
CardLayout cl = (CardLayout) (detailPanel.getLayout());
|
||||
cl.show(detailPanel, card);
|
||||
if(card.equals(DETAILCARDEMPTYPANEL)){
|
||||
if(detailPanel.isVisible()){
|
||||
splitPos=splitPane2.getDividerLocation();
|
||||
if (card.equals(DETAILCARDEMPTYPANEL)) {
|
||||
if (detailPanel.isVisible()) {
|
||||
splitPos = splitPane2.getDividerLocation();
|
||||
detailPanel.setVisible(false);
|
||||
}
|
||||
}else{
|
||||
if(!detailPanel.isVisible()){
|
||||
} else {
|
||||
if (!detailPanel.isVisible()) {
|
||||
detailPanel.setVisible(true);
|
||||
splitPane2.setDividerLocation(splitPos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void showCard(String card) {
|
||||
@@ -1427,7 +1426,7 @@ public class MainFrame extends JFrame implements ActionListener, TreeSelectionLi
|
||||
}
|
||||
tempFile = File.createTempFile("temp", ".swf");
|
||||
tempFile.deleteOnExit();
|
||||
|
||||
|
||||
FileOutputStream fos = new FileOutputStream(tempFile);
|
||||
SWFOutputStream sos = new SWFOutputStream(fos, 10);
|
||||
sos.write("FWS".getBytes());
|
||||
@@ -1465,19 +1464,40 @@ public class MainFrame extends JFrame implements ActionListener, TreeSelectionLi
|
||||
break;
|
||||
}
|
||||
Tag t = (Tag) o;
|
||||
if (frameCnt == fn.getFrame()) {
|
||||
Set<Integer> needed = t.getNeededCharacters();
|
||||
for (int n : needed) {
|
||||
if (!doneCharacters.contains(n)) {
|
||||
sos2.writeTag(characters.get(n));
|
||||
doneCharacters.add(n);
|
||||
}
|
||||
}
|
||||
if (t instanceof CharacterTag) {
|
||||
doneCharacters.add(((CharacterTag) t).getCharacterID());
|
||||
Set<Integer> needed = t.getDeepNeededCharacters(characters);
|
||||
for (int n : needed) {
|
||||
if (!doneCharacters.contains(n)) {
|
||||
sos2.writeTag(characters.get(n));
|
||||
doneCharacters.add(n);
|
||||
}
|
||||
}
|
||||
if (t instanceof CharacterTag) {
|
||||
doneCharacters.add(((CharacterTag) t).getCharacterID());
|
||||
}
|
||||
sos2.writeTag(t);
|
||||
|
||||
if (parent != null) {
|
||||
if (t instanceof PlaceObjectTypeTag) {
|
||||
PlaceObjectTypeTag pot = (PlaceObjectTypeTag) t;
|
||||
int chid = pot.getCharacterId();
|
||||
int depth = pot.getDepth();
|
||||
MATRIX mat = pot.getMatrix();
|
||||
if (mat == null) {
|
||||
mat = new MATRIX();
|
||||
}
|
||||
mat=(MATRIX)Helper.deepCopy(mat);
|
||||
if(parent instanceof BoundedTag){
|
||||
RECT r=((BoundedTag)parent).getRect(characters);
|
||||
mat.translateX = mat.translateX +width / 2 - r.getWidth()/2;
|
||||
mat.translateY = mat.translateY + height/2 - r.getHeight()/2;
|
||||
}else{
|
||||
mat.translateX = mat.translateX + width / 2;
|
||||
mat.translateY = mat.translateY + height / 2;
|
||||
}
|
||||
sos2.writeTag(new PlaceObject2Tag(false, false, false, false, false, true, false, true, depth, chid, mat, null, 0, null, 0, null));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
sos2.writeTag(new ShowFrameTag());
|
||||
} else {
|
||||
@@ -1488,7 +1508,7 @@ public class MainFrame extends JFrame implements ActionListener, TreeSelectionLi
|
||||
}
|
||||
} else if (tagObj instanceof AloneTag) {
|
||||
} else {
|
||||
Set<Integer> needed = ((Tag) tagObj).getNeededCharacters();
|
||||
Set<Integer> needed = ((Tag) tagObj).getDeepNeededCharacters(characters);
|
||||
for (int n : needed) {
|
||||
sos2.writeTag(characters.get(n));
|
||||
}
|
||||
|
||||
@@ -80,26 +80,25 @@ public class DefineSpriteTag extends CharacterTag implements Container, BoundedT
|
||||
|
||||
public RECT getRect(HashMap<Integer, CharacterTag> characters) {
|
||||
RECT ret = new RECT(Integer.MAX_VALUE, Integer.MIN_VALUE, Integer.MAX_VALUE, Integer.MIN_VALUE);
|
||||
HashMap<Integer,Integer> depthMap=new HashMap<Integer, Integer>();
|
||||
for (Tag t : subTags) {
|
||||
Set<Integer> needed = t.getNeededCharacters();
|
||||
Set<Integer> needed = t.getNeededCharacters();
|
||||
MATRIX m = null;
|
||||
if (t instanceof PlaceObjectTypeTag) {
|
||||
PlaceObjectTypeTag pot=(PlaceObjectTypeTag) t;
|
||||
m = pot.getMatrix();
|
||||
int charId=pot.getCharacterId();
|
||||
if(charId>-1){
|
||||
depthMap.put(pot.getDepth(), charId);
|
||||
}else{
|
||||
needed.add(depthMap.get(pot.getDepth()));
|
||||
}
|
||||
}
|
||||
if (needed.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
RECT r = getCharacterBounds(characters, needed);
|
||||
MATRIX m = null;
|
||||
if (t instanceof PlaceObjectTag) {
|
||||
m = ((PlaceObjectTag) t).matrix;
|
||||
}
|
||||
if (t instanceof PlaceObject2Tag) {
|
||||
if (((PlaceObject2Tag) t).placeFlagHasMatrix) {
|
||||
m = ((PlaceObject2Tag) t).matrix;
|
||||
}
|
||||
}
|
||||
if (t instanceof PlaceObject3Tag) {
|
||||
if (((PlaceObject3Tag) t).placeFlagHasMatrix) {
|
||||
m = ((PlaceObject3Tag) t).matrix;
|
||||
}
|
||||
}
|
||||
|
||||
if (m != null) {
|
||||
Point topleft = m.apply(new Point(r.Xmin, r.Ymin));
|
||||
Point bottomright = m.apply(new Point(r.Xmax, r.Ymax));
|
||||
|
||||
@@ -38,7 +38,7 @@ import java.util.Set;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class PlaceObject2Tag extends Tag implements Container {
|
||||
public class PlaceObject2Tag extends Tag implements Container, PlaceObjectTypeTag {
|
||||
|
||||
/**
|
||||
* @since SWF 5 Has clip actions (sprite characters only)
|
||||
@@ -254,4 +254,28 @@ public class PlaceObject2Tag extends Tag implements Container {
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public int getCharacterId() {
|
||||
if(placeFlagHasCharacter){
|
||||
return characterId;
|
||||
}else{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public int getDepth() {
|
||||
return depth;
|
||||
}
|
||||
|
||||
public MATRIX getMatrix() {
|
||||
if(placeFlagHasMatrix){
|
||||
return matrix;
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ import java.util.Set;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class PlaceObject3Tag extends Tag implements Container {
|
||||
public class PlaceObject3Tag extends Tag implements Container, PlaceObjectTypeTag {
|
||||
|
||||
/**
|
||||
* @since SWF 5 has clip actions (sprite characters only)
|
||||
@@ -322,4 +322,25 @@ public class PlaceObject3Tag extends Tag implements Container {
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public int getCharacterId() {
|
||||
if (placeFlagHasCharacter) {
|
||||
return characterId;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public int getDepth() {
|
||||
return depth;
|
||||
}
|
||||
|
||||
public MATRIX getMatrix() {
|
||||
if(placeFlagHasMatrix){
|
||||
return matrix;
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ import java.util.Set;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class PlaceObjectTag extends Tag {
|
||||
public class PlaceObjectTag extends Tag implements PlaceObjectTypeTag{
|
||||
|
||||
/**
|
||||
* ID of character to place
|
||||
@@ -106,4 +106,21 @@ public class PlaceObjectTag extends Tag {
|
||||
ret.add(characterId);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCharacterId() {
|
||||
return characterId;
|
||||
}
|
||||
|
||||
public int getDepth() {
|
||||
return depth;
|
||||
}
|
||||
|
||||
public MATRIX getMatrix() {
|
||||
return matrix;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.jpexs.decompiler.flash.tags;
|
||||
|
||||
import com.jpexs.decompiler.flash.types.MATRIX;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public interface PlaceObjectTypeTag {
|
||||
public int getCharacterId();
|
||||
public int getDepth();
|
||||
public MATRIX getMatrix();
|
||||
}
|
||||
@@ -16,6 +16,8 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.tags;
|
||||
|
||||
import com.jpexs.decompiler.flash.tags.base.CharacterTag;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -120,4 +122,14 @@ public class Tag {
|
||||
public Set<Integer> getNeededCharacters() {
|
||||
return new HashSet<Integer>();
|
||||
}
|
||||
|
||||
public Set<Integer> getDeepNeededCharacters(HashMap<Integer, CharacterTag> characters){
|
||||
Set<Integer> ret=new HashSet<Integer>();
|
||||
Set<Integer> needed=getNeededCharacters();
|
||||
ret.addAll(needed);
|
||||
for(int ch:needed){
|
||||
ret.addAll(characters.get(ch).getDeepNeededCharacters(characters));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.jpexs.decompiler.flash.types;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Represents a standard 2x3 transformation matrix of the sort commonly used in
|
||||
@@ -24,7 +25,7 @@ import java.awt.Point;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class MATRIX {
|
||||
public class MATRIX implements Serializable {
|
||||
|
||||
/**
|
||||
* Has scale values
|
||||
|
||||
Reference in New Issue
Block a user