mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-01 22:25:28 +00:00
Added #1232 Needed/dependent characters list in basic tag info can be expanded to show tag names
This commit is contained in:
@@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file.
|
||||
- Create new empty SWF file
|
||||
- Checking missing needed character tags and their proper position (Marking them as red - with tooltip)
|
||||
- [#1432] Save as EXE from commandline
|
||||
- [#1232] Needed/dependent characters list in basic tag info can be expanded to show tag names
|
||||
|
||||
### Fixed
|
||||
- Flash viewer - subtract blend mode
|
||||
@@ -2503,6 +2504,7 @@ All notable changes to this project will be documented in this file.
|
||||
[#1832]: https://www.free-decompiler.com/flash/issues/1832
|
||||
[#1849]: https://www.free-decompiler.com/flash/issues/1849
|
||||
[#1432]: https://www.free-decompiler.com/flash/issues/1432
|
||||
[#1232]: https://www.free-decompiler.com/flash/issues/1232
|
||||
[#1712]: https://www.free-decompiler.com/flash/issues/1712
|
||||
[#1857]: https://www.free-decompiler.com/flash/issues/1857
|
||||
[#1455]: https://www.free-decompiler.com/flash/issues/1455
|
||||
|
||||
@@ -603,6 +603,9 @@ public abstract class Tag implements NeedsCharacters, Exportable, Serializable {
|
||||
return needed;
|
||||
}
|
||||
Timelined tim = getTimelined();
|
||||
if (tim == null) {
|
||||
return needed;
|
||||
}
|
||||
ReadOnlyTagList tags = tim.getTags();
|
||||
for (int i = tags.indexOf(this) - 1; i >= -1; i--) {
|
||||
if (i == -1) {
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.tags;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
@@ -27,8 +28,17 @@ import java.util.Map;
|
||||
*/
|
||||
public class TagInfo {
|
||||
|
||||
private SWF swf;
|
||||
private final Map<String, List<TagInfoItem>> infos = new LinkedHashMap<>();
|
||||
|
||||
public TagInfo(SWF swf) {
|
||||
this.swf = swf;
|
||||
}
|
||||
|
||||
public SWF getSwf() {
|
||||
return swf;
|
||||
}
|
||||
|
||||
public void addInfo(String categoryName, String name, Object value) {
|
||||
categoryName = "general"; // temporary add everything to general catagory
|
||||
List<TagInfoItem> category = infos.get(categoryName);
|
||||
|
||||
@@ -4056,7 +4056,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
|
||||
if (treeItem instanceof Tag) {
|
||||
Tag tag = (Tag) treeItem;
|
||||
TagInfo tagInfo = new TagInfo();
|
||||
TagInfo tagInfo = new TagInfo(treeItem.getSwf());
|
||||
tag.getTagInfo(tagInfo);
|
||||
if (!tagInfo.isEmpty()) {
|
||||
tagInfoPanel.setTagInfos(tagInfo);
|
||||
@@ -4071,7 +4071,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
frame.getNeededCharacters(needed);
|
||||
|
||||
if (!needed.isEmpty()) {
|
||||
TagInfo tagInfo = new TagInfo();
|
||||
TagInfo tagInfo = new TagInfo(treeItem.getSwf());
|
||||
tagInfo.addInfo("general", "neededCharacters", Helper.joinStrings(needed, ", "));
|
||||
tagInfoPanel.setTagInfos(tagInfo);
|
||||
showDetail(DETAILCARDTAGINFO);
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.gui;
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.tags.TagInfo;
|
||||
import com.jpexs.decompiler.flash.tags.base.CharacterTag;
|
||||
import com.jpexs.decompiler.flash.treeitems.TreeItem;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
@@ -48,7 +49,7 @@ public class TagInfoPanel extends JPanel {
|
||||
|
||||
private final JEditorPane editorPane = new JEditorPane();
|
||||
|
||||
private TagInfo tagInfo = new TagInfo();
|
||||
private TagInfo tagInfo = new TagInfo(null);
|
||||
|
||||
public TagInfoPanel(MainPanel mainPanel) {
|
||||
this.mainPanel = mainPanel;
|
||||
@@ -74,11 +75,13 @@ public class TagInfoPanel extends JPanel {
|
||||
|
||||
String scheme = url.getScheme();
|
||||
String strId = url.getHost();
|
||||
Integer id = Integer.parseInt(strId);
|
||||
Integer id = "expand".equals(scheme) ? null : Integer.parseInt(strId);
|
||||
SWF swf = mainPanel.getCurrentSwf();
|
||||
|
||||
TreeItem item = null;
|
||||
if ("char".equals(scheme)) {
|
||||
if ("expand".equals(scheme)) {
|
||||
updateHtmlContent(true);
|
||||
} else if ("char".equals(scheme)) {
|
||||
item = swf.getCharacter(id);
|
||||
} else if ("frame".equals(scheme)) {
|
||||
item = swf.getTimeline().getFrame(id);
|
||||
@@ -97,7 +100,7 @@ public class TagInfoPanel extends JPanel {
|
||||
buildHtmlContent();
|
||||
}
|
||||
|
||||
private void buildHtmlContent() {
|
||||
private void updateHtmlContent(boolean expand) {
|
||||
String categoryName = "general";
|
||||
String result = "<html><body><table cellspacing='0' cellpadding='0'>";
|
||||
Boolean flipFlop = false;
|
||||
@@ -119,6 +122,7 @@ public class TagInfoPanel extends JPanel {
|
||||
);
|
||||
result += "</tr>";
|
||||
|
||||
SWF swf = tagInfo.getSwf();
|
||||
for (TagInfo.TagInfoItem item : items) {
|
||||
|
||||
flipFlop = !flipFlop;
|
||||
@@ -160,14 +164,31 @@ public class TagInfoPanel extends JPanel {
|
||||
|
||||
Collections.sort(sortedIds);
|
||||
|
||||
String scheme = frameList ? "frame" : "char";
|
||||
String scheme = frameList ? "frame" : "char";
|
||||
|
||||
for (int id : sortedIds) {
|
||||
int displayId = frameList ? id + 1 : id;
|
||||
strValue += String.format("<a href='%s://%d'>%d</a>, ", scheme, id, displayId);
|
||||
|
||||
if (!frameList && expand) {
|
||||
String charName;
|
||||
CharacterTag character = swf == null ? null : swf.getCharacter(id);
|
||||
if (swf == null || character == null) {
|
||||
charName = "???";
|
||||
} else {
|
||||
charName = character.getTagName();
|
||||
}
|
||||
|
||||
strValue += String.format("<a href='%s://%d'>%s (%d)</a><br>", scheme, id, charName, id);
|
||||
} else {
|
||||
strValue += String.format("<a href='%s://%d'>%d</a>, ", scheme, id, displayId);
|
||||
}
|
||||
}
|
||||
|
||||
value = strValue.substring(0, strValue.length() - 2);
|
||||
|
||||
if (!frameList && !expand) {
|
||||
value = value + " <a href='expand://all'>+</a>";
|
||||
}
|
||||
}
|
||||
|
||||
result += "<td>" + value + "</td>";
|
||||
@@ -178,6 +199,10 @@ public class TagInfoPanel extends JPanel {
|
||||
result += "</table></body></html>";
|
||||
|
||||
editorPane.setText(result);
|
||||
}
|
||||
|
||||
private void buildHtmlContent() {
|
||||
updateHtmlContent(false);
|
||||
|
||||
Font font = UIManager.getFont("Table.font");
|
||||
String bodyRule = "body { font-family: " + font.getFamily() + ";"
|
||||
@@ -196,20 +221,19 @@ public class TagInfoPanel extends JPanel {
|
||||
Color bgColor = UIManager.getColor("Table.background");
|
||||
int light = (bgColor.getRed() + bgColor.getGreen() + bgColor.getBlue()) / 3;
|
||||
boolean nightMode = light <= 128;
|
||||
|
||||
|
||||
Color linkColor = Color.blue;
|
||||
if (nightMode) {
|
||||
linkColor = new Color(0x88,0x88,0xff);
|
||||
linkColor = new Color(0x88, 0x88, 0xff);
|
||||
}
|
||||
|
||||
|
||||
bodyRule += "background-color: " + getUIColorToHex("Table.background") + ";"
|
||||
+ "color:" + getUIColorToHex("Table.foreground") + ";"
|
||||
+ "padding:1px;"
|
||||
+ "}"
|
||||
+ "td { border: 1px solid " + getUIColorToHex("Table.gridColor") + "; }"
|
||||
+ "html { border: 1px solid " + getUIColorToHex("Table.gridColor") + "; }"
|
||||
+ "a {color: " + getColorToHex(linkColor) + "}"
|
||||
;
|
||||
+ "a {color: " + getColorToHex(linkColor) + "}";
|
||||
}
|
||||
|
||||
((HTMLDocument) editorPane.getDocument()).getStyleSheet().addRule(bodyRule);
|
||||
@@ -222,6 +246,7 @@ public class TagInfoPanel extends JPanel {
|
||||
private static String getColorToHex(Color c) {
|
||||
return String.format("#%02x%02x%02x", c.getRed(), c.getGreen(), c.getBlue());
|
||||
}
|
||||
|
||||
private static String getUIColorToHex(String name) {
|
||||
Color c = UIManager.getColor(name);
|
||||
return getColorToHex(c);
|
||||
|
||||
@@ -33,6 +33,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import javax.swing.event.TreeModelEvent;
|
||||
import javax.swing.tree.TreePath;
|
||||
|
||||
@@ -274,7 +275,7 @@ public class TagListTreeModel extends AbstractTagTreeModel {
|
||||
newPath.addAll(path);
|
||||
newPath.add(n);
|
||||
|
||||
if (obj.equals(n)) {
|
||||
if (Objects.equals(obj, n)) {
|
||||
return newPath;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user