dump view: basic hex view (should be changed to a real hex view component)

This commit is contained in:
honfika
2014-06-22 09:49:12 +02:00
parent 4e0ec9df93
commit 38335ec2e4
23 changed files with 953 additions and 812 deletions

View File

@@ -1,129 +1,129 @@
/*
* Copyright (C) 2010-2014 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 com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.gui.player.FlashPlayerPanel;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Window;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowStateListener;
import javax.swing.JFrame;
/**
*
* @author JPEXS
*/
public final class MainFrameClassic extends AppFrame implements MainFrame {
public MainPanel panel;
private MainFrameMenu mainMenu;
public MainFrameClassic() {
super();
FlashPlayerPanel flashPanel = null;
try {
flashPanel = new FlashPlayerPanel(this);
} catch (FlashUnsupportedException fue) {
}
boolean externalFlashPlayerUnavailable = flashPanel == null;
mainMenu = new MainFrameClassicMenu(this, externalFlashPlayerUnavailable);
panel = new MainPanel(this, mainMenu, flashPanel);
int w = Configuration.guiWindowWidth.get();
int h = Configuration.guiWindowHeight.get();
Dimension dim = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
if (w > dim.width) {
w = dim.width;
}
if (h > dim.height) {
h = dim.height;
}
setSize(w, h);
boolean maximizedHorizontal = Configuration.guiWindowMaximizedHorizontal.get();
boolean maximizedVertical = Configuration.guiWindowMaximizedVertical.get();
int state = 0;
if (maximizedHorizontal) {
state |= JFrame.MAXIMIZED_HORIZ;
}
if (maximizedVertical) {
state |= JFrame.MAXIMIZED_VERT;
}
setExtendedState(state);
View.setWindowIcon(this);
addWindowStateListener(new WindowStateListener() {
@Override
public void windowStateChanged(WindowEvent e) {
int state = e.getNewState();
Configuration.guiWindowMaximizedHorizontal.set((state & JFrame.MAXIMIZED_HORIZ) == JFrame.MAXIMIZED_HORIZ);
Configuration.guiWindowMaximizedVertical.set((state & JFrame.MAXIMIZED_VERT) == JFrame.MAXIMIZED_VERT);
}
});
addComponentListener(new ComponentAdapter() {
@Override
public void componentResized(ComponentEvent e) {
int state = getExtendedState();
if ((state & JFrame.MAXIMIZED_HORIZ) == 0) {
Configuration.guiWindowWidth.set(getWidth());
}
if ((state & JFrame.MAXIMIZED_VERT) == 0) {
Configuration.guiWindowHeight.set(getHeight());
}
}
});
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
Main.exit();
}
});
java.awt.Container cnt = getContentPane();
cnt.setLayout(new BorderLayout());
cnt.add(panel);
View.centerScreen(this);
}
@Override
public void setVisible(boolean b) {
super.setVisible(b);
panel.setVisible(b);
}
@Override
public MainPanel getPanel() {
return panel;
}
@Override
public Window getWindow() {
return this;
}
}
/*
* Copyright (C) 2010-2014 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 com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.gui.player.FlashPlayerPanel;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Window;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowStateListener;
import javax.swing.JFrame;
/**
*
* @author JPEXS
*/
public final class MainFrameClassic extends AppFrame implements MainFrame {
public MainPanel panel;
private final MainFrameMenu mainMenu;
public MainFrameClassic() {
super();
FlashPlayerPanel flashPanel = null;
try {
flashPanel = new FlashPlayerPanel(this);
} catch (FlashUnsupportedException fue) {
}
boolean externalFlashPlayerUnavailable = flashPanel == null;
mainMenu = new MainFrameClassicMenu(this, externalFlashPlayerUnavailable);
panel = new MainPanel(this, mainMenu, flashPanel);
int w = Configuration.guiWindowWidth.get();
int h = Configuration.guiWindowHeight.get();
Dimension dim = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
if (w > dim.width) {
w = dim.width;
}
if (h > dim.height) {
h = dim.height;
}
setSize(w, h);
boolean maximizedHorizontal = Configuration.guiWindowMaximizedHorizontal.get();
boolean maximizedVertical = Configuration.guiWindowMaximizedVertical.get();
int state = 0;
if (maximizedHorizontal) {
state |= JFrame.MAXIMIZED_HORIZ;
}
if (maximizedVertical) {
state |= JFrame.MAXIMIZED_VERT;
}
setExtendedState(state);
View.setWindowIcon(this);
addWindowStateListener(new WindowStateListener() {
@Override
public void windowStateChanged(WindowEvent e) {
int state = e.getNewState();
Configuration.guiWindowMaximizedHorizontal.set((state & JFrame.MAXIMIZED_HORIZ) == JFrame.MAXIMIZED_HORIZ);
Configuration.guiWindowMaximizedVertical.set((state & JFrame.MAXIMIZED_VERT) == JFrame.MAXIMIZED_VERT);
}
});
addComponentListener(new ComponentAdapter() {
@Override
public void componentResized(ComponentEvent e) {
int state = getExtendedState();
if ((state & JFrame.MAXIMIZED_HORIZ) == 0) {
Configuration.guiWindowWidth.set(getWidth());
}
if ((state & JFrame.MAXIMIZED_VERT) == 0) {
Configuration.guiWindowHeight.set(getHeight());
}
}
});
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
Main.exit();
}
});
java.awt.Container cnt = getContentPane();
cnt.setLayout(new BorderLayout());
cnt.add(panel);
View.centerScreen(this);
}
@Override
public void setVisible(boolean b) {
super.setVisible(b);
panel.setVisible(b);
}
@Override
public MainPanel getPanel() {
return panel;
}
@Override
public Window getWindow() {
return this;
}
}