Experimental confirmations for AS1/2/3 direct editation.

This commit is contained in:
Jindra Petk
2014-04-19 19:40:47 +02:00
parent 2e8927afa9
commit 1babd94f35
6 changed files with 57 additions and 8 deletions

View File

@@ -253,6 +253,15 @@ public class Configuration {
@ConfigurationName("export.formats")
public static final ConfigurationItem<String> lastSelectedExportFormats = null;
@ConfigurationDefaultBoolean(true)
@ConfigurationName("warning.experimental.as12edit")
public static final ConfigurationItem<Boolean> warningExperimentalAS12Edit = null;
@ConfigurationDefaultBoolean(true)
@ConfigurationName("warning.experimental.as3edit")
public static final ConfigurationItem<Boolean> warningExperimentalAS3Edit = null;
private enum OSId {
WINDOWS, OSX, UNIX

View File

@@ -16,6 +16,10 @@
*/
package com.jpexs.decompiler.flash.gui;
import com.jpexs.decompiler.flash.AppStrings;
import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.configuration.ConfigurationItem;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
@@ -43,11 +47,13 @@ import javax.swing.Action;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRootPane;
import javax.swing.JTree;
import javax.swing.KeyStroke;
@@ -358,6 +364,31 @@ public class View {
});
return ret[0];
}
public static int showConfirmDialog(final Component parentComponent, String message, final String title, final int optionType, final int messageTyp, ConfigurationItem<Boolean> showAgainConfig, int defaultOption) {
JLabel warLabel = new JLabel(message);
final JPanel warPanel = new JPanel(new BorderLayout());
warPanel.add(warLabel,BorderLayout.CENTER);
JCheckBox donotShowAgainCheckBox = new JCheckBox(AppStrings.translate("message.confirm.donotshowagain"));
donotShowAgainCheckBox.setSelected(!showAgainConfig.get());
warPanel.add(donotShowAgainCheckBox,BorderLayout.SOUTH);
if(donotShowAgainCheckBox.isSelected()){
return defaultOption;
}
final int ret[] = new int[1];
execInEventDispatch(new Runnable() {
@Override
public void run() {
ret[0] = JOptionPane.showConfirmDialog(parentComponent, warPanel, title, optionType, messageTyp);
}
});
showAgainConfig.set(!donotShowAgainCheckBox.isSelected());
return ret[0];
}
public static void showMessageDialog(final Component parentComponent, final Object message, final String title, final int messageType) {
execInEventDispatch(new Runnable() {

View File

@@ -87,6 +87,7 @@ import java.util.logging.Logger;
import java.util.regex.Pattern;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
@@ -653,13 +654,13 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se
do{
ret = View.showConfirmDialog(this, AppStrings.translate("message.action.playerglobal.place").replace("%libpath%", Configuration.getFlashLibPath().getAbsolutePath()),AppStrings.translate("message.action.playerglobal.title"),JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE);
swc = Configuration.getPlayerSWC();
}while(ret == JOptionPane.OK_OPTION && swc == null);
if(ret == JOptionPane.OK_OPTION){
setDecompiledEditMode(true);
}
}while(ret == JOptionPane.OK_OPTION && swc == null);
}
}else{
setDecompiledEditMode(true);
}
if(swc!=null){
if(View.showConfirmDialog(null, AppStrings.translate("message.confirm.experimental.function"), AppStrings.translate("message.warning"), JOptionPane.OK_CANCEL_OPTION,JOptionPane.WARNING_MESSAGE,Configuration.warningExperimentalAS3Edit,JOptionPane.OK_OPTION)==JOptionPane.OK_OPTION){
setDecompiledEditMode(true);
}
}
break;
case ACTION_CANCEL_DECOMPILED:

View File

@@ -743,7 +743,9 @@ public class ActionPanel extends JPanel implements ActionListener, SearchListene
}
break;
case ACTION_EDIT_DECOMPILED:
setDecompiledEditMode(true);
if(View.showConfirmDialog(null, AppStrings.translate("message.confirm.experimental.function"), AppStrings.translate("message.warning"), JOptionPane.OK_CANCEL_OPTION,JOptionPane.WARNING_MESSAGE,Configuration.warningExperimentalAS12Edit,JOptionPane.OK_OPTION)==JOptionPane.OK_OPTION){
setDecompiledEditMode(true);
}
break;
case ACTION_CANCEL_DECOMPILED:
setDecompiledEditMode(false);

View File

@@ -468,3 +468,6 @@ button.next = Next
message.action.playerglobal.title = PlayerGlobal library needed
message.action.playerglobal.needed = For ActionScript 3 direct editation, a library called "PlayerGlobal.swc" needs to be downloaded from Adobe homepage.\r\n%adobehomepage%\r\nPress OK to go to the download page.
message.action.playerglobal.place = Download the library called PlayerGlobal(.swc), and place it to directory\r\n%libpath%\r\n Press OK to continue.
message.confirm.experimental.function = This function is EXPERIMENTAL. It means that you should not trust the results and the SWF file can be disfunctional after saving.
message.confirm.donotshowagain = Do not show again

View File

@@ -463,4 +463,7 @@ error.sound.invalid = Neplatn\u00fd zvuk.
message.action.playerglobal.title = Vy\u017eadov\u00e1na knihovna PlayerGlobal
message.action.playerglobal.needed = Pro p\u0159\u00edmou editaci ActionScriptu 3 je pot\u0159eba knihovna "PlayerGlobal.swc", kterou lze stahnout ze str\u00e1nek Adobe\r\n%adobehomepage%\r\nStiskn\u011bte OK pro p\u0159echod na stahovac\u00ed str\u00e1nku.
message.action.playerglobal.place = St\u00e1hn\u011bte knihovnu nazvanou PlayerGlobal(.swc), a um\u00edst\u011bte j\u00ed do adres\u00e1\u0159e\r\n%libpath%\r\n Stiskn\u011bte OK pro pokra\u010dov\u00e1n\u00ed.
message.action.playerglobal.place = St\u00e1hn\u011bte knihovnu nazvanou PlayerGlobal(.swc), a um\u00edst\u011bte j\u00ed do adres\u00e1\u0159e\r\n%libpath%\r\n Stiskn\u011bte OK pro pokra\u010dov\u00e1n\u00ed.
message.confirm.experimental.function = Tato funkce je EXPERIMENT\u00c1LN\u00cd. To znamen\u00e1, \u017ee byste nem\u011bli v\u011b\u0159it jej\u00edm v\u00fdsledk\u016fm a SWF soubor m\u016f\u017ee po ulo\u017een\u00ed p\u0159estat fungovat.
message.confirm.donotshowagain = P\u0159\u00ed\u0161t\u011b nezobrazovat