mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-25 11:10:56 +00:00
Checkstyle fix
This commit is contained in:
@@ -37,20 +37,20 @@ import javax.swing.JRadioButton;
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class ConvertPlaceObjectTypeDialog extends AppDialog {
|
||||
|
||||
|
||||
private List<JRadioButton> radios = new ArrayList<>();
|
||||
|
||||
|
||||
private int result = 0;
|
||||
|
||||
|
||||
public ConvertPlaceObjectTypeDialog(Window owner, int currentPlaceObjectNum, int min) {
|
||||
super(owner);
|
||||
setTitle(translate("dialog.title"));
|
||||
JPanel radioPanel = new JPanel();
|
||||
radioPanel.setLayout(new BoxLayout(radioPanel, BoxLayout.Y_AXIS));
|
||||
ButtonGroup radioGroup = new ButtonGroup();
|
||||
|
||||
|
||||
JButton okButton = new JButton(translate("button.ok"));
|
||||
|
||||
|
||||
for (int i = 1; i <= 4; i++) {
|
||||
String text = "PlaceObject" + (i > 1 ? "" + i : "");
|
||||
if (i == min) {
|
||||
@@ -63,39 +63,38 @@ public class ConvertPlaceObjectTypeDialog extends AppDialog {
|
||||
radio.setSelected(true);
|
||||
}
|
||||
final int fi = i;
|
||||
radio.addActionListener(new ActionListener(){
|
||||
radio.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
okButton.setEnabled(fi != currentPlaceObjectNum);
|
||||
}
|
||||
}
|
||||
});
|
||||
radioPanel.add(radio);
|
||||
radioPanel.add(radio);
|
||||
radioGroup.add(radio);
|
||||
radios.add(radio);
|
||||
radios.add(radio);
|
||||
}
|
||||
|
||||
Container cnt = getContentPane();
|
||||
|
||||
Container cnt = getContentPane();
|
||||
cnt.setLayout(new BorderLayout());
|
||||
|
||||
|
||||
cnt.add(radioPanel, BorderLayout.CENTER);
|
||||
|
||||
|
||||
JPanel buttonsPanel = new JPanel(new FlowLayout());
|
||||
|
||||
|
||||
okButton.setEnabled(false);
|
||||
okButton.addActionListener(this::okButtonActionPerformed);
|
||||
JButton cancelButton = new JButton(translate("button.cancel"));
|
||||
cancelButton.addActionListener(this::cancelButtonActionPerformed);
|
||||
buttonsPanel.add(okButton);
|
||||
buttonsPanel.add(cancelButton);
|
||||
|
||||
|
||||
cnt.add(buttonsPanel, BorderLayout.SOUTH);
|
||||
pack();
|
||||
View.centerScreen(this);
|
||||
View.setWindowIcon(this, "placeobject");
|
||||
setModal(true);
|
||||
}
|
||||
|
||||
|
||||
private void okButtonActionPerformed(ActionEvent evt) {
|
||||
result = 0;
|
||||
for (int i = 0; i < radios.size(); i++) {
|
||||
@@ -106,16 +105,16 @@ public class ConvertPlaceObjectTypeDialog extends AppDialog {
|
||||
}
|
||||
setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
private void cancelButtonActionPerformed(ActionEvent evt) {
|
||||
setVisible(false);
|
||||
}
|
||||
|
||||
public int getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public int showDialog() {
|
||||
}
|
||||
|
||||
public int showDialog() {
|
||||
setVisible(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -36,20 +36,20 @@ import javax.swing.JRadioButton;
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class ConvertShapeTypeDialog extends AppDialog {
|
||||
|
||||
|
||||
private List<JRadioButton> radios = new ArrayList<>();
|
||||
|
||||
|
||||
private int result = 0;
|
||||
|
||||
|
||||
public ConvertShapeTypeDialog(Window owner, int currentShapeNum, int minForced, int min) {
|
||||
super(owner);
|
||||
setTitle(translate("dialog.title"));
|
||||
JPanel radioPanel = new JPanel();
|
||||
radioPanel.setLayout(new BoxLayout(radioPanel, BoxLayout.Y_AXIS));
|
||||
ButtonGroup radioGroup = new ButtonGroup();
|
||||
|
||||
|
||||
JButton okButton = new JButton(translate("button.ok"));
|
||||
|
||||
|
||||
for (int i = 1; i <= 4; i++) {
|
||||
String text = "DefineShape" + (i > 1 ? "" + i : "");
|
||||
if (i < minForced) {
|
||||
@@ -68,39 +68,38 @@ public class ConvertShapeTypeDialog extends AppDialog {
|
||||
radio.setSelected(true);
|
||||
}
|
||||
final int fi = i;
|
||||
radio.addActionListener(new ActionListener(){
|
||||
radio.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
okButton.setEnabled(fi != currentShapeNum);
|
||||
}
|
||||
}
|
||||
});
|
||||
radioPanel.add(radio);
|
||||
radioPanel.add(radio);
|
||||
radioGroup.add(radio);
|
||||
radios.add(radio);
|
||||
radios.add(radio);
|
||||
}
|
||||
|
||||
Container cnt = getContentPane();
|
||||
|
||||
Container cnt = getContentPane();
|
||||
cnt.setLayout(new BorderLayout());
|
||||
|
||||
|
||||
cnt.add(radioPanel, BorderLayout.CENTER);
|
||||
|
||||
|
||||
JPanel buttonsPanel = new JPanel(new FlowLayout());
|
||||
|
||||
|
||||
okButton.setEnabled(false);
|
||||
okButton.addActionListener(this::okButtonActionPerformed);
|
||||
JButton cancelButton = new JButton(translate("button.cancel"));
|
||||
cancelButton.addActionListener(this::cancelButtonActionPerformed);
|
||||
buttonsPanel.add(okButton);
|
||||
buttonsPanel.add(cancelButton);
|
||||
|
||||
|
||||
cnt.add(buttonsPanel, BorderLayout.SOUTH);
|
||||
pack();
|
||||
View.centerScreen(this);
|
||||
View.setWindowIcon(this, "shape");
|
||||
setModal(true);
|
||||
}
|
||||
|
||||
|
||||
private void okButtonActionPerformed(ActionEvent evt) {
|
||||
result = 0;
|
||||
for (int i = 0; i < radios.size(); i++) {
|
||||
@@ -111,16 +110,16 @@ public class ConvertShapeTypeDialog extends AppDialog {
|
||||
}
|
||||
setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
private void cancelButtonActionPerformed(ActionEvent evt) {
|
||||
setVisible(false);
|
||||
}
|
||||
|
||||
public int getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public int showDialog() {
|
||||
}
|
||||
|
||||
public int showDialog() {
|
||||
setVisible(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -132,9 +132,8 @@ import org.pushingpixels.substance.api.SubstanceSkin;
|
||||
*/
|
||||
public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
|
||||
|
||||
private static final int MAX_SOUND_CHANNELS = 8; //TODO: Maybe add to Advanced settings
|
||||
|
||||
|
||||
private static final Logger logger = Logger.getLogger(ImagePanel.class.getName());
|
||||
|
||||
private final List<MediaDisplayListener> listeners = new ArrayList<>();
|
||||
@@ -182,7 +181,6 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
private int time = 0;
|
||||
|
||||
//private int selectedDepth = -1;
|
||||
|
||||
//private int freeTransformDepth = -1;
|
||||
private boolean doFreeTransform = false;
|
||||
|
||||
@@ -208,10 +206,10 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
|
||||
private Point2D registrationPoint = null;
|
||||
private Point2D registrationPointUpdated = null;
|
||||
|
||||
|
||||
private int mode = Cursor.DEFAULT_CURSOR;
|
||||
private Rectangle2D bounds;
|
||||
|
||||
|
||||
private Matrix transform;
|
||||
private AffineTransform transformUpdated;
|
||||
|
||||
@@ -262,7 +260,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
private boolean autoPlayed = false;
|
||||
|
||||
private boolean frozen = false;
|
||||
|
||||
|
||||
private boolean frozenButtons = false;
|
||||
|
||||
private boolean muted = false;
|
||||
@@ -308,57 +306,57 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
private List<java.awt.Point> showPoints2 = new ArrayList<>();
|
||||
|
||||
private int displayedFrame = 0;
|
||||
|
||||
|
||||
private JPanel topPanel;
|
||||
|
||||
|
||||
private TagNameResolverInterface tagNameResolver = new DefaultTagNameResolver();
|
||||
|
||||
|
||||
private boolean showAllDepthLevelsInfo = true;
|
||||
|
||||
|
||||
private boolean selectionMode = false;
|
||||
|
||||
|
||||
private boolean transformSelectionMode = false;
|
||||
|
||||
|
||||
private boolean multiSelect = false;
|
||||
|
||||
|
||||
private boolean inMoving = false;
|
||||
|
||||
|
||||
private List<Integer> selectedDepths = new ArrayList<>();
|
||||
|
||||
|
||||
private final List<Integer> parentFrames = new ArrayList<>();
|
||||
|
||||
|
||||
private final List<Integer> parentDepths = new ArrayList<>();
|
||||
|
||||
private final List<Timelined> parentTimelineds = new ArrayList<>();
|
||||
|
||||
public void setFrozenButtons(boolean frozenButtons) {
|
||||
this.frozenButtons = frozenButtons;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean isMultiSelect() {
|
||||
return multiSelect;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setMultiSelect(boolean multiSelect) {
|
||||
this.multiSelect = multiSelect;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setSelectionMode(boolean selectionMode) {
|
||||
this.selectionMode = selectionMode;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setTransformSelectionMode(boolean transformSelectionMode) {
|
||||
this.transformSelectionMode = transformSelectionMode;
|
||||
}
|
||||
}
|
||||
|
||||
public void setTagNameResolver(TagNameResolverInterface tagNameResolver) {
|
||||
this.tagNameResolver = tagNameResolver;
|
||||
}
|
||||
}
|
||||
|
||||
public void setShowAllDepthLevelsInfo(boolean showAllDepthLevelsInfo) {
|
||||
this.showAllDepthLevelsInfo = showAllDepthLevelsInfo;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setTopPanelVisible(boolean visible) {
|
||||
topPanel.setVisible(visible);
|
||||
}
|
||||
@@ -391,17 +389,17 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
private List<BoundsChangeListener> boundsChangeListeners = new ArrayList<>();
|
||||
|
||||
private List<PointUpdateListener> pointUpdateListeners = new ArrayList<>();
|
||||
|
||||
|
||||
private List<Runnable> transformChangeListeners = new ArrayList<>();
|
||||
|
||||
public void addTransformChangeListener(Runnable listener) {
|
||||
transformChangeListeners.add(listener);
|
||||
}
|
||||
|
||||
|
||||
public void removeTransformChangeListener(Runnable listener) {
|
||||
transformChangeListeners.remove(listener);
|
||||
}
|
||||
|
||||
|
||||
public void addPointUpdateListener(PointUpdateListener listener) {
|
||||
pointUpdateListeners.add(listener);
|
||||
}
|
||||
@@ -415,7 +413,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
listener.pointsUpdated(points);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void fireTransformChanged() {
|
||||
for (Runnable listener : transformChangeListeners) {
|
||||
listener.run();
|
||||
@@ -639,8 +637,9 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
}
|
||||
selectDepths(depths);
|
||||
}
|
||||
|
||||
public synchronized void selectDepths(List<Integer> depths) {
|
||||
|
||||
|
||||
depths = new ArrayList<>(depths);
|
||||
for (int i = 0; i < depths.size(); i++) {
|
||||
int depth = depths.get(i);
|
||||
@@ -650,11 +649,11 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
transformUpdated = null;
|
||||
registrationPointUpdated = null;
|
||||
transform = null;
|
||||
|
||||
|
||||
selectedDepths = new ArrayList<>(depths);
|
||||
doFreeTransform = false;
|
||||
|
||||
@@ -667,27 +666,23 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
|
||||
public List<Integer> getSelectedDepths() {
|
||||
return new ArrayList<>(selectedDepths);
|
||||
}
|
||||
|
||||
public synchronized int getFrame() {
|
||||
return frame;
|
||||
}
|
||||
}
|
||||
|
||||
private void calculateFreeOrSelectionTransform() {
|
||||
if (!(doFreeTransform || selectionMode)) {
|
||||
return;
|
||||
}
|
||||
if (selectedDepths.isEmpty()) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
DepthState ds = null;
|
||||
Timeline timeline = timelined.getTimeline();
|
||||
|
||||
|
||||
if (timeline.getFrameCount() <= frame) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (selectedDepths.size() == 1) {
|
||||
ds = timeline.getFrame(frame).layers.get(selectedDepths.get(0));
|
||||
}
|
||||
@@ -712,10 +707,10 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
}
|
||||
}
|
||||
} else {*/
|
||||
transform = new Matrix();
|
||||
Rectangle2D transformBounds = getTransformBounds();
|
||||
registrationPointPosition = RegistrationPointPosition.CENTER;
|
||||
fireBoundsChange(transformBounds, new Point2D.Double(transformBounds.getCenterX(), transformBounds.getCenterY()), registrationPointPosition);
|
||||
transform = new Matrix();
|
||||
Rectangle2D transformBounds = getTransformBounds();
|
||||
registrationPointPosition = RegistrationPointPosition.CENTER;
|
||||
fireBoundsChange(transformBounds, new Point2D.Double(transformBounds.getCenterX(), transformBounds.getCenterY()), registrationPointPosition);
|
||||
//}
|
||||
}
|
||||
|
||||
@@ -726,7 +721,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
}
|
||||
freeTransformDepths(depths);
|
||||
}
|
||||
|
||||
|
||||
public synchronized void freeTransformDepths(List<Integer> depths) {
|
||||
selectedDepths = new ArrayList<>(depths);
|
||||
doFreeTransform = !depths.isEmpty();
|
||||
@@ -739,7 +734,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
redraw();
|
||||
iconPanel.requestFocusInWindow();
|
||||
}
|
||||
|
||||
|
||||
private void centerImage() {
|
||||
Timelined tim = timelined;
|
||||
if (tim == null) {
|
||||
@@ -1184,14 +1179,14 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
MouseInputAdapter mouseInputAdapter = new MouseInputAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
|
||||
if (e.getClickCount() == 2 && selectionMode && !transformSelectionMode) {
|
||||
|
||||
|
||||
if (e.getClickCount() == 2 && selectionMode && !transformSelectionMode) {
|
||||
|
||||
DepthState ds = depthStateUnderCursor;
|
||||
if (ds != null) {
|
||||
CharacterTag cht = ds.getCharacter();
|
||||
if (cht instanceof Timelined) {
|
||||
synchronized(lock) {
|
||||
synchronized (lock) {
|
||||
parentTimelineds.add(timelined);
|
||||
parentDepths.add(ds.depth);
|
||||
parentFrames.add(ds.frame.frame);
|
||||
@@ -1202,10 +1197,10 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
fireMediaDisplayStateChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (shiftDown) {
|
||||
List<Integer> newSelectedPoints = new ArrayList<>(pointsUnderCursor);
|
||||
for (int i : selectedPoints) {
|
||||
@@ -1220,10 +1215,10 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
selectedPoints = new ArrayList<>(pointsUnderCursor);
|
||||
}
|
||||
calculatePointsXY();
|
||||
|
||||
|
||||
if (altDown || selectionMode) {
|
||||
if (depthStateUnderCursor != null) {
|
||||
|
||||
|
||||
List<Integer> newSelectedDepths = new ArrayList<>();
|
||||
if (ctrlDown) {
|
||||
newSelectedDepths.addAll(selectedDepths);
|
||||
@@ -1241,7 +1236,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
freeTransformDepths(newSelectedDepths);
|
||||
firePlaceObjectSelected();
|
||||
}
|
||||
} else if ((altDown && !selectionMode) || selectionMode){
|
||||
} else if ((altDown && !selectionMode) || selectionMode) {
|
||||
selectDepths(newSelectedDepths);
|
||||
firePlaceObjectSelected();
|
||||
}
|
||||
@@ -1256,27 +1251,27 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
selectDepths(new ArrayList<>());
|
||||
firePlaceObjectSelected();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
if (SwingUtilities.isLeftMouseButton(e)) {
|
||||
|
||||
if (SwingUtilities.isLeftMouseButton(e)) {
|
||||
|
||||
if (altDown || selectionMode) {
|
||||
if (depthStateUnderCursor != null && selectedDepths.contains(depthStateUnderCursor.depth)) {
|
||||
inMoving = selectionMode;
|
||||
calculateFreeOrSelectionTransform();
|
||||
calculateFreeOrSelectionTransform();
|
||||
}
|
||||
if (!selectionMode) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
mouseMoved(e); //to correctly calculate mode, because mouseMoved event is not called during dragging
|
||||
setDragStart(e.getPoint());
|
||||
|
||||
setDragStart(e.getPoint());
|
||||
|
||||
if (!shiftDown) {
|
||||
boolean selectedUnderCursor = false;
|
||||
for (int p : pointsUnderCursor) {
|
||||
@@ -1351,7 +1346,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
}
|
||||
updateScrollBarMinMax();
|
||||
}
|
||||
|
||||
|
||||
if (dragStart != null && !inMoving && multiSelect) {
|
||||
Rectangle2D selectionRect = getSelectionRect();
|
||||
if (selectionRect != null) {
|
||||
@@ -1431,7 +1426,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
registrationPointPosition = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
calcRect(); //do not put this inside synchronized block, it cause deadlock
|
||||
fireBoundsChange(getTransformBounds(), registrationPoint, registrationPointPosition);
|
||||
fireTransformChanged();
|
||||
@@ -1451,7 +1446,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
@Override
|
||||
public void mouseDragged(MouseEvent e) {
|
||||
List<DisplayPoint> points = hilightedPoints;
|
||||
|
||||
|
||||
if (dragStart != null && multiSelect && !inMoving && mode == Cursor.DEFAULT_CURSOR) {
|
||||
selectionEnd = e.getPoint();
|
||||
repaint();
|
||||
@@ -1533,21 +1528,21 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
repaint();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//move in selection mode
|
||||
if (dragStart != null && selectionMode && !doFreeTransform) {
|
||||
if (transform == null) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
Matrix parentMatrix = getParentMatrix();
|
||||
|
||||
|
||||
Point2D mouseTransPoint = toTransformPoint(new Point2D.Double(e.getX(), e.getY()));
|
||||
double ex = mouseTransPoint.getX();
|
||||
double ey = mouseTransPoint.getY();
|
||||
Point2D dragStartTransPoint = toTransformPoint(dragStart);
|
||||
double dsx = dragStartTransPoint.getX();
|
||||
double dsy = dragStartTransPoint.getY();
|
||||
|
||||
|
||||
double deltaX = ex - dsx;
|
||||
double deltaY = ey - dsy;
|
||||
|
||||
@@ -1556,7 +1551,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
t.translate(deltaX, deltaY);
|
||||
t.concatenate(parentMatrix.inverse().toTransform());
|
||||
newTransform.preConcatenate(t);
|
||||
|
||||
|
||||
Point2D newRegistrationPoint = new Matrix(t).preConcatenate(parentMatrix.inverse()).concatenate(parentMatrix).transform(registrationPoint);
|
||||
|
||||
transformUpdated = newTransform;
|
||||
@@ -1570,10 +1565,10 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
return;
|
||||
}
|
||||
|
||||
Matrix parentMatrix = getParentMatrix();
|
||||
Matrix parentMatrix = getParentMatrix();
|
||||
Point2D mouseTransPoint = toTransformPoint(new Point2D.Double(e.getX(), e.getY()));
|
||||
//mouseTransPoint = parentMatrix.inverse().transform(mouseTransPoint);
|
||||
|
||||
|
||||
double ex = mouseTransPoint.getX();
|
||||
double ey = mouseTransPoint.getY();
|
||||
Point2D dragStartTransPoint = toTransformPoint(dragStart);
|
||||
@@ -1608,7 +1603,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
AffineTransform newTransform = new AffineTransform(transform.toTransform());
|
||||
AffineTransform t = new AffineTransform();
|
||||
Point2D bStart = parentMatrix.transform(new Point2D.Double(bounds.getX(), bounds.getY()));
|
||||
|
||||
|
||||
t.translate(bStart.getX(), bStart.getY());
|
||||
t.shear(shearX, 0);
|
||||
t.translate(-bStart.getX(), -bStart.getY());
|
||||
@@ -1627,7 +1622,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
|
||||
AffineTransform newTransform = new AffineTransform(transform.toTransform());
|
||||
AffineTransform t = new AffineTransform();
|
||||
Point2D bStart = parentMatrix.transform(new Point2D.Double(bounds.getX(), bounds.getY()));
|
||||
Point2D bStart = parentMatrix.transform(new Point2D.Double(bounds.getX(), bounds.getY()));
|
||||
t.translate(bStart.getX(), bStart.getY());
|
||||
t.shear(0, shearY);
|
||||
t.translate(-bStart.getX(), -bStart.getY());
|
||||
@@ -1646,7 +1641,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
|
||||
AffineTransform newTransform = new AffineTransform(transform.toTransform());
|
||||
AffineTransform t = new AffineTransform();
|
||||
Point2D bStart = parentMatrix.transform(new Point2D.Double(bounds.getX(), bounds.getY()));
|
||||
Point2D bStart = parentMatrix.transform(new Point2D.Double(bounds.getX(), bounds.getY()));
|
||||
t.translate(bStart.getX(), bStart.getY());
|
||||
t.shear(0, shearY);
|
||||
t.translate(-bStart.getX(), -bStart.getY());
|
||||
@@ -1838,7 +1833,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
t.translate(deltaX, deltaY);
|
||||
t.concatenate(parentMatrix.inverse().toTransform());
|
||||
newTransform.preConcatenate(t);
|
||||
|
||||
|
||||
Point2D newRegistrationPoint = new Matrix(t).preConcatenate(parentMatrix.inverse()).concatenate(parentMatrix).transform(registrationPoint);
|
||||
|
||||
transformUpdated = newTransform;
|
||||
@@ -1858,7 +1853,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
newTransform.preConcatenate(t);
|
||||
|
||||
Point2D newRegistrationPoint = new Matrix(t).preConcatenate(parentMatrix.inverse()).concatenate(parentMatrix).transform(registrationPoint);
|
||||
|
||||
|
||||
transformUpdated = newTransform;
|
||||
registrationPointUpdated = newRegistrationPoint;
|
||||
repaint();
|
||||
@@ -2274,8 +2269,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
|
||||
private void calcRect(Zoom z) {
|
||||
synchronized (ImagePanel.this) {
|
||||
|
||||
|
||||
|
||||
Timelined topTimelined = getTopTimelined();
|
||||
if (_img != null || topTimelined != null) {
|
||||
//int w1 = (int) (_img.getWidth() * (lowQuality ? LQ_FACTOR : 1));
|
||||
@@ -2337,7 +2331,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
if (h < h2 && w < w2) {
|
||||
offsetPoint.setLocation(iconPanel.getWidth() / 2 - w / 2 - dx, iconPanel.getHeight() / 2 - h / 2 - dy);
|
||||
updateScrollBars();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
boolean doMove = h > h2 || w > w2;
|
||||
if (zoom.fit) {
|
||||
@@ -2670,8 +2664,8 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
@Override
|
||||
public void run() {
|
||||
drawFrame(thisTimer, true);
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2804,14 +2798,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
@Override
|
||||
public synchronized void zoom(Zoom zoom) {
|
||||
zoom(zoom, false, false);
|
||||
}
|
||||
|
||||
public void zoomFit() {
|
||||
Zoom z = new Zoom();
|
||||
z.value = 1.0;
|
||||
z.fit = true;
|
||||
zoom(z, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void zoom(Zoom zoom, boolean useCursor, boolean forced) {
|
||||
if (!zoomAvailable) {
|
||||
@@ -2839,8 +2826,8 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
|
||||
int dx = (int) (((cursorTransAfter.getX() - cursorTransBefore.getX()) * zoomDouble) / SWF.unitDivisor);
|
||||
int dy = (int) (((cursorTransAfter.getY() - cursorTransBefore.getY()) * zoomDouble) / SWF.unitDivisor);
|
||||
|
||||
offsetPoint.setLocation(offsetPoint.getX() + dx, offsetPoint.getY() + dy);
|
||||
|
||||
offsetPoint.setLocation(offsetPoint.getX() + dx, offsetPoint.getY() + dy);
|
||||
|
||||
updateScrollBars();
|
||||
|
||||
@@ -2861,6 +2848,13 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
}
|
||||
}
|
||||
|
||||
public void zoomFit() {
|
||||
Zoom z = new Zoom();
|
||||
z.value = 1.0;
|
||||
z.fit = true;
|
||||
zoom(z, false, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized BufferedImage printScreen() {
|
||||
return iconPanel.getLastImage();
|
||||
@@ -2874,7 +2868,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
double h1 = bounds.getHeight() / SWF.unitDivisor;
|
||||
|
||||
double w2 = iconPanel.getWidth();
|
||||
double h2 = iconPanel.getHeight();
|
||||
double h2 = iconPanel.getHeight();
|
||||
|
||||
double w;
|
||||
double h;
|
||||
@@ -2971,7 +2965,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
this.timelined = drawable;
|
||||
this.parentTimelineds.clear();
|
||||
this.parentFrames.clear();
|
||||
this.parentDepths.clear();
|
||||
this.parentDepths.clear();
|
||||
centerImage();
|
||||
this.swf = swf;
|
||||
zoomAvailable = allowZoom;
|
||||
@@ -3195,7 +3189,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
}
|
||||
fireMediaDisplayStateChanged();
|
||||
}
|
||||
|
||||
|
||||
public Matrix getParentMatrix() {
|
||||
synchronized (lock) {
|
||||
Matrix parentMatrix = new Matrix();
|
||||
@@ -3205,13 +3199,17 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
parentMatrix = parentMatrix.concatenate(new Matrix(parentDepthState.matrix));
|
||||
}
|
||||
return parentMatrix;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized int getFrame() {
|
||||
return frame;
|
||||
}
|
||||
|
||||
private static SerializableImage getFrame(Rectangle realRect, RECT rect, ExportRectangle viewRect, SWF swf, int frame, int time, Timelined drawable, RenderContext renderContext, List<Integer> selectedDepths, boolean doFreeTransform, double zoom, Reference<Point2D> registrationPointRef, Reference<Rectangle2D> boundsRef, Matrix transform, Matrix temporaryMatrix, Matrix newMatrix, boolean selectionMode,
|
||||
List<Timelined> parentTimelineds, List<Integer> parentDepths, List<Integer> parentFrames,
|
||||
Matrix parentMatrix
|
||||
) {
|
||||
) {
|
||||
Timeline timeline = drawable.getTimeline();
|
||||
SerializableImage img;
|
||||
|
||||
@@ -3232,24 +3230,24 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
m.scale(zoom);
|
||||
|
||||
Matrix fullM = m.clone();
|
||||
|
||||
|
||||
for (int i = 0; i < selectedDepths.size(); i++) {
|
||||
if (newMatrix != null) {
|
||||
DepthState ds = timeline.getFrame(frame).layers.get(selectedDepths.get(i));
|
||||
if (ds != null) {
|
||||
ds.temporaryMatrix = newMatrix.concatenate(new Matrix(ds.matrix)).toMATRIX();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Frame fr = timeline.getFrame(frame);
|
||||
|
||||
|
||||
Frame bgFr = timeline.getFrame(frame);
|
||||
|
||||
|
||||
if (!parentTimelineds.isEmpty()) {
|
||||
bgFr = parentTimelineds.get(0).getTimeline().getFrame(parentFrames.get(0));
|
||||
}
|
||||
|
||||
|
||||
if (bgFr == null || fr == null) {
|
||||
return image;
|
||||
}
|
||||
@@ -3258,36 +3256,35 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
Graphics2D g = (Graphics2D) image.getBufferedImage().getGraphics();
|
||||
g.setPaint(backgroundColor.toColor());
|
||||
g.fillRect(realRect.x, realRect.y, realRect.width, realRect.height);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
parentMatrix = new Matrix();
|
||||
List<Integer> ignoreDepths = new ArrayList<>();
|
||||
for (int i = 0; i < parentTimelineds.size(); i++) {
|
||||
Timelined parentTimelined = parentTimelineds.get(i);
|
||||
Timelined parentTimelined = parentTimelineds.get(i);
|
||||
DepthState parentDepthState = parentTimelineds.get(i).getTimeline().getDepthState(parentFrames.get(i), parentDepths.get(i));
|
||||
|
||||
|
||||
ignoreDepths.add(parentDepthState.depth);
|
||||
parentTimelined.getTimeline().toImage(parentFrames.get(i), 0, new RenderContext(), image, image, false,
|
||||
parentMatrix.preConcatenate(m), new Matrix(), parentMatrix.preConcatenate(m), null, zoom, true, viewRect, parentMatrix.preConcatenate(m), true, Timeline.DRAW_MODE_ALL, 0, !Configuration.disableBitmapSmoothing.get(),
|
||||
ignoreDepths);
|
||||
parentMatrix = parentMatrix.concatenate(new Matrix(parentDepthState.matrix));
|
||||
ignoreDepths.clear();
|
||||
ignoreDepths.clear();
|
||||
}
|
||||
|
||||
|
||||
if (!parentTimelineds.isEmpty()) {
|
||||
Graphics2D g = (Graphics2D) image.getBufferedImage().getGraphics();
|
||||
g.setPaint(new Color(255, 255, 255, 128));
|
||||
g.fillRect(realRect.x, realRect.y, realRect.width, realRect.height);
|
||||
}
|
||||
|
||||
|
||||
timeline.toImage(frame, time, renderContext, image, image, false, parentMatrix.preConcatenate(m), new Matrix(), parentMatrix.preConcatenate(m), null, zoom, true, viewRect, parentMatrix.preConcatenate(m), true, Timeline.DRAW_MODE_ALL, 0, !Configuration.disableBitmapSmoothing.get(), ignoreDepths);
|
||||
|
||||
Graphics2D gg = (Graphics2D) image.getGraphics();
|
||||
gg.setStroke(new BasicStroke(3));
|
||||
gg.setPaint(Color.green);
|
||||
gg.setTransform(AffineTransform.getTranslateInstance(0, 0));
|
||||
|
||||
gg.setTransform(AffineTransform.getTranslateInstance(0, 0));
|
||||
|
||||
if (!doFreeTransform) {
|
||||
for (int selectedDepth : selectedDepths) {
|
||||
DepthState ds = null;
|
||||
@@ -3343,11 +3340,11 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
|
||||
int dframe = time % drawableFrameCount;
|
||||
//Matrix finalMatrix = Matrix.getScaleInstance(1 / SWF.unitDivisor).concatenate(m).concatenate(new Matrix(ds.matrix));
|
||||
|
||||
|
||||
Matrix transform2 = transform;
|
||||
|
||||
|
||||
transform2 = transform.concatenate(new Matrix(ds.matrix));
|
||||
|
||||
|
||||
Shape outline = dt.getOutline(true, dframe, time, ds.ratio, renderContext, transform2, true, viewRect, zoom);
|
||||
|
||||
if (temporaryMatrix != null) {
|
||||
@@ -3371,29 +3368,29 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
}
|
||||
|
||||
if (totalBounds == null) {
|
||||
totalBounds = new Rectangle(0,0,1,1);
|
||||
totalBounds = new Rectangle(0, 0, 1, 1);
|
||||
}
|
||||
|
||||
|
||||
boundsRef.setVal(totalBounds);
|
||||
gg.setStroke(new BasicStroke(1));
|
||||
gg.setPaint(Color.black);
|
||||
if (doFreeTransform) {
|
||||
gg.draw(totalBounds);
|
||||
drawHandles(gg, totalBounds);
|
||||
drawHandles(gg, totalBounds);
|
||||
Point2D regPoint = registrationPointRef.getVal();
|
||||
if (regPoint == null) {
|
||||
regPoint = new Point2D.Double(totalBounds.getCenterX(), totalBounds.getCenterY());
|
||||
}
|
||||
drawRegistrationPoint(gg, regPoint);
|
||||
}
|
||||
|
||||
|
||||
if (timeline != null && timeline.getFrameCount() > frame) {
|
||||
for (int i = 0; i < selectedDepths.size(); i++) {
|
||||
int selectedDepth = selectedDepths.get(i);
|
||||
DepthState ds = timeline.getDepthState(frame, selectedDepth);
|
||||
if (ds != null) {
|
||||
ds.temporaryMatrix = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
img = image;
|
||||
@@ -3628,7 +3625,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
RECT rect = getTopTimelined().getRect();
|
||||
|
||||
synchronized (ImagePanel.this) {
|
||||
synchronized (lock) {
|
||||
synchronized (lock) {
|
||||
_viewRect = getViewRect();
|
||||
}
|
||||
}
|
||||
@@ -3656,18 +3653,18 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
realRect.x += offsetPoint.getX();
|
||||
realRect.y += offsetPoint.getY();
|
||||
|
||||
Point2D rawRegistrationPoint = registrationPoint == null ? null : toImagePoint(registrationPoint);
|
||||
Point2D rawRegistrationPoint = registrationPoint == null ? null : toImagePoint(registrationPoint);
|
||||
Reference<Point2D> registrationPointRef = new Reference<>(rawRegistrationPoint);
|
||||
if (!autoPlayed) {
|
||||
img = getImagePlay();
|
||||
} else if (_viewRect.getHeight() < 0 || _viewRect.getWidth() < 0) {
|
||||
img = new SerializableImage(1, 1, BufferedImage.TYPE_4BYTE_ABGR);
|
||||
} else {
|
||||
img = getFrame(realRect, rect, _viewRect, swf, frame, frozen ? 0 : time, timelined, renderContext, selectedDepths, doFreeTransform, zoomDouble, registrationPointRef, boundsRef, trans2, tempTrans2 == null ? null : new Matrix(tempTrans2), transform, selectionMode, parentTimelineds, parentDepths, parentFrames, getParentMatrix());
|
||||
img = getFrame(realRect, rect, _viewRect, swf, frame, frozen ? 0 : time, timelined, renderContext, selectedDepths, doFreeTransform, zoomDouble, registrationPointRef, boundsRef, trans2, tempTrans2 == null ? null : new Matrix(tempTrans2), transform, selectionMode, parentTimelineds, parentDepths, parentFrames, getParentMatrix());
|
||||
}
|
||||
|
||||
synchronized (ImagePanel.this) {
|
||||
synchronized (lock) {
|
||||
synchronized (lock) {
|
||||
|
||||
Rectangle2D newBounds = getTransformBounds();
|
||||
if (newBounds != null) {
|
||||
@@ -3678,9 +3675,9 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
newBounds.getCenterY());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sw.stop();
|
||||
if (sw.getElapsedMilliseconds() > 100) {
|
||||
if (Configuration.showSlowRenderingWarning.get()) {
|
||||
@@ -3764,7 +3761,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
|
||||
first = false;
|
||||
CharacterTag c = ds.getCharacter();
|
||||
|
||||
|
||||
ret.append(tagNameResolver.getTagName(c));
|
||||
if (ds.depth > -1) {
|
||||
ret.append(" ");
|
||||
@@ -3864,7 +3861,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
}
|
||||
}
|
||||
|
||||
drawReady = true;
|
||||
drawReady = true;
|
||||
}
|
||||
}
|
||||
synchronized (delayObject) {
|
||||
@@ -3888,15 +3885,15 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (soundInfo.syncStop) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (soundPlayers.size() > MAX_SOUND_CHANNELS) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
final SoundTagPlayer sp;
|
||||
try {
|
||||
@@ -3904,7 +3901,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
if (soundInfo != null && soundInfo.hasLoops) {
|
||||
loopCount = Math.max(1, soundInfo.loopCount);
|
||||
}
|
||||
|
||||
|
||||
sp = new SoundTagPlayer(soundInfo, st, loopCount, false, resample);
|
||||
sp.addEventListener(new MediaDisplayListener() {
|
||||
@Override
|
||||
@@ -4037,7 +4034,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
long delay = getMsPerFrame();
|
||||
if (isSingleFrame) {
|
||||
drawFrame(thisTimer, true);
|
||||
|
||||
|
||||
fireMediaDisplayStateChanged();
|
||||
} else {
|
||||
//Time before drawing current frame
|
||||
@@ -4165,6 +4162,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
|
||||
/**
|
||||
* Goto frame
|
||||
*
|
||||
* @param frame 1-based frame
|
||||
*/
|
||||
@Override
|
||||
@@ -4174,15 +4172,15 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
}
|
||||
Timeline timeline = timelined.getTimeline();
|
||||
if (frame > timeline.getFrameCount()) {
|
||||
frame = timeline.getFrameCount();
|
||||
frame = timeline.getFrameCount();
|
||||
}
|
||||
if (frame < 1) {
|
||||
frame = 1;
|
||||
frame = 1;
|
||||
}
|
||||
|
||||
this.autoPlayed = true;
|
||||
this.frame = frame - 1;
|
||||
this.prevFrame = -1;
|
||||
this.prevFrame = -1;
|
||||
stopInternal();
|
||||
redraw();
|
||||
fireMediaDisplayStateChanged();
|
||||
@@ -4265,8 +4263,8 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
|
||||
public RegistrationPointPosition getRegistrationPointPosition() {
|
||||
return registrationPointPosition;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setRegistrationPoint(Point2D registrationPoint) {
|
||||
this.registrationPoint = registrationPoint;
|
||||
this.registrationPointPosition = null;
|
||||
@@ -4300,7 +4298,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
fireTransformChanged();
|
||||
}
|
||||
|
||||
private Point2D toTransformPoint(Point2D point) {
|
||||
private Point2D toTransformPoint(Point2D point) {
|
||||
double zoomDouble = zoom.fit ? getZoomToFit() : zoom.value;
|
||||
if (lowQuality) {
|
||||
zoomDouble /= LQ_FACTOR;
|
||||
@@ -4345,12 +4343,12 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
Point2D bottomRight = toImagePoint(new Point2D.Double(rect.getMaxX(), rect.getMaxY()));
|
||||
return new Rectangle2D.Double(topLeft.getX(), topLeft.getY(), bottomRight.getX() - topLeft.getX(), bottomRight.getY() - topLeft.getY());
|
||||
}
|
||||
|
||||
|
||||
private Point2D toParentPoint(Point2D point) {
|
||||
point = getParentMatrix().transform(point);
|
||||
return point;
|
||||
}
|
||||
|
||||
|
||||
private Rectangle2D toParentRect(Rectangle2D rect) {
|
||||
Point2D topLeft = toParentPoint(new Point2D.Double(rect.getMinX(), rect.getMinY()));
|
||||
Point2D bottomRight = toParentPoint(new Point2D.Double(rect.getMaxX(), rect.getMaxY()));
|
||||
@@ -4370,16 +4368,16 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
if (freeTransformDepth == -1 && selectionMode && transform != null && selectedDepth != -1 && timeline.getFrameCount() > frame) {
|
||||
ds = timeline.getFrame(frame).layers.get(selectedDepth);
|
||||
}*/
|
||||
|
||||
|
||||
if (timeline.getFrameCount() <= frame) {
|
||||
return new Rectangle2D.Double(0,0,1,1);
|
||||
return new Rectangle2D.Double(0, 0, 1, 1);
|
||||
}
|
||||
|
||||
|
||||
Matrix newMatrix = getNewMatrix();
|
||||
|
||||
|
||||
if (newMatrix == null) {
|
||||
return new Rectangle2D.Double(0,0,1,1);
|
||||
}
|
||||
return new Rectangle2D.Double(0, 0, 1, 1);
|
||||
}
|
||||
RenderContext renderContext = new RenderContext();
|
||||
renderContext.displayObjectCache = displayObjectCache;
|
||||
if (cursorPosition != null && !doFreeTransform) {
|
||||
@@ -4438,8 +4436,8 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
|
||||
this.pathPosition = pathPosition;
|
||||
this.closestPoint = closestPoint;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Timelined getTopTimelined() {
|
||||
synchronized (lock) {
|
||||
if (!parentTimelineds.isEmpty()) {
|
||||
|
||||
@@ -665,7 +665,7 @@ public class Main {
|
||||
|
||||
private static void deleteCookiesAfterRun(File tempFile) {
|
||||
SharedObjectsStorage.removeChangedListener(tempFile, runCookieListener);
|
||||
File solDir = SharedObjectsStorage.getSolDirectoryForLocalFile(tempFile);
|
||||
File solDir = SharedObjectsStorage.getSolDirectoryForLocalFile(tempFile);
|
||||
File origSolDir = runningSWF.getFile() == null ? null : SharedObjectsStorage.getSolDirectoryForLocalFile(new File(runningSWF.getFile()));
|
||||
if (solDir != null) {
|
||||
WatchKey foundKey = null;
|
||||
@@ -674,20 +674,20 @@ public class Main {
|
||||
foundKey = key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (foundKey != null) {
|
||||
SharedObjectsStorage.watchedCookieDirectories.remove(foundKey);
|
||||
}
|
||||
|
||||
|
||||
View.execInEventDispatchLater(new Runnable() {
|
||||
public void run() {
|
||||
public void run() {
|
||||
if (solDir.exists()) {
|
||||
|
||||
if (origSolDir != null && origSolDir.exists()) {
|
||||
|
||||
if (origSolDir != null && origSolDir.exists()) {
|
||||
for (File f : origSolDir.listFiles()) {
|
||||
f.delete();
|
||||
}
|
||||
|
||||
|
||||
for (File f : solDir.listFiles()) {
|
||||
try {
|
||||
Files.copy(f.toPath(), origSolDir.toPath().resolve(f.getName()), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.COPY_ATTRIBUTES);
|
||||
@@ -696,12 +696,12 @@ public class Main {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (File f : solDir.listFiles()) {
|
||||
f.delete();
|
||||
}
|
||||
solDir.delete();
|
||||
}
|
||||
solDir.delete();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -730,7 +730,7 @@ public class Main {
|
||||
} catch (IOException ex) {
|
||||
//ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
runCookieListener = new CookiesChangedListener() {
|
||||
@@ -753,7 +753,7 @@ public class Main {
|
||||
} catch (IOException ex) {
|
||||
//ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
SharedObjectsStorage.addChangedListener(tempFile, runCookieListener);
|
||||
@@ -1344,7 +1344,7 @@ public class Main {
|
||||
@Override
|
||||
public boolean accept(File f) {
|
||||
return (f.getName().toLowerCase(Locale.ENGLISH).endsWith(".swf"))
|
||||
|| (f.getName().toLowerCase(Locale.ENGLISH).endsWith(".spl"))
|
||||
|| (f.getName().toLowerCase(Locale.ENGLISH).endsWith(".spl"))
|
||||
|| (f.isDirectory());
|
||||
}
|
||||
|
||||
@@ -2014,30 +2014,30 @@ public class Main {
|
||||
if (fileName != null) {
|
||||
Configuration.addRecentFile(fileName);
|
||||
SharedObjectsStorage.addChangedListener(new File(fileName), new CookiesChangedListener() {
|
||||
|
||||
|
||||
Timer timer;
|
||||
|
||||
|
||||
@Override
|
||||
public void cookiesChanged(File swfFile, List<File> cookies) {
|
||||
public void cookiesChanged(File swfFile, List<File> cookies) {
|
||||
if (timer != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
timer = new Timer();
|
||||
timer.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
View.execInEventDispatchLater(new Runnable(){
|
||||
View.execInEventDispatchLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
getMainFrame().getPanel().refreshTree();
|
||||
timer = null;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}, 500);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
if (watcher != null && Configuration.checkForModifications.get()) {
|
||||
@@ -2151,8 +2151,8 @@ public class Main {
|
||||
FileFilter swfFilter = new FileFilter() {
|
||||
@Override
|
||||
public boolean accept(File f) {
|
||||
return (f.getName().toLowerCase(Locale.ENGLISH).endsWith(".swf"))
|
||||
|| (f.getName().toLowerCase(Locale.ENGLISH).endsWith(".spl"))
|
||||
return (f.getName().toLowerCase(Locale.ENGLISH).endsWith(".swf"))
|
||||
|| (f.getName().toLowerCase(Locale.ENGLISH).endsWith(".spl"))
|
||||
|| (f.isDirectory());
|
||||
}
|
||||
|
||||
@@ -2396,8 +2396,8 @@ public class Main {
|
||||
FileFilter swfFilter = new FileFilter() {
|
||||
@Override
|
||||
public boolean accept(File f) {
|
||||
return (f.getName().toLowerCase(Locale.ENGLISH).endsWith(".swf"))
|
||||
|| (f.getName().toLowerCase(Locale.ENGLISH).endsWith(".spl"))
|
||||
return (f.getName().toLowerCase(Locale.ENGLISH).endsWith(".swf"))
|
||||
|| (f.getName().toLowerCase(Locale.ENGLISH).endsWith(".spl"))
|
||||
|| (f.isDirectory());
|
||||
}
|
||||
|
||||
@@ -2583,10 +2583,10 @@ public class Main {
|
||||
File dir = SharedObjectsStorage.watchedCookieDirectories.get(key);
|
||||
java.nio.file.Path child = dir.toPath().resolve(filename);
|
||||
File fullPath = child.toFile();
|
||||
|
||||
|
||||
View.execInEventDispatchLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
public void run() {
|
||||
SharedObjectsStorage.watchedDirectoryChanged(fullPath);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -158,11 +158,11 @@ public final class MainFrameRibbon extends AppRibbonFrame {
|
||||
|
||||
SWF easySwf = panel.getEasyPanel().getSwf();
|
||||
if (easySwf != null) {
|
||||
Configuration.lastSessionEasySwf.set(easySwf.getFile()+ "|" + easySwf.getFileTitle());
|
||||
Configuration.lastSessionEasySwf.set(easySwf.getFile() + "|" + easySwf.getFileTitle());
|
||||
} else {
|
||||
Configuration.lastSessionEasySwf.set("");
|
||||
}
|
||||
|
||||
|
||||
String pathResources = panel.tagTree.getSelectionPathString();
|
||||
if (pathResources != null) {
|
||||
Configuration.lastSessionSelection.set(pathResources);
|
||||
|
||||
@@ -500,7 +500,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
public void replaceItemPin(TreeItem oldItem, TreeItem newItem) {
|
||||
pinsPanel.replaceItem(oldItem, newItem);
|
||||
}
|
||||
|
||||
|
||||
public void refreshPinnedScriptPacks() {
|
||||
pinsPanel.refreshScriptPacks();
|
||||
}
|
||||
@@ -1473,7 +1473,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
}
|
||||
}
|
||||
|
||||
List<List<String>> expandedNodes = View.getExpandedNodes(tagTree);
|
||||
List<List<String>> expandedNodes = View.getExpandedNodes(tagTree);
|
||||
previewPanel.clear();
|
||||
openables.set(index, newSwfs);
|
||||
|
||||
@@ -1482,7 +1482,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
Main.searchResultsStorage.destroySwf(s);
|
||||
}
|
||||
Openable openable = newSwfs.size() > 0 ? newSwfs.get(0) : null;
|
||||
|
||||
|
||||
easyPanel.setSwfs(new ArrayList<>(getAllSwfs()));
|
||||
if (openable instanceof SWF) {
|
||||
easyPanel.setSwf((SWF) openable);
|
||||
@@ -1505,9 +1505,9 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
previewPanel.clear();
|
||||
|
||||
openables.add(newOpenables);
|
||||
|
||||
|
||||
easyPanel.setSwfs(new ArrayList<>(getAllSwfs()));
|
||||
|
||||
|
||||
Openable openable = newOpenables.size() > 0 ? newOpenables.get(0) : null;
|
||||
if (openable != null) {
|
||||
updateUi(openable);
|
||||
@@ -1831,7 +1831,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
|
||||
mainMenu.updateComponents(null);
|
||||
previewPanel.clear();
|
||||
dumpPreviewPanel.clear();
|
||||
dumpPreviewPanel.clear();
|
||||
doFilter();
|
||||
return true;
|
||||
}
|
||||
@@ -1901,14 +1901,12 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
List<String> newFoldersFilter = findPanel.getFolders();
|
||||
|
||||
if (isFilterEmpty(oldFilter) && oldFoldersFilter.isEmpty()) {
|
||||
unfilteredExpandedNodes.clear();
|
||||
unfilteredExpandedNodes.clear();
|
||||
unfilteredExpandedNodes.addAll(View.getExpandedNodes(tree));
|
||||
}
|
||||
|
||||
if (
|
||||
oldFilter.trim().equals(newFilter.trim())
|
||||
&& oldFoldersFilter.equals(newFoldersFilter)
|
||||
) {
|
||||
if (oldFilter.trim().equals(newFilter.trim())
|
||||
&& oldFoldersFilter.equals(newFoldersFilter)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3161,7 +3159,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
}
|
||||
}
|
||||
List<TreeItem> items = getSelected();
|
||||
|
||||
|
||||
String selected;
|
||||
if (scopeTextTags.isEmpty()) {
|
||||
selected = null;
|
||||
@@ -5043,6 +5041,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
public boolean replace(List<TreeItem> items, boolean create) {
|
||||
return replace(items, create, true);
|
||||
}
|
||||
|
||||
public boolean replace(List<TreeItem> items, boolean create, boolean fill) {
|
||||
if (items.isEmpty()) {
|
||||
return false;
|
||||
@@ -5250,14 +5249,14 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
|
||||
public void replaceNoFillButtonActionPerformed(List<TreeItem> items) {
|
||||
replace(items, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean replaceNoFill(TreeItem item) {
|
||||
List<TreeItem> items = new ArrayList<>();
|
||||
items.add(item);
|
||||
return replace(items, false, false);
|
||||
}
|
||||
|
||||
|
||||
private void showSvgImportWarning() {
|
||||
ViewMessages.showMessageDialog(this, AppStrings.translate("message.warning.svgImportExperimental"), AppStrings.translate("message.warning"), JOptionPane.WARNING_MESSAGE, Configuration.warningSvgImport);
|
||||
}
|
||||
@@ -5684,11 +5683,11 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
|
||||
public boolean showView(int view) {
|
||||
View.checkAccess();
|
||||
|
||||
|
||||
if (view == VIEW_EASY && !EasyPanel.EASY_AVAILABLE) {
|
||||
view = VIEW_RESOURCES;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
setTreeModel(view);
|
||||
switch (view) {
|
||||
case VIEW_DUMP:
|
||||
@@ -5731,8 +5730,8 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
reload(true);
|
||||
updateUiWithCurrentOpenable();
|
||||
return true;
|
||||
case VIEW_EASY:
|
||||
SWF swf = getCurrentSwf();
|
||||
case VIEW_EASY:
|
||||
SWF swf = getCurrentSwf();
|
||||
pinsPanel.setVisible(false);
|
||||
currentView = view;
|
||||
Configuration.lastView.set(currentView);
|
||||
@@ -5741,7 +5740,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
easyPanel.setSwf(swf);
|
||||
if (!isWelcomeScreen) {
|
||||
showContentPanelCard(EASY_PANEL);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
case VIEW_TAGLIST:
|
||||
easyPanel.setNoSwf();
|
||||
@@ -5978,7 +5977,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
@Override
|
||||
public boolean isModified() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReadOnlyTagList getTags() {
|
||||
@@ -6097,7 +6096,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
if (currentView == VIEW_DUMP) {
|
||||
dumpViewReload(forceReload);
|
||||
return;
|
||||
}
|
||||
}
|
||||
/*else if (currentView == VIEW_TAGLIST) {
|
||||
tagListViewReload(forceReload);
|
||||
return;
|
||||
@@ -6109,7 +6108,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
if (treePath != null && tree.getFullModel().treePathExists(treePath)) {
|
||||
treeItem = (TreeItem) treePath.getLastPathComponent();
|
||||
}
|
||||
|
||||
|
||||
if (currentView == VIEW_EASY) {
|
||||
if (treeItem != null) {
|
||||
Openable op = treeItem.getOpenable();
|
||||
@@ -6512,8 +6511,8 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
|
||||
public void setErrorState(ErrorState errorState) {
|
||||
statusPanel.setErrorState(errorState);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void disposeInner(Container container) {
|
||||
for (Component c : container.getComponents()) {
|
||||
if (c instanceof Container) {
|
||||
@@ -6736,5 +6735,5 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
|
||||
public EasyPanel getEasyPanel() {
|
||||
return easyPanel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,8 +33,8 @@ import javax.swing.SwingConstants;
|
||||
* customize the scrollable features by using newly provided setter methods so
|
||||
* you don't have to extend this class every time.
|
||||
* <p>
|
||||
* Scrollable amounts can be specified as a percentage of the viewport size or as
|
||||
* an actual pixel value. The amount can be changed for both unit and block
|
||||
* Scrollable amounts can be specified as a percentage of the viewport size or
|
||||
* as an actual pixel value. The amount can be changed for both unit and block
|
||||
* scrolling for both horizontal and vertical scrollbars.
|
||||
* <p>
|
||||
* The Scrollable interface only provides a boolean value for determining
|
||||
@@ -175,13 +175,13 @@ public class ScrollablePanel extends JPanel implements Scrollable, SwingConstant
|
||||
*
|
||||
* @param orientation specify the scrolling orientation. Must be either:
|
||||
* SwingConstants.HORIZONTAL or SwingConstants.VERTICAL.
|
||||
* @param type
|
||||
* @param amount a value used with the IncrementType to determine the
|
||||
* scrollable amount
|
||||
* @param type specify how the amount parameter in the calculation of the
|
||||
* scrollable amount. Valid values are: IncrementType.PERCENT - treat the
|
||||
* amount as a % of the viewport size IncrementType.PIXEL - treat the amount
|
||||
* as the scrollable amount
|
||||
* @param amount a value used with the IncrementType to determine the
|
||||
* scrollable amount
|
||||
|
||||
*/
|
||||
public void setScrollableBlockIncrement(int orientation, IncrementType type, int amount) {
|
||||
IncrementInfo info = new IncrementInfo(type, amount);
|
||||
|
||||
@@ -63,7 +63,7 @@ import java.util.Set;
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class TimelinedMaker {
|
||||
|
||||
|
||||
public static SWF makeTimelinedImage(ImageTag imageTag) {
|
||||
SWF swf = new SWF();
|
||||
swf.gfx = imageTag.getSwf().gfx;
|
||||
@@ -191,7 +191,7 @@ public class TimelinedMaker {
|
||||
}
|
||||
return swf;
|
||||
}
|
||||
|
||||
|
||||
public static Timelined makeTimelined(final Tag tag) {
|
||||
if (tag instanceof ImageTag) {
|
||||
return makeTimelinedImage((ImageTag) tag);
|
||||
@@ -267,7 +267,7 @@ public class TimelinedMaker {
|
||||
timeline.addFrame(f);
|
||||
timeline.fontFrameNum = frame;
|
||||
} else if (tag instanceof SoundTag) {
|
||||
|
||||
//empty
|
||||
} else {
|
||||
Frame f = new Frame(timeline, 0);
|
||||
DepthState ds = new DepthState(tag.getSwf(), f, f);
|
||||
@@ -287,7 +287,7 @@ public class TimelinedMaker {
|
||||
@Override
|
||||
public RECT getRect(Set<BoundedTag> added) {
|
||||
if (!(tag instanceof BoundedTag)) {
|
||||
return new RECT(0,1,0,1);
|
||||
return new RECT(0, 1, 0, 1);
|
||||
}
|
||||
BoundedTag bt = (BoundedTag) tag;
|
||||
if (!added.contains(bt)) {
|
||||
@@ -308,7 +308,7 @@ public class TimelinedMaker {
|
||||
@Override
|
||||
public boolean isModified() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReadOnlyTagList getTags() {
|
||||
|
||||
@@ -124,7 +124,7 @@ public class TransformPanel extends JPanel {
|
||||
|
||||
private Map<String, JPanel> cardContents = new LinkedHashMap<>();
|
||||
private Map<String, JLabel> cardPlusMinusLabels = new LinkedHashMap<>();
|
||||
|
||||
|
||||
private static final char PLUS_CHAR = '\u2BC8';
|
||||
private static final char MINUS_CHAR = '\u2BC6';
|
||||
|
||||
@@ -175,6 +175,7 @@ public class TransformPanel extends JPanel {
|
||||
public TransformPanel(ImagePanel imagePanel) {
|
||||
this(imagePanel, true);
|
||||
}
|
||||
|
||||
public TransformPanel(ImagePanel imagePanel, boolean headerLabel) {
|
||||
|
||||
imagePanel.addBoundsChangeListener(new BoundsChangeListener() {
|
||||
|
||||
@@ -0,0 +1,327 @@
|
||||
/*
|
||||
* Copyright (C) 2025 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.colordialog;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
class MainSwatchPanel extends MySwatchPanel {
|
||||
|
||||
protected void initValues() {
|
||||
swatchSize = UIManager.getDimension("ColorChooser.swatchesSwatchSize", getLocale());
|
||||
numSwatches = new Dimension(31, 9);
|
||||
gap = new Dimension(1, 1);
|
||||
}
|
||||
|
||||
protected void initColors() {
|
||||
int[] rawValues = initRawValues();
|
||||
int numColors = rawValues.length / 3;
|
||||
colors = new Color[numColors];
|
||||
for (int i = 0; i < numColors; i++) {
|
||||
colors[i] = new Color(rawValues[(i * 3)], rawValues[(i * 3) + 1], rawValues[(i * 3) + 2]);
|
||||
}
|
||||
}
|
||||
|
||||
private int[] initRawValues() {
|
||||
int[] rawValues = {
|
||||
255, 255, 255, // first row.
|
||||
204, 255, 255,
|
||||
204, 204, 255,
|
||||
204, 204, 255,
|
||||
204, 204, 255,
|
||||
204, 204, 255,
|
||||
204, 204, 255,
|
||||
204, 204, 255,
|
||||
204, 204, 255,
|
||||
204, 204, 255,
|
||||
204, 204, 255,
|
||||
255, 204, 255,
|
||||
255, 204, 204,
|
||||
255, 204, 204,
|
||||
255, 204, 204,
|
||||
255, 204, 204,
|
||||
255, 204, 204,
|
||||
255, 204, 204,
|
||||
255, 204, 204,
|
||||
255, 204, 204,
|
||||
255, 204, 204,
|
||||
255, 255, 204,
|
||||
204, 255, 204,
|
||||
204, 255, 204,
|
||||
204, 255, 204,
|
||||
204, 255, 204,
|
||||
204, 255, 204,
|
||||
204, 255, 204,
|
||||
204, 255, 204,
|
||||
204, 255, 204,
|
||||
204, 255, 204,
|
||||
204, 204, 204, // second row.
|
||||
153, 255, 255,
|
||||
153, 204, 255,
|
||||
153, 153, 255,
|
||||
153, 153, 255,
|
||||
153, 153, 255,
|
||||
153, 153, 255,
|
||||
153, 153, 255,
|
||||
153, 153, 255,
|
||||
153, 153, 255,
|
||||
204, 153, 255,
|
||||
255, 153, 255,
|
||||
255, 153, 204,
|
||||
255, 153, 153,
|
||||
255, 153, 153,
|
||||
255, 153, 153,
|
||||
255, 153, 153,
|
||||
255, 153, 153,
|
||||
255, 153, 153,
|
||||
255, 153, 153,
|
||||
255, 204, 153,
|
||||
255, 255, 153,
|
||||
204, 255, 153,
|
||||
153, 255, 153,
|
||||
153, 255, 153,
|
||||
153, 255, 153,
|
||||
153, 255, 153,
|
||||
153, 255, 153,
|
||||
153, 255, 153,
|
||||
153, 255, 153,
|
||||
153, 255, 204,
|
||||
204, 204, 204, // third row
|
||||
102, 255, 255,
|
||||
102, 204, 255,
|
||||
102, 153, 255,
|
||||
102, 102, 255,
|
||||
102, 102, 255,
|
||||
102, 102, 255,
|
||||
102, 102, 255,
|
||||
102, 102, 255,
|
||||
153, 102, 255,
|
||||
204, 102, 255,
|
||||
255, 102, 255,
|
||||
255, 102, 204,
|
||||
255, 102, 153,
|
||||
255, 102, 102,
|
||||
255, 102, 102,
|
||||
255, 102, 102,
|
||||
255, 102, 102,
|
||||
255, 102, 102,
|
||||
255, 153, 102,
|
||||
255, 204, 102,
|
||||
255, 255, 102,
|
||||
204, 255, 102,
|
||||
153, 255, 102,
|
||||
102, 255, 102,
|
||||
102, 255, 102,
|
||||
102, 255, 102,
|
||||
102, 255, 102,
|
||||
102, 255, 102,
|
||||
102, 255, 153,
|
||||
102, 255, 204,
|
||||
153, 153, 153, // fourth row
|
||||
51, 255, 255,
|
||||
51, 204, 255,
|
||||
51, 153, 255,
|
||||
51, 102, 255,
|
||||
51, 51, 255,
|
||||
51, 51, 255,
|
||||
51, 51, 255,
|
||||
102, 51, 255,
|
||||
153, 51, 255,
|
||||
204, 51, 255,
|
||||
255, 51, 255,
|
||||
255, 51, 204,
|
||||
255, 51, 153,
|
||||
255, 51, 102,
|
||||
255, 51, 51,
|
||||
255, 51, 51,
|
||||
255, 51, 51,
|
||||
255, 102, 51,
|
||||
255, 153, 51,
|
||||
255, 204, 51,
|
||||
255, 255, 51,
|
||||
204, 255, 51,
|
||||
153, 255, 51,
|
||||
102, 255, 51,
|
||||
51, 255, 51,
|
||||
51, 255, 51,
|
||||
51, 255, 51,
|
||||
51, 255, 102,
|
||||
51, 255, 153,
|
||||
51, 255, 204,
|
||||
153, 153, 153, // Fifth row
|
||||
0, 255, 255,
|
||||
0, 204, 255,
|
||||
0, 153, 255,
|
||||
0, 102, 255,
|
||||
0, 51, 255,
|
||||
0, 0, 255,
|
||||
51, 0, 255,
|
||||
102, 0, 255,
|
||||
153, 0, 255,
|
||||
204, 0, 255,
|
||||
255, 0, 255,
|
||||
255, 0, 204,
|
||||
255, 0, 153,
|
||||
255, 0, 102,
|
||||
255, 0, 51,
|
||||
255, 0, 0,
|
||||
255, 51, 0,
|
||||
255, 102, 0,
|
||||
255, 153, 0,
|
||||
255, 204, 0,
|
||||
255, 255, 0,
|
||||
204, 255, 0,
|
||||
153, 255, 0,
|
||||
102, 255, 0,
|
||||
51, 255, 0,
|
||||
0, 255, 0,
|
||||
0, 255, 51,
|
||||
0, 255, 102,
|
||||
0, 255, 153,
|
||||
0, 255, 204,
|
||||
102, 102, 102, // sixth row
|
||||
0, 204, 204,
|
||||
0, 204, 204,
|
||||
0, 153, 204,
|
||||
0, 102, 204,
|
||||
0, 51, 204,
|
||||
0, 0, 204,
|
||||
51, 0, 204,
|
||||
102, 0, 204,
|
||||
153, 0, 204,
|
||||
204, 0, 204,
|
||||
204, 0, 204,
|
||||
204, 0, 204,
|
||||
204, 0, 153,
|
||||
204, 0, 102,
|
||||
204, 0, 51,
|
||||
204, 0, 0,
|
||||
204, 51, 0,
|
||||
204, 102, 0,
|
||||
204, 153, 0,
|
||||
204, 204, 0,
|
||||
204, 204, 0,
|
||||
204, 204, 0,
|
||||
153, 204, 0,
|
||||
102, 204, 0,
|
||||
51, 204, 0,
|
||||
0, 204, 0,
|
||||
0, 204, 51,
|
||||
0, 204, 102,
|
||||
0, 204, 153,
|
||||
0, 204, 204,
|
||||
102, 102, 102, // seventh row
|
||||
0, 153, 153,
|
||||
0, 153, 153,
|
||||
0, 153, 153,
|
||||
0, 102, 153,
|
||||
0, 51, 153,
|
||||
0, 0, 153,
|
||||
51, 0, 153,
|
||||
102, 0, 153,
|
||||
153, 0, 153,
|
||||
153, 0, 153,
|
||||
153, 0, 153,
|
||||
153, 0, 153,
|
||||
153, 0, 153,
|
||||
153, 0, 102,
|
||||
153, 0, 51,
|
||||
153, 0, 0,
|
||||
153, 51, 0,
|
||||
153, 102, 0,
|
||||
153, 153, 0,
|
||||
153, 153, 0,
|
||||
153, 153, 0,
|
||||
153, 153, 0,
|
||||
153, 153, 0,
|
||||
102, 153, 0,
|
||||
51, 153, 0,
|
||||
0, 153, 0,
|
||||
0, 153, 51,
|
||||
0, 153, 102,
|
||||
0, 153, 153,
|
||||
0, 153, 153,
|
||||
51, 51, 51, // eighth row
|
||||
0, 102, 102,
|
||||
0, 102, 102,
|
||||
0, 102, 102,
|
||||
0, 102, 102,
|
||||
0, 51, 102,
|
||||
0, 0, 102,
|
||||
51, 0, 102,
|
||||
102, 0, 102,
|
||||
102, 0, 102,
|
||||
102, 0, 102,
|
||||
102, 0, 102,
|
||||
102, 0, 102,
|
||||
102, 0, 102,
|
||||
102, 0, 102,
|
||||
102, 0, 51,
|
||||
102, 0, 0,
|
||||
102, 51, 0,
|
||||
102, 102, 0,
|
||||
102, 102, 0,
|
||||
102, 102, 0,
|
||||
102, 102, 0,
|
||||
102, 102, 0,
|
||||
102, 102, 0,
|
||||
102, 102, 0,
|
||||
51, 102, 0,
|
||||
0, 102, 0,
|
||||
0, 102, 51,
|
||||
0, 102, 102,
|
||||
0, 102, 102,
|
||||
0, 102, 102,
|
||||
0, 0, 0, // ninth row
|
||||
0, 51, 51,
|
||||
0, 51, 51,
|
||||
0, 51, 51,
|
||||
0, 51, 51,
|
||||
0, 51, 51,
|
||||
0, 0, 51,
|
||||
51, 0, 51,
|
||||
51, 0, 51,
|
||||
51, 0, 51,
|
||||
51, 0, 51,
|
||||
51, 0, 51,
|
||||
51, 0, 51,
|
||||
51, 0, 51,
|
||||
51, 0, 51,
|
||||
51, 0, 51,
|
||||
51, 0, 0,
|
||||
51, 51, 0,
|
||||
51, 51, 0,
|
||||
51, 51, 0,
|
||||
51, 51, 0,
|
||||
51, 51, 0,
|
||||
51, 51, 0,
|
||||
51, 51, 0,
|
||||
51, 51, 0,
|
||||
0, 51, 0,
|
||||
0, 51, 51,
|
||||
0, 51, 51,
|
||||
0, 51, 51,
|
||||
0, 51, 51,
|
||||
51, 51, 51};
|
||||
return rawValues;
|
||||
}
|
||||
}
|
||||
@@ -31,17 +31,19 @@ import javax.swing.UIManager;
|
||||
* @author JPEXS
|
||||
*/
|
||||
class MyRecentSwatchPanel extends MySwatchPanel {
|
||||
|
||||
protected void initValues() {
|
||||
swatchSize = UIManager.getDimension("ColorChooser.swatchesRecentSwatchSize", getLocale());
|
||||
numSwatches = new Dimension( 5, 7 );
|
||||
numSwatches = new Dimension(5, 7);
|
||||
gap = new Dimension(1, 1);
|
||||
}
|
||||
|
||||
protected void initColors() {
|
||||
Color defaultRecentColor = UIManager.getColor("ColorChooser.swatchesDefaultRecentColor", getLocale());
|
||||
int numColors = numSwatches.width * numSwatches.height;
|
||||
colors = new Color[numColors];
|
||||
String recentColorsStr = Configuration.recentColors.get();
|
||||
for (int i = 0; i < numColors ; i++) {
|
||||
for (int i = 0; i < numColors; i++) {
|
||||
colors[i] = defaultRecentColor;
|
||||
}
|
||||
Pattern hexColorPattern = Pattern.compile("^#(?<a>[a-fA-F0-9]{2})(?<r>[a-fA-F0-9]{2})(?<g>[a-fA-F0-9]{2})(?<b>[a-fA-F0-9]{2})$");
|
||||
@@ -50,24 +52,25 @@ class MyRecentSwatchPanel extends MySwatchPanel {
|
||||
for (int i = 0; i < colorsHex.length; i++) {
|
||||
Matcher m = hexColorPattern.matcher(colorsHex[i]);
|
||||
if (m.matches()) {
|
||||
colors[i] = new Color(Integer.parseInt(m.group("r"), 16),Integer.parseInt(m.group("g"), 16),Integer.parseInt(m.group("b"), 16), Integer.parseInt(m.group("a"), 16));
|
||||
colors[i] = new Color(Integer.parseInt(m.group("r"), 16), Integer.parseInt(m.group("g"), 16), Integer.parseInt(m.group("b"), 16), Integer.parseInt(m.group("a"), 16));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setMostRecentColor(Color c) {
|
||||
if (colors[0].equals(c)) {
|
||||
return;
|
||||
}
|
||||
System.arraycopy( colors, 0, colors, 1, colors.length-1);
|
||||
System.arraycopy(colors, 0, colors, 1, colors.length - 1);
|
||||
colors[0] = c;
|
||||
|
||||
|
||||
List<String> colorsAsStr = new ArrayList<>();
|
||||
for (int i = 0; i < colors.length; i++) {
|
||||
colorsAsStr.add(new RGBA(colors[i]).toHexARGB());
|
||||
}
|
||||
Configuration.recentColors.set(String.join(",", colorsAsStr));
|
||||
|
||||
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,108 +15,132 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui.colordialog;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.KeyListener;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.io.Serializable;
|
||||
import javax.accessibility.*;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.*;
|
||||
import javax.accessibility.AccessibleContext;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JColorChooser;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.border.CompoundBorder;
|
||||
import javax.swing.border.LineBorder;
|
||||
import javax.swing.colorchooser.AbstractColorChooserPanel;
|
||||
import javax.swing.colorchooser.ColorSelectionModel;
|
||||
|
||||
/**
|
||||
* The standard color swatch chooser.
|
||||
* Modified Java version
|
||||
* The standard color swatch chooser. Modified Java version
|
||||
*/
|
||||
public class MySwatchChooserPanel extends AbstractColorChooserPanel {
|
||||
|
||||
MySwatchPanel swatchPanel;
|
||||
//RecentSwatchPanel recentSwatchPanel;
|
||||
MouseListener mainSwatchListener;
|
||||
MouseListener recentSwatchListener;
|
||||
private KeyListener mainSwatchKeyListener;
|
||||
private KeyListener recentSwatchKeyListener;
|
||||
|
||||
public MySwatchChooserPanel() {
|
||||
super();
|
||||
setInheritsPopupMenu(true);
|
||||
}
|
||||
|
||||
|
||||
void setSelectedColor(Color color) {
|
||||
ColorSelectionModel model = getColorSelectionModel();
|
||||
if (model != null) {
|
||||
model.setSelectedColor(color);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int getInt(Object key, int defaultValue) {
|
||||
Object value = UIManager.get(key, getLocale());
|
||||
if (value instanceof Integer) {
|
||||
return ((Integer)value).intValue();
|
||||
return ((Integer) value).intValue();
|
||||
}
|
||||
if (value instanceof String) {
|
||||
try {
|
||||
return Integer.parseInt((String)value);
|
||||
} catch (NumberFormatException nfe) {}
|
||||
return Integer.parseInt((String) value);
|
||||
} catch (NumberFormatException nfe) {
|
||||
//ignore
|
||||
}
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
|
||||
public String getDisplayName() {
|
||||
return UIManager.getString("ColorChooser.swatchesNameText", getLocale());
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a hint to the look and feel as to the
|
||||
* <code>KeyEvent.VK</code> constant that can be used as a mnemonic to
|
||||
* access the panel. A return value <= 0 indicates there is no mnemonic.
|
||||
* <p>
|
||||
* The return value here is a hint, it is ultimately up to the look
|
||||
* and feel to honor the return value in some meaningful way.
|
||||
* Provides a hint to the look and feel as to the <code>KeyEvent.VK</code>
|
||||
* constant that can be used as a mnemonic to access the panel. A return
|
||||
* value <= 0 indicates there is no mnemonic. <p>
|
||||
* The return value here is a hint, it is ultimately up to the look and feel
|
||||
* to honor the return value in some meaningful way.
|
||||
* <p>
|
||||
* This implementation looks up the value from the default
|
||||
* <code>ColorChooser.swatchesMnemonic</code>, or if it
|
||||
* isn't available (or not an <code>Integer</code>) returns -1.
|
||||
* The lookup for the default is done through the <code>UIManager</code>:
|
||||
* <code>ColorChooser.swatchesMnemonic</code>, or if it isn't available (or
|
||||
* not an <code>Integer</code>) returns -1. The lookup for the default is
|
||||
* done through the <code>UIManager</code>:
|
||||
* <code>UIManager.get("ColorChooser.swatchesMnemonic");</code>.
|
||||
*
|
||||
* @return KeyEvent.VK constant identifying the mnemonic; <= 0 for no
|
||||
* mnemonic
|
||||
* @see #getDisplayedMnemonicIndex
|
||||
* mnemonic @see #getDisplayedMnemonicI
|
||||
* ndex
|
||||
* @since 1.4
|
||||
*/
|
||||
public int getMnemonic() {
|
||||
return getInt("ColorChooser.swatchesMnemonic", -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a hint to the look and feel as to the index of the character in
|
||||
* <code>getDisplayName</code> that should be visually identified as the
|
||||
* mnemonic. The look and feel should only use this if
|
||||
* <code>getMnemonic</code> returns a value > 0.
|
||||
* <p>
|
||||
* The return value here is a hint, it is ultimately up to the look
|
||||
* and feel to honor the return value in some meaningful way. For example,
|
||||
* a look and feel may wish to render each
|
||||
* <code>AbstractColorChooserPanel</code> in a <code>JTabbedPane</code>,
|
||||
* and further use this return value to underline a character in
|
||||
* the <code>getDisplayName</code>.
|
||||
* The return value here is a hint, it is ultimately up to the look and feel
|
||||
* to honor the return value in some meaningful way. For example, a look and
|
||||
* feel may wish to render each <code>AbstractColorChooserPanel</code> in a
|
||||
* <code>JTabbedPane</code>, and further use this return value to underline
|
||||
* a character in the <code>getDisplayName</code>.
|
||||
* <p>
|
||||
* This implementation looks up the value from the default
|
||||
* <code>ColorChooser.rgbDisplayedMnemonicIndex</code>, or if it
|
||||
* isn't available (or not an <code>Integer</code>) returns -1.
|
||||
* The lookup for the default is done through the <code>UIManager</code>:
|
||||
* <code>ColorChooser.rgbDisplayedMnemonicIndex</code>, or if it isn't
|
||||
* available (or not an <code>Integer</code>) returns -1. The lookup for the
|
||||
* default is done through the <code>UIManager</code>:
|
||||
* <code>UIManager.get("ColorChooser.swatchesDisplayedMnemonicIndex");</code>.
|
||||
*
|
||||
* @return Character index to render mnemonic for; -1 to provide no
|
||||
* visual identifier for this panel.
|
||||
* @return Character index to render mnemonic for; -1 to provide no visual
|
||||
* identifier for this panel.
|
||||
* @see #getMnemonic
|
||||
* @since 1.4
|
||||
*/
|
||||
public int getDisplayedMnemonicIndex() {
|
||||
return getInt("ColorChooser.swatchesDisplayedMnemonicIndex", -1);
|
||||
}
|
||||
|
||||
public Icon getSmallDisplayIcon() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Icon getLargeDisplayIcon() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The background color, foreground color, and font are already set to the
|
||||
* defaults from the defaults table before this method is called.
|
||||
@@ -124,14 +148,15 @@ public class MySwatchChooserPanel extends AbstractColorChooserPanel {
|
||||
public void installChooserPanel(JColorChooser enclosingChooser) {
|
||||
super.installChooserPanel(enclosingChooser);
|
||||
}
|
||||
|
||||
protected void buildChooser() {
|
||||
String recentStr = UIManager.getString("ColorChooser.swatchesRecentText", getLocale());
|
||||
GridBagLayout gb = new GridBagLayout();
|
||||
GridBagConstraints gbc = new GridBagConstraints();
|
||||
JPanel superHolder = new JPanel(gb);
|
||||
swatchPanel = new MainSwatchPanel();
|
||||
swatchPanel = new MainSwatchPanel();
|
||||
swatchPanel.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY,
|
||||
getDisplayName());
|
||||
getDisplayName());
|
||||
swatchPanel.setInheritsPopupMenu(true);
|
||||
//recentSwatchPanel = new RecentSwatchPanel();
|
||||
/*recentSwatchPanel.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY,
|
||||
@@ -145,8 +170,8 @@ public class MySwatchChooserPanel extends AbstractColorChooserPanel {
|
||||
//recentSwatchPanel.addMouseListener(recentSwatchListener);
|
||||
//recentSwatchPanel.addKeyListener(recentSwatchKeyListener);
|
||||
JPanel mainHolder = new JPanel(new BorderLayout());
|
||||
Border border = new CompoundBorder( new LineBorder(Color.black),
|
||||
new LineBorder(Color.white) );
|
||||
Border border = new CompoundBorder(new LineBorder(Color.black),
|
||||
new LineBorder(Color.white));
|
||||
mainHolder.setBorder(border);
|
||||
mainHolder.add(swatchPanel, BorderLayout.CENTER);
|
||||
gbc.anchor = GridBagConstraints.LAST_LINE_START;
|
||||
@@ -157,7 +182,7 @@ public class MySwatchChooserPanel extends AbstractColorChooserPanel {
|
||||
superHolder.add(mainHolder, gbc);
|
||||
gbc.insets = oldInsets;
|
||||
//recentSwatchPanel.setInheritsPopupMenu(true);
|
||||
JPanel recentHolder = new JPanel( new BorderLayout() );
|
||||
JPanel recentHolder = new JPanel(new BorderLayout());
|
||||
recentHolder.setBorder(border);
|
||||
recentHolder.setInheritsPopupMenu(true);
|
||||
//recentHolder.add(recentSwatchPanel, BorderLayout.CENTER);
|
||||
@@ -174,6 +199,7 @@ public class MySwatchChooserPanel extends AbstractColorChooserPanel {
|
||||
superHolder.setInheritsPopupMenu(true);
|
||||
add(superHolder);
|
||||
}
|
||||
|
||||
public void uninstallChooserPanel(JColorChooser enclosingChooser) {
|
||||
super.uninstallChooserPanel(enclosingChooser);
|
||||
swatchPanel.removeMouseListener(mainSwatchListener);
|
||||
@@ -188,9 +214,12 @@ public class MySwatchChooserPanel extends AbstractColorChooserPanel {
|
||||
recentSwatchKeyListener = null;
|
||||
removeAll(); // strip out all the sub-components
|
||||
}
|
||||
|
||||
public void updateChooser() {
|
||||
}
|
||||
|
||||
private class RecentSwatchKeyListener extends KeyAdapter {
|
||||
|
||||
public void keyPressed(KeyEvent e) {
|
||||
if (KeyEvent.VK_SPACE == e.getKeyCode()) {
|
||||
/*Color color = recentSwatchPanel.getSelectedColor();
|
||||
@@ -198,7 +227,9 @@ public class MySwatchChooserPanel extends AbstractColorChooserPanel {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class MainSwatchKeyListener extends KeyAdapter {
|
||||
|
||||
public void keyPressed(KeyEvent e) {
|
||||
if (KeyEvent.VK_SPACE == e.getKeyCode()) {
|
||||
Color color = swatchPanel.getSelectedColor();
|
||||
@@ -207,7 +238,9 @@ public class MySwatchChooserPanel extends AbstractColorChooserPanel {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class RecentSwatchListener extends MouseAdapter implements Serializable {
|
||||
|
||||
public void mousePressed(MouseEvent e) {
|
||||
if (isEnabled()) {
|
||||
/*Color color = recentSwatchPanel.getColorForLocation(e.getX(), e.getY());
|
||||
@@ -217,7 +250,9 @@ public class MySwatchChooserPanel extends AbstractColorChooserPanel {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class MainSwatchListener extends MouseAdapter implements Serializable {
|
||||
|
||||
public void mousePressed(MouseEvent e) {
|
||||
if (isEnabled()) {
|
||||
Color color = swatchPanel.getColorForLocation(e.getX(), e.getY());
|
||||
@@ -229,303 +264,3 @@ public class MySwatchChooserPanel extends AbstractColorChooserPanel {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class MainSwatchPanel extends MySwatchPanel {
|
||||
protected void initValues() {
|
||||
swatchSize = UIManager.getDimension("ColorChooser.swatchesSwatchSize", getLocale());
|
||||
numSwatches = new Dimension( 31, 9 );
|
||||
gap = new Dimension(1, 1);
|
||||
}
|
||||
protected void initColors() {
|
||||
int[] rawValues = initRawValues();
|
||||
int numColors = rawValues.length / 3;
|
||||
colors = new Color[numColors];
|
||||
for (int i = 0; i < numColors ; i++) {
|
||||
colors[i] = new Color( rawValues[(i*3)], rawValues[(i*3)+1], rawValues[(i*3)+2] );
|
||||
}
|
||||
}
|
||||
private int[] initRawValues() {
|
||||
int[] rawValues = {
|
||||
255, 255, 255, // first row.
|
||||
204, 255, 255,
|
||||
204, 204, 255,
|
||||
204, 204, 255,
|
||||
204, 204, 255,
|
||||
204, 204, 255,
|
||||
204, 204, 255,
|
||||
204, 204, 255,
|
||||
204, 204, 255,
|
||||
204, 204, 255,
|
||||
204, 204, 255,
|
||||
255, 204, 255,
|
||||
255, 204, 204,
|
||||
255, 204, 204,
|
||||
255, 204, 204,
|
||||
255, 204, 204,
|
||||
255, 204, 204,
|
||||
255, 204, 204,
|
||||
255, 204, 204,
|
||||
255, 204, 204,
|
||||
255, 204, 204,
|
||||
255, 255, 204,
|
||||
204, 255, 204,
|
||||
204, 255, 204,
|
||||
204, 255, 204,
|
||||
204, 255, 204,
|
||||
204, 255, 204,
|
||||
204, 255, 204,
|
||||
204, 255, 204,
|
||||
204, 255, 204,
|
||||
204, 255, 204,
|
||||
204, 204, 204, // second row.
|
||||
153, 255, 255,
|
||||
153, 204, 255,
|
||||
153, 153, 255,
|
||||
153, 153, 255,
|
||||
153, 153, 255,
|
||||
153, 153, 255,
|
||||
153, 153, 255,
|
||||
153, 153, 255,
|
||||
153, 153, 255,
|
||||
204, 153, 255,
|
||||
255, 153, 255,
|
||||
255, 153, 204,
|
||||
255, 153, 153,
|
||||
255, 153, 153,
|
||||
255, 153, 153,
|
||||
255, 153, 153,
|
||||
255, 153, 153,
|
||||
255, 153, 153,
|
||||
255, 153, 153,
|
||||
255, 204, 153,
|
||||
255, 255, 153,
|
||||
204, 255, 153,
|
||||
153, 255, 153,
|
||||
153, 255, 153,
|
||||
153, 255, 153,
|
||||
153, 255, 153,
|
||||
153, 255, 153,
|
||||
153, 255, 153,
|
||||
153, 255, 153,
|
||||
153, 255, 204,
|
||||
204, 204, 204, // third row
|
||||
102, 255, 255,
|
||||
102, 204, 255,
|
||||
102, 153, 255,
|
||||
102, 102, 255,
|
||||
102, 102, 255,
|
||||
102, 102, 255,
|
||||
102, 102, 255,
|
||||
102, 102, 255,
|
||||
153, 102, 255,
|
||||
204, 102, 255,
|
||||
255, 102, 255,
|
||||
255, 102, 204,
|
||||
255, 102, 153,
|
||||
255, 102, 102,
|
||||
255, 102, 102,
|
||||
255, 102, 102,
|
||||
255, 102, 102,
|
||||
255, 102, 102,
|
||||
255, 153, 102,
|
||||
255, 204, 102,
|
||||
255, 255, 102,
|
||||
204, 255, 102,
|
||||
153, 255, 102,
|
||||
102, 255, 102,
|
||||
102, 255, 102,
|
||||
102, 255, 102,
|
||||
102, 255, 102,
|
||||
102, 255, 102,
|
||||
102, 255, 153,
|
||||
102, 255, 204,
|
||||
153, 153, 153, // fourth row
|
||||
51, 255, 255,
|
||||
51, 204, 255,
|
||||
51, 153, 255,
|
||||
51, 102, 255,
|
||||
51, 51, 255,
|
||||
51, 51, 255,
|
||||
51, 51, 255,
|
||||
102, 51, 255,
|
||||
153, 51, 255,
|
||||
204, 51, 255,
|
||||
255, 51, 255,
|
||||
255, 51, 204,
|
||||
255, 51, 153,
|
||||
255, 51, 102,
|
||||
255, 51, 51,
|
||||
255, 51, 51,
|
||||
255, 51, 51,
|
||||
255, 102, 51,
|
||||
255, 153, 51,
|
||||
255, 204, 51,
|
||||
255, 255, 51,
|
||||
204, 255, 51,
|
||||
153, 255, 51,
|
||||
102, 255, 51,
|
||||
51, 255, 51,
|
||||
51, 255, 51,
|
||||
51, 255, 51,
|
||||
51, 255, 102,
|
||||
51, 255, 153,
|
||||
51, 255, 204,
|
||||
153, 153, 153, // Fifth row
|
||||
0, 255, 255,
|
||||
0, 204, 255,
|
||||
0, 153, 255,
|
||||
0, 102, 255,
|
||||
0, 51, 255,
|
||||
0, 0, 255,
|
||||
51, 0, 255,
|
||||
102, 0, 255,
|
||||
153, 0, 255,
|
||||
204, 0, 255,
|
||||
255, 0, 255,
|
||||
255, 0, 204,
|
||||
255, 0, 153,
|
||||
255, 0, 102,
|
||||
255, 0, 51,
|
||||
255, 0 , 0,
|
||||
255, 51, 0,
|
||||
255, 102, 0,
|
||||
255, 153, 0,
|
||||
255, 204, 0,
|
||||
255, 255, 0,
|
||||
204, 255, 0,
|
||||
153, 255, 0,
|
||||
102, 255, 0,
|
||||
51, 255, 0,
|
||||
0, 255, 0,
|
||||
0, 255, 51,
|
||||
0, 255, 102,
|
||||
0, 255, 153,
|
||||
0, 255, 204,
|
||||
102, 102, 102, // sixth row
|
||||
0, 204, 204,
|
||||
0, 204, 204,
|
||||
0, 153, 204,
|
||||
0, 102, 204,
|
||||
0, 51, 204,
|
||||
0, 0, 204,
|
||||
51, 0, 204,
|
||||
102, 0, 204,
|
||||
153, 0, 204,
|
||||
204, 0, 204,
|
||||
204, 0, 204,
|
||||
204, 0, 204,
|
||||
204, 0, 153,
|
||||
204, 0, 102,
|
||||
204, 0, 51,
|
||||
204, 0, 0,
|
||||
204, 51, 0,
|
||||
204, 102, 0,
|
||||
204, 153, 0,
|
||||
204, 204, 0,
|
||||
204, 204, 0,
|
||||
204, 204, 0,
|
||||
153, 204, 0,
|
||||
102, 204, 0,
|
||||
51, 204, 0,
|
||||
0, 204, 0,
|
||||
0, 204, 51,
|
||||
0, 204, 102,
|
||||
0, 204, 153,
|
||||
0, 204, 204,
|
||||
102, 102, 102, // seventh row
|
||||
0, 153, 153,
|
||||
0, 153, 153,
|
||||
0, 153, 153,
|
||||
0, 102, 153,
|
||||
0, 51, 153,
|
||||
0, 0, 153,
|
||||
51, 0, 153,
|
||||
102, 0, 153,
|
||||
153, 0, 153,
|
||||
153, 0, 153,
|
||||
153, 0, 153,
|
||||
153, 0, 153,
|
||||
153, 0, 153,
|
||||
153, 0, 102,
|
||||
153, 0, 51,
|
||||
153, 0, 0,
|
||||
153, 51, 0,
|
||||
153, 102, 0,
|
||||
153, 153, 0,
|
||||
153, 153, 0,
|
||||
153, 153, 0,
|
||||
153, 153, 0,
|
||||
153, 153, 0,
|
||||
102, 153, 0,
|
||||
51, 153, 0,
|
||||
0, 153, 0,
|
||||
0, 153, 51,
|
||||
0, 153, 102,
|
||||
0, 153, 153,
|
||||
0, 153, 153,
|
||||
51, 51, 51, // eighth row
|
||||
0, 102, 102,
|
||||
0, 102, 102,
|
||||
0, 102, 102,
|
||||
0, 102, 102,
|
||||
0, 51, 102,
|
||||
0, 0, 102,
|
||||
51, 0, 102,
|
||||
102, 0, 102,
|
||||
102, 0, 102,
|
||||
102, 0, 102,
|
||||
102, 0, 102,
|
||||
102, 0, 102,
|
||||
102, 0, 102,
|
||||
102, 0, 102,
|
||||
102, 0, 51,
|
||||
102, 0, 0,
|
||||
102, 51, 0,
|
||||
102, 102, 0,
|
||||
102, 102, 0,
|
||||
102, 102, 0,
|
||||
102, 102, 0,
|
||||
102, 102, 0,
|
||||
102, 102, 0,
|
||||
102, 102, 0,
|
||||
51, 102, 0,
|
||||
0, 102, 0,
|
||||
0, 102, 51,
|
||||
0, 102, 102,
|
||||
0, 102, 102,
|
||||
0, 102, 102,
|
||||
0, 0, 0, // ninth row
|
||||
0, 51, 51,
|
||||
0, 51, 51,
|
||||
0, 51, 51,
|
||||
0, 51, 51,
|
||||
0, 51, 51,
|
||||
0, 0, 51,
|
||||
51, 0, 51,
|
||||
51, 0, 51,
|
||||
51, 0, 51,
|
||||
51, 0, 51,
|
||||
51, 0, 51,
|
||||
51, 0, 51,
|
||||
51, 0, 51,
|
||||
51, 0, 51,
|
||||
51, 0, 51,
|
||||
51, 0, 0,
|
||||
51, 51, 0,
|
||||
51, 51, 0,
|
||||
51, 51, 0,
|
||||
51, 51, 0,
|
||||
51, 51, 0,
|
||||
51, 51, 0,
|
||||
51, 51, 0,
|
||||
51, 51, 0,
|
||||
0, 51, 0,
|
||||
0, 51, 51,
|
||||
0, 51, 51,
|
||||
0, 51, 51,
|
||||
0, 51, 51,
|
||||
51, 51, 51 };
|
||||
return rawValues;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,12 +31,14 @@ import javax.swing.JPanel;
|
||||
* @author JPEXS
|
||||
*/
|
||||
class MySwatchPanel extends JPanel {
|
||||
|
||||
protected Color[] colors;
|
||||
protected Dimension swatchSize;
|
||||
protected Dimension numSwatches;
|
||||
protected Dimension gap;
|
||||
private int selRow;
|
||||
private int selCol;
|
||||
|
||||
public MySwatchPanel() {
|
||||
initValues();
|
||||
initColors();
|
||||
@@ -49,6 +51,7 @@ class MySwatchPanel extends JPanel {
|
||||
public void focusGained(FocusEvent e) {
|
||||
repaint();
|
||||
}
|
||||
|
||||
public void focusLost(FocusEvent e) {
|
||||
repaint();
|
||||
}
|
||||
@@ -103,15 +106,18 @@ class MySwatchPanel extends JPanel {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public Color getSelectedColor() {
|
||||
return getColorForCell(selCol, selRow);
|
||||
}
|
||||
|
||||
protected void initValues() {
|
||||
}
|
||||
|
||||
public void paintComponent(Graphics g) {
|
||||
g.setColor(getBackground());
|
||||
g.fillRect(0,0,getWidth(), getHeight());
|
||||
for (int row = 0; row < numSwatches.height; row++) {
|
||||
g.setColor(getBackground());
|
||||
g.fillRect(0, 0, getWidth(), getHeight());
|
||||
for (int row = 0; row < numSwatches.height; row++) {
|
||||
int y = row * (swatchSize.height + gap.height);
|
||||
for (int column = 0; column < numSwatches.width; column++) {
|
||||
Color c = getColorForCell(column, row);
|
||||
@@ -122,10 +128,10 @@ class MySwatchPanel extends JPanel {
|
||||
} else {
|
||||
x = column * (swatchSize.width + gap.width);
|
||||
}
|
||||
g.fillRect( x, y, swatchSize.width, swatchSize.height);
|
||||
g.fillRect(x, y, swatchSize.width, swatchSize.height);
|
||||
g.setColor(Color.black);
|
||||
g.drawLine( x+swatchSize.width-1, y, x+swatchSize.width-1, y+swatchSize.height-1);
|
||||
g.drawLine( x, y+swatchSize.height-1, x+swatchSize.width-1, y+swatchSize.height-1);
|
||||
g.drawLine(x + swatchSize.width - 1, y, x + swatchSize.width - 1, y + swatchSize.height - 1);
|
||||
g.drawLine(x, y + swatchSize.height - 1, x + swatchSize.width - 1, y + swatchSize.height - 1);
|
||||
if (selRow == row && selCol == column && this.isFocusOwner()) {
|
||||
Color c2 = new Color(c.getRed() < 125 ? 255 : 0,
|
||||
c.getGreen() < 125 ? 255 : 0,
|
||||
@@ -139,19 +145,23 @@ class MySwatchPanel extends JPanel {
|
||||
g.drawLine(x, y + swatchSize.height - 1, x + swatchSize.width - 1, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Dimension getPreferredSize() {
|
||||
int x = numSwatches.width * (swatchSize.width + gap.width) - 1;
|
||||
int y = numSwatches.height * (swatchSize.height + gap.height) - 1;
|
||||
return new Dimension( x, y );
|
||||
return new Dimension(x, y);
|
||||
}
|
||||
|
||||
protected void initColors() {
|
||||
}
|
||||
|
||||
public String getToolTipText(MouseEvent e) {
|
||||
Color color = getColorForLocation(e.getX(), e.getY());
|
||||
return color.getRed()+", "+ color.getGreen() + ", " + color.getBlue();
|
||||
return color.getRed() + ", " + color.getGreen() + ", " + color.getBlue();
|
||||
}
|
||||
|
||||
public void setSelectedColorFromLocation(int x, int y) {
|
||||
if (!this.getComponentOrientation().isLeftToRight()) {
|
||||
selCol = numSwatches.width - x / (swatchSize.width + gap.width) - 1;
|
||||
@@ -161,7 +171,8 @@ class MySwatchPanel extends JPanel {
|
||||
selRow = y / (swatchSize.height + gap.height);
|
||||
repaint();
|
||||
}
|
||||
public Color getColorForLocation( int x, int y ) {
|
||||
|
||||
public Color getColorForLocation(int x, int y) {
|
||||
int column;
|
||||
if (!this.getComponentOrientation().isLeftToRight()) {
|
||||
column = numSwatches.width - x / (swatchSize.width + gap.width) - 1;
|
||||
@@ -171,7 +182,8 @@ class MySwatchPanel extends JPanel {
|
||||
int row = y / (swatchSize.height + gap.height);
|
||||
return getColorForCell(column, row);
|
||||
}
|
||||
private Color getColorForCell( int column, int row) {
|
||||
return colors[ (row * numSwatches.width) + column ]; // (STEVE) - change data orientation here
|
||||
|
||||
private Color getColorForCell(int column, int row) {
|
||||
return colors[(row * numSwatches.width) + column]; // (STEVE) - change data orientation here
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ import com.jpexs.decompiler.flash.gui.FasterScrollPane;
|
||||
import com.jpexs.decompiler.flash.gui.View;
|
||||
import com.jpexs.decompiler.flash.gui.ViewMessages;
|
||||
import com.jpexs.decompiler.flash.gui.editor.LineMarkedEditorPane;
|
||||
import com.jpexs.decompiler.flash.importers.amf.amf3.Amf3Importer;
|
||||
import com.jpexs.decompiler.flash.importers.amf.AmfParseException;
|
||||
import com.jpexs.decompiler.flash.importers.amf.amf3.Amf3Importer;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import com.jpexs.helpers.ReflectionTools;
|
||||
import java.awt.BorderLayout;
|
||||
|
||||
@@ -97,7 +97,6 @@ public class PlayerControls extends JPanel implements MediaDisplayListener {
|
||||
private static final Icon resampleIcon = View.getIcon("resample16");
|
||||
|
||||
//private final JLabel percentLabel = new JLabel("100%");
|
||||
|
||||
private final ZoomPanel zoomPanel;
|
||||
|
||||
private final JPanel graphicControls;
|
||||
@@ -106,12 +105,9 @@ public class PlayerControls extends JPanel implements MediaDisplayListener {
|
||||
|
||||
private final JPanel frameControls;
|
||||
|
||||
// private boolean zoomToFit = false;
|
||||
|
||||
// private double realZoom = 1.0;
|
||||
|
||||
//private boolean zoomToFit = false;
|
||||
//private double realZoom = 1.0;
|
||||
//private final JButton zoomFitButton;
|
||||
|
||||
private final JButton snapshotButton;
|
||||
|
||||
private final JToggleButton showButton;
|
||||
@@ -134,10 +130,10 @@ public class PlayerControls extends JPanel implements MediaDisplayListener {
|
||||
|
||||
private static Font notUnderlinedFont = null;
|
||||
|
||||
private final int zeroCharacterWidth;
|
||||
|
||||
private final int zeroCharacterWidth;
|
||||
|
||||
private JButton selectColorButton;
|
||||
|
||||
|
||||
static {
|
||||
Font font = new JLabel().getFont();
|
||||
notUnderlinedFont = font;
|
||||
@@ -166,14 +162,12 @@ public class PlayerControls extends JPanel implements MediaDisplayListener {
|
||||
|
||||
zoomPanel = new ZoomPanel(display);
|
||||
zoomPanel.setVisible(false);
|
||||
|
||||
|
||||
snapshotButton = new JButton(View.getIcon("snapshot16"));
|
||||
snapshotButton.addActionListener(this::snapShotButtonActionPerformed);
|
||||
snapshotButton.setToolTipText(AppStrings.translate("button.snapshot.hint"));
|
||||
snapshotButton.setVisible(false);
|
||||
|
||||
|
||||
|
||||
graphicButtonsPanel.add(zoomPanel);
|
||||
graphicButtonsPanel.add(selectColorButton);
|
||||
graphicButtonsPanel.add(snapshotButton);
|
||||
@@ -436,7 +430,7 @@ public class PlayerControls extends JPanel implements MediaDisplayListener {
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void pauseButtonActionPerformed(ActionEvent evt) {
|
||||
if (display.isPlaying()) {
|
||||
@@ -521,8 +515,6 @@ public class PlayerControls extends JPanel implements MediaDisplayListener {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void snapShotButtonActionPerformed(ActionEvent evt) {
|
||||
putImageToClipBoard(display.printScreen());
|
||||
}
|
||||
@@ -549,8 +541,6 @@ public class PlayerControls extends JPanel implements MediaDisplayListener {
|
||||
Configuration.playFrameSounds.set(!muteButton.isSelected());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void mediaDisplayStateChanged(MediaDisplay source) {
|
||||
if (display != source) {
|
||||
|
||||
@@ -43,18 +43,17 @@ import java.util.regex.Pattern;
|
||||
public class SharedObjectsStorage {
|
||||
|
||||
public static boolean watchingPaused = false;
|
||||
|
||||
|
||||
public static Map<WatchKey, File> watchedCookieDirectories = new HashMap<>();
|
||||
|
||||
|
||||
|
||||
private static Map<File, List<CookiesChangedListener>> swfFileToListeners = new LinkedHashMap<>();
|
||||
|
||||
|
||||
public static void addChangedListener(File file, CookiesChangedListener listener) {
|
||||
if (!swfFileToListeners.containsKey(file)) {
|
||||
swfFileToListeners.put(file, new ArrayList<>());
|
||||
}
|
||||
swfFileToListeners.get(file).add(listener);
|
||||
|
||||
|
||||
File solDir = getSolDirectoryForLocalFile(file);
|
||||
if (solDir == null) {
|
||||
return;
|
||||
@@ -74,7 +73,6 @@ public class SharedObjectsStorage {
|
||||
swfFileToListeners.get(file).remove(listener);
|
||||
}
|
||||
|
||||
|
||||
private static void watchDir(File dir) {
|
||||
try {
|
||||
WatchKey key = dir.toPath().register(Main.getWatcher(), StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_DELETE, StandardWatchEventKinds.ENTRY_MODIFY);
|
||||
@@ -82,9 +80,9 @@ public class SharedObjectsStorage {
|
||||
} catch (IOException ex) {
|
||||
//ignored
|
||||
//ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private enum OSId {
|
||||
WINDOWS, OSX, UNIX
|
||||
}
|
||||
@@ -347,18 +345,18 @@ public class SharedObjectsStorage {
|
||||
|
||||
return subDirs[0];
|
||||
}
|
||||
|
||||
public static void watchedDirectoryChanged(File file) {
|
||||
|
||||
public static void watchedDirectoryChanged(File file) {
|
||||
if (watchingPaused) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
List<File> swfFiles = new ArrayList<>(swfFileToListeners.keySet());
|
||||
for (File swfFile : swfFiles) {
|
||||
File solDir = getSolDirectoryForLocalFile(swfFile);
|
||||
if (file.equals(solDir) || file.getParentFile().equals(solDir)) {
|
||||
fireChanged(swfFile, getSolFilesForLocalFile(swfFile));
|
||||
} else {
|
||||
} else {
|
||||
if (solDir.exists()) {
|
||||
continue;
|
||||
}
|
||||
@@ -373,13 +371,13 @@ public class SharedObjectsStorage {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void fireChanged(File swfFile, List<File> files) {
|
||||
//System.err.println("- firing changed " + swfFile.getAbsolutePath());
|
||||
List<CookiesChangedListener> listeners = swfFileToListeners.get(swfFile);
|
||||
if (listeners != null) {
|
||||
listeners = new ArrayList<>(listeners);
|
||||
for (CookiesChangedListener l:listeners) {
|
||||
for (CookiesChangedListener l : listeners) {
|
||||
l.cookiesChanged(swfFile, files);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,9 +25,9 @@ import com.jpexs.decompiler.flash.gui.FasterScrollPane;
|
||||
import com.jpexs.decompiler.flash.gui.View;
|
||||
import com.jpexs.decompiler.flash.gui.ViewMessages;
|
||||
import com.jpexs.decompiler.flash.gui.editor.LineMarkedEditorPane;
|
||||
import com.jpexs.decompiler.flash.importers.amf.AmfParseException;
|
||||
import com.jpexs.decompiler.flash.importers.amf.amf0.Amf0Importer;
|
||||
import com.jpexs.decompiler.flash.importers.amf.amf3.Amf3Importer;
|
||||
import com.jpexs.decompiler.flash.importers.amf.AmfParseException;
|
||||
import com.jpexs.decompiler.flash.sol.SolFile;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import java.awt.BorderLayout;
|
||||
|
||||
@@ -184,7 +184,7 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
private final MainPanel mainPanel;
|
||||
|
||||
private JMenuItem gotoDocumentClassMenuItem;
|
||||
|
||||
|
||||
private JMenuItem configurePathResolvingMenuItem;
|
||||
|
||||
private JMenuItem setAsLinkageMenuItem;
|
||||
@@ -224,7 +224,7 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
private JMenuItem exportFlashDevelopMenuItem;
|
||||
|
||||
private JMenuItem exportIdeaMenuItem;
|
||||
|
||||
|
||||
private JMenuItem exportVsCodeMenuItem;
|
||||
|
||||
private JMenuItem exportSwfXmlMenuItem;
|
||||
@@ -342,9 +342,9 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
private JMenuItem replaceWithGifMenuItem;
|
||||
|
||||
private JMenuItem collectDepthAsSpritesMenuItem;
|
||||
|
||||
|
||||
private JMenuItem convertShapeTypeMenuItem;
|
||||
|
||||
|
||||
private JMenuItem convertPlaceObjectTypeMenuItem;
|
||||
|
||||
private List<TreeItem> items = new ArrayList<>();
|
||||
@@ -405,7 +405,7 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
configurePathResolvingMenuItem.setIcon(View.getIcon("settings16"));
|
||||
add(configurePathResolvingMenuItem);
|
||||
|
||||
addSeparator();
|
||||
addSeparator();
|
||||
jumpToCharacterMenuItem = new JMenuItem(mainPanel.translate("contextmenu.jumpToCharacter"));
|
||||
jumpToCharacterMenuItem.addActionListener(this::jumpToCharacterActionPerformed);
|
||||
jumpToCharacterMenuItem.setIcon(View.getIcon("jumpto16"));
|
||||
@@ -467,7 +467,7 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
exportIdeaMenuItem.addActionListener(this::exportIdeaActionPerformed);
|
||||
exportIdeaMenuItem.setIcon(View.getIcon("exportidea16"));
|
||||
add(exportIdeaMenuItem);
|
||||
|
||||
|
||||
exportVsCodeMenuItem = new JMenuItem(mainPanel.translate("contextmenu.exportVsCode"));
|
||||
exportVsCodeMenuItem.addActionListener(this::exportVsCodeActionPerformed);
|
||||
exportVsCodeMenuItem.setIcon(View.getIcon("exportvscode16"));
|
||||
@@ -544,19 +544,19 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
replaceRefsWithTagMenuItem.addActionListener(this::replaceRefsWithTagActionPerformed);
|
||||
replaceRefsWithTagMenuItem.setIcon(View.getIcon("replacewithtag16"));
|
||||
add(replaceRefsWithTagMenuItem);
|
||||
|
||||
|
||||
convertShapeTypeMenuItem = new JMenuItem(mainPanel.translate("contextmenu.convertShapeType"));
|
||||
convertShapeTypeMenuItem.addActionListener(this::convertShapeTypeActionPerformed);
|
||||
convertShapeTypeMenuItem.setIcon(View.getIcon("shape16"));
|
||||
add(convertShapeTypeMenuItem);
|
||||
|
||||
|
||||
convertPlaceObjectTypeMenuItem = new JMenuItem(mainPanel.translate("contextmenu.convertPlaceObjectType"));
|
||||
convertPlaceObjectTypeMenuItem.addActionListener(this::convertPlaceObjectTypeActionPerformed);
|
||||
convertPlaceObjectTypeMenuItem.setIcon(View.getIcon("placeobject16"));
|
||||
add(convertPlaceObjectTypeMenuItem);
|
||||
|
||||
addSeparator();
|
||||
|
||||
|
||||
gotoDocumentClassMenuItem = new JMenuItem(mainPanel.translate("menu.tools.gotoDocumentClass"));
|
||||
gotoDocumentClassMenuItem.addActionListener(this::gotoDocumentClassActionPerformed);
|
||||
gotoDocumentClassMenuItem.setIcon(View.getIcon("gotomainclass16"));
|
||||
@@ -920,7 +920,7 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
if (item instanceof Cookie) {
|
||||
if (wasFrame) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
wasNotFrame = true;
|
||||
} else if (item instanceof Tag) {
|
||||
if (wasFrame) {
|
||||
@@ -1089,24 +1089,24 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
}
|
||||
tim = fr.timeline.timelined;
|
||||
}
|
||||
|
||||
|
||||
boolean allSelectedIsShape = true;
|
||||
boolean allSelectedIsPlaceObject = true;
|
||||
|
||||
|
||||
if (items.isEmpty()) {
|
||||
allSelectedIsShape = false;
|
||||
allSelectedIsPlaceObject = false;
|
||||
}
|
||||
|
||||
|
||||
for (TreeItem item : items) {
|
||||
|
||||
|
||||
if (!(item instanceof ShapeTag)) {
|
||||
allSelectedIsShape = false;
|
||||
}
|
||||
if (!(item instanceof PlaceObjectTypeTag)) {
|
||||
allSelectedIsPlaceObject = false;
|
||||
}
|
||||
|
||||
|
||||
if (item instanceof Tag) {
|
||||
Tag tag = (Tag) item;
|
||||
if (tag.isReadOnly()) {
|
||||
@@ -1424,13 +1424,13 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
exportABCMenuItem.setVisible(true);
|
||||
gotoDocumentClassMenuItem.setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
if (firstItem instanceof ScriptPack) {
|
||||
if (firstItem.getOpenable() instanceof SWF) {
|
||||
gotoDocumentClassMenuItem.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (firstItem instanceof SWF) {
|
||||
if (((SWF) firstItem).isAS3()) {
|
||||
gotoDocumentClassMenuItem.setVisible(true);
|
||||
@@ -1455,7 +1455,7 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
replaceRefsWithTagMenuItem.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (firstItem instanceof DefineSpriteTag) {
|
||||
replaceWithGifMenuItem.setVisible(true);
|
||||
}
|
||||
@@ -1481,7 +1481,7 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
addInsideAddAllTags = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
boolean isCookie = firstItem instanceof Cookie;
|
||||
|
||||
addTagInsideMenu.removeAll();
|
||||
@@ -1682,11 +1682,11 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (allSelectedIsShape) {
|
||||
convertShapeTypeMenuItem.setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
if (allSelectedIsPlaceObject) {
|
||||
convertPlaceObjectTypeMenuItem.setVisible(true);
|
||||
}
|
||||
@@ -2600,7 +2600,7 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
mainPanel.refreshTree(swf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void convertShapeTypeActionPerformed(ActionEvent evt) {
|
||||
List<TreeItem> itemr = getSelectedItems();
|
||||
if (itemr.isEmpty()) {
|
||||
@@ -2609,25 +2609,24 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
int currentShapeNum = 0;
|
||||
int min = 0;
|
||||
int minForced = 0;
|
||||
|
||||
|
||||
ShapeTypeConverter converter = new ShapeTypeConverter();
|
||||
|
||||
|
||||
|
||||
if (itemr.size() == 1) {
|
||||
ShapeTag sh = (ShapeTag) itemr.get(0);
|
||||
currentShapeNum = sh.getShapeNum();
|
||||
min = converter.getMinShapeNum(sh);
|
||||
minForced = converter.getForcedMinShapeNum(sh);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ConvertShapeTypeDialog dialog = new ConvertShapeTypeDialog(Main.getDefaultDialogsOwner(), currentShapeNum, minForced, min);
|
||||
|
||||
|
||||
int shapeNum = dialog.showDialog();
|
||||
|
||||
|
||||
if (shapeNum == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
for (TreeItem item : itemr) {
|
||||
ShapeTag sh = (ShapeTag) item;
|
||||
int newShapeNum = shapeNum;
|
||||
@@ -2640,14 +2639,14 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
}
|
||||
converter.convertCharacter(sh.getSwf(), sh.getCharacterId(), newShapeNum);
|
||||
}
|
||||
|
||||
|
||||
mainPanel.refreshTree();
|
||||
if (itemr.size() == 1) {
|
||||
ShapeTag sh = (ShapeTag) itemr.get(0);
|
||||
mainPanel.setTagTreeSelectedNode(mainPanel.getCurrentTree(), sh.getSwf().getCharacter(sh.getCharacterId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void convertPlaceObjectTypeActionPerformed(ActionEvent evt) {
|
||||
List<TreeItem> itemr = getSelectedItems();
|
||||
if (itemr.isEmpty()) {
|
||||
@@ -2655,37 +2654,36 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
}
|
||||
int currentPlaceObjectNum = 0;
|
||||
int min = 0;
|
||||
|
||||
|
||||
PlaceObjectTypeConverter converter = new PlaceObjectTypeConverter();
|
||||
|
||||
|
||||
|
||||
if (itemr.size() == 1) {
|
||||
PlaceObjectTypeTag sh = (PlaceObjectTypeTag) itemr.get(0);
|
||||
currentPlaceObjectNum = sh.getPlaceObjectNum();
|
||||
min = converter.getMinPlaceNum(sh);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ConvertPlaceObjectTypeDialog dialog = new ConvertPlaceObjectTypeDialog(Main.getDefaultDialogsOwner(), currentPlaceObjectNum, min);
|
||||
|
||||
|
||||
int placeNum = dialog.showDialog();
|
||||
|
||||
|
||||
if (placeNum == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
PlaceObjectTypeTag lastConverted = null;
|
||||
for (TreeItem item : itemr) {
|
||||
PlaceObjectTypeTag pl = (PlaceObjectTypeTag) item;
|
||||
if (pl.getPlaceObjectNum()== placeNum) {
|
||||
if (pl.getPlaceObjectNum() == placeNum) {
|
||||
continue;
|
||||
}
|
||||
lastConverted = converter.convertTagType(pl, placeNum);
|
||||
}
|
||||
|
||||
|
||||
mainPanel.refreshTree();
|
||||
if (itemr.size() == 1) {
|
||||
mainPanel.setTagTreeSelectedNode(mainPanel.getCurrentTree(), lastConverted);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void replaceRefsWithTagActionPerformed(ActionEvent evt) {
|
||||
@@ -2828,7 +2826,7 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
item.getOpenable();
|
||||
mainPanel.gotoDocumentClass((SWF) item.getOpenable());
|
||||
}
|
||||
|
||||
|
||||
private void jumpToCharacterActionPerformed(ActionEvent evt) {
|
||||
TreeItem itemj = getCurrentItem();
|
||||
if (itemj == null || !(itemj instanceof HasCharacterId)) {
|
||||
@@ -2988,7 +2986,7 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
}
|
||||
if (!identifier.isEmpty() && !found) {
|
||||
ea.tags.add(ch.getCharacterId());
|
||||
ea.names.add(identifier);
|
||||
ea.names.add(identifier);
|
||||
}
|
||||
ea.setModified(true);
|
||||
if (ea.names.isEmpty()) {
|
||||
@@ -4046,7 +4044,7 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
Cookie cookie = (Cookie) item;
|
||||
((Cookie) item).getSolFile().delete();
|
||||
}
|
||||
|
||||
|
||||
if (item instanceof BUTTONRECORD) {
|
||||
ButtonTag button = (ButtonTag) parent;
|
||||
button.getRecords().remove((BUTTONRECORD) item);
|
||||
@@ -5708,7 +5706,7 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
SWF swf = (SWF) getCurrentItem().getOpenable();
|
||||
mainPanel.exportIdea(swf);
|
||||
}
|
||||
|
||||
|
||||
public void exportVsCodeActionPerformed(ActionEvent evt) {
|
||||
SWF swf = (SWF) getCurrentItem().getOpenable();
|
||||
mainPanel.exportVsCode(swf);
|
||||
|
||||
Reference in New Issue
Block a user