diff --git a/src/com/bytezone/diskbrowser/applefile/DoubleHiResImage.java b/src/com/bytezone/diskbrowser/applefile/DoubleHiResImage.java index 90eb5a6..ac59fb9 100644 --- a/src/com/bytezone/diskbrowser/applefile/DoubleHiResImage.java +++ b/src/com/bytezone/diskbrowser/applefile/DoubleHiResImage.java @@ -83,6 +83,7 @@ public class DoubleHiResImage extends HiResImage @Override protected void createColourImage () { + paletteIndex = paletteFactory.getCurrentPaletteIndex (); Palette palette = paletteFactory.getCurrentPalette (); int[] colours = palette.getColours (); diff --git a/src/com/bytezone/diskbrowser/applefile/HiResImage.java b/src/com/bytezone/diskbrowser/applefile/HiResImage.java index 0171aae..c572b6d 100644 --- a/src/com/bytezone/diskbrowser/applefile/HiResImage.java +++ b/src/com/bytezone/diskbrowser/applefile/HiResImage.java @@ -24,6 +24,7 @@ public abstract class HiResImage extends AbstractFile protected int fileType; protected int auxType; protected byte[] unpackedBuffer; + protected int paletteIndex; public HiResImage (String name, byte[] buffer) { @@ -82,6 +83,12 @@ public abstract class HiResImage extends AbstractFile protected abstract void createColourImage (); + public void checkPalette () + { + if (!monochrome && paletteIndex != paletteFactory.getCurrentPaletteIndex ()) + createImage (); + } + public void setPalette () { if (!monochrome) diff --git a/src/com/bytezone/diskbrowser/applefile/OriginalHiResImage.java b/src/com/bytezone/diskbrowser/applefile/OriginalHiResImage.java index c463e73..28fc06e 100755 --- a/src/com/bytezone/diskbrowser/applefile/OriginalHiResImage.java +++ b/src/com/bytezone/diskbrowser/applefile/OriginalHiResImage.java @@ -71,6 +71,7 @@ public class OriginalHiResImage extends HiResImage @Override protected void createColourImage () { + paletteIndex = paletteFactory.getCurrentPaletteIndex (); int rows = buffer.length <= 8192 ? 192 : 384; image = new BufferedImage (280, rows, BufferedImage.TYPE_INT_RGB); DataBuffer dataBuffer = image.getRaster ().getDataBuffer (); diff --git a/src/com/bytezone/diskbrowser/applefile/PaletteFactory.java b/src/com/bytezone/diskbrowser/applefile/PaletteFactory.java index 2083266..b45e61d 100644 --- a/src/com/bytezone/diskbrowser/applefile/PaletteFactory.java +++ b/src/com/bytezone/diskbrowser/applefile/PaletteFactory.java @@ -10,24 +10,24 @@ public class PaletteFactory public PaletteFactory () { - palettes.add (new Palette ("Palette 1", - new int[] { 0x000000, // 0 black A - 0xFF0000, // 1 red C - 0xA52A2A, // 2 brown E (8) - 0xFFA500, // 3 orange G (9) - 0x008000, // 4 dark green I - 0x808080, // 5 grey1 K - 0x90EE90, // 6 light green M (C) - 0xFFFF00, // 7 yellow O (D) - 0x00008B, // 8 dark blue B (2) - 0x800080, // 9 purple D (3) - 0xC0C0C0, // A grey2 F - 0xFFC0CB, // B pink H - 0x00BFFF, // C med blue J (6) - 0x87CEFA, // D light blue L (7) - 0x00FFFF, // E aqua N - 0xFFFFFF // F white P - })); + // palettes.add (new Palette ("Palette 1", + // new int[] { 0x000000, // 0 black A + // 0xFF0000, // 1 red C + // 0xA52A2A, // 2 brown E (8) + // 0xFFA500, // 3 orange G (9) + // 0x008000, // 4 dark green I + // 0x808080, // 5 grey1 K + // 0x90EE90, // 6 light green M (C) + // 0xFFFF00, // 7 yellow O (D) + // 0x00008B, // 8 dark blue B (2) + // 0x800080, // 9 purple D (3) + // 0xC0C0C0, // A grey2 F + // 0xFFC0CB, // B pink H + // 0x00BFFF, // C med blue J (6) + // 0x87CEFA, // D light blue L (7) + // 0x00FFFF, // E aqua N + // 0xFFFFFF // F white P + // })); palettes.add (new Palette ("Virtual II", new int[] { 0x000000, // 0 black diff --git a/src/com/bytezone/diskbrowser/gui/DataPanel.java b/src/com/bytezone/diskbrowser/gui/DataPanel.java index 16de4b2..1802569 100755 --- a/src/com/bytezone/diskbrowser/gui/DataPanel.java +++ b/src/com/bytezone/diskbrowser/gui/DataPanel.java @@ -269,6 +269,11 @@ class DataPanel extends JTabbedPane } else { + if (dataSource instanceof HiResImage) + { + ((HiResImage) dataSource).checkPalette (); + image = dataSource.getImage (); + } imagePanel.setImage (image); imagePane.setViewportView (imagePanel); // if (!menuHandler.colourMenu.isEnabled ()) diff --git a/src/com/bytezone/diskbrowser/gui/NextPaletteAction.java b/src/com/bytezone/diskbrowser/gui/NextPaletteAction.java index f9b76d2..042ce5d 100644 --- a/src/com/bytezone/diskbrowser/gui/NextPaletteAction.java +++ b/src/com/bytezone/diskbrowser/gui/NextPaletteAction.java @@ -27,7 +27,7 @@ public class NextPaletteAction extends AbstractAction public void actionPerformed (ActionEvent e) { Palette palette = owner.cyclePalette (CycleDirection.FORWARDS); - owner.selectPalette (palette); + // owner.selectPalette (palette); if (palette != null) { diff --git a/src/com/bytezone/diskbrowser/gui/PreviousPaletteAction.java b/src/com/bytezone/diskbrowser/gui/PreviousPaletteAction.java index 5152526..c92d485 100644 --- a/src/com/bytezone/diskbrowser/gui/PreviousPaletteAction.java +++ b/src/com/bytezone/diskbrowser/gui/PreviousPaletteAction.java @@ -27,7 +27,7 @@ public class PreviousPaletteAction extends AbstractAction public void actionPerformed (ActionEvent e) { Palette palette = owner.cyclePalette (CycleDirection.BACKWARDS); - owner.selectPalette (palette); + // owner.selectPalette (palette); if (palette != null) {