Dual DOS and CPM

This commit is contained in:
Denis Molony 2018-12-23 12:15:51 +11:00
parent a7f914fec5
commit 628d115171
4 changed files with 23 additions and 12 deletions

View File

@ -25,6 +25,7 @@ public class CPMDisk extends AbstractFormattedDisk
private int version; // http://www.seasip.info/Cpm/format22.html private int version; // http://www.seasip.info/Cpm/format22.html
// // http://www.seasip.info/Cpm/format31.html // // http://www.seasip.info/Cpm/format31.html
private final DefaultMutableTreeNode volumeNode;
public CPMDisk (Disk disk) public CPMDisk (Disk disk)
{ {
@ -54,7 +55,9 @@ public class CPMDisk extends AbstractFormattedDisk
} }
} }
DefaultMutableTreeNode root = getCatalogTreeRoot (); DefaultMutableTreeNode rootNode = getCatalogTreeRoot ();
volumeNode = new DefaultMutableTreeNode ();
rootNode.add (volumeNode);
for (int sector = 0; sector < 8; sector++) for (int sector = 0; sector < 8; sector++)
{ {
@ -91,7 +94,7 @@ public class CPMDisk extends AbstractFormattedDisk
{ {
fileEntries.add (entry); fileEntries.add (entry);
DefaultMutableTreeNode node = new DefaultMutableTreeNode (entry); DefaultMutableTreeNode node = new DefaultMutableTreeNode (entry);
root.add (node); volumeNode.add (node);
node.setAllowsChildren (false); node.setAllowsChildren (false);
} }
else else
@ -99,8 +102,11 @@ public class CPMDisk extends AbstractFormattedDisk
} }
} }
root.setUserObject (getCatalog ()); // override the disk's default display // root.setUserObject (getCatalog ()); // override the disk's default display
makeNodeVisible (root.getFirstLeaf ()); // makeNodeVisible (rootNode.getFirstLeaf ());
volumeNode.setUserObject (getCatalog ());
makeNodeVisible (volumeNode.getFirstLeaf ());
} }
private SectorType getSectorType (String type) private SectorType getSectorType (String type)
@ -228,4 +234,11 @@ public class CPMDisk extends AbstractFormattedDisk
return false; return false;
return true; return true;
} }
@Override
public String toString ()
{
StringBuffer text = new StringBuffer ("CPM disk");
return text.toString ();
}
} }

View File

@ -226,9 +226,6 @@ public abstract class AbstractFormattedDisk implements FormattedDisk
return null; return null;
} }
/*
* Catalog Tree routines
*/
@Override @Override
public JTree getCatalogTree () public JTree getCatalogTree ()
{ {

View File

@ -416,9 +416,10 @@ public class DiskFactory
if (disk2 != null) if (disk2 != null)
disk = new DualDosDisk (disk, disk2); disk = new DualDosDisk (disk, disk2);
// disk2 = checkCPMDisk (appleDisk256); AppleDisk appleDisk = new AppleDisk (file, 35, 16);
// if (disk2 != null) disk2 = checkCPMDisk (appleDisk);
// disk = new DualDosDisk (disk, disk2); if (disk2 != null)
disk = new DualDosDisk (disk, disk2);
} }
} }
else if (suffix.equals ("po")) else if (suffix.equals ("po"))

View File

@ -23,8 +23,8 @@ public class DualDosDisk implements FormattedDisk
public DualDosDisk (FormattedDisk disk0, FormattedDisk disk1) public DualDosDisk (FormattedDisk disk0, FormattedDisk disk1)
{ {
String diskName = disk0.getDisk ().getFile ().getName (); String diskName = disk0.getDisk ().getFile ().getName ();
String text = "This disk contains both DOS and Prodos files\n\n" + disk0.getDisk () String text = "This disk contains both DOS and another OS\n\n" + disk0.getDisk ()
+ "\n" + disk1.getDisk (); + "\n\n" + disk1.getDisk ();
DefaultAppleFileSource dafs = new DefaultAppleFileSource (diskName, text, this); DefaultAppleFileSource dafs = new DefaultAppleFileSource (diskName, text, this);
DefaultMutableTreeNode root = new DefaultMutableTreeNode (dafs); DefaultMutableTreeNode root = new DefaultMutableTreeNode (dafs);