This commit is contained in:
Denis Molony 2020-05-19 18:22:10 +10:00
parent 73ef60954a
commit c18806a0d5
6 changed files with 41 additions and 47 deletions

View File

@ -78,6 +78,13 @@ public abstract class AbstractFile implements DataSource
return image;
}
// ---------------------------------------------------------------------------------//
String getHeader ()
// ---------------------------------------------------------------------------------//
{
return "Name : " + name + "\n\n";
}
// ---------------------------------------------------------------------------------//
@Override
public JComponent getComponent ()

View File

@ -83,13 +83,6 @@ public class PascalCode extends AbstractFile
return text.toString ();
}
// ---------------------------------------------------------------------------------//
private String getHeader ()
// ---------------------------------------------------------------------------------//
{
return "Name : " + name + "\n\n";
}
// ---------------------------------------------------------------------------------//
@Override
public Iterator<PascalSegment> iterator ()

View File

@ -26,11 +26,4 @@ public class PascalInfo extends AbstractFile
return text.toString ();
}
// ---------------------------------------------------------------------------------//
private String getHeader ()
// ---------------------------------------------------------------------------------//
{
return "Name : " + name + "\n\n";
}
}

View File

@ -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)
// ---------------------------------------------------------------------------------//

View File

@ -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;
}

View File

@ -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<DiskAddress> addresses,
List<TextBuffer> 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);