From 71da5e9bc9a20edd6e5063dbcf63c28b2975bf91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Wed, 28 Dec 2022 21:47:04 +0100 Subject: [PATCH] Ctrl + G shortcut for tag list view --- CHANGELOG.md | 1 + .../jpexs/decompiler/flash/gui/MainPanel.java | 68 ++++++++++--------- 2 files changed, 36 insertions(+), 33 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6553dc499..fbc6f192a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file. - [#1915] SVG import - gradient when it has two final stops - Native sound export format for ADPCM compression is FLV - [#1923] Wrong cyclic tag detection causing hidden sprites +- Ctrl + G shortcut for tag list view ### Changed - [#1913] SVG export/import of shapes - shape exact position (bounds) is retained diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java index 9cfce9e07..2949b1d3a 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -591,7 +591,40 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se if (items.isEmpty()) { return; - } + } + if ((e.getKeyCode() == 'G') && (e.isControlDown())) { + Openable openable = items.get(0).getOpenable(); + SWF swf = null; + if (openable instanceof SWF) { + swf = (SWF) openable; + } + if (swf != null) { + String val = ""; + boolean valid; + int characterId = -1; + do { + val = ViewMessages.showInputDialog(MainPanel.this, translate("message.input.gotoCharacter"), translate("message.input.gotoCharacter.title"), val); + if (val == null) { + break; + } + try { + characterId = Integer.parseInt(val); + } catch (NumberFormatException nfe) { + characterId = -1; + } + } while (characterId <= 0); + + if (characterId > 0) { + CharacterTag tag = swf.getCharacter(characterId); + if (tag == null) { + ViewMessages.showMessageDialog(MainPanel.this, translate("message.character.notfound").replace("%characterid%", "" + characterId), translate("error"), JOptionPane.ERROR_MESSAGE); + } else { + setTagTreeSelectedNode(getCurrentTree(), tag); + } + } + } + return; + } if ((e.getKeyCode() == 'F') && (e.isControlDown())) { AbstractTagTree tree = getCurrentTree(); @@ -1175,38 +1208,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se @Override public void keyPressed(KeyEvent e) { - handleKeyPressed(e); - if ((e.getKeyCode() == 'G') && (e.isControlDown())) { - SWF swf = getCurrentSwf(); - if (swf != null) { - String val = ""; - boolean valid; - int characterId = -1; - do { - val = ViewMessages.showInputDialog(MainPanel.this, translate("message.input.gotoCharacter"), translate("message.input.gotoCharacter.title"), val); - if (val == null) { - break; - } - try { - characterId = Integer.parseInt(val); - } catch (NumberFormatException nfe) { - characterId = -1; - } - } while (characterId <= 0); - - if (characterId > 0) { - CharacterTag tag = swf.getCharacter(characterId); - if (tag == null) { - ViewMessages.showMessageDialog(MainPanel.this, translate("message.character.notfound").replace("%characterid%", "" + characterId), translate("error"), JOptionPane.ERROR_MESSAGE); - } else { - TreePath path = tagTree.getFullModel().getTreePath(tag); - if (path != null) { - tagTree.setSelectionPath(path); - } - } - } - } - } + handleKeyPressed(e); } }); tagListTree.addKeyListener(new KeyAdapter() {