diff --git a/lib/ffdec_lib.jar b/lib/ffdec_lib.jar index b24ec5e1e..5c3357a81 100644 Binary files a/lib/ffdec_lib.jar and b/lib/ffdec_lib.jar differ diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/AppResources.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/AppResources.java new file mode 100644 index 000000000..495332285 --- /dev/null +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/AppResources.java @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2010-2014 JPEXS, All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3.0 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. + */ +package com.jpexs.decompiler.flash; + +import java.util.ResourceBundle; + +/** + * + * @author JPEXS + */ +public class AppResources { + + private static final ResourceBundle resourceBundle = ResourceBundle.getBundle("com.jpexs.decompiler.flash.gui.locales.AppResources"); + + public static String translate(String key) { + return resourceBundle.getString(key); + } + + public static String translate(String bundle, String key) { + ResourceBundle b = ResourceBundle.getBundle(bundle); + return b.getString(key); + } + +} diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/DisassemblyListener.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/DisassemblyListener.java index c3f8a2d4d..9709c2d83 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/DisassemblyListener.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/DisassemblyListener.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash; /** @@ -21,5 +22,7 @@ package com.jpexs.decompiler.flash; */ public interface DisassemblyListener { - public void progress(String phase, long pos, long total); + public void progressReading(long pos, long total); + public void progressToString(long pos, long total); + public void progressDeobfuscating(long pos, long total); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java index a2419a4c0..b84c5f1b9 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java @@ -15,7 +15,7 @@ * License along with this library. */ package com.jpexs.decompiler.flash.abc.types; -import com.jpexs.decompiler.flash.AppStrings; +import com.jpexs.decompiler.flash.AppResources; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.CodeStats; @@ -130,7 +130,7 @@ public class MethodBody implements Cloneable, Serializable { code.toASMSource(constants, trait, method_info.get(this.method_info), this, exportMode, writer); } else { if (!Configuration.decompile.get()) { - writer.appendNoHilight("//" + AppStrings.translate("decompilation.skipped")).newLine(); + writer.appendNoHilight("//" + AppResources.translate("decompilation.skipped")).newLine(); return; } int timeout = Configuration.decompilationTimeoutSingleMethod.get(); @@ -168,7 +168,7 @@ public class MethodBody implements Cloneable, Serializable { } else { if (!Configuration.decompile.get()) { writer.startMethod(this.method_info); - writer.appendNoHilight("//" + AppStrings.translate("decompilation.skipped")).newLine(); + writer.appendNoHilight("//" + AppResources.translate("decompilation.skipped")).newLine(); writer.endMethod(); return writer; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/Action.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/Action.java index 4cdf46962..f03ae3b15 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/Action.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/Action.java @@ -15,7 +15,7 @@ * License along with this library. */ package com.jpexs.decompiler.flash.action; -import com.jpexs.decompiler.flash.AppStrings; +import com.jpexs.decompiler.flash.AppResources; import com.jpexs.decompiler.flash.BaseLocalData; import com.jpexs.decompiler.flash.DisassemblyListener; import com.jpexs.decompiler.flash.SWFOutputStream; @@ -414,7 +414,7 @@ public class Action implements GraphSourceItem { boolean lastPush = false; for (GraphSourceItem s : list) { for (int i = 0; i < listeners.size(); i++) { - listeners.get(i).progress(AppStrings.translate("disassemblingProgress.toString"), pos + 2, list.size()); + listeners.get(i).progressToString(pos + 2, list.size()); } Action a = null; if (s instanceof Action) { @@ -854,9 +854,9 @@ public class Action implements GraphSourceItem { out = new ArrayList<>(); out.add(new CommentItem(new String[]{ "", - " * " + AppStrings.translate("decompilationError"), - " * " + AppStrings.translate("decompilationError.obfuscated"), - " * " + AppStrings.translate("decompilationError.errorType") + ": " + " * " + AppResources.translate("decompilationError"), + " * " + AppResources.translate("decompilationError.obfuscated"), + " * " + AppResources.translate("decompilationError.errorType") + ": " + ex2.getClass().getSimpleName(), ""})); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionListReader.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionListReader.java index 8dbce7f5a..1f18644f8 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionListReader.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionListReader.java @@ -12,10 +12,11 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.action; -import com.jpexs.decompiler.flash.AppStrings; +import com.jpexs.decompiler.flash.AppResources; import com.jpexs.decompiler.flash.DisassemblyListener; import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.action.deobfuscation.ActionDeobfuscator; @@ -727,7 +728,7 @@ public class ActionListReader { long pos = sis.getPos(); long length = pos + sis.available(); for (int i = 0; i < listeners.size(); i++) { - listeners.get(i).progress(AppStrings.translate("disassemblingProgress.reading"), pos, length); + listeners.get(i).progressReading(pos, length); } a.setAddress(ip); @@ -802,7 +803,7 @@ public class ActionListReader { curVisited++; visited.put(ip, curVisited); for (int i = 0; i < listeners.size(); i++) { - listeners.get(i).progress(AppStrings.translate("disassemblingProgress.deobfuscating"), ip, actions.size()); + listeners.get(i).progressDeobfuscating(ip, actions.size()); } int info = a.getTotalActionLength(); @@ -1015,7 +1016,7 @@ public class ActionListReader { } } for (DisassemblyListener listener : listeners) { - listener.progress(AppStrings.translate("disassemblingProgress.deobfuscating"), ip, actions.size()); + listener.progressDeobfuscating(ip, actions.size()); } } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/UnsupportedActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/UnsupportedActionItem.java index afe46f96a..0dcdeb7a1 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/UnsupportedActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/UnsupportedActionItem.java @@ -12,10 +12,11 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.action.model; -import com.jpexs.decompiler.flash.AppStrings; +import com.jpexs.decompiler.flash.AppResources; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.model.LocalData; @@ -31,7 +32,7 @@ public class UnsupportedActionItem extends ActionItem { @Override public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) { - return writer.append("//" + AppStrings.translate("decompilation.unsupported") + ":" + value); + return writer.append("//" + AppResources.translate("decompilation.unsupported") + ":" + value); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources.properties b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources.properties new file mode 100644 index 000000000..7597306e4 --- /dev/null +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources.properties @@ -0,0 +1,36 @@ +# Copyright (C) 2010-2014 JPEXS +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +decompilationError = Decompilation error +decompilationError.timeout = Timeout ({0}) was reached +decompilationError.timeout.description = Not decompiled due to timeout +decompilationError.obfuscated = Code may be obfuscated +decompilationError.errorType = Error type +decompilationError.error.description = Not decompiled due to error + +decompilation.skipped = Decompilation skipped +decompilation.unsupported = Unsupported by decompiler +decompilerMark = decompiler mark + +#example: 1 hour and 2 minutes +timeFormat.and = and +timeFormat.hour = hour +timeFormat.hours = hours +timeFormat.minute = minute +timeFormat.minutes = minutes +timeFormat.second = second +timeFormat.seconds = seconds + +fontNotFound = Font with id=%fontId% was not found. diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_ca.properties b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_ca.properties new file mode 100644 index 000000000..c63bf4b93 --- /dev/null +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_ca.properties @@ -0,0 +1,36 @@ +# Copyright (C) 2010-2014 JPEXS +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +decompilationError = Error de descompilaci\u00f3 +decompilationError.timeout = S'ha at\u00e8s el temps l\u00edmit ({0}) +decompilationError.timeout.description = No s'ha descompilat degut al l\u00edmit de temps +decompilationError.obfuscated = El codi pot estar ofuscat +decompilationError.errorType = Tipus d'error +decompilationError.error.description = No s'ha descompilat degut a l'error + +decompilation.skipped = S'ha om\u00e8s la descompilaci\u00f3 +decompilation.unsupported = No suportat pel descompilador +decompilerMark = marca del descompilar + +#example: 1 hour and 2 minutes +timeFormat.and = i +timeFormat.hour = hora +timeFormat.hours = hores +timeFormat.minute = minut +timeFormat.minutes = minuts +timeFormat.second = segon +timeFormat.seconds = segons + +fontNotFound = No s'ha trobat la tipografia amb id=%fontId%. diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_cs.properties b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_cs.properties new file mode 100644 index 000000000..88f511890 --- /dev/null +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_cs.properties @@ -0,0 +1,36 @@ +# Copyright (C) 2010-2014 JPEXS +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +decompilationError = Chyba dekompilace +decompilationError.timeout = \u010casov\u00fd limit ({0}) vypr\u0161el +decompilationError.timeout.description = Nedekompilov\u00e1no kv\u016fli \u010dasov\u00e9mu limitu +decompilationError.obfuscated = K\u00f3d m\u016f\u017ee b\u00fdt obfuskov\u00e1n +decompilationError.errorType = Typ chyby +decompilationError.error.description = Nedekompilov\u00e1no kv\u016fli chyb\u011b + +decompilation.skipped = Dekompilace p\u0159esko\u010dena +decompilation.unsupported = Nepodporov\u00e1no dekompil\u00e1torem +decompilerMark = zna\u010dka dekompil\u00e1toru + +#example: 1 hour and 2 minutes +timeFormat.and = a +timeFormat.hour = hodina +timeFormat.hours = hodin +timeFormat.minute = minuta +timeFormat.minutes = minut +timeFormat.second = vte\u0159ina +timeFormat.seconds = vte\u0159in + +fontNotFound = P\u00edsmo s id=%fontId% nebylo nalezeno. diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_de.properties b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_de.properties new file mode 100644 index 000000000..532368772 --- /dev/null +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_de.properties @@ -0,0 +1,15 @@ +# Copyright (C) 2010-2014 JPEXS +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_es.properties b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_es.properties new file mode 100644 index 000000000..d8dc158a5 --- /dev/null +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_es.properties @@ -0,0 +1,36 @@ +# Copyright (C) 2010-2014 JPEXS +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +decompilationError = Error de decompilaci\u00f3n +decompilationError.timeout = Tiempo de espera ({0}) alcanzado +decompilationError.timeout.description = No decompilado debido al tiempo de espera +decompilationError.obfuscated = El c\u00f3digo puede estar ofuscado +decompilationError.errorType = Tipo de error +decompilationError.error.description = No decompilado debido a un error + +#example: 1 hour and 2 minutes +timeFormat.and = y +timeFormat.hour = hora +timeFormat.hours = horas +timeFormat.minute = minuto +timeFormat.minutes = minutos +timeFormat.second = segundo +timeFormat.seconds = segundos + +decompilation.skipped = Decompilaci\u00f3n omitida +decompilation.unsupported = No soportado por el decompilador +decompilerMark = marca del decompilador + +fontNotFound = La fuente con id=%fontId% no se encontr\u00f3. diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_fr.properties b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_fr.properties new file mode 100644 index 000000000..cb83f5753 --- /dev/null +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_fr.properties @@ -0,0 +1,36 @@ +# Copyright (C) 2010-2014 JPEXS +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +decompilationError = Erreur de d\u00e9compilation +decompilationError.timeout = Le d\u00e9lais d'attente de ({0}) est expir\u00e9 +decompilationError.timeout.description = Non d\u00e9compil\u00e9 car le d\u00e9lais d'attente a \u00e9t\u00e9 atteint +decompilationError.obfuscated = Le code est probablement obsfusqu\u00e9 +decompilationError.errorType = Type d'erreur +decompilationError.error.description = Non d\u00e9compil\u00e9 car il y a des erreurs + +decompilation.skipped = D\u00e9compilation abandonn\u00e9 +decompilation.unsupported = Non support\u00e9 par le d\u00e9compileur +decompilerMark = Marqueur du d\u00e9compileur + +#example: 1 hour and 2 minutes +timeFormat.and = et +timeFormat.hour = heure +timeFormat.hours = heures +timeFormat.minute = minute +timeFormat.minutes = minutes +timeFormat.second = seconde +timeFormat.seconds = secondes + +fontNotFound = La police de caract\u00e8res n\u00ba%fontId% est introuvable. diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_hu.properties b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_hu.properties new file mode 100644 index 000000000..66e18f6a8 --- /dev/null +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_hu.properties @@ -0,0 +1,36 @@ +# Copyright (C) 2010-2014 JPEXS +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +decompilationError = Visszaford\u00edt\u00e1si hiba +decompilationError.timeout = Id\u0151t\u00fall\u00e9p\u00e9s ({0}) +decompilationError.timeout.description = Id\u0151t\u00fall\u00e9p\u00e9s miatt nem lett visszaford\u00edtva +decompilationError.obfuscated = K\u00f3d tal\u00e1n obfuszk\u00e1lva van +decompilationError.errorType = Hiba t\u00edpus +decompilationError.error.description = Hiba miatt nem lett visszaford\u00edtva + +decompilation.skipped = Visszaford\u00edt\u00e1s mell\u0151zve +decompilation.unsupported = Visszaford\u00edt\u00e1s nem t\u00e1mogatott +decompilerMark = visszaford\u00edt\u00e1si jel + +#example: 1 hour and 2 minutes +timeFormat.and = \u00e9s +timeFormat.hour = \u00f3ra +timeFormat.hours = \u00f3ra +timeFormat.minute = perc +timeFormat.minutes = perc +timeFormat.second = m\u00e1sodperc +timeFormat.seconds = m\u00e1sodperc + +fontNotFound = Bet\u0171t\u00edpus (id=%fontId%) nem tal\u00e1lhat\u00f3. diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_nl.properties b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_nl.properties new file mode 100644 index 000000000..4e3db5bae --- /dev/null +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_nl.properties @@ -0,0 +1,36 @@ +# Copyright (C) 2010-2014 JPEXS +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +decompilationError = Decompilatie fout +decompilationError.timeout = Timeout ({0}) werd bereikt +decompilationError.timeout.description = Niet gedecompileerd vanwege timeout +decompilationError.obfuscated = Code kan worden geobfusceerd +decompilationError.errorType = Fout type +decompilationError.error.description = Niet gedecompileerd gevolg van een fout + +#example: 1 hour and 2 minutes +timeFormat.and = en +timeFormat.hour = uur +timeFormat.hours = uur +timeFormat.minute = minuut +timeFormat.minutes = minuten +timeFormat.second = seconde +timeFormat.seconds = seconden + +decompilation.skipped = Decompilatie overgeslagen +decompilation.unsupported = Niet ondersteund door decompiler +decompilerMark = decompiler mark + +fontNotFound = Lettertype met id=%fontId% is niet gevonden. diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_pt.properties b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_pt.properties new file mode 100644 index 000000000..532368772 --- /dev/null +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_pt.properties @@ -0,0 +1,15 @@ +# Copyright (C) 2010-2014 JPEXS +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_pt_BR.properties b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_pt_BR.properties new file mode 100644 index 000000000..532368772 --- /dev/null +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_pt_BR.properties @@ -0,0 +1,15 @@ +# Copyright (C) 2010-2014 JPEXS +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_ru.properties b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_ru.properties new file mode 100644 index 000000000..b1d45459e --- /dev/null +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_ru.properties @@ -0,0 +1,36 @@ +# Copyright (C) 2010-2014 JPEXS +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +decompilationError = \u041e\u0448\u0438\u0431\u043a\u0430 \u0434\u0435\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 +decompilationError.timeout = \u0422\u0430\u0439\u043c\u0430\u0443\u0442: ({0}) +decompilationError.timeout.description = \u0414\u0435\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f \u043f\u0440\u0435\u0440\u0432\u0430\u043d\u0430 \u0438\u0437-\u0437\u0430 \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u0430 +decompilationError.obfuscated = \u041a\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0431\u0444\u0443\u0441\u0446\u0438\u0440\u043e\u0432\u0430\u043d +decompilationError.errorType = \u0422\u0438\u043f \u043e\u0448\u0438\u0431\u043a\u0438 +decompilationError.error.description = \u0414\u0435\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f \u043f\u0440\u0435\u0440\u0432\u0430\u043d\u0430 \u0438\u0437-\u0437\u0430 \u043e\u0448\u0438\u0431\u043a\u0438 + +decompilation.skipped = \u0414\u0435\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u0430 +decompilation.unsupported = \u041d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u0435\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u043c +decompilerMark = decompiler mark + +#example: 1 hour and 2 minutes +timeFormat.and = \u0438 +timeFormat.hour = \u0447. +timeFormat.hours = \u0447. +timeFormat.minute = \u043c\u0438\u043d. +timeFormat.minutes = \u043c\u0438\u043d. +timeFormat.second = \u0441\u0435\u043a. +timeFormat.seconds = \u0441\u0435\u043a. + +fontNotFound = \u0428\u0440\u0438\u0444\u0442 \u0441 id=%fontId% \u043d\u0435 \u0431\u044b\u043b \u043d\u0430\u0439\u0434\u0435\u043d. diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_sv.properties b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_sv.properties new file mode 100644 index 000000000..40e73c9f3 --- /dev/null +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_sv.properties @@ -0,0 +1,36 @@ +# Copyright (C) 2010-2014 JPEXS +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +decompilationError = Dekompilering felmeddelande +decompilationError.timeout = Timeout ({0}) n\u00e5ddes +decompilationError.timeout.description = Dekompilerades inte p\u00e5grund av en timeout +decompilationError.obfuscated = Koden kan vara obfuskerad +decompilationError.errorType = Fel typ +decompilationError.error.description = Ej dekompilerad p\u00e5grund av fel + +decompilation.skipped = Dekompilering skippades +decompilation.unsupported = st\u00f6ds inte utav dekompileraren +decompilerMark = markera dekompilerare + +#example: 1 hour and 2 minutes +timeFormat.and = och +timeFormat.hour = timme +timeFormat.hours = timmar +timeFormat.minute = minut +timeFormat.minutes = minuter +timeFormat.second = sekund +timeFormat.seconds = sekunder + +fontNotFound = Typsnitt med id=%fontId% hittades inte. diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_uk.properties b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_uk.properties new file mode 100644 index 000000000..78224a30f --- /dev/null +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_uk.properties @@ -0,0 +1,36 @@ +# Copyright (C) 2010-2014 JPEXS +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +decompilationError = \u041f\u043e\u043c\u0438\u043b\u043a\u0430 \u0434\u0435\u043a\u043e\u043c\u043f\u0456\u043b\u044f\u0446\u0456\u0457 +decompilationError.timeout = \u0422\u0430\u0439\u043c\u0430\u0443\u0442 ({0}) \u0431\u0443\u043b\u043e \u0434\u043e\u0441\u044f\u0433\u043d\u0443\u0442\u043e +decompilationError.timeout.description = \u0414\u0435\u043a\u043e\u043c\u043f\u0456\u043b\u044f\u0446\u0456\u044f \u043f\u0435\u0440\u0435\u0440\u0432\u0430\u043d\u0430 \u0447\u0435\u0440\u0435\u0437 \u0442\u0430\u0439\u043c\u0430\u0443\u0442 +decompilationError.obfuscated = \u041a\u043e\u0434 \u043c\u043e\u0436\u0435 \u0431\u0443\u0442\u0438 \u043e\u0431\u0444\u0443\u0441\u043a\u043e\u0432\u0430\u043d\u0438\u0439 +decompilationError.errorType = \u0422\u0438\u043f \u043f\u043e\u043c\u0438\u043b\u043a\u0438 +decompilationError.error.description = \u0414\u0435\u043a\u043e\u043c\u043f\u0456\u043b\u044f\u0446\u0456\u044f \u043f\u0435\u0440\u0435\u0440\u0432\u0430\u043d\u0430 \u0447\u0435\u0440\u0435\u0437 \u043f\u043e\u043c\u0438\u043b\u043a\u0443 + +decompilation.skipped = \u0414\u0435\u043a\u043e\u043c\u043f\u0456\u043b\u044f\u0446\u0456\u044e \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043e +decompilation.unsupported = \u041d\u0435 \u043f\u0456\u0434\u0442\u0440\u0438\u043c\u0443\u0454\u0442\u044c\u0441\u044f \u0434\u0435\u043a\u043e\u043c\u043f\u0456\u043b\u044f\u0442\u043e\u0440\u043e\u043c +decompilerMark = decompiler mark + +#example: 1 hour and 2 minutes +timeFormat.and = \u0442\u0430 +timeFormat.hour = \u0433\u043e\u0434. +timeFormat.hours = \u0433\u043e\u0434. +timeFormat.minute = \u0445\u0432. +timeFormat.minutes = \u0445\u0432. +timeFormat.second = \u0441\u0435\u043a. +timeFormat.seconds = \u0441\u0435\u043a. + +fontNotFound = \u0428\u0440\u0438\u0444\u0442 \u0437 id=%fontId% \u043d\u0435 \u0437\u043d\u0430\u0439\u0434\u0435\u043d\u043e. diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_zh.properties b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_zh.properties new file mode 100644 index 000000000..532368772 --- /dev/null +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/locales/AppResources_zh.properties @@ -0,0 +1,15 @@ +# Copyright (C) 2010-2014 JPEXS +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java index be1e781ff..fc9eb2603 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java @@ -12,10 +12,11 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.tags; -import com.jpexs.decompiler.flash.AppStrings; +import com.jpexs.decompiler.flash.AppResources; import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFOutputStream; @@ -168,7 +169,7 @@ public class DefineTextTag extends TextTag { } if (fnt == null) { - ret += AppStrings.translate("fontNotFound").replace("%fontId%", Integer.toString(rec.fontId)); + ret += AppResources.translate("fontNotFound").replace("%fontId%", Integer.toString(rec.fontId)); } else { ret += Helper.escapeString(rec.getText(fnt)).replace("[", "\\[").replace("]", "\\]"); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/treeitems/HeaderItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/treeitems/HeaderItem.java index 20fd01a85..2af12c7d1 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/treeitems/HeaderItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/treeitems/HeaderItem.java @@ -12,10 +12,10 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.treeitems; -import com.jpexs.decompiler.flash.AppStrings; import com.jpexs.decompiler.flash.SWF; /** @@ -25,9 +25,11 @@ import com.jpexs.decompiler.flash.SWF; public class HeaderItem implements TreeItem { private final SWF swf; + private final String name; - public HeaderItem(SWF swf) { + public HeaderItem(SWF swf, String name) { this.swf = swf; + this.name = name; } @Override @@ -37,7 +39,7 @@ public class HeaderItem implements TreeItem { @Override public String toString() { - return AppStrings.translate("node.header"); + return name; } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/treenodes/HeaderNode.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/treenodes/HeaderNode.java index cf33b23ad..258de9cd5 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/treenodes/HeaderNode.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/treenodes/HeaderNode.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.treenodes; import com.jpexs.decompiler.flash.treeitems.HeaderItem; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/MarkItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/MarkItem.java index eab086535..f55c5fce4 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/MarkItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/MarkItem.java @@ -12,10 +12,11 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.graph; -import com.jpexs.decompiler.flash.AppStrings; +import com.jpexs.decompiler.flash.AppResources; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.model.LocalData; @@ -34,7 +35,7 @@ public class MarkItem extends GraphTargetItem { @Override public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) { - return writer.append("//" + AppStrings.translate("decompilerMark") + ":" + mark); + return writer.append("//" + AppResources.translate("decompilerMark") + ":" + mark); } public String getMark() { diff --git a/libsrc/ffdec_lib/src/com/jpexs/helpers/Helper.java b/libsrc/ffdec_lib/src/com/jpexs/helpers/Helper.java index 6d39af092..9457ae2cf 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/helpers/Helper.java +++ b/libsrc/ffdec_lib/src/com/jpexs/helpers/Helper.java @@ -16,11 +16,10 @@ */ package com.jpexs.helpers; -import com.jpexs.decompiler.flash.AppStrings; +import com.jpexs.decompiler.flash.AppResources; import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.helpers.Freed; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; -import com.jpexs.decompiler.flash.helpers.HilightedTextWriter; import com.jpexs.decompiler.graph.TranslateStack; import com.jpexs.decompiler.graph.model.LocalData; import com.jpexs.helpers.utf8.Utf8Helper; @@ -651,13 +650,13 @@ public class Helper { timeM %= 60; String timeStr = ""; - String strAnd = AppStrings.translate("timeFormat.and"); - String strHour = AppStrings.translate("timeFormat.hour"); - String strHours = AppStrings.translate("timeFormat.hours"); - String strMinute = AppStrings.translate("timeFormat.minute"); - String strMinutes = AppStrings.translate("timeFormat.minutes"); - String strSecond = AppStrings.translate("timeFormat.second"); - String strSeconds = AppStrings.translate("timeFormat.seconds"); + String strAnd = AppResources.translate("timeFormat.and"); + String strHour = AppResources.translate("timeFormat.hour"); + String strHours = AppResources.translate("timeFormat.hours"); + String strMinute = AppResources.translate("timeFormat.minute"); + String strMinutes = AppResources.translate("timeFormat.minutes"); + String strSecond = AppResources.translate("timeFormat.second"); + String strSeconds = AppResources.translate("timeFormat.seconds"); if (timeH > 0) { timeStr += timeH + " " + (timeH > 1 ? strHours : strHour); @@ -681,10 +680,10 @@ public class Helper { public static GraphTextWriter byteArrayToHexWithHeader(GraphTextWriter writer, byte[] data) { writer.appendNoHilight("#hexdata").newLine().newLine(); - return byteArrayToHex(writer, data, 8, 8, -1, false, false); + return byteArrayToHex(writer, data, 8, 8, false, false); } - public static GraphTextWriter byteArrayToHex(GraphTextWriter writer, byte[] data, int bytesPerRow, int groupSize, int limit, boolean addChars, boolean showAddress) { + public static GraphTextWriter byteArrayToHex(GraphTextWriter writer, byte[] data, int bytesPerRow, int groupSize, boolean addChars, boolean showAddress) { /* // hex data from decompiled actions Scanner scanner = new Scanner(srcWithHex); @@ -697,9 +696,6 @@ public class Helper { } }*/ int length = data.length; - if (limit != -1 && length > limit) { - length = limit; - } int rowCount = length / bytesPerRow; if (length % bytesPerRow > 0) { @@ -754,19 +750,9 @@ public class Helper { } writer.newLine(); - if (limit != -1 && data.length > limit) { - writer.appendNoHilight(AppStrings.translate("binaryData.truncateWarning").replace("%count%", Integer.toString(data.length - limit))); - } - return writer; } - public static String byteArrayToHex(byte[] data, int bytesPerRow, int limit) { - HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), false); - byteArrayToHex(writer, data, bytesPerRow, 8, limit, true, true); - return writer.toString(); - } - public static byte[] getBytesFromHexaText(String text) { Scanner scanner = new Scanner(text); scanner.nextLine(); // ignore first line @@ -809,23 +795,23 @@ public class Helper { public static void appendTimeoutComment(GraphTextWriter writer, int timeout) { writer.appendNoHilight("/*").newLine(); - writer.appendNoHilight(" * ").appendNoHilight(AppStrings.translate("decompilationError")).newLine(); - writer.appendNoHilight(" * ").appendNoHilight(MessageFormat.format(AppStrings.translate("decompilationError.timeout"), Helper.formatTimeToText(timeout))).newLine(); + writer.appendNoHilight(" * ").appendNoHilight(AppResources.translate("decompilationError")).newLine(); + writer.appendNoHilight(" * ").appendNoHilight(MessageFormat.format(AppResources.translate("decompilationError.timeout"), Helper.formatTimeToText(timeout))).newLine(); writer.appendNoHilight(" */").newLine(); writer.appendNoHilight("throw new flash.errors.IllegalOperationError(\""). - appendNoHilight(AppStrings.translate("decompilationError.timeout.description")). + appendNoHilight(AppResources.translate("decompilationError.timeout.description")). appendNoHilight("\");").newLine(); } public static void appendErrorComment(GraphTextWriter writer, Throwable ex) { writer.appendNoHilight("/*").newLine(); - writer.appendNoHilight(" * ").appendNoHilight(AppStrings.translate("decompilationError")).newLine(); - writer.appendNoHilight(" * ").appendNoHilight(AppStrings.translate("decompilationError.obfuscated")).newLine(); - writer.appendNoHilight(" * ").appendNoHilight(AppStrings.translate("decompilationError.errorType")). + writer.appendNoHilight(" * ").appendNoHilight(AppResources.translate("decompilationError")).newLine(); + writer.appendNoHilight(" * ").appendNoHilight(AppResources.translate("decompilationError.obfuscated")).newLine(); + writer.appendNoHilight(" * ").appendNoHilight(AppResources.translate("decompilationError.errorType")). appendNoHilight(": " + ex.getClass().getSimpleName()).newLine(); writer.appendNoHilight(" */").newLine(); writer.appendNoHilight("throw new flash.errors.IllegalOperationError(\""). - appendNoHilight(AppStrings.translate("decompilationError.error.description")). + appendNoHilight(AppResources.translate("decompilationError.error.description")). appendNoHilight("\");").newLine(); } diff --git a/src/com/jpexs/decompiler/flash/gui/AdvancedSettingsDialog.java b/src/com/jpexs/decompiler/flash/gui/AdvancedSettingsDialog.java index b74588cba..a2fd50009 100644 --- a/src/com/jpexs/decompiler/flash/gui/AdvancedSettingsDialog.java +++ b/src/com/jpexs/decompiler/flash/gui/AdvancedSettingsDialog.java @@ -16,7 +16,6 @@ */ 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.ConfigurationCategory; import com.jpexs.decompiler.flash.configuration.ConfigurationItem; diff --git a/src/com/jpexs/decompiler/flash/gui/AppDialog.java b/src/com/jpexs/decompiler/flash/gui/AppDialog.java index b1c53b135..90edc9289 100644 --- a/src/com/jpexs/decompiler/flash/gui/AppDialog.java +++ b/src/com/jpexs/decompiler/flash/gui/AppDialog.java @@ -16,7 +16,6 @@ */ package com.jpexs.decompiler.flash.gui; -import com.jpexs.decompiler.flash.AppStrings; import com.jpexs.decompiler.flash.configuration.Configuration; import java.awt.Window; import java.util.ResourceBundle; diff --git a/src/com/jpexs/decompiler/flash/gui/AppFrame.java b/src/com/jpexs/decompiler/flash/gui/AppFrame.java index 1a7db4d0a..08e2e11e2 100644 --- a/src/com/jpexs/decompiler/flash/gui/AppFrame.java +++ b/src/com/jpexs/decompiler/flash/gui/AppFrame.java @@ -1,46 +1,45 @@ -/* - * Copyright (C) 2010-2014 JPEXS - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.jpexs.decompiler.flash.gui; - -import com.jpexs.decompiler.flash.AppStrings; -import java.util.ResourceBundle; -import javax.swing.JFrame; - -/** - * - * @author JPEXS - */ -public abstract class AppFrame extends JFrame { - - private ResourceBundle resourceBundle; - - public AppFrame() { - if (getClass().equals(MainFrameClassic.class)) { - resourceBundle = ResourceBundle.getBundle(AppStrings.getResourcePath(MainFrame.class)); - } else { - resourceBundle = ResourceBundle.getBundle(AppStrings.getResourcePath(getClass())); - } - } - - public String translate(String key) { - return resourceBundle.getString(key); - } - - public void updateLanguage() { - resourceBundle = ResourceBundle.getBundle(AppStrings.getResourcePath(getClass())); - } -} +/* + * Copyright (C) 2010-2014 JPEXS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.jpexs.decompiler.flash.gui; + +import java.util.ResourceBundle; +import javax.swing.JFrame; + +/** + * + * @author JPEXS + */ +public abstract class AppFrame extends JFrame { + + private ResourceBundle resourceBundle; + + public AppFrame() { + if (getClass().equals(MainFrameClassic.class)) { + resourceBundle = ResourceBundle.getBundle(AppStrings.getResourcePath(MainFrame.class)); + } else { + resourceBundle = ResourceBundle.getBundle(AppStrings.getResourcePath(getClass())); + } + } + + public String translate(String key) { + return resourceBundle.getString(key); + } + + public void updateLanguage() { + resourceBundle = ResourceBundle.getBundle(AppStrings.getResourcePath(getClass())); + } +} diff --git a/src/com/jpexs/decompiler/flash/gui/AppRibbonFrame.java b/src/com/jpexs/decompiler/flash/gui/AppRibbonFrame.java index b758b2866..99f8dbb81 100644 --- a/src/com/jpexs/decompiler/flash/gui/AppRibbonFrame.java +++ b/src/com/jpexs/decompiler/flash/gui/AppRibbonFrame.java @@ -1,42 +1,41 @@ -/* - * Copyright (C) 2010-2014 JPEXS - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.jpexs.decompiler.flash.gui; - -import com.jpexs.decompiler.flash.AppStrings; -import java.util.ResourceBundle; -import org.pushingpixels.flamingo.api.ribbon.JRibbonFrame; - -/** - * - * @author JPEXS - */ -public abstract class AppRibbonFrame extends JRibbonFrame { - - private final ResourceBundle resourceBundle; - - public AppRibbonFrame() { - if (getClass().equals(MainFrameRibbon.class)) { - resourceBundle = ResourceBundle.getBundle(AppStrings.getResourcePath(MainFrame.class)); - } else { - resourceBundle = ResourceBundle.getBundle(AppStrings.getResourcePath(getClass())); - } - } - - public String translate(String key) { - return resourceBundle.getString(key); - } -} +/* + * Copyright (C) 2010-2014 JPEXS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.jpexs.decompiler.flash.gui; + +import java.util.ResourceBundle; +import org.pushingpixels.flamingo.api.ribbon.JRibbonFrame; + +/** + * + * @author JPEXS + */ +public abstract class AppRibbonFrame extends JRibbonFrame { + + private final ResourceBundle resourceBundle; + + public AppRibbonFrame() { + if (getClass().equals(MainFrameRibbon.class)) { + resourceBundle = ResourceBundle.getBundle(AppStrings.getResourcePath(MainFrame.class)); + } else { + resourceBundle = ResourceBundle.getBundle(AppStrings.getResourcePath(getClass())); + } + } + + public String translate(String key) { + return resourceBundle.getString(key); + } +} diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/AppStrings.java b/src/com/jpexs/decompiler/flash/gui/AppStrings.java similarity index 95% rename from libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/AppStrings.java rename to src/com/jpexs/decompiler/flash/gui/AppStrings.java index 944afce77..a6c296127 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/AppStrings.java +++ b/src/com/jpexs/decompiler/flash/gui/AppStrings.java @@ -12,8 +12,9 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ -package com.jpexs.decompiler.flash; + * License along with this library. + */ +package com.jpexs.decompiler.flash.gui; import java.util.ResourceBundle; diff --git a/src/com/jpexs/decompiler/flash/gui/FontEmbedDialog.java b/src/com/jpexs/decompiler/flash/gui/FontEmbedDialog.java index a12df4e2d..25779bbf4 100644 --- a/src/com/jpexs/decompiler/flash/gui/FontEmbedDialog.java +++ b/src/com/jpexs/decompiler/flash/gui/FontEmbedDialog.java @@ -1,220 +1,219 @@ -/* - * Copyright (C) 2010-2014 JPEXS - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.jpexs.decompiler.flash.gui; - -import com.jpexs.decompiler.flash.AppStrings; -import com.jpexs.decompiler.flash.tags.base.FontTag; -import com.jpexs.decompiler.flash.tags.font.CharacterRanges; -import java.awt.Container; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.util.Set; -import java.util.TreeSet; -import java.util.Vector; -import javax.swing.Box; -import javax.swing.BoxLayout; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JComboBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTextField; - -/** - * - * @author JPEXS - */ -public class FontEmbedDialog extends AppDialog implements ActionListener { - - private static final String ACTION_OK = "OK"; - private static final String ACTION_CANCEL = "CANCEL"; - - private static final int SAMPLE_MAX_LENGTH = 50; - - private final JComboBox sourceFont; - private final JCheckBox[] rangeCheckboxes; - private final String rangeNames[]; - private final JLabel[] rangeSamples; - private final JTextField individualCharsField; - private boolean result = false; - private JLabel individialSample; - private final int style; - - public String getSelectedFont() { - return sourceFont.getSelectedItem().toString(); - } - - public Set getSelectedChars() { - Set chars = new TreeSet<>(); - Font f = new Font(getSelectedFont(), style, new JLabel().getFont().getSize()); - for (int i = 0; i < rangeCheckboxes.length; i++) { - if (rangeCheckboxes[i].isSelected()) { - int codes[] = CharacterRanges.rangeCodes(i); - for (int c : codes) { - if (f.canDisplay(c)) { - chars.add(c); - } - } - } - } - String indStr = individualCharsField.getText(); - for (int i = 0; i < indStr.length(); i++) { - if (f.canDisplay(indStr.codePointAt(i))) { - chars.add(indStr.codePointAt(i)); - } - } - return chars; - } - - public FontEmbedDialog(String selectedFont, String selectedChars, int style) { - setSize(900, 600); - this.style = style; - setDefaultCloseOperation(HIDE_ON_CLOSE); - setTitle(translate("dialog.title")); - - Container cnt = getContentPane(); - cnt.setLayout(new BoxLayout(cnt, BoxLayout.Y_AXIS)); - - individialSample = new JLabel(); - sourceFont = new JComboBox<>(new Vector<>(FontTag.fontNames)); - sourceFont.setSelectedItem(selectedFont); - cnt.add(sourceFont); - JPanel rangesPanel = new JPanel(); - rangesPanel.setLayout(new BoxLayout(rangesPanel, BoxLayout.Y_AXIS)); - int rc = CharacterRanges.rangeCount(); - rangeCheckboxes = new JCheckBox[rc]; - rangeSamples = new JLabel[rc]; - rangeNames = new String[rc]; - for (int i = 0; i < rc; i++) { - rangeNames[i] = CharacterRanges.rangeName(i); - rangeSamples[i] = new JLabel(""); - rangeCheckboxes[i] = new JCheckBox(rangeNames[i]); - JPanel rangeRowPanel = new JPanel(); - rangeRowPanel.setLayout(new BoxLayout(rangeRowPanel, BoxLayout.X_AXIS)); - rangeRowPanel.add(rangeCheckboxes[i]); - rangeRowPanel.add(Box.createHorizontalGlue()); - rangeRowPanel.add(rangeSamples[i]); - rangeRowPanel.setAlignmentX(0); - rangesPanel.add(rangeRowPanel); - } - cnt.add(new JScrollPane(rangesPanel)); - - JPanel specialPanel = new JPanel(); - specialPanel.setLayout(new BoxLayout(specialPanel, BoxLayout.X_AXIS)); - specialPanel.add(new JLabel(translate("label.individual"))); - individualCharsField = new JTextField(); - individualCharsField.setPreferredSize(new Dimension(100, individualCharsField.getPreferredSize().height)); - individialSample = new JLabel(); - specialPanel.add(individualCharsField); - cnt.add(specialPanel); - cnt.add(individialSample); - - JPanel buttonsPanel = new JPanel(new FlowLayout()); - JButton okButton = new JButton(AppStrings.translate("button.ok")); - okButton.setActionCommand(ACTION_OK); - okButton.addActionListener(this); - JButton cancelButton = new JButton(AppStrings.translate("button.cancel")); - cancelButton.setActionCommand(ACTION_CANCEL); - cancelButton.addActionListener(this); - buttonsPanel.add(okButton); - buttonsPanel.add(cancelButton); - cnt.add(buttonsPanel); - View.setWindowIcon(this); - View.centerScreen(this); - setModalityType(ModalityType.APPLICATION_MODAL); - individualCharsField.setText(selectedChars); - getRootPane().setDefaultButton(okButton); - sourceFont.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - updateCheckboxes(); - } - }); - updateCheckboxes(); - individualCharsField.addKeyListener(new KeyAdapter() { - @Override - public void keyTyped(KeyEvent e) { - updateIndividual(); - } - }); - } - - private void updateIndividual() { - String chars = individualCharsField.getText(); - Font f = new Font(getSelectedFont(), style, new JLabel().getFont().getSize()); - String visibleChars = ""; - for (int i = 0; i < chars.length(); i++) { - if (f.canDisplay(chars.codePointAt(i))) { - visibleChars += "" + chars.charAt(i); - } - } - individialSample.setText(visibleChars); - } - - private void updateCheckboxes() { - String fontStr = sourceFont.getSelectedItem().toString(); - Font f = new Font(fontStr, style, new JLabel().getFont().getSize()); - int rc = CharacterRanges.rangeCount(); - for (int i = 0; i < rc; i++) { - rangeNames[i] = CharacterRanges.rangeName(i); - int codes[] = CharacterRanges.rangeCodes(i); - int avail = 0; - String sample = ""; - for (int c = 0; c < codes.length; c++) { - if (f.canDisplay(codes[c])) { - if (avail < SAMPLE_MAX_LENGTH) { - sample += "" + (char) codes[c]; - } - avail++; - } - } - rangeSamples[i].setText(sample); - rangeSamples[i].setFont(f); - rangeCheckboxes[i].setText(translate("range.description").replace("%available%", "" + avail).replace("%name%", rangeNames[i]).replace("%total%", "" + codes.length)); - } - individialSample.setFont(f); - updateIndividual(); - } - - @Override - public void actionPerformed(ActionEvent e) { - switch (e.getActionCommand()) { - case ACTION_OK: - result = true; - setVisible(false); - break; - case ACTION_CANCEL: - result = false; - setVisible(false); - break; - } - } - - public boolean display() { - result = false; - setVisible(true); - return result; - } -} +/* + * Copyright (C) 2010-2014 JPEXS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.jpexs.decompiler.flash.gui; + +import com.jpexs.decompiler.flash.tags.base.FontTag; +import com.jpexs.decompiler.flash.tags.font.CharacterRanges; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.util.Set; +import java.util.TreeSet; +import java.util.Vector; +import javax.swing.Box; +import javax.swing.BoxLayout; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextField; + +/** + * + * @author JPEXS + */ +public class FontEmbedDialog extends AppDialog implements ActionListener { + + private static final String ACTION_OK = "OK"; + private static final String ACTION_CANCEL = "CANCEL"; + + private static final int SAMPLE_MAX_LENGTH = 50; + + private final JComboBox sourceFont; + private final JCheckBox[] rangeCheckboxes; + private final String rangeNames[]; + private final JLabel[] rangeSamples; + private final JTextField individualCharsField; + private boolean result = false; + private JLabel individialSample; + private final int style; + + public String getSelectedFont() { + return sourceFont.getSelectedItem().toString(); + } + + public Set getSelectedChars() { + Set chars = new TreeSet<>(); + Font f = new Font(getSelectedFont(), style, new JLabel().getFont().getSize()); + for (int i = 0; i < rangeCheckboxes.length; i++) { + if (rangeCheckboxes[i].isSelected()) { + int codes[] = CharacterRanges.rangeCodes(i); + for (int c : codes) { + if (f.canDisplay(c)) { + chars.add(c); + } + } + } + } + String indStr = individualCharsField.getText(); + for (int i = 0; i < indStr.length(); i++) { + if (f.canDisplay(indStr.codePointAt(i))) { + chars.add(indStr.codePointAt(i)); + } + } + return chars; + } + + public FontEmbedDialog(String selectedFont, String selectedChars, int style) { + setSize(900, 600); + this.style = style; + setDefaultCloseOperation(HIDE_ON_CLOSE); + setTitle(translate("dialog.title")); + + Container cnt = getContentPane(); + cnt.setLayout(new BoxLayout(cnt, BoxLayout.Y_AXIS)); + + individialSample = new JLabel(); + sourceFont = new JComboBox<>(new Vector<>(FontTag.fontNames)); + sourceFont.setSelectedItem(selectedFont); + cnt.add(sourceFont); + JPanel rangesPanel = new JPanel(); + rangesPanel.setLayout(new BoxLayout(rangesPanel, BoxLayout.Y_AXIS)); + int rc = CharacterRanges.rangeCount(); + rangeCheckboxes = new JCheckBox[rc]; + rangeSamples = new JLabel[rc]; + rangeNames = new String[rc]; + for (int i = 0; i < rc; i++) { + rangeNames[i] = CharacterRanges.rangeName(i); + rangeSamples[i] = new JLabel(""); + rangeCheckboxes[i] = new JCheckBox(rangeNames[i]); + JPanel rangeRowPanel = new JPanel(); + rangeRowPanel.setLayout(new BoxLayout(rangeRowPanel, BoxLayout.X_AXIS)); + rangeRowPanel.add(rangeCheckboxes[i]); + rangeRowPanel.add(Box.createHorizontalGlue()); + rangeRowPanel.add(rangeSamples[i]); + rangeRowPanel.setAlignmentX(0); + rangesPanel.add(rangeRowPanel); + } + cnt.add(new JScrollPane(rangesPanel)); + + JPanel specialPanel = new JPanel(); + specialPanel.setLayout(new BoxLayout(specialPanel, BoxLayout.X_AXIS)); + specialPanel.add(new JLabel(translate("label.individual"))); + individualCharsField = new JTextField(); + individualCharsField.setPreferredSize(new Dimension(100, individualCharsField.getPreferredSize().height)); + individialSample = new JLabel(); + specialPanel.add(individualCharsField); + cnt.add(specialPanel); + cnt.add(individialSample); + + JPanel buttonsPanel = new JPanel(new FlowLayout()); + JButton okButton = new JButton(AppStrings.translate("button.ok")); + okButton.setActionCommand(ACTION_OK); + okButton.addActionListener(this); + JButton cancelButton = new JButton(AppStrings.translate("button.cancel")); + cancelButton.setActionCommand(ACTION_CANCEL); + cancelButton.addActionListener(this); + buttonsPanel.add(okButton); + buttonsPanel.add(cancelButton); + cnt.add(buttonsPanel); + View.setWindowIcon(this); + View.centerScreen(this); + setModalityType(ModalityType.APPLICATION_MODAL); + individualCharsField.setText(selectedChars); + getRootPane().setDefaultButton(okButton); + sourceFont.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + updateCheckboxes(); + } + }); + updateCheckboxes(); + individualCharsField.addKeyListener(new KeyAdapter() { + @Override + public void keyTyped(KeyEvent e) { + updateIndividual(); + } + }); + } + + private void updateIndividual() { + String chars = individualCharsField.getText(); + Font f = new Font(getSelectedFont(), style, new JLabel().getFont().getSize()); + String visibleChars = ""; + for (int i = 0; i < chars.length(); i++) { + if (f.canDisplay(chars.codePointAt(i))) { + visibleChars += "" + chars.charAt(i); + } + } + individialSample.setText(visibleChars); + } + + private void updateCheckboxes() { + String fontStr = sourceFont.getSelectedItem().toString(); + Font f = new Font(fontStr, style, new JLabel().getFont().getSize()); + int rc = CharacterRanges.rangeCount(); + for (int i = 0; i < rc; i++) { + rangeNames[i] = CharacterRanges.rangeName(i); + int codes[] = CharacterRanges.rangeCodes(i); + int avail = 0; + String sample = ""; + for (int c = 0; c < codes.length; c++) { + if (f.canDisplay(codes[c])) { + if (avail < SAMPLE_MAX_LENGTH) { + sample += "" + (char) codes[c]; + } + avail++; + } + } + rangeSamples[i].setText(sample); + rangeSamples[i].setFont(f); + rangeCheckboxes[i].setText(translate("range.description").replace("%available%", "" + avail).replace("%name%", rangeNames[i]).replace("%total%", "" + codes.length)); + } + individialSample.setFont(f); + updateIndividual(); + } + + @Override + public void actionPerformed(ActionEvent e) { + switch (e.getActionCommand()) { + case ACTION_OK: + result = true; + setVisible(false); + break; + case ACTION_CANCEL: + result = false; + setVisible(false); + break; + } + } + + public boolean display() { + result = false; + setVisible(true); + return result; + } +} diff --git a/src/com/jpexs/decompiler/flash/gui/GenericTagTreePanel.java b/src/com/jpexs/decompiler/flash/gui/GenericTagTreePanel.java index 4b25295c5..4bec55b39 100644 --- a/src/com/jpexs/decompiler/flash/gui/GenericTagTreePanel.java +++ b/src/com/jpexs/decompiler/flash/gui/GenericTagTreePanel.java @@ -16,7 +16,6 @@ */ package com.jpexs.decompiler.flash.gui; -import com.jpexs.decompiler.flash.AppStrings; import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.gui.generictageditors.BooleanEditor; diff --git a/src/com/jpexs/decompiler/flash/gui/GuiAbortRetryIgnoreHandler.java b/src/com/jpexs/decompiler/flash/gui/GuiAbortRetryIgnoreHandler.java index 5e7739270..94e8a883a 100644 --- a/src/com/jpexs/decompiler/flash/gui/GuiAbortRetryIgnoreHandler.java +++ b/src/com/jpexs/decompiler/flash/gui/GuiAbortRetryIgnoreHandler.java @@ -1,43 +1,42 @@ -/* - * Copyright (C) 2010-2014 JPEXS - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.jpexs.decompiler.flash.gui; - -import com.jpexs.decompiler.flash.AbortRetryIgnoreHandler; -import com.jpexs.decompiler.flash.AppStrings; -import javax.swing.JOptionPane; - -/** - * - * @author JPEXS - */ -public class GuiAbortRetryIgnoreHandler implements AbortRetryIgnoreHandler { - - @Override - public int handle(Throwable thrown) { - synchronized (GuiAbortRetryIgnoreHandler.class) { - String[] options = new String[]{AppStrings.translate("button.abort"), AppStrings.translate("button.retry"), AppStrings.translate("button.ignore")}; - return View.showOptionDialog(null, AppStrings.translate("error.occured").replace("%error%", thrown.getLocalizedMessage()), AppStrings.translate("error"), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, options, ""); - } - } - - @Override - public AbortRetryIgnoreHandler getNewInstance() { - // there are no non-static field in this class, so return the original instance - return this; - } - -} +/* + * Copyright (C) 2010-2014 JPEXS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.jpexs.decompiler.flash.gui; + +import com.jpexs.decompiler.flash.AbortRetryIgnoreHandler; +import javax.swing.JOptionPane; + +/** + * + * @author JPEXS + */ +public class GuiAbortRetryIgnoreHandler implements AbortRetryIgnoreHandler { + + @Override + public int handle(Throwable thrown) { + synchronized (GuiAbortRetryIgnoreHandler.class) { + String[] options = new String[]{AppStrings.translate("button.abort"), AppStrings.translate("button.retry"), AppStrings.translate("button.ignore")}; + return View.showOptionDialog(null, AppStrings.translate("error.occured").replace("%error%", thrown.getLocalizedMessage()), AppStrings.translate("error"), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, options, ""); + } + } + + @Override + public AbortRetryIgnoreHandler getNewInstance() { + // there are no non-static field in this class, so return the original instance + return this; + } + +} diff --git a/src/com/jpexs/decompiler/flash/gui/HeaderInfoPanel.java b/src/com/jpexs/decompiler/flash/gui/HeaderInfoPanel.java index 069d25f81..bb9c6d38d 100644 --- a/src/com/jpexs/decompiler/flash/gui/HeaderInfoPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/HeaderInfoPanel.java @@ -16,7 +16,6 @@ */ package com.jpexs.decompiler.flash.gui; -import com.jpexs.decompiler.flash.AppStrings; import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.gui.helpers.SpringUtilities; import javax.swing.JLabel; diff --git a/src/com/jpexs/decompiler/flash/gui/ImagePanel.java b/src/com/jpexs/decompiler/flash/gui/ImagePanel.java index 7cefef044..ad7891373 100644 --- a/src/com/jpexs/decompiler/flash/gui/ImagePanel.java +++ b/src/com/jpexs/decompiler/flash/gui/ImagePanel.java @@ -16,7 +16,6 @@ */ package com.jpexs.decompiler.flash.gui; -import com.jpexs.decompiler.flash.AppStrings; import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.exporters.commonshape.Matrix; import com.jpexs.decompiler.flash.gui.player.MediaDisplay; diff --git a/src/com/jpexs/decompiler/flash/gui/LoadFromCacheFrame.java b/src/com/jpexs/decompiler/flash/gui/LoadFromCacheFrame.java index 797e09829..f958d3260 100644 --- a/src/com/jpexs/decompiler/flash/gui/LoadFromCacheFrame.java +++ b/src/com/jpexs/decompiler/flash/gui/LoadFromCacheFrame.java @@ -19,7 +19,6 @@ package com.jpexs.decompiler.flash.gui; import com.jpexs.browsers.cache.CacheEntry; import com.jpexs.browsers.cache.CacheImplementation; import com.jpexs.browsers.cache.CacheReader; -import com.jpexs.decompiler.flash.AppStrings; import com.jpexs.decompiler.flash.SWFSourceInfo; import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.helpers.Helper; diff --git a/src/com/jpexs/decompiler/flash/gui/LoadFromMemoryFrame.java b/src/com/jpexs/decompiler/flash/gui/LoadFromMemoryFrame.java index d44826f13..33cf7c293 100644 --- a/src/com/jpexs/decompiler/flash/gui/LoadFromMemoryFrame.java +++ b/src/com/jpexs/decompiler/flash/gui/LoadFromMemoryFrame.java @@ -16,7 +16,6 @@ */ package com.jpexs.decompiler.flash.gui; -import com.jpexs.decompiler.flash.AppStrings; import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.SWFSourceInfo; import com.jpexs.decompiler.flash.configuration.Configuration; diff --git a/src/com/jpexs/decompiler/flash/gui/Main.java b/src/com/jpexs/decompiler/flash/gui/Main.java index 3c4c455aa..0a2c6819c 100644 --- a/src/com/jpexs/decompiler/flash/gui/Main.java +++ b/src/com/jpexs/decompiler/flash/gui/Main.java @@ -16,7 +16,6 @@ */ package com.jpexs.decompiler.flash.gui; -import com.jpexs.decompiler.flash.AppStrings; import com.jpexs.decompiler.flash.ApplicationInfo; import com.jpexs.decompiler.flash.EventListener; import com.jpexs.decompiler.flash.SWF; diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java index b0787e818..c22c6cd24 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -17,7 +17,6 @@ package com.jpexs.decompiler.flash.gui; import com.jpexs.decompiler.flash.AbortRetryIgnoreHandler; -import com.jpexs.decompiler.flash.AppStrings; import com.jpexs.decompiler.flash.ApplicationInfo; import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.abc.ABC; diff --git a/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java b/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java index 36ab9fc2c..0a2bbb8f4 100644 --- a/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java @@ -16,7 +16,6 @@ */ package com.jpexs.decompiler.flash.gui; -import com.jpexs.decompiler.flash.AppStrings; import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.action.Action; diff --git a/src/com/jpexs/decompiler/flash/gui/SearchPanel.java b/src/com/jpexs/decompiler/flash/gui/SearchPanel.java index d620dcf93..883696cee 100644 --- a/src/com/jpexs/decompiler/flash/gui/SearchPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/SearchPanel.java @@ -1,152 +1,151 @@ -/* - * Copyright (C) 2010-2014 JPEXS - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.jpexs.decompiler.flash.gui; - -import com.jpexs.decompiler.flash.AppStrings; -import java.awt.Insets; -import java.awt.LayoutManager; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.ArrayList; -import java.util.List; -import javax.swing.JButton; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.SwingUtilities; -import javax.swing.text.JTextComponent; -import jsyntaxpane.actions.DocumentSearchData; - -/** - * - * @author JPEXS - * @param - */ -public class SearchPanel extends JPanel implements ActionListener { - - static final String ACTION_SEARCH_PREV = "SEARCHPREV"; - static final String ACTION_SEARCH_NEXT = "SEARCHNEXT"; - static final String ACTION_SEARCH_CANCEL = "SEARCHCANCEL"; - - private final SearchListener listener; - - private final JLabel searchPos; - private int foundPos = 0; - private final JLabel searchForLabel; - private String searchFor; - private boolean searchIgnoreCase; - private boolean searchRegexp; - private List found = new ArrayList<>(); - - public SearchPanel(LayoutManager lm, SearchListener listener) { - super(lm); - - this.listener = listener; - - JButton prevSearchButton = new JButton(View.getIcon("prev16")); - prevSearchButton.setMargin(new Insets(3, 3, 3, 3)); - prevSearchButton.addActionListener(this); - prevSearchButton.setActionCommand(ACTION_SEARCH_PREV); - JButton nextSearchButton = new JButton(View.getIcon("next16")); - nextSearchButton.setMargin(new Insets(3, 3, 3, 3)); - nextSearchButton.addActionListener(this); - nextSearchButton.setActionCommand(ACTION_SEARCH_NEXT); - JButton cancelSearchButton = new JButton(View.getIcon("cancel16")); - cancelSearchButton.setMargin(new Insets(3, 3, 3, 3)); - cancelSearchButton.addActionListener(this); - cancelSearchButton.setActionCommand(ACTION_SEARCH_CANCEL); - searchPos = new JLabel("0/0"); - searchForLabel = new JLabel(AppStrings.translate("search.info").replace("%text%", "")); - add(searchForLabel); - add(prevSearchButton); - add(new JLabel(AppStrings.translate("search.script") + " ")); - add(searchPos); - add(nextSearchButton); - add(cancelSearchButton); - setVisible(false); - } - - public void showQuickFindDialog(JTextComponent editor) { - DocumentSearchData dsd = DocumentSearchData.getFromEditor(editor); - dsd.setPattern(searchFor, searchRegexp, searchIgnoreCase); - dsd.showQuickFindDialogEx(editor, searchIgnoreCase, searchRegexp); - } - - public void setSearchText(String txt) { - searchFor = txt; - searchForLabel.setText(AppStrings.translate("search.info").replace("%text%", txt) + " "); - } - - public boolean setResults(List results) { - found = results; - if (found.isEmpty()) { - setVisible(false); - return false; - } else { - setPos(0); - setVisible(true); - return true; - } - } - - public void setOptions(boolean ignoreCase, boolean regExp) { - searchIgnoreCase = ignoreCase; - searchRegexp = regExp; - } - - public void setPos(int pos) { - foundPos = pos; - doUpdate(); - } - - public void clear() { - foundPos = 0; - found.clear(); - } - - private void doUpdate() { - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - searchPos.setText((foundPos + 1) + "/" + found.size()); - listener.updateSearchPos(found.get(foundPos)); - } - }); - } - - @Override - public void actionPerformed(ActionEvent e) { - switch (e.getActionCommand()) { - case ACTION_SEARCH_CANCEL: - foundPos = 0; - setVisible(false); - found = new ArrayList<>(); - searchFor = null; - break; - case ACTION_SEARCH_PREV: - foundPos--; - if (foundPos < 0) { - foundPos += found.size(); - } - doUpdate(); - break; - case ACTION_SEARCH_NEXT: - foundPos = (foundPos + 1) % found.size(); - doUpdate(); - break; - } - } -} +/* + * Copyright (C) 2010-2014 JPEXS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.jpexs.decompiler.flash.gui; + +import java.awt.Insets; +import java.awt.LayoutManager; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.List; +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; +import javax.swing.text.JTextComponent; +import jsyntaxpane.actions.DocumentSearchData; + +/** + * + * @author JPEXS + * @param + */ +public class SearchPanel extends JPanel implements ActionListener { + + static final String ACTION_SEARCH_PREV = "SEARCHPREV"; + static final String ACTION_SEARCH_NEXT = "SEARCHNEXT"; + static final String ACTION_SEARCH_CANCEL = "SEARCHCANCEL"; + + private final SearchListener listener; + + private final JLabel searchPos; + private int foundPos = 0; + private final JLabel searchForLabel; + private String searchFor; + private boolean searchIgnoreCase; + private boolean searchRegexp; + private List found = new ArrayList<>(); + + public SearchPanel(LayoutManager lm, SearchListener listener) { + super(lm); + + this.listener = listener; + + JButton prevSearchButton = new JButton(View.getIcon("prev16")); + prevSearchButton.setMargin(new Insets(3, 3, 3, 3)); + prevSearchButton.addActionListener(this); + prevSearchButton.setActionCommand(ACTION_SEARCH_PREV); + JButton nextSearchButton = new JButton(View.getIcon("next16")); + nextSearchButton.setMargin(new Insets(3, 3, 3, 3)); + nextSearchButton.addActionListener(this); + nextSearchButton.setActionCommand(ACTION_SEARCH_NEXT); + JButton cancelSearchButton = new JButton(View.getIcon("cancel16")); + cancelSearchButton.setMargin(new Insets(3, 3, 3, 3)); + cancelSearchButton.addActionListener(this); + cancelSearchButton.setActionCommand(ACTION_SEARCH_CANCEL); + searchPos = new JLabel("0/0"); + searchForLabel = new JLabel(AppStrings.translate("search.info").replace("%text%", "")); + add(searchForLabel); + add(prevSearchButton); + add(new JLabel(AppStrings.translate("search.script") + " ")); + add(searchPos); + add(nextSearchButton); + add(cancelSearchButton); + setVisible(false); + } + + public void showQuickFindDialog(JTextComponent editor) { + DocumentSearchData dsd = DocumentSearchData.getFromEditor(editor); + dsd.setPattern(searchFor, searchRegexp, searchIgnoreCase); + dsd.showQuickFindDialogEx(editor, searchIgnoreCase, searchRegexp); + } + + public void setSearchText(String txt) { + searchFor = txt; + searchForLabel.setText(AppStrings.translate("search.info").replace("%text%", txt) + " "); + } + + public boolean setResults(List results) { + found = results; + if (found.isEmpty()) { + setVisible(false); + return false; + } else { + setPos(0); + setVisible(true); + return true; + } + } + + public void setOptions(boolean ignoreCase, boolean regExp) { + searchIgnoreCase = ignoreCase; + searchRegexp = regExp; + } + + public void setPos(int pos) { + foundPos = pos; + doUpdate(); + } + + public void clear() { + foundPos = 0; + found.clear(); + } + + private void doUpdate() { + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + searchPos.setText((foundPos + 1) + "/" + found.size()); + listener.updateSearchPos(found.get(foundPos)); + } + }); + } + + @Override + public void actionPerformed(ActionEvent e) { + switch (e.getActionCommand()) { + case ACTION_SEARCH_CANCEL: + foundPos = 0; + setVisible(false); + found = new ArrayList<>(); + searchFor = null; + break; + case ACTION_SEARCH_PREV: + foundPos--; + if (foundPos < 0) { + foundPos += found.size(); + } + doUpdate(); + break; + case ACTION_SEARCH_NEXT: + foundPos = (foundPos + 1) % found.size(); + doUpdate(); + break; + } + } +} diff --git a/src/com/jpexs/decompiler/flash/gui/SelectLanguageDialog.java b/src/com/jpexs/decompiler/flash/gui/SelectLanguageDialog.java index 3179a2b13..2a8f31c74 100644 --- a/src/com/jpexs/decompiler/flash/gui/SelectLanguageDialog.java +++ b/src/com/jpexs/decompiler/flash/gui/SelectLanguageDialog.java @@ -16,7 +16,6 @@ */ package com.jpexs.decompiler.flash.gui; -import com.jpexs.decompiler.flash.AppStrings; import com.jpexs.decompiler.flash.configuration.Configuration; import java.awt.BorderLayout; import java.awt.Container; diff --git a/src/com/jpexs/decompiler/flash/gui/SwfInMemory.java b/src/com/jpexs/decompiler/flash/gui/SwfInMemory.java index 2e706c04b..377f6d340 100644 --- a/src/com/jpexs/decompiler/flash/gui/SwfInMemory.java +++ b/src/com/jpexs/decompiler/flash/gui/SwfInMemory.java @@ -1,52 +1,51 @@ -/* - * Copyright (C) 2010-2014 JPEXS - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.jpexs.decompiler.flash.gui; - -import com.jpexs.decompiler.flash.AppStrings; -import com.jpexs.helpers.ReReadableInputStream; -import java.util.ResourceBundle; - -/** - * - * @author JPEXS - */ -public class SwfInMemory { - - public ReReadableInputStream is; - public int version; - public long fileSize; - public com.jpexs.process.Process process; - - public SwfInMemory(ReReadableInputStream is, int version, long fileSize, com.jpexs.process.Process process) { - this.is = is; - this.version = version; - this.fileSize = fileSize; - this.process = process; - } - - private static final ResourceBundle resourceBundle = ResourceBundle.getBundle(AppStrings.getResourcePath(LoadFromMemoryFrame.class)); - - public String translate(String key) { - return resourceBundle.getString(key); - } - - @Override - public String toString() { - String p = translate("swfitem").replace("%version%", "" + version).replace("%size%", "" + fileSize); - return p; - } -} +/* + * Copyright (C) 2010-2014 JPEXS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.jpexs.decompiler.flash.gui; + +import com.jpexs.helpers.ReReadableInputStream; +import java.util.ResourceBundle; + +/** + * + * @author JPEXS + */ +public class SwfInMemory { + + public ReReadableInputStream is; + public int version; + public long fileSize; + public com.jpexs.process.Process process; + + public SwfInMemory(ReReadableInputStream is, int version, long fileSize, com.jpexs.process.Process process) { + this.is = is; + this.version = version; + this.fileSize = fileSize; + this.process = process; + } + + private static final ResourceBundle resourceBundle = ResourceBundle.getBundle(AppStrings.getResourcePath(LoadFromMemoryFrame.class)); + + public String translate(String key) { + return resourceBundle.getString(key); + } + + @Override + public String toString() { + String p = translate("swfitem").replace("%version%", "" + version).replace("%size%", "" + fileSize); + return p; + } +} diff --git a/src/com/jpexs/decompiler/flash/gui/TagTreeModel.java b/src/com/jpexs/decompiler/flash/gui/TagTreeModel.java index b16792886..de1449b1e 100644 --- a/src/com/jpexs/decompiler/flash/gui/TagTreeModel.java +++ b/src/com/jpexs/decompiler/flash/gui/TagTreeModel.java @@ -244,7 +244,7 @@ public class TagTreeModel implements TreeModel { } swfNode.scriptsNode = actionScriptNode; - ret.add(new HeaderNode(new HeaderItem(swf))); + ret.add(new HeaderNode(new HeaderItem(swf, AppStrings.translate("node.header")))); if (!shapesNode.subNodes.isEmpty()) { ret.add(shapesNode); diff --git a/src/com/jpexs/decompiler/flash/gui/View.java b/src/com/jpexs/decompiler/flash/gui/View.java index ce679d15b..3df20b3bf 100644 --- a/src/com/jpexs/decompiler/flash/gui/View.java +++ b/src/com/jpexs/decompiler/flash/gui/View.java @@ -16,7 +16,6 @@ */ package com.jpexs.decompiler.flash.gui; -import com.jpexs.decompiler.flash.AppStrings; import com.jpexs.decompiler.flash.configuration.ConfigurationItem; import java.awt.BorderLayout; import java.awt.Color; diff --git a/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java b/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java index 5ab0e6e03..6720ff4f7 100644 --- a/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java @@ -16,7 +16,6 @@ */ package com.jpexs.decompiler.flash.gui.abc; -import com.jpexs.decompiler.flash.AppStrings; import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ClassPath; @@ -40,6 +39,7 @@ import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst; import com.jpexs.decompiler.flash.abc.types.traits.Traits; import com.jpexs.decompiler.flash.abc.usages.MultinameUsage; import com.jpexs.decompiler.flash.configuration.Configuration; +import com.jpexs.decompiler.flash.gui.AppStrings; import com.jpexs.decompiler.flash.gui.HeaderLabel; import com.jpexs.decompiler.flash.gui.Main; import com.jpexs.decompiler.flash.gui.MainPanel; diff --git a/src/com/jpexs/decompiler/flash/gui/abc/ClassesListTreeModel.java b/src/com/jpexs/decompiler/flash/gui/abc/ClassesListTreeModel.java index d1903ef08..89720fa6a 100644 --- a/src/com/jpexs/decompiler/flash/gui/abc/ClassesListTreeModel.java +++ b/src/com/jpexs/decompiler/flash/gui/abc/ClassesListTreeModel.java @@ -1,188 +1,188 @@ -/* - * Copyright (C) 2010-2014 JPEXS, Paolo Cancedda - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.jpexs.decompiler.flash.gui.abc; - -import com.jpexs.decompiler.flash.AppStrings; -import com.jpexs.decompiler.flash.SWF; -import com.jpexs.decompiler.flash.abc.ClassPath; -import com.jpexs.decompiler.flash.abc.ScriptPack; -import com.jpexs.decompiler.flash.abc.types.traits.Trait; -import com.jpexs.decompiler.flash.abc.types.traits.TraitClass; -import com.jpexs.decompiler.flash.gui.abc.treenodes.TreeElement; -import com.jpexs.decompiler.flash.helpers.collections.MyEntry; -import com.jpexs.decompiler.flash.treeitems.TreeElementItem; -import com.jpexs.decompiler.flash.treenodes.TreeNode; -import java.util.ArrayList; -import java.util.List; -import javax.swing.event.TreeModelEvent; -import javax.swing.event.TreeModelListener; -import javax.swing.tree.TreeModel; -import javax.swing.tree.TreePath; - -class ClassIndexVisitor implements TreeVisitor { - - private TreeElement found = null; - private int classIndex = 0; - - public ClassIndexVisitor(int classIndex) { - this.classIndex = classIndex; - } - - @Override - public void onBranch(TreeElement branch) { - Object o = branch.getItem(); - if (o == null) { - return; - } - ScriptPack sc = (ScriptPack) o; - for (Trait t : sc.abc.script_info.get(sc.scriptIndex).traits.traits) { - if (t instanceof TraitClass) { - if (((TraitClass) t).class_info == classIndex) { - found = branch; - return; - } - } - } - } - - @Override - public void onLeaf(TreeElement leaf) { - Object o = leaf.getItem(); - if (o == null) { - return; - } - ScriptPack sc = (ScriptPack) o; - for (Trait t : sc.abc.script_info.get(sc.scriptIndex).traits.traits) { - if (t instanceof TraitClass) { - if (((TraitClass) t).class_info == classIndex) { - found = leaf; - return; - } - } - } - } - - public TreeElement getFound() { - return found; - } -} - -public class ClassesListTreeModel implements TreeModel, TreeElementItem { - - private SWF swf; - private Tree classTree; - private List> list; - private final List listeners = new ArrayList<>(); - - public List> getList() { - return list; - } - - public ClassesListTreeModel(SWF swf) { - this(swf, null); - } - - public ClassesListTreeModel(SWF swf, String filter) { - this.swf = swf; - this.list = swf.getAS3Packs(); - setFilter(filter); - } - - @Override - public SWF getSwf() { - return swf; - } - - public final void update() { - this.list = swf.getAS3Packs(); - TreeModelEvent event = new TreeModelEvent(this, new TreePath(classTree.getRoot())); - for (TreeModelListener listener : listeners) { - listener.treeStructureChanged(event); - } - } - - public final void setFilter(String filter) { - classTree = new Tree(); - filter = (filter == null || filter.isEmpty()) ? null : filter.toLowerCase(); - for (MyEntry item : list) { - if (filter != null) { - if (!item.key.toString().toLowerCase().contains(filter)) { - continue; - } - } - //String nsName = path.contains(".") ? path.substring(path.lastIndexOf(".") + 1) : path; - //String packageName = path.contains(".") ? path.substring(0, path.lastIndexOf(".")) : ""; - classTree.add(item.key.className, item.key.packageStr, item.value); - } - } - - public TreeElement getElementByClassIndex(int classIndex) { - ClassIndexVisitor civ = new ClassIndexVisitor(classIndex); - classTree.visit(civ); - return civ.getFound(); - } - - @Override - public TreeElement getRoot() { - return classTree.getRoot(); - } - - @Override - public TreeNode getChild(Object parent, int index) { - TreeElement pte = (TreeElement) parent; - TreeElement te = pte.getChild(index); - return te; - } - - @Override - public int getChildCount(Object parent) { - TreeElement te = (TreeElement) parent; - return te.getChildCount(); - } - - @Override - public boolean isLeaf(Object node) { - TreeElement te = (TreeElement) node; - return te.isLeaf(); - } - - @Override - public void valueForPathChanged(TreePath path, Object newValue) { - } - - @Override - public int getIndexOfChild(Object parent, Object child) { - TreeElement te1 = (TreeElement) parent; - TreeElement te2 = (TreeElement) child; - return te1.getIndexOfChild(te2); - } - - @Override - public void addTreeModelListener(TreeModelListener l) { - listeners.add(l); - } - - @Override - public void removeTreeModelListener(TreeModelListener l) { - listeners.remove(l); - } - - @Override - public String toString() { - return AppStrings.translate("node.scripts"); - } -} +/* + * Copyright (C) 2010-2014 JPEXS, Paolo Cancedda + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.jpexs.decompiler.flash.gui.abc; + +import com.jpexs.decompiler.flash.SWF; +import com.jpexs.decompiler.flash.abc.ClassPath; +import com.jpexs.decompiler.flash.abc.ScriptPack; +import com.jpexs.decompiler.flash.abc.types.traits.Trait; +import com.jpexs.decompiler.flash.abc.types.traits.TraitClass; +import com.jpexs.decompiler.flash.gui.AppStrings; +import com.jpexs.decompiler.flash.gui.abc.treenodes.TreeElement; +import com.jpexs.decompiler.flash.helpers.collections.MyEntry; +import com.jpexs.decompiler.flash.treeitems.TreeElementItem; +import com.jpexs.decompiler.flash.treenodes.TreeNode; +import java.util.ArrayList; +import java.util.List; +import javax.swing.event.TreeModelEvent; +import javax.swing.event.TreeModelListener; +import javax.swing.tree.TreeModel; +import javax.swing.tree.TreePath; + +class ClassIndexVisitor implements TreeVisitor { + + private TreeElement found = null; + private int classIndex = 0; + + public ClassIndexVisitor(int classIndex) { + this.classIndex = classIndex; + } + + @Override + public void onBranch(TreeElement branch) { + Object o = branch.getItem(); + if (o == null) { + return; + } + ScriptPack sc = (ScriptPack) o; + for (Trait t : sc.abc.script_info.get(sc.scriptIndex).traits.traits) { + if (t instanceof TraitClass) { + if (((TraitClass) t).class_info == classIndex) { + found = branch; + return; + } + } + } + } + + @Override + public void onLeaf(TreeElement leaf) { + Object o = leaf.getItem(); + if (o == null) { + return; + } + ScriptPack sc = (ScriptPack) o; + for (Trait t : sc.abc.script_info.get(sc.scriptIndex).traits.traits) { + if (t instanceof TraitClass) { + if (((TraitClass) t).class_info == classIndex) { + found = leaf; + return; + } + } + } + } + + public TreeElement getFound() { + return found; + } +} + +public class ClassesListTreeModel implements TreeModel, TreeElementItem { + + private SWF swf; + private Tree classTree; + private List> list; + private final List listeners = new ArrayList<>(); + + public List> getList() { + return list; + } + + public ClassesListTreeModel(SWF swf) { + this(swf, null); + } + + public ClassesListTreeModel(SWF swf, String filter) { + this.swf = swf; + this.list = swf.getAS3Packs(); + setFilter(filter); + } + + @Override + public SWF getSwf() { + return swf; + } + + public final void update() { + this.list = swf.getAS3Packs(); + TreeModelEvent event = new TreeModelEvent(this, new TreePath(classTree.getRoot())); + for (TreeModelListener listener : listeners) { + listener.treeStructureChanged(event); + } + } + + public final void setFilter(String filter) { + classTree = new Tree(); + filter = (filter == null || filter.isEmpty()) ? null : filter.toLowerCase(); + for (MyEntry item : list) { + if (filter != null) { + if (!item.key.toString().toLowerCase().contains(filter)) { + continue; + } + } + //String nsName = path.contains(".") ? path.substring(path.lastIndexOf(".") + 1) : path; + //String packageName = path.contains(".") ? path.substring(0, path.lastIndexOf(".")) : ""; + classTree.add(item.key.className, item.key.packageStr, item.value); + } + } + + public TreeElement getElementByClassIndex(int classIndex) { + ClassIndexVisitor civ = new ClassIndexVisitor(classIndex); + classTree.visit(civ); + return civ.getFound(); + } + + @Override + public TreeElement getRoot() { + return classTree.getRoot(); + } + + @Override + public TreeNode getChild(Object parent, int index) { + TreeElement pte = (TreeElement) parent; + TreeElement te = pte.getChild(index); + return te; + } + + @Override + public int getChildCount(Object parent) { + TreeElement te = (TreeElement) parent; + return te.getChildCount(); + } + + @Override + public boolean isLeaf(Object node) { + TreeElement te = (TreeElement) node; + return te.isLeaf(); + } + + @Override + public void valueForPathChanged(TreePath path, Object newValue) { + } + + @Override + public int getIndexOfChild(Object parent, Object child) { + TreeElement te1 = (TreeElement) parent; + TreeElement te2 = (TreeElement) child; + return te1.getIndexOfChild(te2); + } + + @Override + public void addTreeModelListener(TreeModelListener l) { + listeners.add(l); + } + + @Override + public void removeTreeModelListener(TreeModelListener l) { + listeners.remove(l); + } + + @Override + public String toString() { + return AppStrings.translate("node.scripts"); + } +} diff --git a/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java b/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java index 1f94ce734..498dabad1 100644 --- a/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java +++ b/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java @@ -16,7 +16,6 @@ */ package com.jpexs.decompiler.flash.gui.abc; -import com.jpexs.decompiler.flash.AppStrings; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ScriptPack; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; @@ -28,6 +27,7 @@ import com.jpexs.decompiler.flash.abc.types.traits.TraitMethodGetterSetter; import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst; import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode; +import com.jpexs.decompiler.flash.gui.AppStrings; import com.jpexs.decompiler.flash.gui.View; import com.jpexs.decompiler.flash.helpers.HilightedText; import com.jpexs.decompiler.flash.helpers.HilightedTextWriter; diff --git a/src/com/jpexs/decompiler/flash/gui/abc/DetailPanel.java b/src/com/jpexs/decompiler/flash/gui/abc/DetailPanel.java index f985c86e3..532402dff 100644 --- a/src/com/jpexs/decompiler/flash/gui/abc/DetailPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/abc/DetailPanel.java @@ -16,8 +16,8 @@ */ package com.jpexs.decompiler.flash.gui.abc; -import com.jpexs.decompiler.flash.AppStrings; import com.jpexs.decompiler.flash.abc.types.traits.Trait; +import com.jpexs.decompiler.flash.gui.AppStrings; import com.jpexs.decompiler.flash.gui.HeaderLabel; import com.jpexs.decompiler.flash.gui.View; import com.jpexs.helpers.CancellableWorker; diff --git a/src/com/jpexs/decompiler/flash/gui/abc/DialogMissingSymbolHandler.java b/src/com/jpexs/decompiler/flash/gui/abc/DialogMissingSymbolHandler.java index 8aa8193c4..5caace182 100644 --- a/src/com/jpexs/decompiler/flash/gui/abc/DialogMissingSymbolHandler.java +++ b/src/com/jpexs/decompiler/flash/gui/abc/DialogMissingSymbolHandler.java @@ -1,45 +1,45 @@ -/* - * Copyright (C) 2010-2014 JPEXS - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.jpexs.decompiler.flash.gui.abc; - -import com.jpexs.decompiler.flash.AppStrings; -import com.jpexs.decompiler.flash.abc.avm2.parser.pcode.MissingSymbolHandler; -import com.jpexs.decompiler.flash.gui.View; -import javax.swing.JOptionPane; - -public class DialogMissingSymbolHandler implements MissingSymbolHandler { - - @Override - public boolean missingString(String value) { - return View.showConfirmDialog(null, AppStrings.translate("message.constant.new.string").replace("%value%", value), AppStrings.translate("message.constant.new.string.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION; - } - - @Override - public boolean missingInt(long value) { - return View.showConfirmDialog(null, AppStrings.translate("message.constant.new.integer").replace("%value%", "" + value), AppStrings.translate("message.constant.new.integer.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION; - } - - @Override - public boolean missingUInt(long value) { - return View.showConfirmDialog(null, AppStrings.translate("message.constant.new.unsignedinteger").replace("%value%", "" + value), AppStrings.translate("message.constant.new.unsignedinteger.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION; - } - - @Override - public boolean missingDouble(double value) { - return View.showConfirmDialog(null, AppStrings.translate("message.constant.new.double").replace("%value%", "" + value), AppStrings.translate("message.constant.new.double.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION; - } -} +/* + * Copyright (C) 2010-2014 JPEXS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.jpexs.decompiler.flash.gui.abc; + +import com.jpexs.decompiler.flash.abc.avm2.parser.pcode.MissingSymbolHandler; +import com.jpexs.decompiler.flash.gui.AppStrings; +import com.jpexs.decompiler.flash.gui.View; +import javax.swing.JOptionPane; + +public class DialogMissingSymbolHandler implements MissingSymbolHandler { + + @Override + public boolean missingString(String value) { + return View.showConfirmDialog(null, AppStrings.translate("message.constant.new.string").replace("%value%", value), AppStrings.translate("message.constant.new.string.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION; + } + + @Override + public boolean missingInt(long value) { + return View.showConfirmDialog(null, AppStrings.translate("message.constant.new.integer").replace("%value%", "" + value), AppStrings.translate("message.constant.new.integer.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION; + } + + @Override + public boolean missingUInt(long value) { + return View.showConfirmDialog(null, AppStrings.translate("message.constant.new.unsignedinteger").replace("%value%", "" + value), AppStrings.translate("message.constant.new.unsignedinteger.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION; + } + + @Override + public boolean missingDouble(double value) { + return View.showConfirmDialog(null, AppStrings.translate("message.constant.new.double").replace("%value%", "" + value), AppStrings.translate("message.constant.new.double.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION; + } +} diff --git a/src/com/jpexs/decompiler/flash/gui/abc/MethodCodePanel.java b/src/com/jpexs/decompiler/flash/gui/abc/MethodCodePanel.java index 0df5d6733..f5accf41a 100644 --- a/src/com/jpexs/decompiler/flash/gui/abc/MethodCodePanel.java +++ b/src/com/jpexs/decompiler/flash/gui/abc/MethodCodePanel.java @@ -1,173 +1,173 @@ -/* - * Copyright (C) 2010-2014 JPEXS - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.jpexs.decompiler.flash.gui.abc; - -import com.jpexs.decompiler.flash.AppStrings; -import com.jpexs.decompiler.flash.abc.ABC; -import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; -import com.jpexs.decompiler.flash.abc.types.traits.Trait; -import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode; -import com.jpexs.decompiler.flash.gui.Main; -import com.jpexs.decompiler.flash.gui.View; -import java.awt.BorderLayout; -import java.awt.Font; -import java.awt.Insets; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import javax.swing.BoxLayout; -import javax.swing.JButton; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JToggleButton; - -/** - * - * @author JPEXS - */ -public class MethodCodePanel extends JPanel implements ActionListener { - - static final String ACTION_GRAPH = "GRAPH"; - static final String ACTION_HEX = "HEX"; - static final String ACTION_HEX_ONLY = "HEXONLY"; - - private final ASMSourceEditorPane sourceTextArea; - public JPanel buttonsPanel; - private final JToggleButton hexButton; - private final JToggleButton hexOnlyButton; - - public void focusEditor() { - sourceTextArea.requestFocusInWindow(); - } - - public String getTraitName() { - return sourceTextArea.getName(); - } - - public void setIgnoreCarret(boolean ignoreCarret) { - sourceTextArea.setIgnoreCarret(ignoreCarret); - } - - public void hilighOffset(long offset) { - sourceTextArea.hilighOffset(offset); - } - - public void hilighSpecial(String type, int index) { - sourceTextArea.hilighSpecial(type, index); - } - - public void setBodyIndex(int bodyIndex, ABC abc, Trait trait) { - sourceTextArea.setBodyIndex(bodyIndex, abc, sourceTextArea.getName(), trait); - } - - public void setBodyIndex(int bodyIndex, ABC abc, String name, Trait trait) { - sourceTextArea.setBodyIndex(bodyIndex, abc, name, trait); - } - - public int getBodyIndex() { - return sourceTextArea.bodyIndex; - } - - public void clear() { - sourceTextArea.clear(); - } - - public boolean save(ConstantPool constants) { - return sourceTextArea.save(constants); - } - - public MethodCodePanel(DecompiledEditorPane decompiledEditor) { - sourceTextArea = new ASMSourceEditorPane(decompiledEditor); - - setLayout(new BorderLayout()); - add(new JScrollPane(sourceTextArea), BorderLayout.CENTER); - sourceTextArea.setContentType("text/flasm3"); - sourceTextArea.setFont(new Font("Monospaced", Font.PLAIN, sourceTextArea.getFont().getSize())); - - buttonsPanel = new JPanel(); - buttonsPanel.setLayout(new BoxLayout(buttonsPanel, BoxLayout.X_AXIS)); - - JButton graphButton = new JButton(View.getIcon("graph16")); - graphButton.setActionCommand(ACTION_GRAPH); - graphButton.addActionListener(this); - graphButton.setToolTipText(AppStrings.translate("button.viewgraph")); - graphButton.setMargin(new Insets(3, 3, 3, 3)); - - hexButton = new JToggleButton(View.getIcon("hexas16")); - hexButton.setActionCommand(ACTION_HEX); - hexButton.addActionListener(this); - hexButton.setToolTipText(AppStrings.translate("button.viewhex")); - hexButton.setMargin(new Insets(3, 3, 3, 3)); - - hexOnlyButton = new JToggleButton(View.getIcon("hex16")); - hexOnlyButton.setActionCommand(ACTION_HEX_ONLY); - hexOnlyButton.addActionListener(this); - hexOnlyButton.setToolTipText(AppStrings.translate("button.viewhex")); - hexOnlyButton.setMargin(new Insets(3, 3, 3, 3)); - - buttonsPanel.add(graphButton); - buttonsPanel.add(hexButton); - buttonsPanel.add(hexOnlyButton); - buttonsPanel.add(new JPanel()); - // buttonsPanel.add(saveButton); - // buttonsPan.add(execButton); - - add(buttonsPanel, BorderLayout.NORTH); - } - - @Override - public void actionPerformed(ActionEvent e) { - if (Main.isWorking()) { - return; - } - - switch (e.getActionCommand()) { - case ACTION_GRAPH: - sourceTextArea.graph(); - break; - case ACTION_HEX: - case ACTION_HEX_ONLY: - if (e.getActionCommand() == ACTION_HEX) { - hexOnlyButton.setSelected(false); - } else { - hexButton.setSelected(false); - } - sourceTextArea.setHex(getExportMode(), false); - break; - } - } - - private ScriptExportMode getExportMode() { - ScriptExportMode exportMode = hexOnlyButton.isSelected() ? ScriptExportMode.HEX - : (hexButton.isSelected() ? ScriptExportMode.PCODE_HEX : ScriptExportMode.PCODE); - return exportMode; - } - - public void setEditMode(boolean val) { - ScriptExportMode exportMode = getExportMode(); - if (val) { - sourceTextArea.setHex(exportMode == ScriptExportMode.HEX ? ScriptExportMode.HEX : ScriptExportMode.PCODE, false); - } else { - if (exportMode != ScriptExportMode.PCODE) { - sourceTextArea.setHex(exportMode, false); - } - } - - sourceTextArea.setEditable(val); - sourceTextArea.getCaret().setVisible(true); - buttonsPanel.setVisible(!val); - } -} +/* + * Copyright (C) 2010-2014 JPEXS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.jpexs.decompiler.flash.gui.abc; + +import com.jpexs.decompiler.flash.abc.ABC; +import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; +import com.jpexs.decompiler.flash.abc.types.traits.Trait; +import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode; +import com.jpexs.decompiler.flash.gui.AppStrings; +import com.jpexs.decompiler.flash.gui.Main; +import com.jpexs.decompiler.flash.gui.View; +import java.awt.BorderLayout; +import java.awt.Font; +import java.awt.Insets; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import javax.swing.BoxLayout; +import javax.swing.JButton; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JToggleButton; + +/** + * + * @author JPEXS + */ +public class MethodCodePanel extends JPanel implements ActionListener { + + static final String ACTION_GRAPH = "GRAPH"; + static final String ACTION_HEX = "HEX"; + static final String ACTION_HEX_ONLY = "HEXONLY"; + + private final ASMSourceEditorPane sourceTextArea; + public JPanel buttonsPanel; + private final JToggleButton hexButton; + private final JToggleButton hexOnlyButton; + + public void focusEditor() { + sourceTextArea.requestFocusInWindow(); + } + + public String getTraitName() { + return sourceTextArea.getName(); + } + + public void setIgnoreCarret(boolean ignoreCarret) { + sourceTextArea.setIgnoreCarret(ignoreCarret); + } + + public void hilighOffset(long offset) { + sourceTextArea.hilighOffset(offset); + } + + public void hilighSpecial(String type, int index) { + sourceTextArea.hilighSpecial(type, index); + } + + public void setBodyIndex(int bodyIndex, ABC abc, Trait trait) { + sourceTextArea.setBodyIndex(bodyIndex, abc, sourceTextArea.getName(), trait); + } + + public void setBodyIndex(int bodyIndex, ABC abc, String name, Trait trait) { + sourceTextArea.setBodyIndex(bodyIndex, abc, name, trait); + } + + public int getBodyIndex() { + return sourceTextArea.bodyIndex; + } + + public void clear() { + sourceTextArea.clear(); + } + + public boolean save(ConstantPool constants) { + return sourceTextArea.save(constants); + } + + public MethodCodePanel(DecompiledEditorPane decompiledEditor) { + sourceTextArea = new ASMSourceEditorPane(decompiledEditor); + + setLayout(new BorderLayout()); + add(new JScrollPane(sourceTextArea), BorderLayout.CENTER); + sourceTextArea.setContentType("text/flasm3"); + sourceTextArea.setFont(new Font("Monospaced", Font.PLAIN, sourceTextArea.getFont().getSize())); + + buttonsPanel = new JPanel(); + buttonsPanel.setLayout(new BoxLayout(buttonsPanel, BoxLayout.X_AXIS)); + + JButton graphButton = new JButton(View.getIcon("graph16")); + graphButton.setActionCommand(ACTION_GRAPH); + graphButton.addActionListener(this); + graphButton.setToolTipText(AppStrings.translate("button.viewgraph")); + graphButton.setMargin(new Insets(3, 3, 3, 3)); + + hexButton = new JToggleButton(View.getIcon("hexas16")); + hexButton.setActionCommand(ACTION_HEX); + hexButton.addActionListener(this); + hexButton.setToolTipText(AppStrings.translate("button.viewhex")); + hexButton.setMargin(new Insets(3, 3, 3, 3)); + + hexOnlyButton = new JToggleButton(View.getIcon("hex16")); + hexOnlyButton.setActionCommand(ACTION_HEX_ONLY); + hexOnlyButton.addActionListener(this); + hexOnlyButton.setToolTipText(AppStrings.translate("button.viewhex")); + hexOnlyButton.setMargin(new Insets(3, 3, 3, 3)); + + buttonsPanel.add(graphButton); + buttonsPanel.add(hexButton); + buttonsPanel.add(hexOnlyButton); + buttonsPanel.add(new JPanel()); + // buttonsPanel.add(saveButton); + // buttonsPan.add(execButton); + + add(buttonsPanel, BorderLayout.NORTH); + } + + @Override + public void actionPerformed(ActionEvent e) { + if (Main.isWorking()) { + return; + } + + switch (e.getActionCommand()) { + case ACTION_GRAPH: + sourceTextArea.graph(); + break; + case ACTION_HEX: + case ACTION_HEX_ONLY: + if (e.getActionCommand() == ACTION_HEX) { + hexOnlyButton.setSelected(false); + } else { + hexButton.setSelected(false); + } + sourceTextArea.setHex(getExportMode(), false); + break; + } + } + + private ScriptExportMode getExportMode() { + ScriptExportMode exportMode = hexOnlyButton.isSelected() ? ScriptExportMode.HEX + : (hexButton.isSelected() ? ScriptExportMode.PCODE_HEX : ScriptExportMode.PCODE); + return exportMode; + } + + public void setEditMode(boolean val) { + ScriptExportMode exportMode = getExportMode(); + if (val) { + sourceTextArea.setHex(exportMode == ScriptExportMode.HEX ? ScriptExportMode.HEX : ScriptExportMode.PCODE, false); + } else { + if (exportMode != ScriptExportMode.PCODE) { + sourceTextArea.setHex(exportMode, false); + } + } + + sourceTextArea.setEditable(val); + sourceTextArea.getCaret().setVisible(true); + buttonsPanel.setVisible(!val); + } +} diff --git a/src/com/jpexs/decompiler/flash/gui/abc/NewTraitDialog.java b/src/com/jpexs/decompiler/flash/gui/abc/NewTraitDialog.java index 053d11b66..0bc9a221c 100644 --- a/src/com/jpexs/decompiler/flash/gui/abc/NewTraitDialog.java +++ b/src/com/jpexs/decompiler/flash/gui/abc/NewTraitDialog.java @@ -1,179 +1,179 @@ -/* - * Copyright (C) 2010-2014 JPEXS - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.jpexs.decompiler.flash.gui.abc; - -import com.jpexs.decompiler.flash.AppStrings; -import com.jpexs.decompiler.flash.abc.types.Namespace; -import com.jpexs.decompiler.flash.abc.types.traits.Trait; -import com.jpexs.decompiler.flash.gui.AppDialog; -import com.jpexs.decompiler.flash.gui.View; -import java.awt.BorderLayout; -import java.awt.Container; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JComboBox; -import javax.swing.JComponent; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JTextField; -import javax.swing.event.AncestorEvent; -import javax.swing.event.AncestorListener; - -/** - * - * @author JPEXS - */ -public class NewTraitDialog extends AppDialog implements ActionListener { - - static final String ACTION_OK = "OK"; - static final String ACTION_CANCEL = "CANCEL"; - - private static final int modifiers[] = new int[]{ - Namespace.KIND_PACKAGE, - Namespace.KIND_PRIVATE, - Namespace.KIND_PROTECTED, - Namespace.KIND_NAMESPACE, - Namespace.KIND_PACKAGE_INTERNAL, - Namespace.KIND_EXPLICIT, - Namespace.KIND_STATIC_PROTECTED - }; - private static final int types[] = new int[]{ - Trait.TRAIT_METHOD, - Trait.TRAIT_GETTER, - Trait.TRAIT_SETTER, - Trait.TRAIT_CONST, - Trait.TRAIT_SLOT - }; - private final JComboBox accessComboBox; - private final JComboBox typeComboBox; - private final JCheckBox staticCheckbox; - private final JTextField nameField; - - public boolean getStatic() { - return staticCheckbox.isSelected(); - } - - public int getNamespaceKind() { - return modifiers[accessComboBox.getSelectedIndex()]; - } - - public int getTraitType() { - return types[typeComboBox.getSelectedIndex()]; - } - - public String getTraitName() { - return nameField.getText(); - } - - public NewTraitDialog() { - setSize(500, 300); - setTitle(translate("dialog.title")); - View.centerScreen(this); - View.setWindowIcon(this); - Container cnt = getContentPane(); - cnt.setLayout(new BorderLayout()); - JPanel optionsPanel = new JPanel(new FlowLayout()); - //optionsPanel.add(new JLabel(translate("label.type"))); - typeComboBox = new JComboBox<>(new String[]{ - translate("type.method"), - translate("type.getter"), - translate("type.setter"), - translate("type.const"), - translate("type.slot"),}); - staticCheckbox = new JCheckBox(translate("checkbox.static")); - optionsPanel.add(staticCheckbox); - String accessStrings[] = new String[modifiers.length]; - for (int i = 0; i < accessStrings.length; i++) { - String pref = Namespace.kindToPrefix(modifiers[i]); - String name = Namespace.kindToStr(modifiers[i]); - accessStrings[i] = (pref.isEmpty() ? "" : pref + " ") + "(" + name + ")"; - } - - //optionsPanel.add(new JLabel(translate("label.access"))); - accessComboBox = new JComboBox<>(accessStrings); - optionsPanel.add(accessComboBox); - - optionsPanel.add(typeComboBox); - - //optionsPanel.add(new JLabel(translate("label.name"))); - nameField = new JTextField(); - nameField.setPreferredSize(new Dimension(300, nameField.getPreferredSize().height)); - optionsPanel.add(nameField); - - cnt.add(optionsPanel, BorderLayout.CENTER); - JPanel buttonsPanel = new JPanel(new FlowLayout()); - JButton buttonOk = new JButton(AppStrings.translate("button.ok")); - buttonOk.setActionCommand(ACTION_OK); - buttonOk.addActionListener(this); - JButton buttonCancel = new JButton(AppStrings.translate("button.cancel")); - buttonCancel.setActionCommand(ACTION_CANCEL); - buttonCancel.addActionListener(this); - buttonsPanel.add(buttonOk); - buttonsPanel.add(buttonCancel); - cnt.add(buttonsPanel, BorderLayout.SOUTH); - pack(); - setDefaultCloseOperation(HIDE_ON_CLOSE); - setModalityType(ModalityType.APPLICATION_MODAL); - - nameField.addAncestorListener(new AncestorListener() { - @Override - public void ancestorAdded(AncestorEvent event) { - JComponent component = event.getComponent(); - component.requestFocusInWindow(); - } - - @Override - public void ancestorRemoved(AncestorEvent event) { - } - - @Override - public void ancestorMoved(AncestorEvent event) { - } - }); - getRootPane().setDefaultButton(buttonOk); - } - - public boolean display() { - nameField.setText(""); - setVisible(true); - return result; - } - private boolean result = false; - - @Override - public void actionPerformed(ActionEvent e) { - switch (e.getActionCommand()) { - case ACTION_OK: - if (nameField.getText().trim().isEmpty()) { - View.showMessageDialog(null, translate("error.name"), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE); - return; - } - result = true; - setVisible(false); - break; - case ACTION_CANCEL: - result = false; - setVisible(false); - break; - } - - } -} +/* + * Copyright (C) 2010-2014 JPEXS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.jpexs.decompiler.flash.gui.abc; + +import com.jpexs.decompiler.flash.abc.types.Namespace; +import com.jpexs.decompiler.flash.abc.types.traits.Trait; +import com.jpexs.decompiler.flash.gui.AppDialog; +import com.jpexs.decompiler.flash.gui.AppStrings; +import com.jpexs.decompiler.flash.gui.View; +import java.awt.BorderLayout; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JComboBox; +import javax.swing.JComponent; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JTextField; +import javax.swing.event.AncestorEvent; +import javax.swing.event.AncestorListener; + +/** + * + * @author JPEXS + */ +public class NewTraitDialog extends AppDialog implements ActionListener { + + static final String ACTION_OK = "OK"; + static final String ACTION_CANCEL = "CANCEL"; + + private static final int modifiers[] = new int[]{ + Namespace.KIND_PACKAGE, + Namespace.KIND_PRIVATE, + Namespace.KIND_PROTECTED, + Namespace.KIND_NAMESPACE, + Namespace.KIND_PACKAGE_INTERNAL, + Namespace.KIND_EXPLICIT, + Namespace.KIND_STATIC_PROTECTED + }; + private static final int types[] = new int[]{ + Trait.TRAIT_METHOD, + Trait.TRAIT_GETTER, + Trait.TRAIT_SETTER, + Trait.TRAIT_CONST, + Trait.TRAIT_SLOT + }; + private final JComboBox accessComboBox; + private final JComboBox typeComboBox; + private final JCheckBox staticCheckbox; + private final JTextField nameField; + + public boolean getStatic() { + return staticCheckbox.isSelected(); + } + + public int getNamespaceKind() { + return modifiers[accessComboBox.getSelectedIndex()]; + } + + public int getTraitType() { + return types[typeComboBox.getSelectedIndex()]; + } + + public String getTraitName() { + return nameField.getText(); + } + + public NewTraitDialog() { + setSize(500, 300); + setTitle(translate("dialog.title")); + View.centerScreen(this); + View.setWindowIcon(this); + Container cnt = getContentPane(); + cnt.setLayout(new BorderLayout()); + JPanel optionsPanel = new JPanel(new FlowLayout()); + //optionsPanel.add(new JLabel(translate("label.type"))); + typeComboBox = new JComboBox<>(new String[]{ + translate("type.method"), + translate("type.getter"), + translate("type.setter"), + translate("type.const"), + translate("type.slot"),}); + staticCheckbox = new JCheckBox(translate("checkbox.static")); + optionsPanel.add(staticCheckbox); + String accessStrings[] = new String[modifiers.length]; + for (int i = 0; i < accessStrings.length; i++) { + String pref = Namespace.kindToPrefix(modifiers[i]); + String name = Namespace.kindToStr(modifiers[i]); + accessStrings[i] = (pref.isEmpty() ? "" : pref + " ") + "(" + name + ")"; + } + + //optionsPanel.add(new JLabel(translate("label.access"))); + accessComboBox = new JComboBox<>(accessStrings); + optionsPanel.add(accessComboBox); + + optionsPanel.add(typeComboBox); + + //optionsPanel.add(new JLabel(translate("label.name"))); + nameField = new JTextField(); + nameField.setPreferredSize(new Dimension(300, nameField.getPreferredSize().height)); + optionsPanel.add(nameField); + + cnt.add(optionsPanel, BorderLayout.CENTER); + JPanel buttonsPanel = new JPanel(new FlowLayout()); + JButton buttonOk = new JButton(AppStrings.translate("button.ok")); + buttonOk.setActionCommand(ACTION_OK); + buttonOk.addActionListener(this); + JButton buttonCancel = new JButton(AppStrings.translate("button.cancel")); + buttonCancel.setActionCommand(ACTION_CANCEL); + buttonCancel.addActionListener(this); + buttonsPanel.add(buttonOk); + buttonsPanel.add(buttonCancel); + cnt.add(buttonsPanel, BorderLayout.SOUTH); + pack(); + setDefaultCloseOperation(HIDE_ON_CLOSE); + setModalityType(ModalityType.APPLICATION_MODAL); + + nameField.addAncestorListener(new AncestorListener() { + @Override + public void ancestorAdded(AncestorEvent event) { + JComponent component = event.getComponent(); + component.requestFocusInWindow(); + } + + @Override + public void ancestorRemoved(AncestorEvent event) { + } + + @Override + public void ancestorMoved(AncestorEvent event) { + } + }); + getRootPane().setDefaultButton(buttonOk); + } + + public boolean display() { + nameField.setText(""); + setVisible(true); + return result; + } + private boolean result = false; + + @Override + public void actionPerformed(ActionEvent e) { + switch (e.getActionCommand()) { + case ACTION_OK: + if (nameField.getText().trim().isEmpty()) { + View.showMessageDialog(null, translate("error.name"), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE); + return; + } + result = true; + setVisible(false); + break; + case ACTION_CANCEL: + result = false; + setVisible(false); + break; + } + + } +} diff --git a/src/com/jpexs/decompiler/flash/gui/abc/SlotConstTraitDetailPanel.java b/src/com/jpexs/decompiler/flash/gui/abc/SlotConstTraitDetailPanel.java index ea234b375..38fef426c 100644 --- a/src/com/jpexs/decompiler/flash/gui/abc/SlotConstTraitDetailPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/abc/SlotConstTraitDetailPanel.java @@ -1,142 +1,142 @@ -/* - * Copyright (C) 2010-2014 JPEXS - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.jpexs.decompiler.flash.gui.abc; - -import com.jpexs.decompiler.flash.AppStrings; -import com.jpexs.decompiler.flash.abc.ABC; -import com.jpexs.decompiler.flash.abc.avm2.parser.ParseException; -import com.jpexs.decompiler.flash.abc.avm2.parser.pcode.ASM3Parser; -import com.jpexs.decompiler.flash.abc.types.ValueKind; -import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst; -import com.jpexs.decompiler.flash.configuration.Configuration; -import com.jpexs.decompiler.flash.gui.View; -import com.jpexs.decompiler.flash.helpers.HilightedTextWriter; -import com.jpexs.decompiler.flash.helpers.hilight.Highlighting; -import java.awt.BorderLayout; -import java.io.IOException; -import java.io.StringReader; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.swing.JEditorPane; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.event.CaretEvent; -import javax.swing.event.CaretListener; - -/** - * - * @author JPEXS - */ -public class SlotConstTraitDetailPanel extends JPanel implements TraitDetail { - - public JEditorPane slotConstEditor; - private ABC abc; - private TraitSlotConst trait; - private boolean showWarning = false; - private List specialHilights; - private boolean ignoreCaret = false; - - public SlotConstTraitDetailPanel(final DecompiledEditorPane editor) { - slotConstEditor = new LineMarkedEditorPane(); - setLayout(new BorderLayout()); - add(new JScrollPane(slotConstEditor), BorderLayout.CENTER); - slotConstEditor.setContentType("text/flasm3"); - slotConstEditor.addCaretListener(new CaretListener() { - @Override - public void caretUpdate(CaretEvent e) { - if (ignoreCaret) { - return; - } - Highlighting spec = Highlighting.search(specialHilights, slotConstEditor.getCaretPosition()); - if (spec != null) { - editor.hilightSpecial(spec.getPropertyString("subtype"), (int) (long) spec.getPropertyLong("index")); - slotConstEditor.getCaret().setVisible(true); - } - } - }); - } - - public void hilightSpecial(Highlighting special) { - Highlighting sel = null; - for (Highlighting h : specialHilights) { - if (h.getPropertyString("subtype").equals(special.getPropertyString("subtype"))) { - if (h.getPropertyString("index").equals(special.getPropertyString("index"))) { - sel = h; - break; - } - } - } - if (sel != null) { - ignoreCaret = true; - slotConstEditor.setCaretPosition(sel.startPos); - slotConstEditor.getCaret().setVisible(true); - ignoreCaret = false; - } - } - - public void load(TraitSlotConst trait, ABC abc, boolean isStatic) { - this.abc = abc; - this.trait = trait; - HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), true); - writer.appendNoHilight("trait "); - writer.hilightSpecial(abc.constants.multinameToString(trait.name_index), "traitname"); - writer.appendNoHilight(" "); - writer.hilightSpecial(trait.isConst() ? "const" : "slot", "traittype"); - writer.appendNoHilight(" slotid "); - writer.hilightSpecial("" + trait.slot_id, "slotid"); - writer.appendNoHilight(" type "); - writer.hilightSpecial(abc.constants.multinameToString(trait.type_index), "traittypename"); - writer.appendNoHilight(" value "); - writer.hilightSpecial((new ValueKind(trait.value_index, trait.value_kind).toASMString(abc.constants)), "traitvalue"); - String s = writer.toString(); - specialHilights = writer.specialHilights; - showWarning = trait.isConst() || isStatic; - slotConstEditor.setText(s); - } - - @Override - public boolean save() { - try {//(slotConstEditor.getText(), trait, abc) - if (!ASM3Parser.parseSlotConst(new StringReader(slotConstEditor.getText()), abc.constants, trait)) { - return false; - } - } catch (ParseException ex) { - View.showMessageDialog(slotConstEditor, ex.text, AppStrings.translate("error.slotconst.typevalue"), JOptionPane.ERROR_MESSAGE); - return false; - } catch (IOException ex) { - Logger.getLogger(SlotConstTraitDetailPanel.class.getName()).log(Level.SEVERE, null, ex); - return false; - } - return true; - } - - @Override - public void setEditMode(boolean val) { - if (val && active) { - JOptionPane.showMessageDialog(null, AppStrings.translate("warning.initializers"), AppStrings.translate("message.warning"), JOptionPane.WARNING_MESSAGE); - } - slotConstEditor.setEditable(val); - } - private boolean active = false; - - @Override - public void setActive(boolean val) { - this.active = val; - } -} +/* + * Copyright (C) 2010-2014 JPEXS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.jpexs.decompiler.flash.gui.abc; + +import com.jpexs.decompiler.flash.abc.ABC; +import com.jpexs.decompiler.flash.abc.avm2.parser.ParseException; +import com.jpexs.decompiler.flash.abc.avm2.parser.pcode.ASM3Parser; +import com.jpexs.decompiler.flash.abc.types.ValueKind; +import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst; +import com.jpexs.decompiler.flash.configuration.Configuration; +import com.jpexs.decompiler.flash.gui.AppStrings; +import com.jpexs.decompiler.flash.gui.View; +import com.jpexs.decompiler.flash.helpers.HilightedTextWriter; +import com.jpexs.decompiler.flash.helpers.hilight.Highlighting; +import java.awt.BorderLayout; +import java.io.IOException; +import java.io.StringReader; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.swing.JEditorPane; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.event.CaretEvent; +import javax.swing.event.CaretListener; + +/** + * + * @author JPEXS + */ +public class SlotConstTraitDetailPanel extends JPanel implements TraitDetail { + + public JEditorPane slotConstEditor; + private ABC abc; + private TraitSlotConst trait; + private boolean showWarning = false; + private List specialHilights; + private boolean ignoreCaret = false; + + public SlotConstTraitDetailPanel(final DecompiledEditorPane editor) { + slotConstEditor = new LineMarkedEditorPane(); + setLayout(new BorderLayout()); + add(new JScrollPane(slotConstEditor), BorderLayout.CENTER); + slotConstEditor.setContentType("text/flasm3"); + slotConstEditor.addCaretListener(new CaretListener() { + @Override + public void caretUpdate(CaretEvent e) { + if (ignoreCaret) { + return; + } + Highlighting spec = Highlighting.search(specialHilights, slotConstEditor.getCaretPosition()); + if (spec != null) { + editor.hilightSpecial(spec.getPropertyString("subtype"), (int) (long) spec.getPropertyLong("index")); + slotConstEditor.getCaret().setVisible(true); + } + } + }); + } + + public void hilightSpecial(Highlighting special) { + Highlighting sel = null; + for (Highlighting h : specialHilights) { + if (h.getPropertyString("subtype").equals(special.getPropertyString("subtype"))) { + if (h.getPropertyString("index").equals(special.getPropertyString("index"))) { + sel = h; + break; + } + } + } + if (sel != null) { + ignoreCaret = true; + slotConstEditor.setCaretPosition(sel.startPos); + slotConstEditor.getCaret().setVisible(true); + ignoreCaret = false; + } + } + + public void load(TraitSlotConst trait, ABC abc, boolean isStatic) { + this.abc = abc; + this.trait = trait; + HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), true); + writer.appendNoHilight("trait "); + writer.hilightSpecial(abc.constants.multinameToString(trait.name_index), "traitname"); + writer.appendNoHilight(" "); + writer.hilightSpecial(trait.isConst() ? "const" : "slot", "traittype"); + writer.appendNoHilight(" slotid "); + writer.hilightSpecial("" + trait.slot_id, "slotid"); + writer.appendNoHilight(" type "); + writer.hilightSpecial(abc.constants.multinameToString(trait.type_index), "traittypename"); + writer.appendNoHilight(" value "); + writer.hilightSpecial((new ValueKind(trait.value_index, trait.value_kind).toASMString(abc.constants)), "traitvalue"); + String s = writer.toString(); + specialHilights = writer.specialHilights; + showWarning = trait.isConst() || isStatic; + slotConstEditor.setText(s); + } + + @Override + public boolean save() { + try {//(slotConstEditor.getText(), trait, abc) + if (!ASM3Parser.parseSlotConst(new StringReader(slotConstEditor.getText()), abc.constants, trait)) { + return false; + } + } catch (ParseException ex) { + View.showMessageDialog(slotConstEditor, ex.text, AppStrings.translate("error.slotconst.typevalue"), JOptionPane.ERROR_MESSAGE); + return false; + } catch (IOException ex) { + Logger.getLogger(SlotConstTraitDetailPanel.class.getName()).log(Level.SEVERE, null, ex); + return false; + } + return true; + } + + @Override + public void setEditMode(boolean val) { + if (val && active) { + JOptionPane.showMessageDialog(null, AppStrings.translate("warning.initializers"), AppStrings.translate("message.warning"), JOptionPane.WARNING_MESSAGE); + } + slotConstEditor.setEditable(val); + } + private boolean active = false; + + @Override + public void setActive(boolean val) { + this.active = val; + } +} diff --git a/src/com/jpexs/decompiler/flash/gui/abc/TraitsListItem.java b/src/com/jpexs/decompiler/flash/gui/abc/TraitsListItem.java index 89843ec4a..3112d43e5 100644 --- a/src/com/jpexs/decompiler/flash/gui/abc/TraitsListItem.java +++ b/src/com/jpexs/decompiler/flash/gui/abc/TraitsListItem.java @@ -16,13 +16,13 @@ */ package com.jpexs.decompiler.flash.gui.abc; -import com.jpexs.decompiler.flash.AppStrings; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.types.traits.Trait; import com.jpexs.decompiler.flash.abc.types.traits.TraitMethodGetterSetter; import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst; import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode; +import com.jpexs.decompiler.flash.gui.AppStrings; import com.jpexs.decompiler.flash.helpers.HilightedTextWriter; import com.jpexs.decompiler.flash.helpers.NulWriter; import com.jpexs.decompiler.flash.tags.ABCContainerTag; diff --git a/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java b/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java index 54156b208..f404af8c6 100644 --- a/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java @@ -16,7 +16,6 @@ */ package com.jpexs.decompiler.flash.gui.action; -import com.jpexs.decompiler.flash.AppStrings; import com.jpexs.decompiler.flash.DisassemblyListener; import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.action.Action; @@ -29,6 +28,7 @@ import com.jpexs.decompiler.flash.action.swf4.ActionPush; import com.jpexs.decompiler.flash.action.swf4.ConstantIndex; import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode; +import com.jpexs.decompiler.flash.gui.AppStrings; import com.jpexs.decompiler.flash.gui.GraphDialog; import com.jpexs.decompiler.flash.gui.HeaderLabel; import com.jpexs.decompiler.flash.gui.Main; @@ -361,8 +361,7 @@ public class ActionPanel extends JPanel implements ActionListener, SearchListene int percent = 0; String phase = ""; - @Override - public void progress(String phase, long pos, long total) { + private void progress(String phase, long pos, long total) { if (total < 1) { return; } @@ -373,6 +372,21 @@ public class ActionPanel extends JPanel implements ActionListener, SearchListene setEditorText("; " + AppStrings.translate("work.disassembling") + " - " + phase + " " + percent + "%...", "text/flasm"); } } + + @Override + public void progressReading(long pos, long total) { + progress(AppStrings.translate("disassemblingProgress.reading"), pos, total); + } + + @Override + public void progressToString(long pos, long total) { + progress(AppStrings.translate("disassemblingProgress.toString"), pos, total); + } + + @Override + public void progressDeobfuscating(long pos, long total) { + progress(AppStrings.translate("disassemblingProgress.deobfuscating"), pos, total); + } }; return listener; } diff --git a/src/com/jpexs/decompiler/flash/gui/generictageditors/ColorEditor.java b/src/com/jpexs/decompiler/flash/gui/generictageditors/ColorEditor.java index 66658c161..414cce831 100644 --- a/src/com/jpexs/decompiler/flash/gui/generictageditors/ColorEditor.java +++ b/src/com/jpexs/decompiler/flash/gui/generictageditors/ColorEditor.java @@ -1,179 +1,179 @@ -/* - * Copyright (C) 2010-2014 JPEXS - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.jpexs.decompiler.flash.gui.generictageditors; - -import com.jpexs.decompiler.flash.AppStrings; -import com.jpexs.decompiler.flash.types.ARGB; -import com.jpexs.decompiler.flash.types.RGB; -import com.jpexs.decompiler.flash.types.RGBA; -import java.awt.Color; -import java.awt.Cursor; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.Graphics; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.FocusAdapter; -import java.awt.event.FocusEvent; -import java.lang.reflect.Field; -import javax.swing.BorderFactory; -import javax.swing.JButton; -import javax.swing.JColorChooser; -import javax.swing.JPanel; -import javax.swing.border.BevelBorder; - -/** - * - * @author JPEXS - */ -public class ColorEditor extends JPanel implements GenericTagEditor, ActionListener { - - private final Object obj; - private final Field field; - private final int index; - private final Class type; - private final String fieldName; - private Color color; - public static final int COLOR_TYPE_RGB = 0; - public static final int COLOR_TYPE_RGBA = 1; - public static final int COLOR_TYPE_ARGB = 2; - private int colorType; - private JButton buttonChange; - - public int getColorType() { - return colorType; - } - - public ColorEditor(String fieldName, Object obj, Field field, int index, Class type) { - this.obj = obj; - this.field = field; - this.index = index; - this.type = type; - this.fieldName = fieldName; - try { - Object val = ReflectionTools.getValue(obj, field, index); - if (val instanceof RGBA) { - colorType = COLOR_TYPE_RGBA; - } else if (val instanceof RGB) { - colorType = COLOR_TYPE_RGB; - } else if (val instanceof ARGB) { - colorType = COLOR_TYPE_ARGB; - } else { - throw new IllegalArgumentException("Invalid value type"); - } - if (val instanceof RGB) { //Note: Can be RGBA too - color = ((RGB) val).toColor(); - } - if (val instanceof ARGB) { - color = ((ARGB) val).toColor(); - } - setLayout(new FlowLayout()); - - //add(colorPanel); - buttonChange = new JButton("") { - - @Override - protected void paintComponent(Graphics g) { - g.setColor(getBackground()); - g.fillRect(0, 0, getWidth(), getHeight()); - super.paintBorder(g); - } - - }; - buttonChange.setToolTipText(AppStrings.translate("button.selectcolor.hint")); - buttonChange.setCursor(new Cursor(Cursor.HAND_CURSOR)); - buttonChange.addActionListener(this); - buttonChange.setBackground(color); - buttonChange.setBorderPainted(true); - buttonChange.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED)); - Dimension colorDim = new Dimension(16, 16); - buttonChange.setSize(colorDim); - buttonChange.setPreferredSize(colorDim); - add(buttonChange); - } catch (IllegalArgumentException | IllegalAccessException ex) { - // ignore - } - - } - - @Override - public void save() { - Object val = getChangedValue(); - try { - ReflectionTools.setValue(obj, field, index, val); - } catch (IllegalArgumentException | IllegalAccessException ex) { - // ignore - } - } - - @Override - public void addChangeListener(final ChangeListener l) { - final GenericTagEditor t = this; - addFocusListener(new FocusAdapter() { - - @Override - public void focusLost(FocusEvent e) { - l.change(t); - } - - }); - } - - @Override - public Object getChangedValue() { - Object val = null; - switch (colorType) { - case COLOR_TYPE_RGB: - val = new RGB(color); - break; - case COLOR_TYPE_RGBA: - val = new RGBA(color); - break; - case COLOR_TYPE_ARGB: - val = new ARGB(); - break; - } - return val; - } - - @Override - public String getFieldName() { - return fieldName; - } - - @Override - public Field getField() { - return field; - } - - @Override - public void actionPerformed(ActionEvent e) { - Color newColor = JColorChooser.showDialog(null, AppStrings.translate("dialog.selectcolor.title"), color); - if (newColor != null) { - color = newColor; - buttonChange.setBackground(color); - repaint(); - } - } - - @Override - public String getReadOnlyValue() { - int h = System.identityHashCode(this); - return "     " + getChangedValue().toString(); - } - -} +/* + * Copyright (C) 2010-2014 JPEXS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.jpexs.decompiler.flash.gui.generictageditors; + +import com.jpexs.decompiler.flash.gui.AppStrings; +import com.jpexs.decompiler.flash.types.ARGB; +import com.jpexs.decompiler.flash.types.RGB; +import com.jpexs.decompiler.flash.types.RGBA; +import java.awt.Color; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Graphics; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.lang.reflect.Field; +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JColorChooser; +import javax.swing.JPanel; +import javax.swing.border.BevelBorder; + +/** + * + * @author JPEXS + */ +public class ColorEditor extends JPanel implements GenericTagEditor, ActionListener { + + private final Object obj; + private final Field field; + private final int index; + private final Class type; + private final String fieldName; + private Color color; + public static final int COLOR_TYPE_RGB = 0; + public static final int COLOR_TYPE_RGBA = 1; + public static final int COLOR_TYPE_ARGB = 2; + private int colorType; + private JButton buttonChange; + + public int getColorType() { + return colorType; + } + + public ColorEditor(String fieldName, Object obj, Field field, int index, Class type) { + this.obj = obj; + this.field = field; + this.index = index; + this.type = type; + this.fieldName = fieldName; + try { + Object val = ReflectionTools.getValue(obj, field, index); + if (val instanceof RGBA) { + colorType = COLOR_TYPE_RGBA; + } else if (val instanceof RGB) { + colorType = COLOR_TYPE_RGB; + } else if (val instanceof ARGB) { + colorType = COLOR_TYPE_ARGB; + } else { + throw new IllegalArgumentException("Invalid value type"); + } + if (val instanceof RGB) { //Note: Can be RGBA too + color = ((RGB) val).toColor(); + } + if (val instanceof ARGB) { + color = ((ARGB) val).toColor(); + } + setLayout(new FlowLayout()); + + //add(colorPanel); + buttonChange = new JButton("") { + + @Override + protected void paintComponent(Graphics g) { + g.setColor(getBackground()); + g.fillRect(0, 0, getWidth(), getHeight()); + super.paintBorder(g); + } + + }; + buttonChange.setToolTipText(AppStrings.translate("button.selectcolor.hint")); + buttonChange.setCursor(new Cursor(Cursor.HAND_CURSOR)); + buttonChange.addActionListener(this); + buttonChange.setBackground(color); + buttonChange.setBorderPainted(true); + buttonChange.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED)); + Dimension colorDim = new Dimension(16, 16); + buttonChange.setSize(colorDim); + buttonChange.setPreferredSize(colorDim); + add(buttonChange); + } catch (IllegalArgumentException | IllegalAccessException ex) { + // ignore + } + + } + + @Override + public void save() { + Object val = getChangedValue(); + try { + ReflectionTools.setValue(obj, field, index, val); + } catch (IllegalArgumentException | IllegalAccessException ex) { + // ignore + } + } + + @Override + public void addChangeListener(final ChangeListener l) { + final GenericTagEditor t = this; + addFocusListener(new FocusAdapter() { + + @Override + public void focusLost(FocusEvent e) { + l.change(t); + } + + }); + } + + @Override + public Object getChangedValue() { + Object val = null; + switch (colorType) { + case COLOR_TYPE_RGB: + val = new RGB(color); + break; + case COLOR_TYPE_RGBA: + val = new RGBA(color); + break; + case COLOR_TYPE_ARGB: + val = new ARGB(); + break; + } + return val; + } + + @Override + public String getFieldName() { + return fieldName; + } + + @Override + public Field getField() { + return field; + } + + @Override + public void actionPerformed(ActionEvent e) { + Color newColor = JColorChooser.showDialog(null, AppStrings.translate("dialog.selectcolor.title"), color); + if (newColor != null) { + color = newColor; + buttonChange.setBackground(color); + repaint(); + } + } + + @Override + public String getReadOnlyValue() { + int h = System.identityHashCode(this); + return "     " + getChangedValue().toString(); + } + +} diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties index 595e606c1..9f73cb831 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties @@ -400,29 +400,11 @@ errors.info = There are INFORMATIONS in the log. Click to view. errors.warning = There are WARNINGS in the log. Click to view. decompilationError = Decompilation error -decompilationError.timeout = Timeout ({0}) was reached -decompilationError.timeout.description = Not decompiled due to timeout -decompilationError.obfuscated = Code may be obfuscated -decompilationError.errorType = Error type -decompilationError.error.description = Not decompiled due to error - -#example: 1 hour and 2 minutes -timeFormat.and = and -timeFormat.hour = hour -timeFormat.hours = hours -timeFormat.minute = minute -timeFormat.minutes = minutes -timeFormat.second = second -timeFormat.seconds = seconds disassemblingProgress.toString = toString disassemblingProgress.reading = Reading disassemblingProgress.deobfuscating = Deobfuscating -decompilation.skipped = Decompilation skipped -decompilation.unsupported = Unsupported by decompiler -decompilerMark = decompiler mark -fontNotFound = Font with id=%fontId% was not found. contextmenu.moveTag = Move tag to filter.swc = SWC component files (*.swc) @@ -454,7 +436,6 @@ generictag.array.insertend = Insert %item% at the end #after version 2.0.0 contextmenu.expandAll = Expand all -binaryData.truncateWarning = %count% bytes truncated. filter.sounds = Supported sound formats (*.wav, *.mp3) filter.sounds.wav = Wave file format (*.wav) diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_ca.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_ca.properties index 971d4ef19..3d4987cdd 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_ca.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_ca.properties @@ -400,29 +400,11 @@ errors.info = Hi han INFORMACIONS al registre. Fes clic per veure-les. errors.warning = Hi han AVISOS al registre. Fes clic per veure'ls. decompilationError = Error de descompilaci\u00f3 -decompilationError.timeout = S'ha at\u00e8s el temps l\u00edmit ({0}) -decompilationError.timeout.description = No s'ha descompilat degut al l\u00edmit de temps -decompilationError.obfuscated = El codi pot estar ofuscat -decompilationError.errorType = Tipus d'error -decompilationError.error.description = No s'ha descompilat degut a l'error - -#example: 1 hour and 2 minutes -timeFormat.and = i -timeFormat.hour = hora -timeFormat.hours = hores -timeFormat.minute = minut -timeFormat.minutes = minuts -timeFormat.second = segon -timeFormat.seconds = segons disassemblingProgress.toString = toString disassemblingProgress.reading = S'est\u00e0 llegint disassemblingProgress.deobfuscating = S'est\u00e0 desofuscant -decompilation.skipped = S'ha om\u00e8s la descompilaci\u00f3 -decompilation.unsupported = No suportat pel descompilador -decompilerMark = marca del descompilar -fontNotFound = No s'ha trobat la tipografia amb id=%fontId%. contextmenu.moveTag = Despla\u00e7a l'etiqueta a filter.swc = Fitxers de component SWC (*.swc) @@ -454,7 +436,6 @@ generictag.array.insertend = Insereix %item% al final #after version 2.0.0 contextmenu.expandAll = Expandeix-ho tot -binaryData.truncateWarning = S'han truncat %count% bytes. filter.sounds = Formats de so suportats (*.wav, *.mp3) filter.sounds.wav = Fitxer de format Wave (*.wav) diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_cs.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_cs.properties index 5cbd64e2e..47e382c35 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_cs.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_cs.properties @@ -401,29 +401,11 @@ errors.info = V logu jsou INFORMACE. Klikn\u011bte pro zobrazen\u00ed. errors.warning = V logu jsou VAROV\u00c1N\u00cd. Klikn\u011bte pro zobrazen\u00ed. decompilationError = Chyba dekompilace -decompilationError.timeout = \u010casov\u00fd limit ({0}) vypr\u0161el -decompilationError.timeout.description = Nedekompilov\u00e1no kv\u016fli \u010dasov\u00e9mu limitu -decompilationError.obfuscated = K\u00f3d m\u016f\u017ee b\u00fdt obfuskov\u00e1n -decompilationError.errorType = Typ chyby -decompilationError.error.description = Nedekompilov\u00e1no kv\u016fli chyb\u011b - -#example: 1 hour and 2 minutes -timeFormat.and = a -timeFormat.hour = hodina -timeFormat.hours = hodin -timeFormat.minute = minuta -timeFormat.minutes = minut -timeFormat.second = vte\u0159ina -timeFormat.seconds = vte\u0159in disassemblingProgress.toString = toString disassemblingProgress.reading = \u010cten\u00ed disassemblingProgress.deobfuscating = Deobfuskace -decompilation.skipped = Dekompilace p\u0159esko\u010dena -decompilation.unsupported = Nepodporov\u00e1no dekompil\u00e1torem -decompilerMark = zna\u010dka dekompil\u00e1toru -fontNotFound = P\u00edsmo s id=%fontId% nebylo nalezeno. contextmenu.moveTag = P\u0159esunout tag do filter.swc = SWC soubory komponent (*.swc) @@ -455,7 +437,6 @@ generictag.array.insertend = Vlo\u017eit %item% na konec #after version 2.0.0 contextmenu.expandAll = Rozbalit v\u0161e -binaryData.truncateWarning = %count% byt\u016f o\u0159\u00edznuto. filter.sounds = Podporovan\u00e9 zvukov\u00e9 form\u00e1ty (*.wav, *.mp3) filter.sounds.wav = Wave form\u00e1t (*.wav) @@ -508,4 +489,4 @@ header.framerate = Frekvence sn\u00edmk\u016f: header.framecount = Po\u010det sn\u00edmk\u016f: header.displayrect = Zobrazen\u00fd obd\u00e9ln\u00edk: header.displayrect.value.twips = %xmin%,%ymin% => %xmax%,%ymax% twip\u016f -header.displayrect.value.pixels = %xmin%,%ymin% => %xmax%,%ymax% pixel\u016f \ No newline at end of file +header.displayrect.value.pixels = %xmin%,%ymin% => %xmax%,%ymax% pixel\u016f diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_es.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_es.properties index 7c22e4f1e..7d946649e 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_es.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_es.properties @@ -334,6 +334,7 @@ error.font.nocharacter = Fuente de origen seleccionado no contiene caracteres "% warning.initializers = Los campos est\u00e1ticos y constantes son a menudo inicializados en el inicializador.\nEditar el valor aqu\u00ed usualmente no es suficiente! #after version 1.7.0u1: + menu.tools.searchmemory = Buscar SWFs en memoria menu.file.reload = Recargar message.confirm.reload = Esta acci\u00f3n eliminar\u00e1 todos lo cambios no guardados y recargar\u00e1 el archivo SWF otra vez.\nDesea continuar? @@ -399,33 +400,11 @@ errors.info = Hay INFORMATIONS en el log. Clickear para ver. errors.warning = Hay WARNINGS en el log. Clickear para ver. decompilationError = Error de decompilaci\u00f3n -decompilationError.timeout = Tiempo de espera ({0}) alcanzado -decompilationError.timeout.description = No decompilado debido al tiempo de espera -decompilationError.obfuscated = El c\u00f3digo puede estar ofuscado -decompilationError.errorType = Tipo de error -decompilationError.error.description = No decompilado debido a un error - -#example: 1 hour and 2 minutes -timeFormat.and = y -timeFormat.hour = hora -timeFormat.hours = horas -timeFormat.minute = minuto -timeFormat.minutes = minutos -timeFormat.second = segundo -timeFormat.seconds = segundos disassemblingProgress.toString = toString disassemblingProgress.reading = Leyendo disassemblingProgress.deobfuscating = Desofuscando -decompilation.skipped = Decompilaci\u00f3n omitida -decompilation.unsupported = No soportado por el decompilador -decompilerMark = marca del decompilador -open.error = Error -open.error.fileNotFound = Archivo no encontrado -open.error.cannotOpen = No se puede abrir el archivo - -fontNotFound = La fuente con id=%fontId% no se encontr\u00f3. contextmenu.moveTag = Mover etiqueta a filter.swc = Archivo de componente SWC (*.swc) @@ -453,4 +432,4 @@ generictag.array.insertbeginning = Insertar %item% al comienzo generictag.array.insertbefore = Insertar %item% antes generictag.array.remove = Remover %item% generictag.array.insertafter = Insertar %item% despu\u00e9s -generictag.array.insertend = Insertar %item% al final \ No newline at end of file +generictag.array.insertend = Insertar %item% al final diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_fr.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_fr.properties index db5defc6c..59424a5e5 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_fr.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_fr.properties @@ -400,29 +400,11 @@ errors.info = Il y a des INFORMATIONS inscrites dans le journal. Cliquez pour le errors.warning = Il y a des ALARMES inscrites dans le journal. Cliquez pour le consulter. decompilationError = Erreur de d\u00e9compilation -decompilationError.timeout = Le d\u00e9lais d'attente de ({0}) est expir\u00e9 -decompilationError.timeout.description = Non d\u00e9compil\u00e9 car le d\u00e9lais d'attente a \u00e9t\u00e9 atteint -decompilationError.obfuscated = Le code est probablement obsfusqu\u00e9 -decompilationError.errorType = Type d'erreur -decompilationError.error.description = Non d\u00e9compil\u00e9 car il y a des erreurs - -#example: 1 hour and 2 minutes -timeFormat.and = et -timeFormat.hour = heure -timeFormat.hours = heures -timeFormat.minute = minute -timeFormat.minutes = minutes -timeFormat.second = seconde -timeFormat.seconds = secondes disassemblingProgress.toString = total trait\u00e9 disassemblingProgress.reading = Lecture disassemblingProgress.deobfuscating = D\u00e9sobfuscation -decompilation.skipped = D\u00e9compilation abandonn\u00e9 -decompilation.unsupported = Non support\u00e9 par le d\u00e9compileur -decompilerMark = Marqueur du d\u00e9compileur -fontNotFound = La police de caract\u00e8res n\u00ba%fontId% est introuvable. contextmenu.moveTag = D\u00e9placer la balise vers filter.swc = Biblioth\u00e8ques SWC (*.swc) @@ -454,7 +436,6 @@ generictag.array.insertend = Ins\u00e9rer %item% \u00e0 la fin #after version 2.0.0 contextmenu.expandAll = ExpD\u00e9velopper tout -binaryData.truncateWarning = %count% octets tronqu\u00e9s. filter.sounds = Formats audios support\u00e9s (*.wav, *.mp3) filter.sounds.wav = Audio brut Wave (*.wav) @@ -490,4 +471,4 @@ menu.settings.dumpView = Dump view menu.view = Vue menu.file.view.resources = Ressources -menu.file.view.hex = Vue hexad\u00e9cimale \ No newline at end of file +menu.file.view.hex = Vue hexad\u00e9cimale 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 ba493aaa5..05da53b8c 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_hu.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_hu.properties @@ -400,29 +400,11 @@ errors.info = INFORM\u00c1CI\u00d3K vannak a napl\u00f3ban. Kattintson ide a meg errors.warning = FIGYELMEZTET\u00c9SEK vannak a napl\u00f3ban. Kattintson ide a megjelen\u00edt\u00e9shez. decompilationError = Visszaford\u00edt\u00e1si hiba -decompilationError.timeout = Id\u0151t\u00fall\u00e9p\u00e9s ({0}) -decompilationError.timeout.description = Id\u0151t\u00fall\u00e9p\u00e9s miatt nem lett visszaford\u00edtva -decompilationError.obfuscated = K\u00f3d tal\u00e1n obfuszk\u00e1lva van -decompilationError.errorType = Hiba t\u00edpus -decompilationError.error.description = Hiba miatt nem lett visszaford\u00edtva - -#example: 1 hour and 2 minutes -timeFormat.and = \u00e9s -timeFormat.hour = \u00f3ra -timeFormat.hours = \u00f3ra -timeFormat.minute = perc -timeFormat.minutes = perc -timeFormat.second = m\u00e1sodperc -timeFormat.seconds = m\u00e1sodperc disassemblingProgress.toString = Karakterl\u00e1ncc\u00e1 alak\u00edt\u00e1s disassemblingProgress.reading = Olvas\u00e1s disassemblingProgress.deobfuscating = Deobfuszk\u00e1l\u00e1s -decompilation.skipped = Visszaford\u00edt\u00e1s mell\u0151zve -decompilation.unsupported = Visszaford\u00edt\u00e1s nem t\u00e1mogatott -decompilerMark = visszaford\u00edt\u00e1si jel -fontNotFound = Bet\u0171t\u00edpus (id=%fontId%) nem tal\u00e1lhat\u00f3. contextmenu.moveTag = \u00c1thelyez\u00e9s ide filter.swc = SWC komponens f\u00e1jlok (*.swc) @@ -454,7 +436,6 @@ generictag.array.insertend = %item% besz\u00far\u00e1sa a v\u00e9g\u00e9re #after version 2.0.0 contextmenu.expandAll = Mindent kinyit -binaryData.truncateWarning = %count% byte lev\u00e1gva. filter.sounds = T\u00e1mogatott hang form\u00e1tumok (*.wav, *.mp3) filter.sounds.wav = Hanghull\u00e1m form\u00e1tum (*.wav) diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_nl.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_nl.properties index cc813a70f..7e92083df 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_nl.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_nl.properties @@ -334,6 +334,7 @@ error.font.nocharacter = Geselecteerde bron lettertype geen "%char%" teken bevat warning.initializers = Statische velden en constanten worden vaak in de initialiseerders ge\u00efnitialiseerd.\nHier waarde bewerken is meestal niet genoeg! #after version 1.7.0u1: + menu.tools.searchmemory = Naar SWFs in het geheugen zoeken menu.file.reload = Herladen message.confirm.reload = Hiermee annuleert U alle niet-opgeslagen veranderingen en laadt het SWF-bestand opnieuw.\nWilt U doorgaan? @@ -350,6 +351,7 @@ ColorChooser.swatchesRecentText = Recent: ColorChooser.sampleText = Voorbeeldtekst Voorbeeldtekst #after version 1.7.1: + preview.play = Spelen preview.pause = Pauzeren preview.stop = Stoppen @@ -359,6 +361,7 @@ message.confirm.removemultiple = Weet U zeker dat U %count% items\n en alle obje menu.tools.searchcache = In de browser-cache zoeken #after version 1.7.2u2 + error.trait.exists = Karaktertrek met de naam "%name%" bestaat al. button.addtrait = Karaktertrek toevoegen button.font.embed = Inbedden... @@ -397,29 +400,11 @@ errors.info = Er zijn INFORMATIES in het logboek. Klik om te zien. errors.warning = Er zijn WAARSCHUWINGEN in het logboek. Klik om te zien. decompilationError = Decompilatie fout -decompilationError.timeout = Timeout ({0}) werd bereikt -decompilationError.timeout.description = Niet gedecompileerd vanwege timeout -decompilationError.obfuscated = Code kan worden geobfusceerd -decompilationError.errorType = Fout type -decompilationError.error.description = Niet gedecompileerd gevolg van een fout - -#example: 1 hour and 2 minutes -timeFormat.and = en -timeFormat.hour = uur -timeFormat.hours = uur -timeFormat.minute = minuut -timeFormat.minutes = minuten -timeFormat.second = seconde -timeFormat.seconds = seconden disassemblingProgress.toString = Tekstweergave disassemblingProgress.reading = Aan het lezen disassemblingProgress.deobfuscating = Aan het deobfusceren -decompilation.skipped = Decompilatie overgeslagen -decompilation.unsupported = Niet ondersteund door decompiler -decompilerMark = decompiler mark -fontNotFound = Lettertype met id=%fontId% is niet gevonden. contextmenu.moveTag = Verplaats tag naar filter.swc = SWC bibliotheken (*.swc) diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_ru.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_ru.properties index 8c7f2ff43..1a3a3e351 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_ru.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_ru.properties @@ -400,29 +400,11 @@ errors.info = \u0412 \u043b\u043e\u0433\u0435 \u0435\u0441\u0442\u044c \u0432\u0 errors.warning = \u0412 \u043b\u043e\u0433\u0435 \u0435\u0441\u0442\u044c \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f! \u041a\u043b\u0438\u043a\u043d\u0438\u0442\u0435 \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430. decompilationError = \u041e\u0448\u0438\u0431\u043a\u0430 \u0434\u0435\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 -decompilationError.timeout = \u0422\u0430\u0439\u043c\u0430\u0443\u0442: ({0}) -decompilationError.timeout.description = \u0414\u0435\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f \u043f\u0440\u0435\u0440\u0432\u0430\u043d\u0430 \u0438\u0437-\u0437\u0430 \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u0430 -decompilationError.obfuscated = \u041a\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0431\u0444\u0443\u0441\u0446\u0438\u0440\u043e\u0432\u0430\u043d -decompilationError.errorType = \u0422\u0438\u043f \u043e\u0448\u0438\u0431\u043a\u0438 -decompilationError.error.description = \u0414\u0435\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f \u043f\u0440\u0435\u0440\u0432\u0430\u043d\u0430 \u0438\u0437-\u0437\u0430 \u043e\u0448\u0438\u0431\u043a\u0438 - -#example: 1 hour and 2 minutes -timeFormat.and = \u0438 -timeFormat.hour = \u0447. -timeFormat.hours = \u0447. -timeFormat.minute = \u043c\u0438\u043d. -timeFormat.minutes = \u043c\u0438\u043d. -timeFormat.second = \u0441\u0435\u043a. -timeFormat.seconds = \u0441\u0435\u043a. disassemblingProgress.toString = \u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0441\u0442\u0440\u043e\u043a disassemblingProgress.reading = \u0427\u0442\u0435\u043d\u0438\u0435 disassemblingProgress.deobfuscating = \u0414\u0435\u043e\u0431\u0444\u0443\u0441\u043a\u0430\u0446\u0438\u044f -decompilation.skipped = \u0414\u0435\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u0430 -decompilation.unsupported = \u041d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u0435\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u043c -decompilerMark = decompiler mark -fontNotFound = \u0428\u0440\u0438\u0444\u0442 \u0441 id=%fontId% \u043d\u0435 \u0431\u044b\u043b \u043d\u0430\u0439\u0434\u0435\u043d. contextmenu.moveTag = \u041f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0442\u044d\u0433 filter.swc = SWC \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 (*.swc) @@ -454,7 +436,6 @@ generictag.array.insertend = \u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044c %i #after version 2.0.0 contextmenu.expandAll = \u0420\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0432\u0441\u0435 -binaryData.truncateWarning = \u0411\u0430\u0439\u0442 \u043d\u0435 \u0443\u043c\u0435\u0441\u0442\u0438\u043b\u043e\u0441\u044c: %count% filter.sounds = \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u0437\u0432\u0443\u043a\u043e\u0432\u044b\u0435 \u0444\u043e\u0440\u043c\u0430\u0442\u044b (*.wav,*.mp3) filter.sounds.wav = Wave \u0444\u043e\u0440\u043c\u0430\u0442 (*.wav) diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_sv.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_sv.properties index ea883b85d..e9a163017 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_sv.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_sv.properties @@ -296,7 +296,7 @@ FileChooser.listViewButtonToolTip.textAndMnemonic = Lista FileChooser.lookInLabel.textAndMnemonic = Kolla i: FileChooser.newFolderActionLabel.textAndMnemonic = Ny mapp FileChooser.newFolderToolTip.textAndMnemonic = Skapa Ny Mapp -FileChooser.refreshActionLabel.textAndMnemonic = Refresh +FileChooser.refreshActionLabel.textAndMnemonic = Refresh FileChooser.saveInLabel.textAndMnemonic = Spara i: FileChooser.upFolderToolTip.textAndMnemonic = Upp en niv\u00e5 FileChooser.viewMenuButtonAccessibleName = Visa meny @@ -308,9 +308,9 @@ FileChooser.detailsViewActionLabelText = Detaljer FileChooser.refreshActionLabelText = Uppdatera FileChooser.sortMenuLabelText = Ordna ikoner efter FileChooser.viewMenuLabelText = Visa -FileChooser.fileSizeKiloBytes = {0} KB -FileChooser.fileSizeMegaBytes = {0} MB -FileChooser.fileSizeGigaBytes = {0} GB +FileChooser.fileSizeKiloBytes = {0} KB +FileChooser.fileSizeMegaBytes = {0} MB +FileChooser.fileSizeGigaBytes = {0} GB FileChooser.folderNameLabelText = Mappnamn: error.occured = Ett fel uppstod : %error% @@ -397,30 +397,13 @@ button.preview = F\u00f6rhandsgranska button.reset = \u00c5terst\u00e4ll errors.info = Det \u00e4r information i loggen. Klicka f\u00f6r att visa. errors.warning = Det \u00e4r varningar i loggen. Klicka f\u00f6r att visa.. -decompilationError = Dekompilering felmeddelande -decompilationError.timeout = Timeout ({0}) n\u00e5ddes -decompilationError.timeout.description = Dekompilerades inte p\u00e5grund av en timeout -decompilationError.obfuscated = Koden kan vara obfuskerad -decompilationError.errorType = Fel typ -decompilationError.error.description = Ej dekompilerad p\u00e5grund av fel -#example: 1 hour and 2 minutes -timeFormat.and = och -timeFormat.hour = timme -timeFormat.hours = timmar -timeFormat.minute = minut -timeFormat.minutes = minuter -timeFormat.second = sekund -timeFormat.seconds = sekunder +decompilationError = Dekompilering felmeddelande disassemblingProgress.toString = toString disassemblingProgress.reading = L\u00e4ser disassemblingProgress.deobfuscating = Deobfuskering -decompilation.skipped = Dekompilering skippades -decompilation.unsupported = st\u00f6ds inte utav dekompileraren -decompilerMark = markera dekompilerare -fontNotFound = Typsnitt med id=%fontId% hittades inte. contextmenu.moveTag = Flytta tag till filter.swc = SWC komponent filer (*.swc) diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_uk.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_uk.properties index dea5ec4fc..c3d79b033 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_uk.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_uk.properties @@ -400,29 +400,11 @@ errors.info = \u0412 \u0436\u0443\u0440\u043d\u0430\u043b\u0456 \u0454 \u0432\u0 errors.warning = \u0412 \u0436\u0443\u0440\u043d\u0430\u043b\u0456 \u0454 \u043f\u043e\u043f\u0435\u0440\u0435\u0434\u0436\u0435\u043d\u043d\u044f. \u041d\u0430\u0442\u0438\u0441\u043d\u0456\u0442\u044c, \u0449\u043e\u0431 \u043f\u043e\u0434\u0438\u0432\u0438\u0442\u0438\u0441\u044f. decompilationError = \u041f\u043e\u043c\u0438\u043b\u043a\u0430 \u0434\u0435\u043a\u043e\u043c\u043f\u0456\u043b\u044f\u0446\u0456\u0457 -decompilationError.timeout = \u0422\u0430\u0439\u043c\u0430\u0443\u0442 ({0}) \u0431\u0443\u043b\u043e \u0434\u043e\u0441\u044f\u0433\u043d\u0443\u0442\u043e -decompilationError.timeout.description = \u0414\u0435\u043a\u043e\u043c\u043f\u0456\u043b\u044f\u0446\u0456\u044f \u043f\u0435\u0440\u0435\u0440\u0432\u0430\u043d\u0430 \u0447\u0435\u0440\u0435\u0437 \u0442\u0430\u0439\u043c\u0430\u0443\u0442 -decompilationError.obfuscated = \u041a\u043e\u0434 \u043c\u043e\u0436\u0435 \u0431\u0443\u0442\u0438 \u043e\u0431\u0444\u0443\u0441\u043a\u043e\u0432\u0430\u043d\u0438\u0439 -decompilationError.errorType = \u0422\u0438\u043f \u043f\u043e\u043c\u0438\u043b\u043a\u0438 -decompilationError.error.description = \u0414\u0435\u043a\u043e\u043c\u043f\u0456\u043b\u044f\u0446\u0456\u044f \u043f\u0435\u0440\u0435\u0440\u0432\u0430\u043d\u0430 \u0447\u0435\u0440\u0435\u0437 \u043f\u043e\u043c\u0438\u043b\u043a\u0443 - -#example: 1 hour and 2 minutes -timeFormat.and = \u0442\u0430 -timeFormat.hour = \u0433\u043e\u0434. -timeFormat.hours = \u0433\u043e\u0434. -timeFormat.minute = \u0445\u0432. -timeFormat.minutes = \u0445\u0432. -timeFormat.second = \u0441\u0435\u043a. -timeFormat.seconds = \u0441\u0435\u043a. disassemblingProgress.toString = \u0422\u0435\u043a\u0441\u0442\u043e\u0432\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044f disassemblingProgress.reading = \u0427\u0438\u0442\u0430\u043d\u043d\u044f disassemblingProgress.deobfuscating = \u0414\u0435\u043e\u0431\u0444\u0443\u0441\u043a\u0430\u0446\u0456\u044f -decompilation.skipped = \u0414\u0435\u043a\u043e\u043c\u043f\u0456\u043b\u044f\u0446\u0456\u044e \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043e -decompilation.unsupported = \u041d\u0435 \u043f\u0456\u0434\u0442\u0440\u0438\u043c\u0443\u0454\u0442\u044c\u0441\u044f \u0434\u0435\u043a\u043e\u043c\u043f\u0456\u043b\u044f\u0442\u043e\u0440\u043e\u043c -decompilerMark = decompiler mark -fontNotFound = \u0428\u0440\u0438\u0444\u0442 \u0437 id=%fontId% \u043d\u0435 \u0437\u043d\u0430\u0439\u0434\u0435\u043d\u043e. contextmenu.moveTag = \u041f\u0435\u0440\u0435\u043c\u0456\u0441\u0442\u0438\u0442\u0438 \u0442\u0435\u0433 filter.swc = SWC \u0431\u0456\u0431\u043b\u0456\u043e\u0442\u0435\u043a\u0438 (*.swc) diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_zh.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_zh.properties index f461de393..c71eb14ec 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_zh.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_zh.properties @@ -91,7 +91,6 @@ message.confirm.autodeobfuscate = \u81ea\u52a8\u53cd\u6df7\u6dc6\u662f\u4e00\u79 message.parallel = \u591a\u7ebf\u7a0b message.trait.saved = \u5df2\u6210\u529f\u4fdd\u5b58Trait - message.constant.new.string = \u5728\u5e38\u91cf\u8868\u4e2d\u627e\u4e0d\u5230\u5b57\u7b26\u4e32 "%value%" \uff0c\u9700\u8981\u6dfb\u52a0\u5417\uff1f message.constant.new.string.title = \u6dfb\u52a0\u5b57\u7b26\u4e32 message.constant.new.integer = \u5728\u5e38\u91cf\u8868\u4e2d\u627e\u4e0d\u5230\u6574\u6570 "%value%" \uff0c\u9700\u8981\u6dfb\u52a0\u5417\uff1f @@ -119,7 +118,6 @@ work.buildingscripttree = \u5efa\u7acb\u811a\u672c\u6811 work.deobfuscating.complete = \u53cd\u6df7\u6dc6\u5b8c\u6210 - message.search.notfound = \u6ca1\u6709\u627e\u5230\u5b57\u7b26\u4e32 "%searchtext%" . message.search.notfound.title = \u6ca1\u6709\u627e\u5230 diff --git a/src/com/jpexs/decompiler/flash/gui/player/PlayerControls.java b/src/com/jpexs/decompiler/flash/gui/player/PlayerControls.java index 9a75252a0..478b85a9d 100644 --- a/src/com/jpexs/decompiler/flash/gui/player/PlayerControls.java +++ b/src/com/jpexs/decompiler/flash/gui/player/PlayerControls.java @@ -16,7 +16,7 @@ */ package com.jpexs.decompiler.flash.gui.player; -import com.jpexs.decompiler.flash.AppStrings; +import com.jpexs.decompiler.flash.gui.AppStrings; import com.jpexs.decompiler.flash.gui.View; import java.awt.BorderLayout; import java.awt.Dimension;