From 39f81eec1ee916869f848b3348b9b3a5e81cd243 Mon Sep 17 00:00:00 2001 From: honfika Date: Sun, 8 Jun 2014 20:16:26 +0200 Subject: [PATCH] new functions in contextmenu: jump to character, raw edit all tags --- .../jpexs/decompiler/flash/gui/MainPanel.java | 40 ++++++++++++++++++- .../decompiler/flash/gui/PreviewPanel.java | 5 ++- .../flash/gui/locales/MainFrame.properties | 3 ++ .../flash/gui/locales/MainFrame_hu.properties | 5 +++ 4 files changed, 51 insertions(+), 2 deletions(-) diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java index cae7696d0..62cc5ed92 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -95,6 +95,7 @@ import com.jpexs.decompiler.flash.tags.Tag; import com.jpexs.decompiler.flash.tags.base.ASMSource; import com.jpexs.decompiler.flash.tags.base.BoundedTag; import com.jpexs.decompiler.flash.tags.base.ButtonTag; +import com.jpexs.decompiler.flash.tags.base.CharacterIdTag; import com.jpexs.decompiler.flash.tags.base.CharacterTag; import com.jpexs.decompiler.flash.tags.base.Container; import com.jpexs.decompiler.flash.tags.base.ContainerItem; @@ -249,6 +250,8 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec public static final String ACTION_SELECT_BKCOLOR = "SELECTCOLOR"; public static final String ACTION_REPLACE = "REPLACE"; + private static final String ACTION_RAW_EDIT = "RAWEDIT"; + private static final String ACTION_JUMP_TO_CHARACTER = "JUMPTOCHARACTER"; private static final String ACTION_REMOVE_ITEM = "REMOVEITEM"; private static final String ACTION_REMOVE_ITEM_WITH_DEPENDENCIES = "REMOVEITEMWITHDEPENDENCIES"; private static final String ACTION_CLOSE_SWF = "CLOSESWF"; @@ -333,13 +336,24 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec replaceSelectionMenuItem.addActionListener(this); contextPopupMenu.add(replaceSelectionMenuItem); + final JMenuItem rawEditMenuItem = new JMenuItem(translate("contextmenu.rawEdit")); + rawEditMenuItem.setActionCommand(ACTION_RAW_EDIT); + rawEditMenuItem.addActionListener(this); + rawEditMenuItem.setVisible(false); + contextPopupMenu.add(rawEditMenuItem); + + final JMenuItem jumpToCharacterMenuItem = new JMenuItem(translate("contextmenu.jumpToCharacter")); + jumpToCharacterMenuItem.setActionCommand(ACTION_JUMP_TO_CHARACTER); + jumpToCharacterMenuItem.addActionListener(this); + jumpToCharacterMenuItem.setVisible(false); + contextPopupMenu.add(jumpToCharacterMenuItem); + final JMenuItem closeSelectionMenuItem = new JMenuItem(translate("contextmenu.closeSwf")); closeSelectionMenuItem.setActionCommand(ACTION_CLOSE_SWF); closeSelectionMenuItem.addActionListener(this); contextPopupMenu.add(closeSelectionMenuItem); final JMenu moveTagMenu = new JMenu(translate("contextmenu.moveTag")); - moveTagMenu.addActionListener(this); contextPopupMenu.add(moveTagMenu); tagTree.addMouseListener(new MouseAdapter() { @@ -420,6 +434,10 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec TreeModel model = tagTree.getModel(); expandRecursiveMenuItem.setVisible(model.getChildCount(treeNode) > 0); + + jumpToCharacterMenuItem.setVisible(item instanceof CharacterIdTag && !(item instanceof CharacterTag)); + + rawEditMenuItem.setVisible(item instanceof Tag); } removeMenuItem.setVisible(allSelectedIsTagOrFrame); @@ -2240,6 +2258,26 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec } } break; + case ACTION_RAW_EDIT: { + TreeItem item = tagTree.getCurrentTreeItem(); + if (item == null) { + return; + } + + showCard(CARDPREVIEWPANEL); + previewPanel.showGenericTagPanel((Tag) item); + } + break; + case ACTION_JUMP_TO_CHARACTER: { + TreeItem item = tagTree.getCurrentTreeItem(); + if (item == null || !(item instanceof CharacterIdTag)) { + return; + } + + CharacterIdTag characterIdTag = (CharacterIdTag) item; + setTreeItem(item.getSwf().characters.get(characterIdTag.getCharacterId())); + } + break; case ACTION_EXPAND_RECURSIVE: { TreePath path = tagTree.getSelectionPath(); if (path == null) { diff --git a/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java b/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java index bece97e9b..97a772f8b 100644 --- a/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java @@ -878,8 +878,11 @@ public class PreviewPanel extends JSplitPane implements ActionListener { break; case ACTION_SAVE_GENERIC_TAG: { genericTagPanel.save(); + SWF.clearImageCache(); + Tag tag = genericTagPanel.getTag(); + tag.getTimelined().resetTimeline(); mainPanel.refreshTree(); - mainPanel.setTreeItem(genericTagPanel.getTag()); + mainPanel.setTreeItem(tag); editButton.setVisible(true); saveButton.setVisible(false); cancelButton.setVisible(false); diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties index 3a1e3164f..b7d4188a4 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties @@ -483,3 +483,6 @@ contextmenu.removeWithDependencies = Remove with dependencies abc.action.find-usages = Find usages abc.action.find-declaration = Find declaration + +contextmenu.rawEdit = Nyers szerkeszt\u00e9s +contextmenu.jumpToCharacter = Jump to character diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_hu.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_hu.properties index 99bc1f0b7..b62dd29c2 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_hu.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_hu.properties @@ -465,6 +465,7 @@ error.sound.invalid = \u00c9rv\u00e9nytelen hang. button.prev = El\u0151z\u0151 button.next = K\u00f6vetkez\u0151 +#after version 2.1.0 message.action.playerglobal.title = PlayerGlobal k\u00f6nyvt\u00e1r sz\u00fcks\u00e9ges message.action.playerglobal.needed = Az ActionScript 3 k\u00f6zvetlen szerkeszt\u00e9s\u00e9hez a "PlayerGlobal.swc" nev\u0171 k\u00f6nyvt\u00e1rra van sz\u00fcks\u00e9g, melyet az Adobe honlapj\u00e1r\u00f3l lehet let\u00f6lteni.\r\n%adobehomepage%\r\nNyomjon OK-t a let\u00f6lt\u00e9si oldal megnyit\u00e1s\u00e1hoz. message.action.playerglobal.place = T\u00f6ltse le a PlayerGlobal(.swc) nev\u0171 k\u00f6nyvt\u00e1rat \u00e9s helyezze el a k\u00f6vetkez\u0151 mapp\u00e1ban:\r\n%libpath%\r\n Nyomjon OK-t a folytat\u00e1shoz. @@ -477,7 +478,11 @@ menu.file.import.text = Sz\u00f6veg import\u00e1l\u00e1sa import.select.directory = V\u00e1lassza ki a mapp\u00e1t az import\u00e1l\u00e1shoz error.text.import = Hiba sz\u00f6veg import\u00e1l\u00e1s k\u00f6zben. Folytatja? +#after version 2.1.1 contextmenu.removeWithDependencies = Elt\u00e1vol\u00edt\u00e1s a f\u00fcgg\u0151s\u00e9gekkel egy\u00fctt abc.action.find-usages = Haszn\u00e1l\u00f3k keres\u00e9se abc.action.find-declaration = Deklar\u00e1ci\u00f3 keres\u00e9se + +contextmenu.rawEdit = Raw edit +contextmenu.jumpToCharacter = Ugr\u00e1s a karakterhez