Merge origin/master

Conflicts:
	src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java
	src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java
This commit is contained in:
Jindra Petřík
2015-05-24 17:07:22 +02:00
19 changed files with 229 additions and 212 deletions

View File

@@ -59,7 +59,35 @@ import org.pushingpixels.flamingo.internal.ui.ribbon.AbstractBandControlPanel;
*/
public class MainFrameRibbonMenu extends MainFrameMenu {
private JRibbon ribbon;
private final JRibbon ribbon;
private final Map<String, Object> menuItems = new HashMap<>();
private final Map<String, String> menuTitles = new HashMap<>();
private final Map<String, String> menuIcons = new HashMap<>();
private final Map<String, ActionListener> menuActions = new HashMap<>();
private final Map<String, ActionListener> menuLoaders = new HashMap<>();
private final Map<String, Integer> menuPriorities = new HashMap<>();
private final Map<String, List<String>> menuSubs = new HashMap<>();
private final Map<String, Integer> menuType = new HashMap<>();
private final Map<String, String> menuGroup = new HashMap<>();
private final Map<String, CommandToggleButtonGroup> menuToggleGroups = new HashMap<>();
private final Map<String, CommandToggleButtonGroup> menuToToggleGroup = new HashMap<>();
private static final int TYPE_MENU = 1;
private static final int TYPE_MENUITEM = 2;
private static final int TYPE_TOGGLEMENUITEM = 3;
public MainFrameRibbonMenu(MainFrameRibbon mainFrame, JRibbon ribbon, boolean externalFlashPlayerUnavailable) {
super(mainFrame, externalFlashPlayerUnavailable);
@@ -120,24 +148,6 @@ public class MainFrameRibbonMenu extends MainFrameMenu {
return resizePolicies;
}
private final Map<String, Object> menuItems = new HashMap<>();
private final Map<String, String> menuTitles = new HashMap<>();
private final Map<String, String> menuIcons = new HashMap<>();
private final Map<String, ActionListener> menuActions = new HashMap<>();
private final Map<String, ActionListener> menuLoaders = new HashMap<>();
private final Map<String, Integer> menuPriorities = new HashMap<>();
private final Map<String, List<String>> menuSubs = new HashMap<>();
private final Map<String, Integer> menuType = new HashMap<>();
private final Map<String, String> menuGroup = new HashMap<>();
private final Map<String, CommandToggleButtonGroup> menuToggleGroups = new HashMap<>();
private final Map<String, CommandToggleButtonGroup> menuToToggleGroup = new HashMap<>();
private static final int TYPE_MENU = 1;
private static final int TYPE_MENUITEM = 2;
private static final int TYPE_TOGGLEMENUITEM = 3;
@Override
protected void loadRecent(ActionEvent evt) {
if (evt.getSource() instanceof JPanel) {
@@ -152,15 +162,11 @@ public class MainFrameRibbonMenu extends MainFrameMenu {
String path = recentFiles.get(i);
RecentFilesButton historyButton = new RecentFilesButton(j + " " + path, null);
historyButton.fileName = path;
historyButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ae) {
RecentFilesButton source = (RecentFilesButton) ae.getSource();
if (Main.openFile(source.fileName, null) == OpenFileResult.NOT_FOUND) {
if (View.showConfirmDialog(null, translate("message.confirm.recentFileNotFound"), translate("message.confirm"), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_NO_OPTION) {
Configuration.removeRecentFile(source.fileName);
}
historyButton.addActionListener((ActionEvent ae) -> {
RecentFilesButton source = (RecentFilesButton) ae.getSource();
if (Main.openFile(source.fileName, null) == OpenFileResult.NOT_FOUND) {
if (View.showConfirmDialog(null, translate("message.confirm.recentFileNotFound"), translate("message.confirm"), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_NO_OPTION) {
Configuration.removeRecentFile(source.fileName);
}
}
});
@@ -228,10 +234,10 @@ public class MainFrameRibbonMenu extends MainFrameMenu {
if (sub.startsWith("_/$")) //FooterMenu
{
RibbonApplicationMenuEntryFooter footerMenu = new RibbonApplicationMenuEntryFooter(View.getResizableIcon(subIcon, 16), subTitle, subAction);
RibbonApplicationMenuEntryFooter footerMenu = new RibbonApplicationMenuEntryFooter(View.getResizableIcon(subIcon), subTitle, subAction);
mainMenu.addFooterEntry(footerMenu);
} else {
RibbonApplicationMenuEntryPrimary menu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon(subIcon, 32), subTitle, subAction,
RibbonApplicationMenuEntryPrimary menu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon(subIcon), subTitle, subAction,
subType == TYPE_MENU ? JCommandButton.CommandButtonKind.ACTION_AND_POPUP_MAIN_ACTION : JCommandButton.CommandButtonKind.ACTION_ONLY);
if (subLoader != null) {
@@ -260,13 +266,12 @@ 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, subPriority == PRIORITY_TOP ? 32 : 16));
cbut = new JCommandButton(fixCommandTitle(subTitle), View.getResizableIcon(subIcon));
} else {
cbut = new JCommandButton(fixCommandTitle(subTitle));
}
@@ -294,7 +299,7 @@ public class MainFrameRibbonMenu extends MainFrameMenu {
menuItems.put(sub, cb);
} else {
if (subIcon != null) {
but = new JCommandToggleButton(fixCommandTitle(subTitle), View.getResizableIcon(subIcon, subPriority == PRIORITY_TOP ? 32 : 16));
but = new JCommandToggleButton(fixCommandTitle(subTitle), View.getResizableIcon(subIcon));
} else {
but = new JCommandToggleButton(fixCommandTitle(subTitle));
}
@@ -309,9 +314,9 @@ public class MainFrameRibbonMenu extends MainFrameMenu {
}
}
//if (parts.length == 3)
//if (parts.length == 3)
{ //3rd level - it's a Band!
JRibbonBand band = new JRibbonBand(title, icon != null ? View.getResizableIcon(icon, 16) : null, null);
JRibbonBand band = new JRibbonBand(title, icon != null ? View.getResizableIcon(icon) : null, null);
band.setResizePolicies(getResizePolicies(band));
int cnt = 0;
for (String sub : subs) {
@@ -544,5 +549,4 @@ public class MainFrameRibbonMenu extends MainFrameMenu {
public boolean supportsAppMenu() {
return true;
}
}