mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-25 10:55:40 +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
|
||||
- Move tag to action did not remove original tag
|
||||
- Show in tag list from tag scripts
|
||||
- Move/Copy tag to action on tag scripts
|
||||
|
||||
### Changed
|
||||
- GFX - DefineExternalImage2 no longer handled as character
|
||||
|
||||
@@ -36,6 +36,7 @@ import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import javax.swing.tree.TreePath;
|
||||
import org.pushingpixels.substance.api.ColorSchemeAssociationKind;
|
||||
import org.pushingpixels.substance.api.ComponentState;
|
||||
import org.pushingpixels.substance.api.DecorationAreaType;
|
||||
@@ -113,9 +114,8 @@ public class PinButton extends JPanel {
|
||||
|
||||
|
||||
label = new JLabel();
|
||||
label.setIcon(AbstractTagTree.getIconFor(item));
|
||||
label.setText(mainPanel.itemToString(item));
|
||||
|
||||
label.setIcon(AbstractTagTree.getIconFor(item));
|
||||
refresh();
|
||||
button = new JLabel();
|
||||
button.setMinimumSize(new Dimension(10 + 16, 16));
|
||||
button.setPreferredSize(new Dimension(10 + 16, 16));
|
||||
@@ -175,6 +175,8 @@ public class PinButton extends JPanel {
|
||||
};
|
||||
addMouseListener(adapter);
|
||||
addMouseMotionListener(adapter);
|
||||
label.addMouseListener(adapter);
|
||||
label.addMouseMotionListener(adapter);
|
||||
|
||||
button.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
|
||||
button.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
||||
@@ -233,7 +235,7 @@ public class PinButton extends JPanel {
|
||||
|
||||
setLayout(new BorderLayout());
|
||||
add(label, BorderLayout.CENTER);
|
||||
add(button, BorderLayout.EAST);
|
||||
add(button, BorderLayout.EAST);
|
||||
}
|
||||
|
||||
private void updateIcon() {
|
||||
@@ -318,8 +320,24 @@ public class PinButton extends JPanel {
|
||||
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() {
|
||||
label.setText(mainPanel.itemToString(item));
|
||||
label.setToolTipText(getTreeItemPath(item));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,21 +136,7 @@ public class PinsPanel extends JPanel {
|
||||
|
||||
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() {
|
||||
removeAll();
|
||||
@@ -159,7 +145,6 @@ public class PinsPanel extends JPanel {
|
||||
boolean currentPinned = false;
|
||||
for (TreeItem item : items) {
|
||||
PinButton pinButton = new PinButton(mainPanel, item, true);
|
||||
pinButton.setToolTipText(getTreeItemPath(item));
|
||||
pinButton.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
@@ -247,7 +232,6 @@ public class PinsPanel extends JPanel {
|
||||
currentUnpinnedButton = new PinButton(mainPanel, current, false);
|
||||
lastSelectedButton = currentUnpinnedButton;
|
||||
add(currentUnpinnedButton);
|
||||
currentUnpinnedButton.setToolTipText(getTreeItemPath(current));
|
||||
currentUnpinnedButton.setSelected(true);
|
||||
currentUnpinnedButton.addChangeListener(new ChangeListener() {
|
||||
@Override
|
||||
@@ -395,8 +379,18 @@ public class PinsPanel extends JPanel {
|
||||
}
|
||||
|
||||
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++) {
|
||||
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);
|
||||
rebuild();
|
||||
break;
|
||||
|
||||
@@ -959,15 +959,16 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
copyTagToMenu.removeAll();
|
||||
copyTagToWithDependenciesMenu.removeAll();
|
||||
|
||||
if (allSelectedIsTag) {
|
||||
List<TreeItem> tagItems = new ArrayList<>();
|
||||
for (TreeItem item : items) {
|
||||
if (item instanceof TagScript) {
|
||||
tagItems.add(((TagScript) item).getTag());
|
||||
} else {
|
||||
tagItems.add((Tag) item);
|
||||
}
|
||||
List<TreeItem> tagItems = new ArrayList<>();
|
||||
for (TreeItem item : items) {
|
||||
if (item instanceof TagScript) {
|
||||
tagItems.add(((TagScript) item).getTag());
|
||||
} else {
|
||||
tagItems.add((Tag) item);
|
||||
}
|
||||
}
|
||||
if (allSelectedIsTag) {
|
||||
|
||||
JMenuItem copyToClipboardMenuItem = new JMenuItem(AppStrings.translate("contextmenu.clipboard") + " (CTRL+C)", View.getIcon("clipboard16"));
|
||||
copyToClipboardMenuItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
@@ -999,10 +1000,10 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
if ((targetSwfList.size() == 1) && (targetSwfList.get(0) == singleSwf)) {
|
||||
continue;
|
||||
}
|
||||
addCopyMoveToMenusSwfList(KIND_MOVETO, singleSwf, targetSwfList, moveTagToMenu, items);
|
||||
addCopyMoveToMenusSwfList(KIND_MOVETODEPS, singleSwf, targetSwfList, moveTagToWithDependenciesMenu, items);
|
||||
addCopyMoveToMenusSwfList(KIND_COPYTO, singleSwf, targetSwfList, copyTagToMenu, items);
|
||||
addCopyMoveToMenusSwfList(KIND_COPYTODEPS, singleSwf, targetSwfList, copyTagToWithDependenciesMenu, items);
|
||||
addCopyMoveToMenusSwfList(KIND_MOVETO, singleSwf, targetSwfList, moveTagToMenu, tagItems);
|
||||
addCopyMoveToMenusSwfList(KIND_MOVETODEPS, singleSwf, targetSwfList, moveTagToWithDependenciesMenu, tagItems);
|
||||
addCopyMoveToMenusSwfList(KIND_COPYTO, singleSwf, targetSwfList, copyTagToMenu, tagItems);
|
||||
addCopyMoveToMenusSwfList(KIND_COPYTODEPS, singleSwf, targetSwfList, copyTagToWithDependenciesMenu, tagItems);
|
||||
}
|
||||
moveTagToMenu.setVisible(true);
|
||||
moveTagToWithDependenciesMenu.setVisible(true);
|
||||
|
||||
Reference in New Issue
Block a user