From 9b6816dbeb7a0b116c32be299d44089a699b53ee Mon Sep 17 00:00:00 2001 From: "honfika@gmail.com" Date: Sun, 22 Feb 2015 14:12:42 +0100 Subject: [PATCH] #805 Editor mode for Define*Texts added --- .../decompiler/flash/configuration/Configuration.java | 4 ++++ src/com/jpexs/decompiler/flash/gui/MainPanel.java | 4 +++- src/com/jpexs/decompiler/flash/gui/TextPanel.java | 8 ++++++-- .../flash/gui/locales/AdvancedSettingsDialog.properties | 3 +++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java index c5318cd2d..69d3a2ac3 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java @@ -405,6 +405,10 @@ public class Configuration { @ConfigurationCategory("ui") public static final ConfigurationItem showCloseConfirmation = null; + @ConfigurationDefaultBoolean(false) + @ConfigurationCategory("ui") + public static final ConfigurationItem editorMode = null; + private enum OSId { WINDOWS, OSX, UNIX diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java index 82cf6b069..8d054718f 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -2214,6 +2214,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec reload(false); return; } + TreeItem treeItem = (TreeItem) e.getPath().getLastPathComponent(); if (!(treeItem instanceof SWFList)) { SWF swf = treeItem.getSwf(); @@ -2226,7 +2227,8 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec } else { updateUi(); } - previewPanel.setEditText(false); + + previewPanel.setEditText(Configuration.editorMode.get()); reload(false); } diff --git a/src/com/jpexs/decompiler/flash/gui/TextPanel.java b/src/com/jpexs/decompiler/flash/gui/TextPanel.java index 5d7acdff8..e047570a6 100644 --- a/src/com/jpexs/decompiler/flash/gui/TextPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/TextPanel.java @@ -169,6 +169,10 @@ public class TextPanel extends JPanel { public void setEditText(boolean edit) { textValue.setEditable(edit); + updateButtonsVisibility(edit); + } + + private void updateButtonsVisibility(boolean edit) { textSaveButton.setVisible(edit); textEditButton.setVisible(!edit); textCancelButton.setVisible(edit); @@ -227,7 +231,7 @@ public class TextPanel extends JPanel { if (item instanceof TextTag) { TextTag textTag = (TextTag) item; if (mainPanel.alignText(textTag, textAlign)) { - setEditText(false); + updateButtonsVisibility(textValue.isEditable()); item.getSwf().clearImageCache(); mainPanel.refreshTree(); } @@ -239,7 +243,7 @@ public class TextPanel extends JPanel { if (item instanceof TextTag) { TextTag textTag = (TextTag) item; if (mainPanel.translateText(textTag, delta)) { - setEditText(false); + updateButtonsVisibility(textValue.isEditable()); item.getSwf().clearImageCache(); mainPanel.refreshTree(); } diff --git a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties index afe5b9256..38934fe6c 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties @@ -317,3 +317,6 @@ config.description.showTraitSavedMessage = Show again trait saved message config.name.updateProxyAddress = Http Proxy address for checking updates config.description.updateProxyAddress = Http Proxy address for checking updates. Format: example.com:8080 + +config.name.editorMode = Editor Mode +config.description.editorMode = Make text areas edittable automatically when you select a Text or Script node