fix selection highlight not being marked

This commit is contained in:
Denis Molony 2016-07-17 07:18:20 +10:00
parent a2d4c4c05c
commit b1c9e1aadc
4 changed files with 13 additions and 6 deletions

View File

@ -25,8 +25,9 @@ class CatalogEntry extends AbstractCatalogEntry
dosDisk.sectorTypes[da.getBlock ()] = dosDisk.tsListSector;
else
{
System.out.print ("Attempt to assign TS sector to occupied sector : " + da);
System.out.println (" from " + name);
System.out.printf ("Attempt to assign TS sector to occupied sector "
+ ": %s from %s%n", da, name);
break;
}
tsSectors.add (da);
byte[] sectorBuffer = disk.readSector (da);

View File

@ -101,7 +101,6 @@ class DiskLayoutImage extends JPanel implements Scrollable, RedoListener
int maxBlock = gw * gh;
Disk d = disk.getDisk ();
List<DiskAddress> selectedBlocks = selectionHandler.getHighlights ();
// this stops an index error when using alt-5 to switch to 512-byte blocks
// if (maxBlock > d.getTotalBlocks ())
@ -116,8 +115,8 @@ class DiskLayoutImage extends JPanel implements Scrollable, RedoListener
{
DiskAddress da = d.getDiskAddress (blockNo);
boolean flag = showFreeSectors && disk.isSectorFree (da);
boolean selected = selectedBlocks.contains (da);
drawBlock ((Graphics2D) g, blockNo, x, y, flag, selected);
drawBlock ((Graphics2D) g, blockNo, x, y, flag,
selectionHandler.isSelected (da));
}
}
}

View File

@ -126,6 +126,14 @@ class DiskLayoutSelection implements Iterable<DiskAddress>
return new ArrayList<DiskAddress> (highlights);
}
public boolean isSelected (DiskAddress da)
{
for (DiskAddress selection : highlights)
if (selection.compareTo (da) == 0)
return true;
return false;
}
public void setSelection (List<DiskAddress> list)
{
highlights.clear ();

View File

@ -2,7 +2,6 @@ package com.bytezone.diskbrowser.visicalc;
class Or extends Function
{
public Or (Sheet parent, String text)
{
super (parent, text);