mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-03 17:45:24 +00:00
Added #1460 Bulk importing images
This commit is contained in:
@@ -22,27 +22,36 @@ import com.jpexs.decompiler.flash.search.ScriptSearchResult;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ItemListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.swing.ButtonGroup;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JToggleButton;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import javax.swing.plaf.basic.BasicPopupMenuUI;
|
||||
import org.pushingpixels.flamingo.api.common.AbstractCommandButton;
|
||||
import org.pushingpixels.flamingo.api.common.CommandButtonDisplayState;
|
||||
import org.pushingpixels.flamingo.api.common.CommandToggleButtonGroup;
|
||||
import org.pushingpixels.flamingo.api.common.JCommandButton;
|
||||
import org.pushingpixels.flamingo.api.common.JCommandButtonPanel;
|
||||
import org.pushingpixels.flamingo.api.common.JCommandToggleButton;
|
||||
import org.pushingpixels.flamingo.api.common.PopupActionListener;
|
||||
import org.pushingpixels.flamingo.api.common.model.PopupButtonModel;
|
||||
import org.pushingpixels.flamingo.api.common.popup.JPopupPanel;
|
||||
import org.pushingpixels.flamingo.api.common.popup.PopupPanelCallback;
|
||||
import org.pushingpixels.flamingo.api.ribbon.AbstractRibbonBand;
|
||||
@@ -373,30 +382,41 @@ public class MainFrameRibbonMenu extends MainFrameMenu {
|
||||
final ActionListener subLoader = menuLoaders.get(sub);
|
||||
AbstractCommandButton but = null;
|
||||
if (subType == TYPE_MENUITEM || (subType == TYPE_MENU && subAction != null)) {
|
||||
JCommandButton cbut;
|
||||
if (subIcon != null) {
|
||||
cbut = new JCommandButton(fixCommandTitle(subTitle), View.getResizableIcon(subIcon, subPriority == PRIORITY_TOP ? 32 : 16));
|
||||
if (parts.length == 4) {
|
||||
JMenuItem menuItem = new JMenuItem(subTitle);
|
||||
if (subIcon != null) {
|
||||
menuItem.setIcon(View.getIcon(subIcon, 16));
|
||||
}
|
||||
if (subAction != null) {
|
||||
menuItem.addActionListener(subAction);
|
||||
}
|
||||
menuItems.put(sub, menuItem);
|
||||
} else {
|
||||
cbut = new JCommandButton(fixCommandTitle(subTitle));
|
||||
}
|
||||
if (subKey != null) {
|
||||
//cbut.setActionRichTooltip(new RichTooltip(subTitle, subKey.toString()));
|
||||
}
|
||||
if (subLoader != null) {
|
||||
cbut.setCommandButtonKind(JCommandButton.CommandButtonKind.ACTION_AND_POPUP_MAIN_ACTION);
|
||||
cbut.setPopupCallback(new PopupPanelCallback() {
|
||||
JCommandButton cbut;
|
||||
if (subIcon != null) {
|
||||
cbut = new JCommandButton(fixCommandTitle(subTitle), View.getResizableIcon(subIcon, subPriority == PRIORITY_TOP ? 32 : 16));
|
||||
} else {
|
||||
cbut = new JCommandButton(fixCommandTitle(subTitle));
|
||||
}
|
||||
if (subKey != null) {
|
||||
//cbut.setActionRichTooltip(new RichTooltip(subTitle, subKey.toString()));
|
||||
}
|
||||
if (subLoader != null) {
|
||||
cbut.setCommandButtonKind(JCommandButton.CommandButtonKind.ACTION_AND_POPUP_MAIN_ACTION);
|
||||
cbut.setPopupCallback(new PopupPanelCallback() {
|
||||
|
||||
@Override
|
||||
public JPopupPanel getPopupPanel(JCommandButton jcb) {
|
||||
JPopupPanel jp = new JPopupPanel() {
|
||||
};
|
||||
@Override
|
||||
public JPopupPanel getPopupPanel(JCommandButton jcb) {
|
||||
JPopupPanel jp = new JPopupPanel() {
|
||||
};
|
||||
|
||||
subLoader.actionPerformed(new ActionEvent(jp, 0, "load:" + sub));
|
||||
return jp;
|
||||
}
|
||||
});
|
||||
subLoader.actionPerformed(new ActionEvent(jp, 0, "load:" + sub));
|
||||
return jp;
|
||||
}
|
||||
});
|
||||
}
|
||||
but = cbut;
|
||||
}
|
||||
but = cbut;
|
||||
} else if (subType == TYPE_TOGGLEMENUITEM) {
|
||||
if (onlyCheckboxes) {
|
||||
JCheckBox cb = new JCheckBox(subTitle);
|
||||
@@ -422,6 +442,44 @@ public class MainFrameRibbonMenu extends MainFrameMenu {
|
||||
}
|
||||
|
||||
//if (parts.length == 3)
|
||||
if (parts.length == 4)
|
||||
{
|
||||
JCommandButton popupButton;
|
||||
if (icon != null) {
|
||||
popupButton = new JCommandButton(fixCommandTitle(title), View.getResizableIcon(icon, priority == PRIORITY_TOP ? 32 : 16));
|
||||
} else {
|
||||
popupButton = new JCommandButton(fixCommandTitle(title));
|
||||
}
|
||||
JPopupMenu popupMenu = new JPopupMenu();
|
||||
popupButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
popupMenu.show(popupButton, 0, popupButton.getHeight());
|
||||
}
|
||||
});
|
||||
int cnt = 0;
|
||||
for (String sub : subs) {
|
||||
if (sub.equals("-")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Object o = menuItems.get(sub);
|
||||
int subPriority = menuPriorities.get(sub);
|
||||
int subType = menuType.get(sub);
|
||||
ActionListener subAction = menuActions.get(sub);
|
||||
if (subType != TYPE_MENU || (subAction != null)) {
|
||||
if (o instanceof JMenuItem) {
|
||||
JMenuItem mi = (JMenuItem)o;
|
||||
popupMenu.add((JMenuItem) o);
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cnt > 0) {
|
||||
menuItems.put(path, popupButton);
|
||||
}
|
||||
}
|
||||
else
|
||||
{ //3rd level - it's a Band!
|
||||
JRibbonBand band = new JRibbonBand(title, icon != null ? View.getResizableIcon(icon, 16) : null, null);
|
||||
band.setResizePolicies(getResizePolicies(band));
|
||||
@@ -435,7 +493,8 @@ public class MainFrameRibbonMenu extends MainFrameMenu {
|
||||
int subPriority = menuPriorities.get(sub);
|
||||
int subType = menuType.get(sub);
|
||||
ActionListener subAction = menuActions.get(sub);
|
||||
if (subType != TYPE_MENU || (subAction != null)) {
|
||||
//if (subType != TYPE_MENU || (subAction != null))
|
||||
{
|
||||
if (o instanceof AbstractCommandButton) {
|
||||
RibbonElementPriority ribbonPriority = RibbonElementPriority.MEDIUM;
|
||||
switch (subPriority) {
|
||||
@@ -452,6 +511,8 @@ public class MainFrameRibbonMenu extends MainFrameMenu {
|
||||
|
||||
band.addCommandButton((AbstractCommandButton) o, ribbonPriority);
|
||||
cnt++;
|
||||
} else if (o instanceof JRibbonBand) {
|
||||
//ignore
|
||||
} else if (o instanceof JComponent) {
|
||||
band.addRibbonComponent(new JRibbonComponent((JComponent) o));
|
||||
cnt++;
|
||||
|
||||
Reference in New Issue
Block a user