From 6234e7daef950d258c9d31f41049357e7e96b7a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sun, 30 Oct 2022 13:43:01 +0100 Subject: [PATCH] Hidden not working buttons for next/prev text tag in tag list view --- src/com/jpexs/decompiler/flash/gui/MainPanel.java | 15 +++------------ src/com/jpexs/decompiler/flash/gui/TextPanel.java | 8 +++++--- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java index b86ed265d..0964a03d7 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -3113,12 +3113,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se } public boolean previousTag() { - JTree tree = null; - if (getCurrentView() == VIEW_RESOURCES) { - tree = tagTree; - } else if (getCurrentView() == VIEW_TAGLIST) { - tree = tagTree; - } + JTree tree = getCurrentTree(); if (tree != null) { if (tree.getSelectionRows().length > 0) { @@ -3136,12 +3131,8 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se } public boolean nextTag() { - JTree tree = null; - if (getCurrentView() == VIEW_RESOURCES) { - tree = tagTree; - } else if (getCurrentView() == VIEW_TAGLIST) { - tree = tagTree; - } + JTree tree = getCurrentTree(); + if (tree != null) { if (tree.getSelectionRows().length > 0) { int row = tree.getSelectionRows()[0]; diff --git a/src/com/jpexs/decompiler/flash/gui/TextPanel.java b/src/com/jpexs/decompiler/flash/gui/TextPanel.java index 78dfed9ae..fe500a7ac 100644 --- a/src/com/jpexs/decompiler/flash/gui/TextPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/TextPanel.java @@ -66,7 +66,7 @@ public class TextPanel extends JPanel implements TagEditorPanel { private final JButton textCancelButton; - private final JButton selectPrevousTagButton; + private final JButton selectPreviousTagButton; private final JButton selectNextTagButton; @@ -107,7 +107,7 @@ public class TextPanel extends JPanel implements TagEditorPanel { textButtonsPanel.setLayout(new FlowLayout(SwingConstants.WEST)); textButtonsPanel.setMinimumSize(new Dimension(10, textButtonsPanel.getMinimumSize().height)); - selectPrevousTagButton = createButton(null, "arrowup16", "selectPreviousTag", e -> mainPanel.previousTag()); + selectPreviousTagButton = createButton(null, "arrowup16", "selectPreviousTag", e -> mainPanel.previousTag()); selectNextTagButton = createButton(null, "arrowdown16", "selectNextTag", e -> mainPanel.nextTag()); textAlignLeftButton = createButton(null, "textalignleft16", "text.align.left", e -> textAlign(TextAlign.LEFT)); textAlignCenterButton = createButton(null, "textaligncenter16", "text.align.center", e -> textAlign(TextAlign.CENTER)); @@ -118,7 +118,7 @@ public class TextPanel extends JPanel implements TagEditorPanel { changeCaseButton = createButton(null, "textuppercase16", "text.toggleCase", e -> changeCase(0)); undoChangesButton = createButton(null, "reload16", "text.undo", e -> undoChanges()); - textButtonsPanel.add(selectPrevousTagButton); + textButtonsPanel.add(selectPreviousTagButton); textButtonsPanel.add(selectNextTagButton); textButtonsPanel.add(textAlignLeftButton); textButtonsPanel.add(textAlignCenterButton); @@ -195,6 +195,8 @@ public class TextPanel extends JPanel implements TagEditorPanel { increaseTranslateXButton.setVisible(!readOnly); changeCaseButton.setVisible(!readOnly); undoChangesButton.setVisible(!readOnly); + selectPreviousTagButton.setVisible(mainPanel.getCurrentView() == MainPanel.VIEW_RESOURCES); + selectNextTagButton.setVisible(mainPanel.getCurrentView() == MainPanel.VIEW_RESOURCES); } private boolean isModified() {