mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-25 01:10:44 +00:00
Fixed Move/Copy tag to action on tag scripts
Refreshing pin path Fixed pin after move to action
This commit is contained in:
@@ -39,6 +39,7 @@ All notable changes to this project will be documented in this file.
|
|||||||
- Header of display panel not visible on certain color schemes
|
- Header of display panel not visible on certain color schemes
|
||||||
- Move tag to action did not remove original tag
|
- Move tag to action did not remove original tag
|
||||||
- Show in tag list from tag scripts
|
- Show in tag list from tag scripts
|
||||||
|
- Move/Copy tag to action on tag scripts
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- GFX - DefineExternalImage2 no longer handled as character
|
- GFX - DefineExternalImage2 no longer handled as character
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ import javax.swing.JLabel;
|
|||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.event.ChangeEvent;
|
import javax.swing.event.ChangeEvent;
|
||||||
import javax.swing.event.ChangeListener;
|
import javax.swing.event.ChangeListener;
|
||||||
|
import javax.swing.tree.TreePath;
|
||||||
import org.pushingpixels.substance.api.ColorSchemeAssociationKind;
|
import org.pushingpixels.substance.api.ColorSchemeAssociationKind;
|
||||||
import org.pushingpixels.substance.api.ComponentState;
|
import org.pushingpixels.substance.api.ComponentState;
|
||||||
import org.pushingpixels.substance.api.DecorationAreaType;
|
import org.pushingpixels.substance.api.DecorationAreaType;
|
||||||
@@ -113,9 +114,8 @@ public class PinButton extends JPanel {
|
|||||||
|
|
||||||
|
|
||||||
label = new JLabel();
|
label = new JLabel();
|
||||||
label.setIcon(AbstractTagTree.getIconFor(item));
|
label.setIcon(AbstractTagTree.getIconFor(item));
|
||||||
label.setText(mainPanel.itemToString(item));
|
refresh();
|
||||||
|
|
||||||
button = new JLabel();
|
button = new JLabel();
|
||||||
button.setMinimumSize(new Dimension(10 + 16, 16));
|
button.setMinimumSize(new Dimension(10 + 16, 16));
|
||||||
button.setPreferredSize(new Dimension(10 + 16, 16));
|
button.setPreferredSize(new Dimension(10 + 16, 16));
|
||||||
@@ -175,6 +175,8 @@ public class PinButton extends JPanel {
|
|||||||
};
|
};
|
||||||
addMouseListener(adapter);
|
addMouseListener(adapter);
|
||||||
addMouseMotionListener(adapter);
|
addMouseMotionListener(adapter);
|
||||||
|
label.addMouseListener(adapter);
|
||||||
|
label.addMouseMotionListener(adapter);
|
||||||
|
|
||||||
button.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
|
button.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
|
||||||
button.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
button.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
||||||
@@ -233,7 +235,7 @@ public class PinButton extends JPanel {
|
|||||||
|
|
||||||
setLayout(new BorderLayout());
|
setLayout(new BorderLayout());
|
||||||
add(label, BorderLayout.CENTER);
|
add(label, BorderLayout.CENTER);
|
||||||
add(button, BorderLayout.EAST);
|
add(button, BorderLayout.EAST);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateIcon() {
|
private void updateIcon() {
|
||||||
@@ -318,8 +320,24 @@ public class PinButton extends JPanel {
|
|||||||
g.drawLine(0, 2, getWidth() - 1, 2);
|
g.drawLine(0, 2, getWidth() - 1, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getTreeItemPath(TreeItem item) {
|
||||||
|
TreePath path = mainPanel.getCurrentTree().getModel().getTreePath(item);
|
||||||
|
if (path == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
StringBuilder pathString = new StringBuilder();
|
||||||
|
for (int i = 1; i < path.getPathCount(); i++) {
|
||||||
|
if (pathString.length() > 0) {
|
||||||
|
pathString.append(" / ");
|
||||||
|
}
|
||||||
|
pathString.append(mainPanel.itemToString((TreeItem) path.getPathComponent(i)));
|
||||||
|
}
|
||||||
|
return pathString.toString();
|
||||||
|
}
|
||||||
|
|
||||||
public void refresh() {
|
public void refresh() {
|
||||||
label.setText(mainPanel.itemToString(item));
|
label.setText(mainPanel.itemToString(item));
|
||||||
|
label.setToolTipText(getTreeItemPath(item));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,21 +136,7 @@ public class PinsPanel extends JPanel {
|
|||||||
|
|
||||||
rebuild();
|
rebuild();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getTreeItemPath(TreeItem item) {
|
|
||||||
TreePath path = mainPanel.getCurrentTree().getModel().getTreePath(item);
|
|
||||||
if (path == null) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
StringBuilder pathString = new StringBuilder();
|
|
||||||
for (int i = 1; i < path.getPathCount(); i++) {
|
|
||||||
if (pathString.length() > 0) {
|
|
||||||
pathString.append(" / ");
|
|
||||||
}
|
|
||||||
pathString.append(mainPanel.itemToString((TreeItem) path.getPathComponent(i)));
|
|
||||||
}
|
|
||||||
return pathString.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void rebuild() {
|
private void rebuild() {
|
||||||
removeAll();
|
removeAll();
|
||||||
@@ -159,7 +145,6 @@ public class PinsPanel extends JPanel {
|
|||||||
boolean currentPinned = false;
|
boolean currentPinned = false;
|
||||||
for (TreeItem item : items) {
|
for (TreeItem item : items) {
|
||||||
PinButton pinButton = new PinButton(mainPanel, item, true);
|
PinButton pinButton = new PinButton(mainPanel, item, true);
|
||||||
pinButton.setToolTipText(getTreeItemPath(item));
|
|
||||||
pinButton.addMouseListener(new MouseAdapter() {
|
pinButton.addMouseListener(new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void mousePressed(MouseEvent e) {
|
public void mousePressed(MouseEvent e) {
|
||||||
@@ -247,7 +232,6 @@ public class PinsPanel extends JPanel {
|
|||||||
currentUnpinnedButton = new PinButton(mainPanel, current, false);
|
currentUnpinnedButton = new PinButton(mainPanel, current, false);
|
||||||
lastSelectedButton = currentUnpinnedButton;
|
lastSelectedButton = currentUnpinnedButton;
|
||||||
add(currentUnpinnedButton);
|
add(currentUnpinnedButton);
|
||||||
currentUnpinnedButton.setToolTipText(getTreeItemPath(current));
|
|
||||||
currentUnpinnedButton.setSelected(true);
|
currentUnpinnedButton.setSelected(true);
|
||||||
currentUnpinnedButton.addChangeListener(new ChangeListener() {
|
currentUnpinnedButton.addChangeListener(new ChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
@@ -395,8 +379,18 @@ public class PinsPanel extends JPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void replaceItem(TreeItem oldItem, TreeItem newItem) {
|
public void replaceItem(TreeItem oldItem, TreeItem newItem) {
|
||||||
|
|
||||||
|
TreeItem oldItemNoTs = oldItem;
|
||||||
|
if (oldItem instanceof TagScript) {
|
||||||
|
oldItemNoTs = ((TagScript) oldItem).getTag();
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < items.size(); i++) {
|
for (int i = 0; i < items.size(); i++) {
|
||||||
if (items.get(i) == oldItem) {
|
TreeItem item2NoTs = items.get(i);
|
||||||
|
if (item2NoTs instanceof TagScript) {
|
||||||
|
item2NoTs = ((TagScript) item2NoTs).getTag();
|
||||||
|
}
|
||||||
|
if (item2NoTs == oldItemNoTs) {
|
||||||
items.set(i, newItem);
|
items.set(i, newItem);
|
||||||
rebuild();
|
rebuild();
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -959,15 +959,16 @@ public class TagTreeContextMenu extends JPopupMenu {
|
|||||||
copyTagToMenu.removeAll();
|
copyTagToMenu.removeAll();
|
||||||
copyTagToWithDependenciesMenu.removeAll();
|
copyTagToWithDependenciesMenu.removeAll();
|
||||||
|
|
||||||
if (allSelectedIsTag) {
|
List<TreeItem> tagItems = new ArrayList<>();
|
||||||
List<TreeItem> tagItems = new ArrayList<>();
|
for (TreeItem item : items) {
|
||||||
for (TreeItem item : items) {
|
if (item instanceof TagScript) {
|
||||||
if (item instanceof TagScript) {
|
tagItems.add(((TagScript) item).getTag());
|
||||||
tagItems.add(((TagScript) item).getTag());
|
} else {
|
||||||
} else {
|
tagItems.add((Tag) item);
|
||||||
tagItems.add((Tag) item);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (allSelectedIsTag) {
|
||||||
|
|
||||||
JMenuItem copyToClipboardMenuItem = new JMenuItem(AppStrings.translate("contextmenu.clipboard") + " (CTRL+C)", View.getIcon("clipboard16"));
|
JMenuItem copyToClipboardMenuItem = new JMenuItem(AppStrings.translate("contextmenu.clipboard") + " (CTRL+C)", View.getIcon("clipboard16"));
|
||||||
copyToClipboardMenuItem.addActionListener(new ActionListener() {
|
copyToClipboardMenuItem.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
@@ -999,10 +1000,10 @@ public class TagTreeContextMenu extends JPopupMenu {
|
|||||||
if ((targetSwfList.size() == 1) && (targetSwfList.get(0) == singleSwf)) {
|
if ((targetSwfList.size() == 1) && (targetSwfList.get(0) == singleSwf)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
addCopyMoveToMenusSwfList(KIND_MOVETO, singleSwf, targetSwfList, moveTagToMenu, items);
|
addCopyMoveToMenusSwfList(KIND_MOVETO, singleSwf, targetSwfList, moveTagToMenu, tagItems);
|
||||||
addCopyMoveToMenusSwfList(KIND_MOVETODEPS, singleSwf, targetSwfList, moveTagToWithDependenciesMenu, items);
|
addCopyMoveToMenusSwfList(KIND_MOVETODEPS, singleSwf, targetSwfList, moveTagToWithDependenciesMenu, tagItems);
|
||||||
addCopyMoveToMenusSwfList(KIND_COPYTO, singleSwf, targetSwfList, copyTagToMenu, items);
|
addCopyMoveToMenusSwfList(KIND_COPYTO, singleSwf, targetSwfList, copyTagToMenu, tagItems);
|
||||||
addCopyMoveToMenusSwfList(KIND_COPYTODEPS, singleSwf, targetSwfList, copyTagToWithDependenciesMenu, items);
|
addCopyMoveToMenusSwfList(KIND_COPYTODEPS, singleSwf, targetSwfList, copyTagToWithDependenciesMenu, tagItems);
|
||||||
}
|
}
|
||||||
moveTagToMenu.setVisible(true);
|
moveTagToMenu.setVisible(true);
|
||||||
moveTagToWithDependenciesMenu.setVisible(true);
|
moveTagToWithDependenciesMenu.setVisible(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user