mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-12-24 23:31:31 +00:00
tidying
This commit is contained in:
parent
174d604233
commit
445ec60318
@ -16,11 +16,12 @@ public class CPMDisk extends AbstractFormattedDisk
|
||||
public final SectorType catalogSector = new SectorType ("Catalog", green);
|
||||
public final SectorType prnSector = new SectorType ("PRN", Color.lightGray);
|
||||
public final SectorType comSector = new SectorType ("COM", Color.red);
|
||||
public final SectorType dataSector = new SectorType ("Data", Color.blue);
|
||||
public final SectorType otherSector = new SectorType ("Other", Color.blue);
|
||||
public final SectorType docSector = new SectorType ("DOC", Color.cyan);
|
||||
public final SectorType basSector = new SectorType ("BAS", Color.gray);
|
||||
public final SectorType asmSector = new SectorType ("ASM", Color.orange);
|
||||
public final SectorType ovrSector = new SectorType ("OVR", Color.magenta);
|
||||
public final SectorType macSector = new SectorType ("Green", Color.green);
|
||||
|
||||
private int version; // http://www.seasip.info/Cpm/format22.html
|
||||
|
||||
@ -31,11 +32,12 @@ public class CPMDisk extends AbstractFormattedDisk
|
||||
sectorTypesList.add (catalogSector);
|
||||
sectorTypesList.add (prnSector);
|
||||
sectorTypesList.add (comSector);
|
||||
sectorTypesList.add (dataSector);
|
||||
sectorTypesList.add (basSector);
|
||||
sectorTypesList.add (docSector);
|
||||
sectorTypesList.add (asmSector);
|
||||
sectorTypesList.add (ovrSector);
|
||||
sectorTypesList.add (macSector);
|
||||
sectorTypesList.add (otherSector);
|
||||
|
||||
getDisk ().setEmptyByte ((byte) 0xE5);
|
||||
setSectorTypes ();
|
||||
@ -99,8 +101,10 @@ public class CPMDisk extends AbstractFormattedDisk
|
||||
return asmSector;
|
||||
if ("OVR".equals (type))
|
||||
return ovrSector;
|
||||
if ("MAC".equals (type))
|
||||
return macSector;
|
||||
|
||||
return dataSector;
|
||||
return otherSector;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -44,7 +44,7 @@ public class DiskFactory
|
||||
Boolean compressed = false;
|
||||
Path p = Paths.get (path);
|
||||
|
||||
if (suffix.equalsIgnoreCase ("sdk"))
|
||||
if (suffix.equals ("sdk"))
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -68,7 +68,7 @@ public class DiskFactory
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (suffix.equalsIgnoreCase ("gz")) // will be .dsk.gz
|
||||
else if (suffix.equals ("gz")) // will be .dsk.gz
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -266,6 +266,7 @@ public class DiskFactory
|
||||
{
|
||||
if (debug)
|
||||
System.out.println ("Checking Prodos disk");
|
||||
|
||||
try
|
||||
{
|
||||
AppleDisk disk = new AppleDisk (file, 35, 8);
|
||||
|
@ -1,12 +1,6 @@
|
||||
package com.bytezone.diskbrowser.gui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Cursor;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.*;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
@ -26,7 +20,8 @@ import com.bytezone.diskbrowser.gui.RedoHandler.RedoEvent;
|
||||
class DiskLayoutImage extends JPanel implements Scrollable
|
||||
{
|
||||
static final Cursor crosshairCursor = new Cursor (Cursor.CROSSHAIR_CURSOR);
|
||||
FormattedDisk disk;
|
||||
|
||||
private FormattedDisk disk;
|
||||
LayoutDetails layoutDetails;
|
||||
private boolean showFreeSectors;
|
||||
DiskLayoutSelection selectionHandler = new DiskLayoutSelection ();
|
||||
@ -51,9 +46,6 @@ class DiskLayoutImage extends JPanel implements Scrollable
|
||||
this.disk = disk;
|
||||
layoutDetails = details;
|
||||
|
||||
// System.out.println (details);
|
||||
// new Exception ().printStackTrace ();
|
||||
|
||||
bw = layoutDetails.block.width;
|
||||
bh = layoutDetails.block.height;
|
||||
gw = layoutDetails.grid.width;
|
||||
@ -65,6 +57,11 @@ class DiskLayoutImage extends JPanel implements Scrollable
|
||||
repaint ();
|
||||
}
|
||||
|
||||
public FormattedDisk getDisk ()
|
||||
{
|
||||
return disk;
|
||||
}
|
||||
|
||||
public void setShowFreeSectors (boolean showFree)
|
||||
{
|
||||
showFreeSectors = showFree;
|
||||
@ -97,15 +94,10 @@ class DiskLayoutImage extends JPanel implements Scrollable
|
||||
Rectangle clipRect = g.getClipBounds ();
|
||||
|
||||
Point p1 = new Point (clipRect.x / bw * bw, clipRect.y / bh * bh);
|
||||
Point p2 =
|
||||
new Point ((clipRect.x + clipRect.width - 1) / bw * bw, (clipRect.y
|
||||
+ clipRect.height - 1)
|
||||
/ bh * bh);
|
||||
Point p2 = new Point ((clipRect.x + clipRect.width - 1) / bw * bw,
|
||||
(clipRect.y + clipRect.height - 1) / bh * bh);
|
||||
|
||||
// System.out.printf ("gw=%d, gh=%d, bw=%d, bh=%d%n", gw, gh, bw, bh);
|
||||
// int totalBlocks = 0;
|
||||
int maxBlock = gw * gh;
|
||||
// System.out.printf ("Max blocks: %d%n", maxBlock);
|
||||
Disk d = disk.getDisk ();
|
||||
List<DiskAddress> selectedBlocks = selectionHandler.getHighlights ();
|
||||
|
||||
@ -123,7 +115,6 @@ class DiskLayoutImage extends JPanel implements Scrollable
|
||||
boolean flag = showFreeSectors && disk.isSectorFree (da);
|
||||
boolean selected = selectedBlocks.contains (da);
|
||||
drawBlock ((Graphics2D) g, blockNo, x, y, flag, selected);
|
||||
// totalBlocks++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -135,7 +126,6 @@ class DiskLayoutImage extends JPanel implements Scrollable
|
||||
int offset = (bw - 4) / 2 + 1;
|
||||
|
||||
Rectangle rect = new Rectangle (x, y, bw, bh);
|
||||
// System.out.printf ("Rect: %4d %4d %4d %4d%n", x, y, bw, bh);
|
||||
|
||||
// draw frame
|
||||
if (true) // this needs to draw the outside rectangle, and show less white space
|
||||
@ -176,7 +166,7 @@ class DiskLayoutImage extends JPanel implements Scrollable
|
||||
{
|
||||
if (type.colour == Color.WHITE || type.colour == Color.YELLOW
|
||||
|| type.colour == Color.PINK || type.colour == Color.CYAN
|
||||
|| type.colour == Color.ORANGE)
|
||||
|| type.colour == Color.ORANGE || type.colour == Color.GREEN)
|
||||
return Color.BLACK;
|
||||
return Color.WHITE;
|
||||
}
|
||||
|
@ -3,7 +3,11 @@ package com.bytezone.diskbrowser.gui;
|
||||
import static javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS;
|
||||
import static javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.MouseAdapter;
|
||||
@ -22,8 +26,8 @@ import com.bytezone.diskbrowser.disk.FormattedDisk;
|
||||
import com.bytezone.diskbrowser.gui.RedoHandler.RedoEvent;
|
||||
import com.bytezone.diskbrowser.gui.RedoHandler.RedoListener;
|
||||
|
||||
class DiskLayoutPanel extends JPanel implements DiskSelectionListener, FileSelectionListener,
|
||||
RedoListener, FontChangeListener
|
||||
class DiskLayoutPanel extends JPanel implements DiskSelectionListener,
|
||||
FileSelectionListener, RedoListener, FontChangeListener
|
||||
{
|
||||
private static final int SIZE = 15; // basic unit of a display block
|
||||
|
||||
@ -227,7 +231,7 @@ class DiskLayoutPanel extends JPanel implements DiskSelectionListener, FileSelec
|
||||
{
|
||||
if (newDisk instanceof DualDosDisk)
|
||||
newDisk = ((DualDosDisk) newDisk).getCurrentDisk (); // never set to a Dual-dos disk
|
||||
if (newDisk != image.disk)
|
||||
if (newDisk != image.getDisk ())
|
||||
{
|
||||
LayoutDetails layout = new LayoutDetails (newDisk);
|
||||
image.setDisk (newDisk, layout);
|
||||
|
@ -108,12 +108,14 @@ public class ProdosDisk extends AbstractFormattedDisk
|
||||
sectorTypes[vdh.bitMapBlock + i] = volumeMapSector;
|
||||
parentNode.setUserObject (vdh); // populate the empty volume node
|
||||
break;
|
||||
|
||||
case ProdosConstants.TYPE_SUBDIRECTORY_HEADER:
|
||||
localHeader = new SubDirectoryHeader (this, entry, parent);
|
||||
headerEntries.add (localHeader);
|
||||
currentSectorType = subcatalogSector;
|
||||
sectorTypes[block] = currentSectorType;
|
||||
break;
|
||||
|
||||
case ProdosConstants.TYPE_SUBDIRECTORY:
|
||||
FileEntry ce = new FileEntry (this, entry, localHeader, block);
|
||||
fileEntries.add (ce);
|
||||
@ -122,6 +124,7 @@ public class ProdosDisk extends AbstractFormattedDisk
|
||||
parentNode.add (directoryNode);
|
||||
processDirectoryBlock (ce.keyPtr, ce, directoryNode); // Recursion !!
|
||||
break;
|
||||
|
||||
case ProdosConstants.TYPE_SEEDLING:
|
||||
case ProdosConstants.TYPE_SAPLING:
|
||||
case ProdosConstants.TYPE_TREE:
|
||||
@ -133,6 +136,7 @@ public class ProdosDisk extends AbstractFormattedDisk
|
||||
node.setAllowsChildren (false);
|
||||
parentNode.add (node);
|
||||
break;
|
||||
|
||||
default:
|
||||
System.out.println ("Unknown storage type : " + storageType);
|
||||
System.out.println (HexFormatter.format (entry, 0, entry.length));
|
||||
@ -168,6 +172,7 @@ public class ProdosDisk extends AbstractFormattedDisk
|
||||
int bitMapBlock = HexFormatter.intValue (buffer[0x27], buffer[0x28]);
|
||||
if (bitMapBlock != 6)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user