diff --git a/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java b/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java index 9565791d1..837d917fc 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java +++ b/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java @@ -737,9 +737,10 @@ public abstract class MainFrameMenu implements MenuBuilder { addSeparator("/file"); addMenuItem("/file/close", translate("menu.file.close"), "close32", this::close, PRIORITY_MEDIUM, null, true); - addMenuItem("/file/closeAll", translate("menu.file.closeAll"), "close32", this::closeAll, PRIORITY_MEDIUM, null, true); + addMenuItem("/file/closeAll", translate("menu.file.closeAll"), "closeall32", this::closeAll, PRIORITY_MEDIUM, null, true); if (!supportsAppMenu()) { + addSeparator("/file"); addMenuItem("/file/exit", translate("menu.file.exit"), "exit32", this::exit, PRIORITY_TOP, null, true); } finishMenu("/file"); diff --git a/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java b/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java index f84dccb68..bd5e8899b 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java +++ b/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java @@ -228,10 +228,10 @@ public class MainFrameRibbonMenu extends MainFrameMenu { if (sub.startsWith("_/$")) //FooterMenu { - RibbonApplicationMenuEntryFooter footerMenu = new RibbonApplicationMenuEntryFooter(View.getResizableIcon(subIcon), subTitle, subAction); + RibbonApplicationMenuEntryFooter footerMenu = new RibbonApplicationMenuEntryFooter(View.getResizableIcon(subIcon, 16), subTitle, subAction); mainMenu.addFooterEntry(footerMenu); } else { - RibbonApplicationMenuEntryPrimary menu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon(subIcon), subTitle, subAction, + RibbonApplicationMenuEntryPrimary menu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon(subIcon, 32), subTitle, subAction, subType == TYPE_MENU ? JCommandButton.CommandButtonKind.ACTION_AND_POPUP_MAIN_ACTION : JCommandButton.CommandButtonKind.ACTION_ONLY); if (subLoader != null) { @@ -260,12 +260,13 @@ public class MainFrameRibbonMenu extends MainFrameMenu { String subTitle = menuTitles.get(sub); String subIcon = menuIcons.get(sub); String subGroup = menuGroup.get(sub); + int subPriority = menuPriorities.get(sub); final ActionListener subLoader = menuLoaders.get(sub); AbstractCommandButton but = null; if (subType == TYPE_MENUITEM || (subType == TYPE_MENU && subAction != null)) { JCommandButton cbut = null; if (subIcon != null) { - cbut = new JCommandButton(fixCommandTitle(subTitle), View.getResizableIcon(subIcon)); + cbut = new JCommandButton(fixCommandTitle(subTitle), View.getResizableIcon(subIcon, subPriority == PRIORITY_TOP ? 32 : 16)); } else { cbut = new JCommandButton(fixCommandTitle(subTitle)); } @@ -293,7 +294,7 @@ public class MainFrameRibbonMenu extends MainFrameMenu { menuItems.put(sub, cb); } else { if (subIcon != null) { - but = new JCommandToggleButton(fixCommandTitle(subTitle), View.getResizableIcon(subIcon)); + but = new JCommandToggleButton(fixCommandTitle(subTitle), View.getResizableIcon(subIcon, subPriority == PRIORITY_TOP ? 32 : 16)); } else { but = new JCommandToggleButton(fixCommandTitle(subTitle)); } @@ -310,7 +311,7 @@ public class MainFrameRibbonMenu extends MainFrameMenu { //if (parts.length == 3) { //3rd level - it's a Band! - JRibbonBand band = new JRibbonBand(title, icon != null ? View.getResizableIcon(icon) : null, null); + JRibbonBand band = new JRibbonBand(title, icon != null ? View.getResizableIcon(icon, 16) : null, null); band.setResizePolicies(getResizePolicies(band)); int cnt = 0; for (String sub : subs) { diff --git a/src/com/jpexs/decompiler/flash/gui/View.java b/src/com/jpexs/decompiler/flash/gui/View.java index ff9a99087..e699ef13d 100644 --- a/src/com/jpexs/decompiler/flash/gui/View.java +++ b/src/com/jpexs/decompiler/flash/gui/View.java @@ -45,6 +45,8 @@ import java.util.ArrayList; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import javax.imageio.ImageIO; import javax.swing.AbstractAction; import javax.swing.Action; @@ -345,7 +347,10 @@ public class View { } public static ImageIcon getIcon(String name, int size) { - ImageIcon icon = getIcon(name); + ImageIcon icon = getIcon(getPrefferedIconName(name, size)); + if (icon.getIconWidth() == size && icon.getIconHeight() == size) { + return icon; + } icon.getImage(); BufferedImage bi = new BufferedImage(size, size, BufferedImage.TYPE_INT_ARGB); bi.createGraphics().drawImage(icon.getImage(), 0, 0, size, size, null, null); @@ -374,6 +379,28 @@ public class View { root.getActionMap().put(dispatchWindowClosingActionMapKey, dispatchClosing); } + public static boolean iconExists(String resource) { + return View.class.getResource("/com/jpexs/decompiler/flash/gui/graphics/" + resource + ".png") != null; + } + + private static String getPrefferedIconName(String resource, int preferredSize) { + Matcher m = Pattern.compile("(.*[^0-9])([0-9]+)").matcher(resource); + if (m.matches()) { + int origSize = Integer.parseInt(m.group(2)); + String name = m.group(1); + if (origSize != preferredSize) { + if (iconExists(name + preferredSize)) { + return name + preferredSize; + } + } + } + return resource; + } + + public static ImageWrapperResizableIcon getResizableIcon(String resource, int preferredSize) { + return getResizableIcon(getPrefferedIconName(resource, preferredSize)); + } + public static ImageWrapperResizableIcon getResizableIcon(String resource) { return ImageWrapperResizableIcon.getIcon(View.class.getResource("/com/jpexs/decompiler/flash/gui/graphics/" + resource + ".png"), new Dimension(256, 256)); } diff --git a/src/com/jpexs/decompiler/flash/gui/graphics/close16.png b/src/com/jpexs/decompiler/flash/gui/graphics/close16.png index ace289edd..09a10ddb0 100644 Binary files a/src/com/jpexs/decompiler/flash/gui/graphics/close16.png and b/src/com/jpexs/decompiler/flash/gui/graphics/close16.png differ diff --git a/src/com/jpexs/decompiler/flash/gui/graphics/close32.png b/src/com/jpexs/decompiler/flash/gui/graphics/close32.png index 30a45b821..c7c33ddc9 100644 Binary files a/src/com/jpexs/decompiler/flash/gui/graphics/close32.png and b/src/com/jpexs/decompiler/flash/gui/graphics/close32.png differ diff --git a/src/com/jpexs/decompiler/flash/gui/graphics/closeall16.png b/src/com/jpexs/decompiler/flash/gui/graphics/closeall16.png new file mode 100644 index 000000000..c3c790433 Binary files /dev/null and b/src/com/jpexs/decompiler/flash/gui/graphics/closeall16.png differ diff --git a/src/com/jpexs/decompiler/flash/gui/graphics/closeall32.png b/src/com/jpexs/decompiler/flash/gui/graphics/closeall32.png new file mode 100644 index 000000000..94db10016 Binary files /dev/null and b/src/com/jpexs/decompiler/flash/gui/graphics/closeall32.png differ diff --git a/src/com/jpexs/decompiler/flash/gui/graphics/exportfla16.png b/src/com/jpexs/decompiler/flash/gui/graphics/exportfla16.png new file mode 100644 index 000000000..81f80e9a4 Binary files /dev/null and b/src/com/jpexs/decompiler/flash/gui/graphics/exportfla16.png differ