mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-25 04:40:46 +00:00
Issue #677 Zoom level in export settings
This commit is contained in:
@@ -1,252 +1,298 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.ScriptPack;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.BinaryDataExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.FontExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.FramesExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.ImageExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.MorphShapeExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.MovieExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.ShapeExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.SoundExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.TextExportMode;
|
||||
import com.jpexs.decompiler.flash.tags.DefineBinaryDataTag;
|
||||
import com.jpexs.decompiler.flash.tags.DefineVideoStreamTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.FontTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.ImageTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.MorphShapeTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.ShapeTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.SoundTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.TextTag;
|
||||
import com.jpexs.decompiler.flash.treeitems.FrameNodeItem;
|
||||
import com.jpexs.decompiler.flash.treenodes.TreeNode;
|
||||
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 java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class ExportDialog extends AppDialog {
|
||||
|
||||
boolean cancelled = false;
|
||||
|
||||
String[] optionNames = {
|
||||
"shapes",
|
||||
"texts",
|
||||
"images",
|
||||
"movies",
|
||||
"sounds",
|
||||
"scripts",
|
||||
"binaryData",
|
||||
"frames",
|
||||
"fonts",
|
||||
"morphshapes"
|
||||
};
|
||||
|
||||
//Display options only when these classes found
|
||||
Class[][] objClasses = {
|
||||
{ShapeTag.class},
|
||||
{TextTag.class},
|
||||
{ImageTag.class},
|
||||
{DefineVideoStreamTag.class},
|
||||
{SoundTag.class},
|
||||
{TreeNode.class, ScriptPack.class},
|
||||
{DefineBinaryDataTag.class},
|
||||
{FrameNodeItem.class},
|
||||
{FontTag.class},
|
||||
{MorphShapeTag.class}
|
||||
};
|
||||
|
||||
//Enum classes for values
|
||||
Class[] optionClasses = {
|
||||
ShapeExportMode.class,
|
||||
TextExportMode.class,
|
||||
ImageExportMode.class,
|
||||
MovieExportMode.class,
|
||||
SoundExportMode.class,
|
||||
ScriptExportMode.class,
|
||||
BinaryDataExportMode.class,
|
||||
FramesExportMode.class,
|
||||
FontExportMode.class,
|
||||
MorphShapeExportMode.class
|
||||
};
|
||||
|
||||
private final JComboBox[] combos;
|
||||
|
||||
public <E> E getValue(Class<E> option) {
|
||||
for (int i = 0; i < optionClasses.length; i++) {
|
||||
if (option == optionClasses[i]) {
|
||||
E values[] = option.getEnumConstants();
|
||||
return values[combos[i].getSelectedIndex()];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void saveConfig() {
|
||||
String cfg = "";
|
||||
for (int i = 0; i < optionNames.length; i++) {
|
||||
int selIndex = combos[i].getSelectedIndex();
|
||||
Class c = optionClasses[i];
|
||||
Object vals[] = c.getEnumConstants();
|
||||
String key = optionNames[i] + "." + vals[selIndex].toString().toLowerCase();
|
||||
if (i > 0) {
|
||||
cfg += ",";
|
||||
}
|
||||
cfg += key;
|
||||
}
|
||||
Configuration.lastSelectedExportFormats.set(cfg);
|
||||
}
|
||||
|
||||
public ExportDialog(List<Object> exportables) {
|
||||
setTitle(translate("dialog.title"));
|
||||
addWindowListener(new WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(WindowEvent e) {
|
||||
cancelled = true;
|
||||
}
|
||||
});
|
||||
|
||||
Container cnt = getContentPane();
|
||||
cnt.setLayout(new BorderLayout());
|
||||
JPanel comboPanel = new JPanel(null);
|
||||
combos = new JComboBox[optionNames.length];
|
||||
JLabel[] labels = new JLabel[optionNames.length];
|
||||
int labWidth = 0;
|
||||
for (int i = 0; i < optionNames.length; i++) {
|
||||
labels[i] = new JLabel(optionNames[i]);
|
||||
if (labels[i].getPreferredSize().width > labWidth) {
|
||||
labWidth = labels[i].getPreferredSize().width;
|
||||
}
|
||||
}
|
||||
String exportFormatsStr = Configuration.lastSelectedExportFormats.get();
|
||||
if ("".equals(exportFormatsStr)) {
|
||||
exportFormatsStr = null;
|
||||
}
|
||||
String exportFormatsArr[] = new String[0];
|
||||
if (exportFormatsStr != null) {
|
||||
if (exportFormatsStr.contains(",")) {
|
||||
exportFormatsArr = exportFormatsStr.split(",");
|
||||
} else {
|
||||
exportFormatsArr = new String[]{exportFormatsStr};
|
||||
}
|
||||
|
||||
}
|
||||
List<String> exportFormats = Arrays.asList(exportFormatsArr);
|
||||
int comboWidth = 200;
|
||||
int top = 10;
|
||||
for (int i = 0; i < optionNames.length; i++) {
|
||||
Class c = optionClasses[i];
|
||||
Object vals[] = c.getEnumConstants();
|
||||
String names[] = new String[vals.length];
|
||||
int itemIndex = -1;
|
||||
for (int j = 0; j < vals.length; j++) {
|
||||
|
||||
String key = optionNames[i] + "." + vals[j].toString().toLowerCase();
|
||||
if (exportFormats.contains(key)) {
|
||||
itemIndex = j;
|
||||
}
|
||||
names[j] = translate(key);
|
||||
}
|
||||
|
||||
combos[i] = new JComboBox<>(names);
|
||||
if (itemIndex > -1) {
|
||||
combos[i].setSelectedIndex(itemIndex);
|
||||
}
|
||||
combos[i].setBounds(10 + labWidth + 10, top, comboWidth, combos[i].getPreferredSize().height);
|
||||
boolean exportableExists = false;
|
||||
if (exportables == null) {
|
||||
exportableExists = true;
|
||||
} else {
|
||||
for (Object e : exportables) {
|
||||
for (int j = 0; j < objClasses[i].length; j++) {
|
||||
if (objClasses[i][j].isInstance(e)) {
|
||||
exportableExists = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!exportableExists) {
|
||||
continue;
|
||||
}
|
||||
JLabel lab = new JLabel(translate(optionNames[i]));
|
||||
lab.setBounds(10, top, lab.getPreferredSize().width, lab.getPreferredSize().height);
|
||||
comboPanel.add(lab);
|
||||
comboPanel.add(combos[i]);
|
||||
top += combos[i].getHeight();
|
||||
}
|
||||
Dimension dim = new Dimension(10 + labWidth + 10 + comboWidth + 10, top + 10);
|
||||
comboPanel.setMinimumSize(dim);
|
||||
comboPanel.setPreferredSize(dim);
|
||||
cnt.add(comboPanel, BorderLayout.CENTER);
|
||||
|
||||
JPanel buttonsPanel = new JPanel(new FlowLayout());
|
||||
JButton okButton = new JButton(translate("button.ok"));
|
||||
okButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
saveConfig();
|
||||
setVisible(false);
|
||||
}
|
||||
});
|
||||
|
||||
JButton cancelButton = new JButton(translate("button.cancel"));
|
||||
cancelButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
cancelled = true;
|
||||
setVisible(false);
|
||||
}
|
||||
});
|
||||
|
||||
buttonsPanel.add(okButton);
|
||||
buttonsPanel.add(cancelButton);
|
||||
|
||||
cnt.add(buttonsPanel, BorderLayout.SOUTH);
|
||||
pack();
|
||||
//setSize(245, top + getInsets().top);
|
||||
View.centerScreen(this);
|
||||
View.setWindowIcon(this);
|
||||
getRootPane().setDefaultButton(okButton);
|
||||
setModal(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVisible(boolean b) {
|
||||
if (b) {
|
||||
cancelled = false;
|
||||
}
|
||||
super.setVisible(b);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.ScriptPack;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.BinaryDataExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.FontExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.FramesExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.ImageExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.MorphShapeExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.MovieExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.ShapeExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.SoundExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.TextExportMode;
|
||||
import com.jpexs.decompiler.flash.tags.DefineBinaryDataTag;
|
||||
import com.jpexs.decompiler.flash.tags.DefineVideoStreamTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.FontTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.ImageTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.MorphShapeTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.ShapeTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.SoundTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.TextTag;
|
||||
import com.jpexs.decompiler.flash.treeitems.FrameNodeItem;
|
||||
import com.jpexs.decompiler.flash.treenodes.TreeNode;
|
||||
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 java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class ExportDialog extends AppDialog {
|
||||
|
||||
boolean cancelled = false;
|
||||
|
||||
String[] optionNames = {
|
||||
"shapes",
|
||||
"texts",
|
||||
"images",
|
||||
"movies",
|
||||
"sounds",
|
||||
"scripts",
|
||||
"binaryData",
|
||||
"frames",
|
||||
"fonts",
|
||||
"morphshapes"
|
||||
};
|
||||
|
||||
//Display options only when these classes found
|
||||
Class[][] objClasses = {
|
||||
{ShapeTag.class},
|
||||
{TextTag.class},
|
||||
{ImageTag.class},
|
||||
{DefineVideoStreamTag.class},
|
||||
{SoundTag.class},
|
||||
{TreeNode.class, ScriptPack.class},
|
||||
{DefineBinaryDataTag.class},
|
||||
{FrameNodeItem.class},
|
||||
{FontTag.class},
|
||||
{MorphShapeTag.class}
|
||||
};
|
||||
|
||||
//Enum classes for values
|
||||
Class[] optionClasses = {
|
||||
ShapeExportMode.class,
|
||||
TextExportMode.class,
|
||||
ImageExportMode.class,
|
||||
MovieExportMode.class,
|
||||
SoundExportMode.class,
|
||||
ScriptExportMode.class,
|
||||
BinaryDataExportMode.class,
|
||||
FramesExportMode.class,
|
||||
FontExportMode.class,
|
||||
MorphShapeExportMode.class
|
||||
};
|
||||
|
||||
Class[] zoomClasses = {
|
||||
ShapeExportMode.class,
|
||||
TextExportMode.class,
|
||||
FramesExportMode.class,
|
||||
MorphShapeExportMode.class
|
||||
};
|
||||
|
||||
private final JComboBox[] combos;
|
||||
private JTextField zoomTextField = new JTextField();
|
||||
|
||||
public <E> E getValue(Class<E> option) {
|
||||
for (int i = 0; i < optionClasses.length; i++) {
|
||||
if (option == optionClasses[i]) {
|
||||
E values[] = option.getEnumConstants();
|
||||
return values[combos[i].getSelectedIndex()];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public double getZoom(){
|
||||
return Double.parseDouble(zoomTextField.getText())/100;
|
||||
}
|
||||
|
||||
|
||||
private void saveConfig() {
|
||||
String cfg = "";
|
||||
for (int i = 0; i < optionNames.length; i++) {
|
||||
int selIndex = combos[i].getSelectedIndex();
|
||||
Class c = optionClasses[i];
|
||||
Object vals[] = c.getEnumConstants();
|
||||
String key = optionNames[i] + "." + vals[selIndex].toString().toLowerCase();
|
||||
if (i > 0) {
|
||||
cfg += ",";
|
||||
}
|
||||
cfg += key;
|
||||
}
|
||||
Configuration.lastSelectedExportZoom.set(Double.parseDouble(zoomTextField.getText()));
|
||||
Configuration.lastSelectedExportFormats.set(cfg);
|
||||
}
|
||||
|
||||
public ExportDialog(List<Object> exportables) {
|
||||
setTitle(translate("dialog.title"));
|
||||
addWindowListener(new WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(WindowEvent e) {
|
||||
cancelled = true;
|
||||
}
|
||||
});
|
||||
|
||||
Container cnt = getContentPane();
|
||||
cnt.setLayout(new BorderLayout());
|
||||
JPanel comboPanel = new JPanel(null);
|
||||
combos = new JComboBox[optionNames.length];
|
||||
JLabel[] labels = new JLabel[optionNames.length];
|
||||
int labWidth = 0;
|
||||
for (int i = 0; i < optionNames.length; i++) {
|
||||
labels[i] = new JLabel(optionNames[i]);
|
||||
if (labels[i].getPreferredSize().width > labWidth) {
|
||||
labWidth = labels[i].getPreferredSize().width;
|
||||
}
|
||||
}
|
||||
String exportFormatsStr = Configuration.lastSelectedExportFormats.get();
|
||||
if ("".equals(exportFormatsStr)) {
|
||||
exportFormatsStr = null;
|
||||
}
|
||||
String exportFormatsArr[] = new String[0];
|
||||
if (exportFormatsStr != null) {
|
||||
if (exportFormatsStr.contains(",")) {
|
||||
exportFormatsArr = exportFormatsStr.split(",");
|
||||
} else {
|
||||
exportFormatsArr = new String[]{exportFormatsStr};
|
||||
}
|
||||
|
||||
}
|
||||
List<String> exportFormats = Arrays.asList(exportFormatsArr);
|
||||
int comboWidth = 200;
|
||||
int top = 10;
|
||||
boolean zoomable = false;
|
||||
for (int i = 0; i < optionNames.length; i++) {
|
||||
Class c = optionClasses[i];
|
||||
Object vals[] = c.getEnumConstants();
|
||||
String names[] = new String[vals.length];
|
||||
int itemIndex = -1;
|
||||
for (int j = 0; j < vals.length; j++) {
|
||||
|
||||
String key = optionNames[i] + "." + vals[j].toString().toLowerCase();
|
||||
if (exportFormats.contains(key)) {
|
||||
itemIndex = j;
|
||||
}
|
||||
names[j] = translate(key);
|
||||
}
|
||||
|
||||
combos[i] = new JComboBox<>(names);
|
||||
if (itemIndex > -1) {
|
||||
combos[i].setSelectedIndex(itemIndex);
|
||||
}
|
||||
combos[i].setBounds(10 + labWidth + 10, top, comboWidth, combos[i].getPreferredSize().height);
|
||||
boolean exportableExists = false;
|
||||
if (exportables == null) {
|
||||
exportableExists = true;
|
||||
} else {
|
||||
for (Object e : exportables) {
|
||||
for (int j = 0; j < objClasses[i].length; j++) {
|
||||
if (objClasses[i][j].isInstance(e)) {
|
||||
exportableExists = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!exportableExists) {
|
||||
continue;
|
||||
}
|
||||
if(Arrays.asList(zoomClasses).contains(c)){
|
||||
zoomable = true;
|
||||
}
|
||||
JLabel lab = new JLabel(translate(optionNames[i]));
|
||||
lab.setBounds(10, top, lab.getPreferredSize().width, lab.getPreferredSize().height);
|
||||
comboPanel.add(lab);
|
||||
comboPanel.add(combos[i]);
|
||||
top += combos[i].getHeight();
|
||||
}
|
||||
int zoomWidth = 50;
|
||||
if(zoomable){
|
||||
top+=2;
|
||||
JLabel zlab = new JLabel(translate("zoom"));
|
||||
zlab.setBounds(10, top+4, zlab.getPreferredSize().width, zlab.getPreferredSize().height);
|
||||
zoomTextField.setBounds(10 + labWidth + 10, top, zoomWidth, zoomTextField.getPreferredSize().height);
|
||||
JLabel pctLabel = new JLabel(translate("zoom.percent"));
|
||||
pctLabel.setBounds(10 + labWidth + 10 + zoomWidth + 5, top+4, 20, pctLabel.getPreferredSize().height);
|
||||
|
||||
comboPanel.add(zlab);
|
||||
comboPanel.add(zoomTextField);
|
||||
comboPanel.add(pctLabel);
|
||||
top+=zoomTextField.getHeight();
|
||||
}
|
||||
|
||||
Dimension dim = new Dimension(10 + labWidth + 10 + comboWidth + 10, top + 10);
|
||||
comboPanel.setMinimumSize(dim);
|
||||
comboPanel.setPreferredSize(dim);
|
||||
cnt.add(comboPanel, BorderLayout.CENTER);
|
||||
|
||||
JPanel buttonsPanel = new JPanel(new FlowLayout());
|
||||
JButton okButton = new JButton(translate("button.ok"));
|
||||
okButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try{
|
||||
saveConfig();
|
||||
}catch(NumberFormatException nfe){
|
||||
JOptionPane.showMessageDialog(ExportDialog.this, translate("zoom.invalid"),AppStrings.translate("error"),JOptionPane.ERROR_MESSAGE);
|
||||
zoomTextField.requestFocusInWindow();
|
||||
return;
|
||||
}
|
||||
setVisible(false);
|
||||
}
|
||||
});
|
||||
|
||||
JButton cancelButton = new JButton(translate("button.cancel"));
|
||||
cancelButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
cancelled = true;
|
||||
setVisible(false);
|
||||
}
|
||||
});
|
||||
|
||||
buttonsPanel.add(okButton);
|
||||
buttonsPanel.add(cancelButton);
|
||||
|
||||
cnt.add(buttonsPanel, BorderLayout.SOUTH);
|
||||
pack();
|
||||
View.centerScreen(this);
|
||||
View.setWindowIcon(this);
|
||||
getRootPane().setDefaultButton(okButton);
|
||||
setModal(true);
|
||||
String pct = ""+Configuration.lastSelectedExportZoom.get()*100;
|
||||
if(pct.endsWith(".0")){
|
||||
pct = pct.substring(0,pct.length()-2);
|
||||
}
|
||||
zoomTextField.setText(pct);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVisible(boolean b) {
|
||||
if (b) {
|
||||
cancelled = false;
|
||||
}
|
||||
super.setVisible(b);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,6 +86,7 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis
|
||||
private final IconPanel iconPanel;
|
||||
private int time = 0;
|
||||
private int selectedDepth = -1;
|
||||
public double zoom = 1.0;
|
||||
|
||||
public void selectDepth(int depth) {
|
||||
if (depth != selectedDepth) {
|
||||
@@ -518,8 +519,8 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis
|
||||
}
|
||||
}
|
||||
|
||||
private static SerializableImage getFrame(SWF swf, int frame, int time, Timelined drawable, DepthState stateUnderCursor, int mouseButton, int selectedDepth) {
|
||||
String key = "drawable_" + frame + "_" + drawable.hashCode() + "_" + mouseButton + "_depth" + selectedDepth + "_" + (stateUnderCursor == null ? "out" : stateUnderCursor.hashCode());
|
||||
private static SerializableImage getFrame(SWF swf, int frame, int time, Timelined drawable, DepthState stateUnderCursor, int mouseButton, int selectedDepth, double zoom) {
|
||||
String key = "drawable_" + frame + "_" + drawable.hashCode() + "_" + mouseButton + "_depth" + selectedDepth + "_" + (stateUnderCursor == null ? "out" : stateUnderCursor.hashCode())+"_"+zoom;
|
||||
SerializableImage img = SWF.getFromCache(key);
|
||||
if (img == null) {
|
||||
if (drawable instanceof BoundedTag) {
|
||||
@@ -528,13 +529,14 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis
|
||||
if (rect == null) { //??? Why?
|
||||
rect = new RECT(0, 0, 1, 1);
|
||||
}
|
||||
int width = rect.getWidth();
|
||||
int height = rect.getHeight();
|
||||
int width = (int)(rect.getWidth()*zoom);
|
||||
int height = (int)(rect.getHeight()*zoom);
|
||||
SerializableImage image = new SerializableImage((int) (width / SWF.unitDivisor) + 1,
|
||||
(int) (height / SWF.unitDivisor) + 1, SerializableImage.TYPE_INT_ARGB);
|
||||
image.fillTransparent();
|
||||
Matrix m = new Matrix();
|
||||
m.translate(-rect.Xmin, -rect.Ymin);
|
||||
m.scale(zoom);
|
||||
drawable.getTimeline().toImage(frame, time, frame, stateUnderCursor, mouseButton, image, m, new ColorTransform());
|
||||
|
||||
Graphics2D gg = (Graphics2D) image.getGraphics();
|
||||
@@ -551,6 +553,10 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis
|
||||
DrawableTag dt = (DrawableTag) cht;
|
||||
Shape outline = dt.getOutline(0, ds.time, ds.ratio, stateUnderCursor, mouseButton, new Matrix(ds.matrix));
|
||||
Rectangle bounds = outline.getBounds();
|
||||
bounds.x *= zoom;
|
||||
bounds.y *= zoom;
|
||||
bounds.width *= zoom;
|
||||
bounds.height *= zoom;
|
||||
bounds.x /= 20;
|
||||
bounds.y /= 20;
|
||||
bounds.width /= 20;
|
||||
@@ -597,7 +603,7 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis
|
||||
mat.translateX = swf.displayRect.Xmin;
|
||||
mat.translateY = swf.displayRect.Ymin;
|
||||
updatePos(lastMouseEvent, false);
|
||||
SerializableImage img = getFrame(swf, frame, time, timelined, stateUnderCursor, mouseButton, selectedDepth);
|
||||
SerializableImage img = getFrame(swf, frame, time, timelined, stateUnderCursor, mouseButton, selectedDepth, zoom);
|
||||
List<Integer> sounds = new ArrayList<>();
|
||||
List<String> soundClasses = new ArrayList<>();
|
||||
timeline.getSounds(frame, time, stateUnderCursor, mouseButton, sounds, soundClasses);
|
||||
|
||||
@@ -1090,11 +1090,11 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
ret.addAll(new ImageExporter().exportImages(handler, selFile + File.separator + "images", images,
|
||||
new ImageExportSettings(export.getValue(ImageExportMode.class))));
|
||||
ret.addAll(new ShapeExporter().exportShapes(handler, selFile + File.separator + "shapes", shapes,
|
||||
new ShapeExportSettings(export.getValue(ShapeExportMode.class))));
|
||||
new ShapeExportSettings(export.getValue(ShapeExportMode.class),export.getZoom())));
|
||||
ret.addAll(new MorphShapeExporter().exportMorphShapes(handler, selFile + File.separator + "morphshapes", morphshapes,
|
||||
new MorphShapeExportSettings(export.getValue(MorphShapeExportMode.class))));
|
||||
new MorphShapeExportSettings(export.getValue(MorphShapeExportMode.class),export.getZoom())));
|
||||
ret.addAll(new TextExporter().exportTexts(handler, selFile + File.separator + "texts", texts,
|
||||
new TextExportSettings(export.getValue(TextExportMode.class), Configuration.textExportSingleFile.get())));
|
||||
new TextExportSettings(export.getValue(TextExportMode.class), Configuration.textExportSingleFile.get(), export.getZoom())));
|
||||
ret.addAll(new MovieExporter().exportMovies(handler, selFile + File.separator + "movies", movies,
|
||||
new MovieExportSettings(export.getValue(MovieExportMode.class))));
|
||||
ret.addAll(new SoundExporter().exportSounds(handler, selFile + File.separator + "sounds", sounds,
|
||||
@@ -1106,7 +1106,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
|
||||
for (Entry<Integer, List<Integer>> entry : frames.entrySet()) {
|
||||
ret.addAll(swf.exportFrames(handler, selFile + File.separator + "frames", entry.getKey(), entry.getValue(),
|
||||
new FramesExportSettings(export.getValue(FramesExportMode.class))));
|
||||
new FramesExportSettings(export.getValue(FramesExportMode.class),export.getZoom())));
|
||||
}
|
||||
List<ABCContainerTag> abcList = swf.abcList;
|
||||
if (abcPanel != null) {
|
||||
@@ -1675,11 +1675,11 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
swf.exportImages(errorHandler, selFile + File.separator + "images",
|
||||
new ImageExportSettings(export.getValue(ImageExportMode.class)));
|
||||
swf.exportShapes(errorHandler, selFile + File.separator + "shapes",
|
||||
new ShapeExportSettings(export.getValue(ShapeExportMode.class)));
|
||||
new ShapeExportSettings(export.getValue(ShapeExportMode.class),export.getZoom()));
|
||||
swf.exportMorphShapes(errorHandler, selFile + File.separator + "morphshapes",
|
||||
new MorphShapeExportSettings(export.getValue(MorphShapeExportMode.class)));
|
||||
new MorphShapeExportSettings(export.getValue(MorphShapeExportMode.class),export.getZoom()));
|
||||
swf.exportTexts(errorHandler, selFile + File.separator + "texts",
|
||||
new TextExportSettings(export.getValue(TextExportMode.class), Configuration.textExportSingleFile.get()));
|
||||
new TextExportSettings(export.getValue(TextExportMode.class), Configuration.textExportSingleFile.get(),export.getZoom()));
|
||||
swf.exportMovies(errorHandler, selFile + File.separator + "movies",
|
||||
new MovieExportSettings(export.getValue(MovieExportMode.class)));
|
||||
swf.exportSounds(errorHandler, selFile + File.separator + "sounds",
|
||||
@@ -1689,11 +1689,11 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
swf.exportFonts(errorHandler, selFile + File.separator + "fonts",
|
||||
new FontExportSettings(export.getValue(FontExportMode.class)));
|
||||
swf.exportFrames(errorHandler, selFile + File.separator + "frames", 0, null,
|
||||
new FramesExportSettings(export.getValue(FramesExportMode.class)));
|
||||
new FramesExportSettings(export.getValue(FramesExportMode.class),export.getZoom()));
|
||||
for (CharacterTag c : swf.characters.values()) {
|
||||
if (c instanceof DefineSpriteTag) {
|
||||
swf.exportFrames(errorHandler, selFile + File.separator + "frames", c.getCharacterId(), null,
|
||||
new FramesExportSettings(export.getValue(FramesExportMode.class)));
|
||||
new FramesExportSettings(export.getValue(FramesExportMode.class),export.getZoom()));
|
||||
}
|
||||
}
|
||||
swf.exportActionScript(errorHandler, selFile, exportMode, Configuration.parallelSpeedUp.get());
|
||||
|
||||
@@ -176,7 +176,7 @@ public class PreviewImage extends JPanel {
|
||||
if (treeItem instanceof FrameNodeItem) {
|
||||
FrameNodeItem fn = (FrameNodeItem) treeItem;
|
||||
RECT rect = swf.displayRect;
|
||||
imgSrc = SWF.frameToImageGet(swf.getTimeline(), fn.getFrame() - 1, 0, null, 0, rect, new Matrix(), new ColorTransform(), null, true);
|
||||
imgSrc = SWF.frameToImageGet(swf.getTimeline(), fn.getFrame() - 1, 0, null, 0, rect, new Matrix(), new ColorTransform(), null, true,1.0);
|
||||
width = (imgSrc.getWidth());
|
||||
height = (imgSrc.getHeight());
|
||||
} else if (treeItem instanceof ImageTag) {
|
||||
|
||||
@@ -66,3 +66,7 @@ frames.pdf = PDF
|
||||
fonts = Fonts
|
||||
fonts.ttf = TTF
|
||||
fonts.woff = WOFF
|
||||
|
||||
zoom = Zoom
|
||||
zoom.percent = %
|
||||
zoom.invalid = Invalid zoom value.
|
||||
Reference in New Issue
Block a user