diff --git a/CHANGELOG.md b/CHANGELOG.md index f20aa5eca..71ada8230 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,23 @@ # Change Log All notable changes to this project will be documented in this file. +## [Unreleased] +### Added +- Allow add tag after header context menu +- DefineScalingGrid has icon +- Adding tag "inside" allows setting character id to original when possible + +### Fixed +- Do not show option to Show in taglist on resource view folders +- Disallow add tag before header context menu +- Context menu on tags mapped to other characters like DefineScalingGrid +- Add tag before/after for frame selection position +- Add tag (before/after/inside) refactored to more meaningful menus + +### Changed +- Add tag renamed to Add tag inside +- Clone tag menuitem renamed to just Clone as it clones both tags and frames + ## [16.0.0] - 2022-10-30 ### Added - Replace characters references diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/Tag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/Tag.java index 4918bd5cc..d6f1edf07 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/Tag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/Tag.java @@ -307,7 +307,7 @@ public abstract class Tag implements NeedsCharacters, Exportable, Serializable { return knownTagInfosByName; } - + private static void addTagInfo(Map map, Map map2, int id, Class cls, String name) { map.put(id, new TagTypeInfo(id, cls, name)); map2.put(name, new TagTypeInfo(id, cls, name)); diff --git a/src/com/jpexs/decompiler/flash/gui/SelectTagPositionDialog.java b/src/com/jpexs/decompiler/flash/gui/SelectTagPositionDialog.java index 2a0d38755..50a6fd046 100644 --- a/src/com/jpexs/decompiler/flash/gui/SelectTagPositionDialog.java +++ b/src/com/jpexs/decompiler/flash/gui/SelectTagPositionDialog.java @@ -78,6 +78,8 @@ public class SelectTagPositionDialog extends AppDialog { private Timelined selectedTimelined = null; private boolean allowInsideSprites; + private boolean selectNext; + private static class MyTreeNode implements TreeNode { private final List children = new ArrayList<>(); @@ -218,27 +220,49 @@ public class SelectTagPositionDialog extends AppDialog { root.addChild(endNode); } + private void selectPath(List path) { + Object[] pathArray = path.toArray(new Object[path.size()]); + TreePath tpath = new TreePath(pathArray); + positionTree.setSelectionPath(tpath); + int row = positionTree.getRowForPath(tpath); + if (row != -1) { + Rectangle rect = positionTree.getRowBounds(row); + rect.width += rect.x; + rect.x = 0; + positionTree.scrollRectToVisible(rect); + } + } + private void selectCurrent(MyTreeNode root, Timelined timelined, List path) { + if (selectedTag == null && !allowInsideSprites) { + + } + for (int i = 0; i < root.getChildCount(); i++) { MyTreeNode node = (MyTreeNode) root.getChildAt(i); List subPath = new ArrayList<>(path); subPath.add(node); + + List nextPath = new ArrayList<>(path); + if (i + 1 < root.getChildCount()) { + nextPath.add(root.getChildAt(i + 1)); + } - if (node.getData() == selectedTag && timelined == selectedTimelined) { - Object[] pathArray = subPath.toArray(new Object[subPath.size()]); - TreePath tpath = new TreePath(pathArray); - positionTree.setSelectionPath(tpath); - int row = positionTree.getRowForPath(tpath); - if (row != -1) { - Rectangle rect = positionTree.getRowBounds(row); - rect.width += rect.x; - rect.x = 0; - positionTree.scrollRectToVisible(rect); - } + if (timelined == selectedTimelined && ((node.getData() == selectedTag))) { + selectPath(selectNext ? nextPath : subPath); return; } + if (timelined == selectedTimelined && (node.getData() instanceof MyTimelineEnd) && selectedTag == null) { + selectPath(subPath); + return; + } + if ((selectedTimelined instanceof DefineSpriteTag) && !allowInsideSprites && node.getData() == selectedTimelined) { + selectPath(nextPath); + return; + } + if (node.getData() instanceof DefineSpriteTag) { selectCurrent(node, (DefineSpriteTag) node.getData(), subPath); @@ -249,13 +273,13 @@ public class SelectTagPositionDialog extends AppDialog { } public SelectTagPositionDialog(Window parent, SWF swf, boolean allowInsideSprites) { - this(parent, swf, null, null, allowInsideSprites); + this(parent, swf, null, null, allowInsideSprites, false); } private static class PositionTreeCellRenderer extends DefaultTreeCellRenderer { private boolean selected; - + public PositionTreeCellRenderer() { if (View.isOceanic()) { setUI(new BasicLabelUI()); @@ -278,24 +302,25 @@ public class SelectTagPositionDialog extends AppDialog { if (subValue instanceof MyTimelineEnd) { lab.setIcon(TagTree.getIconForType(TreeNodeType.END)); } - + if (subValue instanceof MyFrame) { lab.setIcon(TagTree.getIconForType(TreeNodeType.FRAME)); } if (subValue instanceof TreeItem) { - lab.setIcon(TagTree.getIconForType(TagTree.getTreeNodeType((TreeItem)subValue))); + lab.setIcon(TagTree.getIconForType(TagTree.getTreeNodeType((TreeItem) subValue))); } } return renderer; } } - public SelectTagPositionDialog(Window parent, SWF swf, Tag selectedTag, Timelined selectedTimelined, boolean allowInsideSprites) { + public SelectTagPositionDialog(Window parent, SWF swf, Tag selectedTag, Timelined selectedTimelined, boolean allowInsideSprites, boolean selectNext) { super(parent); this.swf = swf; this.selectedTag = selectedTag; this.selectedTimelined = selectedTimelined; this.allowInsideSprites = allowInsideSprites; + this.selectNext = selectNext; setTitle(translate("dialog.title")); setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); Container cnt = getContentPane(); @@ -374,7 +399,7 @@ public class SelectTagPositionDialog extends AppDialog { positionTree.addTreeSelectionListener(this::spriteValueChanged); positionTree.addTreeSelectionListener(this::positionTreeValueChanged); positionTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); - + previewPanel = new PreviewPanel(Main.getMainFrame().getPanel(), null); previewPanel.setReadOnly(true); previewPanel.setPreferredSize(new Dimension(300, 1)); @@ -395,14 +420,14 @@ public class SelectTagPositionDialog extends AppDialog { setResizable(true); View.centerScreen(this); View.setWindowIcon(this); - + calculateEnabled(); } public void positionTreeValueChanged(TreeSelectionEvent e) { calculateEnabled(); } - + private void calculateEnabled() { MyTreeNode node = (MyTreeNode) positionTree.getLastSelectedPathComponent(); boolean enabled = true; diff --git a/src/com/jpexs/decompiler/flash/gui/TreeNodeType.java b/src/com/jpexs/decompiler/flash/gui/TreeNodeType.java index 5ab7e7837..a65bab14a 100644 --- a/src/com/jpexs/decompiler/flash/gui/TreeNodeType.java +++ b/src/com/jpexs/decompiler/flash/gui/TreeNodeType.java @@ -60,5 +60,6 @@ public enum TreeNodeType { METADATA, PLACE_OBJECT, REMOVE_OBJECT, + SCALING_GRID, END } diff --git a/src/com/jpexs/decompiler/flash/gui/dumpview/DumpTree.java b/src/com/jpexs/decompiler/flash/gui/dumpview/DumpTree.java index f80693244..a9903e130 100644 --- a/src/com/jpexs/decompiler/flash/gui/dumpview/DumpTree.java +++ b/src/com/jpexs/decompiler/flash/gui/dumpview/DumpTree.java @@ -49,6 +49,7 @@ import com.jpexs.decompiler.flash.tags.DefineFont4Tag; import com.jpexs.decompiler.flash.tags.DefineFontTag; import com.jpexs.decompiler.flash.tags.DefineMorphShape2Tag; import com.jpexs.decompiler.flash.tags.DefineMorphShapeTag; +import com.jpexs.decompiler.flash.tags.DefineScalingGridTag; import com.jpexs.decompiler.flash.tags.DefineShape2Tag; import com.jpexs.decompiler.flash.tags.DefineShape3Tag; import com.jpexs.decompiler.flash.tags.DefineShape4Tag; @@ -218,6 +219,9 @@ public class DumpTree extends JTree { case RemoveObject2Tag.NAME: nodeType = TreeNodeType.REMOVE_OBJECT; break; + case DefineScalingGridTag.NAME: + nodeType = TreeNodeType.SCALING_GRID; + break; default: nodeType = TreeNodeType.OTHER_TAG; } diff --git a/src/com/jpexs/decompiler/flash/gui/graphics/scalinggrid16.png b/src/com/jpexs/decompiler/flash/gui/graphics/scalinggrid16.png new file mode 100644 index 000000000..736d879d4 Binary files /dev/null and b/src/com/jpexs/decompiler/flash/gui/graphics/scalinggrid16.png differ diff --git a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties index 13a7f7102..39504a19a 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties @@ -517,15 +517,18 @@ config.description.displayAs3PCodeDocsPanel = Show panel with documentation of i config.name.displayAs3TraitsListAndConstantsPanel = Show AS3 traits list and constants panel config.description.displayAs3TraitsListAndConstantsPanel = Show panel with list of traits and constants under the tag tree for AS3 +#after 14.1.0 config.name.useAsTypeIcons = Use script icons based on item type config.description.useAsTypeIcons = Use different icons for different script types (class/interface/frame/...) config.name.limitAs3PCodeOffsetMatching = Limit of AS3 P-code offset matching config.description.limitAs3PCodeOffsetMatching = Limit of instructions in AS3 P-code which are offset-matched to AS3 script +#after 14.2.1 config.name.showSlowRenderingWarning = Log warning when rendering is too slow config.description.showSlowRenderingWarning = Logs warning when internal flash viewer is too slow to display content +#after 14.3.1 config.name.autoCloseQuotes = Auto close single quotes on script edit config.description.autoCloseQuotes = Automatically inserts second single quote ' on typing first one @@ -541,9 +544,11 @@ config.description.autoCloseParenthesis = Automatically inserts closing parenthe config.name.showDialogOnError = Show error dialog on every error config.description.showDialogOnError = Automatically displays error dialog on every error occurrence +#after 14.4.0 config.name.limitSameChars = Limit of the same characters for \\{xx}C (repeat) escape config.description.limitSameChars = Maximum number of the same characters in a row in P-code strings or obufuscated names before replacing with \\{xx}C repeat escape +#after 14.5.2 config.name.showImportScriptsInfo = Show information before importing scripts config.description.showImportScriptsInfo = Displays some info about how importing scripts works after clicking Import scripts in the menu. @@ -556,6 +561,7 @@ config.description.showImportSymbolClassInfo = Displays some info about how Symb config.name.showImportXmlInfo = Show information before importing XML config.description.showImportXmlInfo = Displays some info about how XML importing works after clicking Import XML in the menu. +#after 15.1.1 config.name.lastSessionTagListSelection = Last session tag list selection config.description.lastSessionTagListSelection = Contains the selection from the last session on the list selection view diff --git a/src/com/jpexs/decompiler/flash/gui/locales/FontEmbedDialog.properties b/src/com/jpexs/decompiler/flash/gui/locales/FontEmbedDialog.properties index 236cf6d6c..031f96ef7 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/FontEmbedDialog.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/FontEmbedDialog.properties @@ -24,4 +24,5 @@ installed = Installed: ttffile.noselection = TTF file: