From c18806a0d5489ece8ae461fbe5d069d87520d068 Mon Sep 17 00:00:00 2001 From: Denis Molony Date: Tue, 19 May 2020 18:22:10 +1000 Subject: [PATCH] tidying --- .../diskbrowser/applefile/AbstractFile.java | 7 +++ .../diskbrowser/applefile/PascalCode.java | 7 --- .../diskbrowser/applefile/PascalInfo.java | 7 --- .../diskbrowser/applefile/PascalText.java | 7 --- .../bytezone/diskbrowser/gui/DataPanel.java | 5 +- .../diskbrowser/prodos/FileEntry.java | 55 +++++++++++-------- 6 files changed, 41 insertions(+), 47 deletions(-) diff --git a/src/com/bytezone/diskbrowser/applefile/AbstractFile.java b/src/com/bytezone/diskbrowser/applefile/AbstractFile.java index e9b6ceb..eac3225 100755 --- a/src/com/bytezone/diskbrowser/applefile/AbstractFile.java +++ b/src/com/bytezone/diskbrowser/applefile/AbstractFile.java @@ -78,6 +78,13 @@ public abstract class AbstractFile implements DataSource return image; } + // ---------------------------------------------------------------------------------// + String getHeader () + // ---------------------------------------------------------------------------------// + { + return "Name : " + name + "\n\n"; + } + // ---------------------------------------------------------------------------------// @Override public JComponent getComponent () diff --git a/src/com/bytezone/diskbrowser/applefile/PascalCode.java b/src/com/bytezone/diskbrowser/applefile/PascalCode.java index 93a4bbf..d80ec57 100755 --- a/src/com/bytezone/diskbrowser/applefile/PascalCode.java +++ b/src/com/bytezone/diskbrowser/applefile/PascalCode.java @@ -83,13 +83,6 @@ public class PascalCode extends AbstractFile return text.toString (); } - // ---------------------------------------------------------------------------------// - private String getHeader () - // ---------------------------------------------------------------------------------// - { - return "Name : " + name + "\n\n"; - } - // ---------------------------------------------------------------------------------// @Override public Iterator iterator () diff --git a/src/com/bytezone/diskbrowser/applefile/PascalInfo.java b/src/com/bytezone/diskbrowser/applefile/PascalInfo.java index ac855c9..78f1d17 100644 --- a/src/com/bytezone/diskbrowser/applefile/PascalInfo.java +++ b/src/com/bytezone/diskbrowser/applefile/PascalInfo.java @@ -26,11 +26,4 @@ public class PascalInfo extends AbstractFile return text.toString (); } - - // ---------------------------------------------------------------------------------// - private String getHeader () - // ---------------------------------------------------------------------------------// - { - return "Name : " + name + "\n\n"; - } } \ No newline at end of file diff --git a/src/com/bytezone/diskbrowser/applefile/PascalText.java b/src/com/bytezone/diskbrowser/applefile/PascalText.java index 8bbac77..d72cc17 100755 --- a/src/com/bytezone/diskbrowser/applefile/PascalText.java +++ b/src/com/bytezone/diskbrowser/applefile/PascalText.java @@ -44,13 +44,6 @@ public class PascalText extends AbstractFile return text.toString (); } - // ---------------------------------------------------------------------------------// - private String getHeader () - // ---------------------------------------------------------------------------------// - { - return "Name : " + name + "\n\n"; - } - // ---------------------------------------------------------------------------------// private String getLine (int ptr) // ---------------------------------------------------------------------------------// diff --git a/src/com/bytezone/diskbrowser/gui/DataPanel.java b/src/com/bytezone/diskbrowser/gui/DataPanel.java index 317737e..aa62f2f 100755 --- a/src/com/bytezone/diskbrowser/gui/DataPanel.java +++ b/src/com/bytezone/diskbrowser/gui/DataPanel.java @@ -54,12 +54,11 @@ public class DataPanel extends JTabbedPane implements DiskSelectionListener, // these two panes are interchangeable private final JScrollPane formattedPane; private final JScrollPane imagePane; + private boolean imageVisible = false; private final ImagePanel imagePanel; // internal class private boolean debugMode; - private boolean imageVisible = false; - // used to determine whether the text has been set boolean formattedTextValid; boolean hexTextValid; @@ -364,7 +363,6 @@ public class DataPanel extends JTabbedPane implements DiskSelectionListener, animation.cancel (); animation = new Worker ((SHRPictureFile2) dataSource); animation.execute (); - // System.out.println ("new animation"); } } @@ -562,6 +560,7 @@ public class DataPanel extends JTabbedPane implements DiskSelectionListener, public Worker (SHRPictureFile2 image) { + assert image.isAnimation (); this.image = image; } diff --git a/src/com/bytezone/diskbrowser/prodos/FileEntry.java b/src/com/bytezone/diskbrowser/prodos/FileEntry.java index 75de918..27cc3fc 100755 --- a/src/com/bytezone/diskbrowser/prodos/FileEntry.java +++ b/src/com/bytezone/diskbrowser/prodos/FileEntry.java @@ -23,6 +23,7 @@ import com.bytezone.diskbrowser.applefile.IntegerBasicProgram; import com.bytezone.diskbrowser.applefile.LodeRunner; import com.bytezone.diskbrowser.applefile.MerlinSource; import com.bytezone.diskbrowser.applefile.OriginalHiResImage; +import com.bytezone.diskbrowser.applefile.PascalArea; import com.bytezone.diskbrowser.applefile.QuickDrawFont; import com.bytezone.diskbrowser.applefile.SHRPictureFile1; import com.bytezone.diskbrowser.applefile.SHRPictureFile2; @@ -109,9 +110,12 @@ class FileEntry extends CatalogEntry implements ProdosConstants break; case PASCAL_ON_PROFILE: - indexBlocks.add (disk.getDiskAddress (keyPtr)); - System.out.println ("PASCAL on PROFILE: " + name); // PDUCSD12.PO - // are these blocks guaranteed to be contiguous? + for (int i = keyPtr; i < disk.getTotalBlocks (); i++) + { + dataBlocks.add (disk.getDiskAddress (i)); + parentDisk.setSectorType (i, parentDisk.dataSector); + } + // System.out.println ("PASCAL on PROFILE: " + name); // PDUCSD12.PO break; default: @@ -479,6 +483,9 @@ class FileEntry extends CatalogEntry implements ProdosConstants break; case FILE_TYPE_PASCAL_VOLUME: + file = new PascalArea (name, exactBuffer); + break; + case FILE_TYPE_GEO: case FILE_TYPE_LDF: case FILE_TYPE_PAL: @@ -521,26 +528,6 @@ class FileEntry extends CatalogEntry implements ProdosConstants return false; } - // ---------------------------------------------------------------------------------// - private byte[] getExactBuffer (byte[] buffer) - // ---------------------------------------------------------------------------------// - { - byte[] exactBuffer; - if (buffer.length < endOfFile) - { - exactBuffer = new byte[endOfFile]; - System.arraycopy (buffer, 0, exactBuffer, 0, buffer.length); - } - else if (buffer.length == endOfFile || endOfFile == 512) // 512 seems like crap - exactBuffer = buffer; - else - { - exactBuffer = new byte[endOfFile]; - System.arraycopy (buffer, 0, exactBuffer, 0, endOfFile); - } - return exactBuffer; - } - // ---------------------------------------------------------------------------------// private DataSource getRandomAccessTextFile () // ---------------------------------------------------------------------------------// @@ -661,6 +648,27 @@ class FileEntry extends CatalogEntry implements ProdosConstants } } + // ---------------------------------------------------------------------------------// + private byte[] getExactBuffer (byte[] buffer) + // ---------------------------------------------------------------------------------// + { + byte[] exactBuffer; + if (buffer.length < endOfFile) + { + exactBuffer = new byte[endOfFile]; + System.arraycopy (buffer, 0, exactBuffer, 0, buffer.length); + } + // 512 seems like crap + else if (buffer.length == endOfFile || endOfFile == 512 || endOfFile == 0) + exactBuffer = buffer; + else + { + exactBuffer = new byte[endOfFile]; + System.arraycopy (buffer, 0, exactBuffer, 0, endOfFile); + } + return exactBuffer; + } + // ---------------------------------------------------------------------------------// private int readIndexBlock (int indexBlock, List addresses, List buffers, int logicalBlock) @@ -743,6 +751,7 @@ class FileEntry extends CatalogEntry implements ProdosConstants String timeC = created == null ? "" : parentDisk.df.format (created.getTime ()); String timeF = modified == null ? "" : parentDisk.df.format (modified.getTime ()); + return String.format ("%s %s%-30s %3d %,10d %15s %15s", ProdosConstants.fileTypes[fileType], locked, parentDirectory.name + "/" + name, blocksUsed, endOfFile, timeC, timeF);