This commit is contained in:
Denis Molony 2021-06-03 18:11:44 +10:00
parent 95538f5282
commit dc551285bb

View File

@ -43,6 +43,7 @@ public class DataPanel extends JTabbedPane
{ {
private static final int TEXT_WIDTH = 65; private static final int TEXT_WIDTH = 65;
// final MenuHandler menuHandler;
private final JTextArea formattedText; private final JTextArea formattedText;
private final JTextArea hexText; private final JTextArea hexText;
private final JTextArea disassemblyText; private final JTextArea disassemblyText;
@ -50,36 +51,34 @@ public class DataPanel extends JTabbedPane
// these two panes are interchangeable // these two panes are interchangeable
private final JScrollPane formattedPane; private final JScrollPane formattedPane;
private final JScrollPane imagePane; private final JScrollPane imagePane;
private boolean imageVisible = false; private boolean imageVisible = false;
private final ImagePanel imagePanel; // internal class private final ImagePanel imagePanel = new ImagePanel ();
private AnimationWorker animation;
private boolean debugMode; private boolean debugMode;
private DataSource currentDataSource;
// used to determine whether the text has been set // used to determine whether the text has been set
boolean formattedTextValid; private boolean formattedTextValid;
boolean hexTextValid; private boolean hexTextValid;
boolean assemblerTextValid; private boolean assemblerTextValid;
DataSource currentDataSource;
private AnimationWorker animation; private DebuggingAction debuggingAction = new DebuggingAction ();
private MonochromeAction monochromeAction = new MonochromeAction ();
private ColourQuirksAction colourQuirksAction = new ColourQuirksAction ();
private LineWrapAction lineWrapAction = new LineWrapAction ();
final MenuHandler menuHandler; private enum TabType
DebuggingAction debuggingAction = new DebuggingAction ();
MonochromeAction monochromeAction = new MonochromeAction ();
ColourQuirksAction colourQuirksAction = new ColourQuirksAction ();
LineWrapAction lineWrapAction = new LineWrapAction ();
enum TabType
{ {
FORMATTED, HEX, DISASSEMBLED FORMATTED, HEX, DISASSEMBLED
} }
// ---------------------------------------------------------------------------------// // ---------------------------------------------------------------------------------//
public DataPanel (MenuHandler mh) public DataPanel (MenuHandler menuHandler)
// ---------------------------------------------------------------------------------// // ---------------------------------------------------------------------------------//
{ {
this.menuHandler = mh; // this.menuHandler = mh;
setTabPlacement (SwingConstants.BOTTOM); setTabPlacement (SwingConstants.BOTTOM);
formattedText = new JTextArea (10, TEXT_WIDTH); formattedText = new JTextArea (10, TEXT_WIDTH);
@ -89,7 +88,7 @@ public class DataPanel extends JTabbedPane
+ "\ntell DiskBrowser where your Apple disks are located." + "\ntell DiskBrowser where your Apple disks are located."
+ "\n\nTo see the contents of a disk in more detail, double-click" + "\n\nTo see the contents of a disk in more detail, double-click"
+ "\nthe disk. You will then be able to select individual files to " + "\nthe disk. You will then be able to select individual files to "
+ "view completely."); + "view them.");
hexText = new JTextArea (10, TEXT_WIDTH); hexText = new JTextArea (10, TEXT_WIDTH);
setPanel (hexText, "Hex dump"); setPanel (hexText, "Hex dump");
@ -97,7 +96,6 @@ public class DataPanel extends JTabbedPane
disassemblyText = new JTextArea (10, TEXT_WIDTH); disassemblyText = new JTextArea (10, TEXT_WIDTH);
setPanel (disassemblyText, "Disassembly"); setPanel (disassemblyText, "Disassembly");
imagePanel = new ImagePanel ();
imagePane = imagePane =
new JScrollPane (imagePanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, new JScrollPane (imagePanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
@ -124,6 +122,7 @@ public class DataPanel extends JTabbedPane
formattedTextValid = true; formattedTextValid = true;
} }
break; break;
case 1: // Hex case 1: // Hex
if (!hexTextValid) if (!hexTextValid)
{ {
@ -134,6 +133,7 @@ public class DataPanel extends JTabbedPane
hexTextValid = true; hexTextValid = true;
} }
break; break;
case 2: // Assembler case 2: // Assembler
if (!assemblerTextValid) if (!assemblerTextValid)
{ {
@ -144,8 +144,9 @@ public class DataPanel extends JTabbedPane
assemblerTextValid = true; assemblerTextValid = true;
} }
break; break;
default: default:
System.out.println ("Invalid index selected in DataPanel"); System.out.println ("Impossible - Invalid index selected in DataPanel");
} }
} }
}); });
@ -172,6 +173,7 @@ public class DataPanel extends JTabbedPane
JCheckBoxMenuItem item = (JCheckBoxMenuItem) enumeration.nextElement (); JCheckBoxMenuItem item = (JCheckBoxMenuItem) enumeration.nextElement ();
item.setAction (new PaletteAction (this, palettes.get (ndx++))); item.setAction (new PaletteAction (this, palettes.get (ndx++)));
} }
menuHandler.nextPaletteItem.setAction (new NextPaletteAction (this, buttonGroup)); menuHandler.nextPaletteItem.setAction (new NextPaletteAction (this, buttonGroup));
menuHandler.prevPaletteItem.setAction (new PreviousPaletteAction (this, buttonGroup)); menuHandler.prevPaletteItem.setAction (new PreviousPaletteAction (this, buttonGroup));
} }
@ -315,6 +317,7 @@ public class DataPanel extends JTabbedPane
JScrollPane outputScrollPane = JScrollPane outputScrollPane =
new JScrollPane (outputPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, new JScrollPane (outputPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
outputScrollPane.setBorder (null); // remove the ugly default border outputScrollPane.setBorder (null); // remove the ugly default border
add (outputScrollPane, tabName); add (outputScrollPane, tabName);
return outputScrollPane; return outputScrollPane;