try to call flash functions

This commit is contained in:
Jindra Petk
2013-09-13 07:07:21 +02:00
parent 5e2bac3959
commit 892b2ff278
3 changed files with 35 additions and 9 deletions

View File

@@ -290,6 +290,7 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel
private ComponentListener fontChangeList;
private JComboBox<String> fontSelection;
private JCommandButton saveCommandButton;
private PlayerControls flashControls;
private Map<Integer, String> sourceFontsMap = new HashMap<>();
private AbortRetryIgnoreHandler errorHandler = new AbortRetryIgnoreHandler() {
@Override
@@ -1249,7 +1250,7 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel
if (flashPanel != null) {
JPanel flashPlayPanel = new JPanel(new BorderLayout());
flashPlayPanel.add(flashPanel, BorderLayout.CENTER);
flashPlayPanel.add(new PlayerControls(flashPanel), BorderLayout.SOUTH);
flashPlayPanel.add(flashControls = new PlayerControls(flashPanel), BorderLayout.SOUTH);
leftComponent = flashPlayPanel;
} else {
JPanel swtPanel = new JPanel(new BorderLayout());
@@ -2953,6 +2954,9 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel
if (!forceReload && (tagObj == oldValue)) {
return;
}
swfPreviewPanel.stop();
stopFlashPlayer();
oldValue = tagObj;
if (tagObj instanceof ScriptPack) {
final ScriptPack scriptLeaf = (ScriptPack) tagObj;
@@ -2990,9 +2994,9 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel
} else {
showDetail(DETAILCARDEMPTYPANEL);
}
swfPreviewPanel.stop();
if ((tagObj instanceof SWFRoot)) {
stopFlashPlayer();
if (miInternalViewer.isSelected()) {
showCard(CARDSWFPREVIEWPANEL);
swfPreviewPanel.load(swf);
@@ -3029,23 +3033,18 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel
} else if ((tagObj instanceof DefineSoundTag) || (tagObj instanceof SoundStreamHeadTag) || (tagObj instanceof SoundStreamHead2Tag)) {
showCard(CARDEMPTYPANEL);
} */ else if (tagObj instanceof DefineBinaryDataTag) {
stopFlashPlayer();
showCard(CARDEMPTYPANEL);
} else if (tagObj instanceof ASMSource) {
stopFlashPlayer();
showCard(CARDACTIONSCRIPTPANEL);
actionPanel.setSource((ASMSource) tagObj, !forceReload);
} else if (tagObj instanceof ImageTag) {
stopFlashPlayer();
imageButtonsPanel.setVisible(((ImageTag) tagObj).importSupported());
showCard(CARDIMAGEPANEL);
imagePanel.setImage(((ImageTag) tagObj).getImage(swf.tags));
} else if ((tagObj instanceof DrawableTag) && (!(tagObj instanceof TextTag)) && (miInternalViewer.isSelected())) {
stopFlashPlayer();
showCard(CARDDRAWPREVIEWPANEL);
previewImagePanel.setDrawable((DrawableTag) tagObj, swf, characters, 50/*FIXME*/);
} else if (tagObj instanceof FrameNode && ((FrameNode) tagObj).isDisplayed() && (miInternalViewer.isSelected())) {
stopFlashPlayer();
showCard(CARDDRAWPREVIEWPANEL);
FrameNode fn = (FrameNode) tagObj;
List<Tag> controlTags = swf.tags;

View File

@@ -49,8 +49,35 @@ public class FlashPlayerPanel extends Panel implements FlashDisplay {
private static final int CMD_PLAYING = 8;
private static final int CMD_REWIND = 9;
private static final int CMD_GOTO = 10;
private static final int CMD_CALL = 11;
private int frameRate;
public boolean functionPlayback = false;
public synchronized String call(String callString){
if (pipe != null) {
IntByReference ibr = new IntByReference();
Kernel32.INSTANCE.WriteFile(pipe, new byte[]{CMD_CALL}, 1, ibr, null);
int callLen=callString.getBytes().length;
Kernel32.INSTANCE.WriteFile(pipe, new byte[]{(byte)((callLen>>8) &0xff),(byte)(callLen & 0xff)}, 2, ibr, null);
Kernel32.INSTANCE.WriteFile(pipe, callString.getBytes(), callLen, ibr, null);
byte res[] = new byte[2];
if (Kernel32.INSTANCE.ReadFile(pipe, res, 2, ibr, null)) {
int retLen = ((res[0] & 0xff) << 8) + (res[1] & 0xff);
res = new byte[retLen];
if (Kernel32.INSTANCE.ReadFile(pipe, res, retLen, ibr, null)) {
String ret=new String(res,0,retLen);
return ret;
}else{
return null;
}
} else {
return null;
}
}
return null;
}
private synchronized void resize() {
if (pipe != null) {
IntByReference ibr = new IntByReference();

View File

@@ -49,7 +49,7 @@ public class PlayerControls extends JPanel implements ActionListener {
private JLabel timeLabel;
private JLabel totalTimeLabel;
private static final Icon pauseIcon = View.getIcon("pause16");
private static final Icon playIcon = View.getIcon("play16");
private static final Icon playIcon = View.getIcon("play16");
public PlayerControls(final FlashDisplay display) {
this.display = display;