Skip to content

Commit

Permalink
Fixed: #2384 Vanishing pins on AS3 code editing save, on script delet…
Browse files Browse the repository at this point in the history
…ion and few other cases
  • Loading branch information
jindrapetrik committed Jan 5, 2025
1 parent bc24feb commit 85c155b
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ All notable changes to this project will be documented in this file.
- [#2375] Added limit of simultaneously played sounds
- AS1/2 - Push action hilighting, GetProperty, Call action hilighting
- [#2381] Font color values with alpha allowed in html edittext, but alpha ignored
- [#2384] Vanishing pins on AS3 code editing save
- [#2384] Vanishing pins on AS3 code editing save, on script deletion and few other cases

## [22.0.1] - 2024-11-20
### Added
Expand Down
5 changes: 5 additions & 0 deletions src/com/jpexs/decompiler/flash/gui/MainPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,10 @@ public boolean isPinned(TreeItem item) {
public void replaceItemPin(TreeItem oldItem, TreeItem newItem) {
pinsPanel.replaceItem(oldItem, newItem);
}

public void refreshPinnedScriptPacks() {
pinsPanel.refreshScriptPacks();
}

private void handleKeyReleased(KeyEvent e) {
if (checkEdited()) {
Expand Down Expand Up @@ -1878,6 +1882,7 @@ public void updateClassesList() {
if (tp != null) {
getCurrentTree().setSelectionPath(tp);
}
refreshPinnedScriptPacks();
}

private boolean isFilterEmpty(String filter) {
Expand Down
18 changes: 18 additions & 0 deletions src/com/jpexs/decompiler/flash/gui/PinsPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
package com.jpexs.decompiler.flash.gui;

import com.jpexs.decompiler.flash.abc.ScriptPack;
import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.gui.tagtree.TreeRoot;
import com.jpexs.decompiler.flash.timeline.TagScript;
Expand All @@ -25,6 +26,7 @@
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.regex.Pattern;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
Expand Down Expand Up @@ -448,4 +450,20 @@ public void refresh() {
currentUnpinnedButton.refresh();
}
}

public void refreshScriptPacks() {
for (int b = 0; b < buttons.size(); b++) {
PinButton button = buttons.get(b);
if (button.getItem() instanceof ScriptPack) {
ScriptPack sp = (ScriptPack) button.getItem();
List<ScriptPack> packs = sp.abc.getScriptPacks(null, sp.allABCs);
for (ScriptPack sp2 : packs) {
if (Objects.equals(sp.getClassPath(), sp2.getClassPath())) {
replaceItem(sp, sp2);
break;
}
}
}
}
}
}
2 changes: 1 addition & 1 deletion src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -1737,7 +1737,7 @@ private void saveDecompiled(boolean refreshTree) {
TreeItem sel = mainPanel.getCurrentTree().getCurrentTreeItem();
if ((sel instanceof ScriptPack) && (sel != pack)) {
mainPanel.replaceItemPin(pack, sel);
}
}
}
reload();
mainPanel.clearEditingStatus();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4221,6 +4221,7 @@ public void tagRemoved(Tag tag) {
mainPanel.refreshTree();
}
mainPanel.savePins();
mainPanel.updateClassesList();
}
}
}
Expand Down

0 comments on commit 85c155b

Please sign in to comment.