From 457f1f753cf882a2bc488d31e399dbd5f093de30 Mon Sep 17 00:00:00 2001 From: Denis Molony Date: Sun, 17 Nov 2019 23:36:49 +1000 Subject: [PATCH] dual dos disks use back button correctly --- src/com/bytezone/diskbrowser/gui/AppleDiskTab.java | 8 +++++++- src/com/bytezone/diskbrowser/gui/CatalogPanel.java | 4 ++-- src/com/bytezone/diskbrowser/gui/FileSelectedEvent.java | 4 ++++ src/com/bytezone/diskbrowser/utilities/Utility.java | 8 ++++++++ 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/com/bytezone/diskbrowser/gui/AppleDiskTab.java b/src/com/bytezone/diskbrowser/gui/AppleDiskTab.java index ab92c51..ba805c5 100755 --- a/src/com/bytezone/diskbrowser/gui/AppleDiskTab.java +++ b/src/com/bytezone/diskbrowser/gui/AppleDiskTab.java @@ -121,7 +121,13 @@ class AppleDiskTab extends AbstractTab void redoEvent (RedoEvent event) { AppleFileSource afs = ((FileSelectedEvent) event.value).appleFileSource; - selectNode (((FileSelectedEvent) event.value).appleFileSource.getUniqueName ()); + FileSelectedEvent fileSelectedEvent = (FileSelectedEvent) event.value; + if (fileSelectedEvent.volumeNo >= 0) + { + DualDosDisk ddd = (DualDosDisk) afs.getFormattedDisk ().getParent (); + ddd.setCurrentDiskNo (fileSelectedEvent.volumeNo); + } + selectNode (fileSelectedEvent.appleFileSource.getUniqueName ()); } private DefaultMutableTreeNode findNode (String nodeName) diff --git a/src/com/bytezone/diskbrowser/gui/CatalogPanel.java b/src/com/bytezone/diskbrowser/gui/CatalogPanel.java index 644349e..ff400b0 100755 --- a/src/com/bytezone/diskbrowser/gui/CatalogPanel.java +++ b/src/com/bytezone/diskbrowser/gui/CatalogPanel.java @@ -116,7 +116,7 @@ class CatalogPanel extends JTabbedPane // called after a double-click in the fileTab // ---------------------------------------------------------------------------------// - public void addDiskPanel (FormattedDisk disk, String lastFileUsed, boolean activate) + public void addDiskPanel (FormattedDisk disk, boolean activate) // ---------------------------------------------------------------------------------// { int tabNo = 1; @@ -433,7 +433,7 @@ class CatalogPanel extends JTabbedPane // lister.catalogLister.setNode (selectedNode); } else if (e.getClickCount () == 2) - addDiskPanel (node.getFormattedDisk (), null, true); + addDiskPanel (node.getFormattedDisk (), true); } } diff --git a/src/com/bytezone/diskbrowser/gui/FileSelectedEvent.java b/src/com/bytezone/diskbrowser/gui/FileSelectedEvent.java index 9298ee8..f3bbc96 100755 --- a/src/com/bytezone/diskbrowser/gui/FileSelectedEvent.java +++ b/src/com/bytezone/diskbrowser/gui/FileSelectedEvent.java @@ -10,6 +10,7 @@ public class FileSelectedEvent extends EventObject { public final AppleFileSource appleFileSource; boolean redo; + int volumeNo = -1; public FileSelectedEvent (Object source, AppleFileSource appleFileSource) { @@ -21,7 +22,10 @@ public class FileSelectedEvent extends EventObject FormattedDisk fd = appleFileSource.getFormattedDisk (); DualDosDisk ddd = (DualDosDisk) fd.getParent (); if (ddd != null) + { ddd.setCurrentDisk (fd); + volumeNo = ddd.getCurrentDiskNo (); + } } @Override diff --git a/src/com/bytezone/diskbrowser/utilities/Utility.java b/src/com/bytezone/diskbrowser/utilities/Utility.java index 8fbd8ab..d11cacb 100644 --- a/src/com/bytezone/diskbrowser/utilities/Utility.java +++ b/src/com/bytezone/diskbrowser/utilities/Utility.java @@ -22,6 +22,14 @@ public class Utility .equals (AffineTransform.getScaleInstance (2.0, 2.0)); } + // ---------------------------------------------------------------------------------// + public static void printStackTrace () + // ---------------------------------------------------------------------------------// + { + for (StackTraceElement ste : java.lang.Thread.currentThread ().getStackTrace ()) + System.out.println (ste); + } + // ---------------------------------------------------------------------------------// static int getLong (byte[] buffer, int ptr) // ---------------------------------------------------------------------------------//