Added initial support for multiple logical disks. This implementation just

creates one tab per logical disk. Thus, a UniDOS disk gets 6 tabs - two
of each tab (Information, Disk Map, Explorer).
This commit is contained in:
Robert Greene 2002-12-14 05:49:04 +00:00
parent 18e9cd0450
commit 75350b2617
4 changed files with 38 additions and 18 deletions

View File

@ -129,7 +129,11 @@ public class DiskExplorerTab {
*/ */
protected void createFilesTab(CTabFolder tabFolder) { protected void createFilesTab(CTabFolder tabFolder) {
CTabItem ctabitem = new CTabItem(tabFolder, SWT.NULL); CTabItem ctabitem = new CTabItem(tabFolder, SWT.NULL);
ctabitem.setText("Files"); if (disk.getLogicalDiskNumber() > 0) {
ctabitem.setText("Files #" + disk.getLogicalDiskNumber());
} else {
ctabitem.setText("Files");
}
Composite composite = new Composite(tabFolder, SWT.NULL); Composite composite = new Composite(tabFolder, SWT.NULL);
ctabitem.setControl(composite); ctabitem.setControl(composite);

View File

@ -43,7 +43,11 @@ public class DiskInfoTab {
*/ */
public DiskInfoTab(CTabFolder tabFolder, FormattedDisk disk) { public DiskInfoTab(CTabFolder tabFolder, FormattedDisk disk) {
CTabItem ctabitem = new CTabItem(tabFolder, SWT.NULL); CTabItem ctabitem = new CTabItem(tabFolder, SWT.NULL);
ctabitem.setText("Disk Info"); if (disk.getLogicalDiskNumber() > 0) {
ctabitem.setText("Disk Info #" + disk.getLogicalDiskNumber());
} else {
ctabitem.setText("Disk Info");
}
Table table = new Table(tabFolder, SWT.FULL_SELECTION); Table table = new Table(tabFolder, SWT.FULL_SELECTION);
ctabitem.setControl(table); ctabitem.setControl(table);

View File

@ -71,7 +71,11 @@ public class DiskMapTab {
*/ */
protected void createDiskMapTab(CTabFolder tabFolder) { protected void createDiskMapTab(CTabFolder tabFolder) {
CTabItem item = new CTabItem(tabFolder, SWT.NULL); CTabItem item = new CTabItem(tabFolder, SWT.NULL);
item.setText("Disk Map"); if (disk.getLogicalDiskNumber() > 0) {
item.setText("Disk Map #" + disk.getLogicalDiskNumber());
} else {
item.setText("Disk Map");
}
Canvas canvas = new Canvas(tabFolder, SWT.NULL); Canvas canvas = new Canvas(tabFolder, SWT.NULL);
GridLayout grid = new GridLayout(2, false); GridLayout grid = new GridLayout(2, false);

View File

@ -39,18 +39,18 @@ public class DiskWindow {
private ImageManager imageManager; private ImageManager imageManager;
private Shell shell; private Shell shell;
private FormattedDisk disk; private FormattedDisk[] disks;
private DiskInfoTab diskInfoTab; private DiskInfoTab[] diskInfoTabs;
private DiskMapTab diskMapTab; private DiskMapTab[] diskMapTabs;
private DiskExplorerTab diskExplorerTab; private DiskExplorerTab[] diskExplorerTabs;
/** /**
* Construct the disk window. * Construct the disk window.
*/ */
public DiskWindow(Shell parentShell, FormattedDisk disk, ImageManager imageManager) { public DiskWindow(Shell parentShell, FormattedDisk[] disks, ImageManager imageManager) {
this.parentShell = shell; this.parentShell = shell;
this.disk = disk; this.disks = disks;
this.imageManager = imageManager; this.imageManager = imageManager;
} }
@ -61,7 +61,7 @@ public class DiskWindow {
shell = new Shell(parentShell, SWT.SHELL_TRIM); shell = new Shell(parentShell, SWT.SHELL_TRIM);
shell.setLayout(new FillLayout()); shell.setLayout(new FillLayout());
shell.setImage(imageManager.getDiskIcon()); shell.setImage(imageManager.getDiskIcon());
shell.setText("AppleCommander - " + disk.getFilename()); shell.setText("AppleCommander - " + disks[0].getFilename());
shell.addDisposeListener(new DisposeListener() { shell.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent event) { public void widgetDisposed(DisposeEvent event) {
dispose(event); dispose(event);
@ -69,9 +69,15 @@ public class DiskWindow {
}); });
CTabFolder tabFolder = new CTabFolder(shell, SWT.BOTTOM); CTabFolder tabFolder = new CTabFolder(shell, SWT.BOTTOM);
diskExplorerTab = new DiskExplorerTab(tabFolder, disk, imageManager); diskMapTabs = new DiskMapTab[disks.length];
diskMapTab = new DiskMapTab(tabFolder, disk); diskInfoTabs = new DiskInfoTab[disks.length];
diskInfoTab = new DiskInfoTab(tabFolder, disk); diskExplorerTabs = new DiskExplorerTab[disks.length];
for (int i=0; i<disks.length; i++) {
diskExplorerTabs[i] = new DiskExplorerTab(tabFolder, disks[i],
imageManager);
diskMapTabs[i] = new DiskMapTab(tabFolder, disks[i]);
diskInfoTabs[i] = new DiskInfoTab(tabFolder, disks[i]);
}
tabFolder.setSelection(tabFolder.getItems()[0]); tabFolder.setSelection(tabFolder.getItems()[0]);
shell.open(); shell.open();
@ -81,12 +87,14 @@ public class DiskWindow {
* Dispose of all shared resources. * Dispose of all shared resources.
*/ */
private void dispose(DisposeEvent event) { private void dispose(DisposeEvent event) {
diskMapTab.dispose(); for (int i=0; i<disks.length; i++) {
diskInfoTab.dispose(); diskMapTabs[i].dispose();
diskInfoTabs[i].dispose();
}
disk = null; disks = null;
diskMapTab = null; diskMapTabs = null;
diskInfoTab = null; diskInfoTabs = null;
System.gc(); System.gc();
} }