woraround for #1246 Minimum gui-pane widths (since version 8) make FFDEC unusable on small monitors

This commit is contained in:
honfika@gmail.com
2016-12-28 15:51:09 +01:00
parent f7e5479bdd
commit 41b381acbe
3 changed files with 76 additions and 19 deletions

View File

@@ -0,0 +1,47 @@
/*
* Copyright (C) 2010-2016 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.gui;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.Container;
import java.util.HashMap;
import java.util.Map;
/**
*
* @author JPEXS
*/
public class LazyCardLayout extends CardLayout {
private final Map<String, Component> registeredComponents = new HashMap<>();
@Override
public void show(Container parent, String name) {
Component component = registeredComponents.get(name);
if (component != null && component.getParent() != parent) {
parent.add(component, name);
}
super.show(parent, name);
}
public void registerLayout(Component component, String card) {
registeredComponents.put(card, component);
}
}

View File

@@ -684,9 +684,12 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
});
searchPanel.add(closeSearchButton, BorderLayout.EAST);
searchPanel.setVisible(false);
treePanel = new JPanel(new CardLayout());
treePanel.add(createResourcesViewCard(), RESOURCES_VIEW);
treePanel.add(createDumpViewCard(), DUMP_VIEW);
LazyCardLayout treePanelLayout = new LazyCardLayout();
treePanelLayout.registerLayout(createResourcesViewCard(), RESOURCES_VIEW);
treePanelLayout.registerLayout(createDumpViewCard(), DUMP_VIEW);
treePanel = new JPanel(treePanelLayout);
//treePanel.add(searchPanel, BorderLayout.SOUTH);
//searchPanel.setVisible(false);
filterField.getDocument().addDocumentListener(new DocumentListener() {
@@ -719,13 +722,12 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
timelineViewPanel = new TimelineViewPanel();
CardLayout cl3 = new CardLayout();
contentPanel = new JPanel(cl3);
contentPanel = new JPanel(new CardLayout());
contentPanel.add(welcomePanel, WELCOME_PANEL);
contentPanel.add(splitPane1, SPLIT_PANE1);
contentPanel.add(timelineViewPanel, TIMELINE_PANEL);
add(contentPanel);
cl3.show(contentPanel, WELCOME_PANEL);
showContentPanelCard(WELCOME_PANEL);
tagTree.addKeyListener(new KeyAdapter() {
@Override
@@ -846,8 +848,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
}
if (isWelcomeScreen) {
CardLayout cl = (CardLayout) (contentPanel.getLayout());
cl.show(contentPanel, SPLIT_PANE1);
showContentPanelCard(SPLIT_PANE1);
isWelcomeScreen = false;
}
@@ -883,8 +884,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
View.checkAccess();
if (!isWelcomeScreen && swfs.isEmpty()) {
CardLayout cl = (CardLayout) (contentPanel.getLayout());
cl.show(contentPanel, WELCOME_PANEL);
showContentPanelCard(WELCOME_PANEL);
isWelcomeScreen = true;
closeTagTreeSearch();
}
@@ -3157,27 +3157,35 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
return r;
}
public boolean showView(int view) {
private void showContentPanelCard(String card) {
CardLayout cl = (CardLayout) (contentPanel.getLayout());
CardLayout cl2 = (CardLayout) (treePanel.getLayout());
cl.show(contentPanel, card);
}
private void showTreePanelCard(String card) {
CardLayout cl = (CardLayout) (treePanel.getLayout());
cl.show(treePanel, card);
}
public boolean showView(int view) {
View.checkAccess();
setTreeModel(view);
switch (view) {
case VIEW_DUMP:
if (!isWelcomeScreen) {
cl.show(contentPanel, SPLIT_PANE1);
showContentPanelCard(SPLIT_PANE1);
}
cl2.show(treePanel, DUMP_VIEW);
showTreePanelCard(DUMP_VIEW);
treePanelMode = TreePanelMode.DUMP_TREE;
showDetail(DETAILCARDEMPTYPANEL);
reload(true);
return true;
case VIEW_RESOURCES:
if (!isWelcomeScreen) {
cl.show(contentPanel, SPLIT_PANE1);
showContentPanelCard(SPLIT_PANE1);
}
cl2.show(treePanel, RESOURCES_VIEW);
showTreePanelCard(RESOURCES_VIEW);
treePanelMode = TreePanelMode.TAG_TREE;
@@ -3204,7 +3212,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
} else {
timelineViewPanel.setTimelined(swf);
}
cl.show(contentPanel, TIMELINE_PANEL);
showContentPanelCard(TIMELINE_PANEL);
return true;
}
return false;

View File

@@ -477,7 +477,9 @@ public class ActionPanel extends JPanel implements SearchListener<ActionSearchRe
});
HighlightedText htext = SWF.getCached(asm, innerActions);
setSourceCompleted(asm, htext, innerActions);
View.execInEventDispatch(() -> {
setSourceCompleted(asm, htext, innerActions);
});
}
return null;