Added text preferences
This commit is contained in:
parent
67349bf999
commit
92824e5db6
|
@ -9,7 +9,9 @@ import java.util.Stack;
|
|||
import com.bytezone.diskbrowser.utilities.HexFormatter;
|
||||
import com.bytezone.diskbrowser.utilities.Utility;
|
||||
|
||||
// -----------------------------------------------------------------------------------//
|
||||
public class ApplesoftBasicProgram extends BasicProgram
|
||||
// -----------------------------------------------------------------------------------//
|
||||
{
|
||||
private static final byte TOKEN_FOR = (byte) 0x81;
|
||||
private static final byte TOKEN_NEXT = (byte) 0x82;
|
||||
|
@ -28,7 +30,9 @@ public class ApplesoftBasicProgram extends BasicProgram
|
|||
private final Set<Integer> gotoLines = new HashSet<> ();
|
||||
private final Set<Integer> gosubLines = new HashSet<> ();
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
public ApplesoftBasicProgram (String name, byte[] buffer)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
super (name, buffer);
|
||||
|
||||
|
@ -50,8 +54,10 @@ public class ApplesoftBasicProgram extends BasicProgram
|
|||
endPtr = ptr;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public String getText ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
StringBuilder fullText = new StringBuilder ();
|
||||
Stack<String> loopVariables = new Stack<String> ();
|
||||
|
@ -228,7 +234,9 @@ public class ApplesoftBasicProgram extends BasicProgram
|
|||
return fullText.toString ();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
private List<String> splitPrint (String line)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
int first = line.indexOf ("\"") + 1;
|
||||
int last = line.indexOf ("\"", first + 1) - 1;
|
||||
|
@ -271,7 +279,9 @@ public class ApplesoftBasicProgram extends BasicProgram
|
|||
return lines;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
private List<String> splitRemark (String remark, int wrapLength)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
List<String> remarks = new ArrayList<> ();
|
||||
while (remark.length () > wrapLength)
|
||||
|
@ -288,7 +298,9 @@ public class ApplesoftBasicProgram extends BasicProgram
|
|||
return remarks;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
private int countChars (StringBuilder text, byte ch)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
int total = 0;
|
||||
for (int i = 0; i < text.length (); i++)
|
||||
|
@ -297,7 +309,9 @@ public class ApplesoftBasicProgram extends BasicProgram
|
|||
return total;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
private String getBase (SourceLine line)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
if (!basicPreferences.showTargets)
|
||||
return String.format (" %5d", line.lineNumber);
|
||||
|
@ -324,7 +338,9 @@ public class ApplesoftBasicProgram extends BasicProgram
|
|||
|
||||
// Decide whether the current subline needs to be aligned on its equals sign. If so,
|
||||
// and the column hasn't been calculated, read ahead to find the highest position.
|
||||
// ---------------------------------------------------------------------------------//
|
||||
private int alignEqualsPosition (SubLine subline, int currentAlignPosition)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
if (subline.assignEqualPos > 0) // does the line have an equals sign?
|
||||
{
|
||||
|
@ -337,7 +353,9 @@ public class ApplesoftBasicProgram extends BasicProgram
|
|||
|
||||
// The IF processing is so that any assignment that is being aligned doesn't continue
|
||||
// to the next full line (because the indentation has changed).
|
||||
// ---------------------------------------------------------------------------------//
|
||||
private int findHighest (SubLine startSubline)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
boolean started = false;
|
||||
int highestAssign = startSubline.assignEqualPos;
|
||||
|
@ -369,8 +387,10 @@ public class ApplesoftBasicProgram extends BasicProgram
|
|||
return highestAssign;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public String getHexDump ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
if (buffer.length < 2)
|
||||
return super.getHexDump ();
|
||||
|
@ -412,14 +432,18 @@ public class ApplesoftBasicProgram extends BasicProgram
|
|||
return pgm.toString ();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
private void addHeader (StringBuilder pgm)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
pgm.append ("Name : " + name + "\n");
|
||||
pgm.append (String.format ("Length : $%04X (%<,d)%n", buffer.length));
|
||||
pgm.append (String.format ("Load at : $%04X (%<,d)%n%n", getLoadAddress ()));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
private int getLoadAddress ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
int programLoadAddress = 0;
|
||||
if (buffer.length > 1)
|
||||
|
@ -430,7 +454,9 @@ public class ApplesoftBasicProgram extends BasicProgram
|
|||
return programLoadAddress;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
private int getLineLength (int ptr)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
int offset = Utility.unsignedShort (buffer, ptr);
|
||||
if (offset == 0)
|
||||
|
@ -444,7 +470,9 @@ public class ApplesoftBasicProgram extends BasicProgram
|
|||
return length;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
private void popLoopVariables (Stack<String> loopVariables, SubLine subline)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
if (subline.nextVariables.length == 0) // naked NEXT
|
||||
{
|
||||
|
@ -459,7 +487,9 @@ public class ApplesoftBasicProgram extends BasicProgram
|
|||
break;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
private boolean sameVariable (String v1, String v2)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
if (v1.equals (v2))
|
||||
return true;
|
||||
|
@ -469,7 +499,9 @@ public class ApplesoftBasicProgram extends BasicProgram
|
|||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
private class SourceLine
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
List<SubLine> sublines = new ArrayList<> ();
|
||||
int lineNumber;
|
||||
|
@ -548,7 +580,9 @@ public class ApplesoftBasicProgram extends BasicProgram
|
|||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
private class SubLine
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
SourceLine parent;
|
||||
int startPtr;
|
||||
|
|
|
@ -2,7 +2,9 @@ package com.bytezone.diskbrowser.applefile;
|
|||
|
||||
import com.bytezone.diskbrowser.gui.BasicPreferences;
|
||||
|
||||
// -----------------------------------------------------------------------------------//
|
||||
public abstract class BasicProgram extends AbstractFile
|
||||
// -----------------------------------------------------------------------------------//
|
||||
{
|
||||
static final byte ASCII_QUOTE = 0x22;
|
||||
static final byte ASCII_COLON = 0x3A;
|
||||
|
@ -11,28 +13,38 @@ public abstract class BasicProgram extends AbstractFile
|
|||
|
||||
static BasicPreferences basicPreferences; // set by MenuHandler
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
public static void setBasicPreferences (BasicPreferences basicPreferences)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
BasicProgram.basicPreferences = basicPreferences;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
public BasicProgram (String name, byte[] buffer)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
super (name, buffer);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
boolean isHighBitSet (byte value)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
return (value & 0x80) != 0;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
boolean isControlCharacter (byte value)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
int val = value & 0xFF;
|
||||
return val > 0 && val < 32;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
boolean isDigit (byte value)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
return value >= 48 && value <= 57;
|
||||
}
|
||||
|
|
|
@ -2,17 +2,27 @@ package com.bytezone.diskbrowser.applefile;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import com.bytezone.diskbrowser.gui.TextPreferences;
|
||||
import com.bytezone.diskbrowser.utilities.HexFormatter;
|
||||
|
||||
// -----------------------------------------------------------------------------------//
|
||||
public class TextFile extends AbstractFile
|
||||
// -----------------------------------------------------------------------------------//
|
||||
{
|
||||
private int recordLength; // prodos aux
|
||||
private List<TextBuffer> buffers; // only used if it is a Prodos text file
|
||||
static TextPreferences textPreferences; // set by MenuHandler
|
||||
|
||||
private int recordLength; // prodos aux
|
||||
private List<TextBuffer> buffers; // only used if it is a Prodos text file
|
||||
private int eof;
|
||||
private boolean prodosFile;
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
public static void setTextPreferences (TextPreferences textPreferences)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
TextFile.textPreferences = textPreferences;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
public TextFile (String name, byte[] buffer)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
|
@ -68,15 +78,19 @@ public class TextFile extends AbstractFile
|
|||
{
|
||||
StringBuilder text = new StringBuilder ();
|
||||
|
||||
text.append ("Name : " + name + "\n");
|
||||
if (prodosFile)
|
||||
if (textPreferences.showHeader)
|
||||
{
|
||||
text.append (String.format ("Record length : %,8d%n", recordLength));
|
||||
text.append (String.format ("End of file : %,8d%n", eof));
|
||||
text.append ("Name : " + name + "\n");
|
||||
|
||||
if (prodosFile)
|
||||
{
|
||||
text.append (String.format ("Record length : %,8d%n", recordLength));
|
||||
text.append (String.format ("End of file : %,8d%n", eof));
|
||||
}
|
||||
else
|
||||
text.append (String.format ("End of file : %,8d%n", buffer.length));
|
||||
text.append ("\n");
|
||||
}
|
||||
else
|
||||
text.append (String.format ("End of file : %,8d%n", buffer.length));
|
||||
text.append ("\n");
|
||||
|
||||
// check whether file is spread over multiple buffers
|
||||
if (buffers != null)
|
||||
|
@ -145,20 +159,25 @@ public class TextFile extends AbstractFile
|
|||
int ptr = 0;
|
||||
int size = buffer.length;
|
||||
int lastVal = 0;
|
||||
boolean newFormat = true;
|
||||
boolean showAllOffsets = true;
|
||||
// boolean showAllOffsets = true;
|
||||
|
||||
if (newFormat)
|
||||
if (textPreferences.showTextOffsets)
|
||||
{
|
||||
text.append (" Offset Text values\n");
|
||||
text.append ("---------- -------------------------------------------------------"
|
||||
+ "-------------------\n");
|
||||
if (buffer.length == 0)
|
||||
return text.toString ();
|
||||
|
||||
if (buffer[0] != 0)
|
||||
text.append (String.format ("%,10d ", ptr));
|
||||
}
|
||||
else
|
||||
{
|
||||
text.append (" Text values\n");
|
||||
text.append ("-------------------------------------------------------"
|
||||
+ "-------------------------------\n");
|
||||
}
|
||||
if (buffer.length == 0)
|
||||
return text.toString ();
|
||||
|
||||
if (buffer[0] != 0 && textPreferences.showTextOffsets)
|
||||
text.append (String.format ("%,10d ", ptr));
|
||||
|
||||
int gcd = 0;
|
||||
|
||||
|
@ -173,19 +192,15 @@ public class TextFile extends AbstractFile
|
|||
{
|
||||
if (nulls > 0)
|
||||
{
|
||||
if (newFormat)
|
||||
if (textPreferences.showTextOffsets)
|
||||
text.append (String.format ("%,10d ", ptr - 1));
|
||||
else
|
||||
text.append ("\nNew record at : " + (ptr - 1) + "\n");
|
||||
|
||||
nulls = 0;
|
||||
|
||||
gcd = gcd == 0 ? ptr - 1 : gcd (gcd, ptr - 1);
|
||||
}
|
||||
else if (lastVal == 0x0D && newFormat)
|
||||
if (showAllOffsets)
|
||||
text.append (String.format ("%,10d ", ptr - 1));
|
||||
else
|
||||
text.append (" ");
|
||||
else if (lastVal == 0x0D && textPreferences.showTextOffsets)
|
||||
text.append (String.format ("%,10d ", ptr - 1));
|
||||
|
||||
text.append ((char) val);
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ import com.bytezone.diskbrowser.applefile.Palette;
|
|||
import com.bytezone.diskbrowser.applefile.PaletteFactory.CycleDirection;
|
||||
import com.bytezone.diskbrowser.applefile.QuickDrawFont;
|
||||
import com.bytezone.diskbrowser.applefile.SHRPictureFile2;
|
||||
import com.bytezone.diskbrowser.applefile.TextFile;
|
||||
import com.bytezone.diskbrowser.applefile.VisicalcFile;
|
||||
import com.bytezone.diskbrowser.disk.DiskAddress;
|
||||
import com.bytezone.diskbrowser.disk.SectorList;
|
||||
|
@ -39,9 +40,10 @@ import com.bytezone.diskbrowser.gui.FontAction.FontChangeEvent;
|
|||
import com.bytezone.diskbrowser.gui.FontAction.FontChangeListener;
|
||||
|
||||
// -----------------------------------------------------------------------------------//
|
||||
public class DataPanel extends JTabbedPane implements DiskSelectionListener,
|
||||
FileSelectionListener, SectorSelectionListener, FileNodeSelectionListener,
|
||||
FontChangeListener, BasicPreferencesListener, AssemblerPreferencesListener
|
||||
public class DataPanel extends JTabbedPane
|
||||
implements DiskSelectionListener, FileSelectionListener, SectorSelectionListener,
|
||||
FileNodeSelectionListener, FontChangeListener, BasicPreferencesListener,
|
||||
AssemblerPreferencesListener, TextPreferencesListener
|
||||
// -----------------------------------------------------------------------------------//
|
||||
{
|
||||
private static final int TEXT_WIDTH = 65;
|
||||
|
@ -551,6 +553,15 @@ public class DataPanel extends JTabbedPane implements DiskSelectionListener,
|
|||
setDataSource (currentDataSource);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public void setTextPreferences (TextPreferences textPreferences)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
if (currentDataSource instanceof TextFile)
|
||||
setDataSource (currentDataSource);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
class Worker extends SwingWorker<Void, Integer>
|
||||
// ---------------------------------------------------------------------------------//
|
||||
|
|
|
@ -188,6 +188,7 @@ public class DiskBrowser extends JFrame implements DiskSelectionListener, QuitLi
|
|||
|
||||
menuHandler.addBasicPreferencesListener (dataPanel);
|
||||
menuHandler.addAssemblerPreferencesListener (dataPanel);
|
||||
menuHandler.addTextPreferencesListener (dataPanel);
|
||||
|
||||
// activate the highest panel now that the listeners are ready
|
||||
catalogPanel.activate ();
|
||||
|
|
|
@ -22,6 +22,7 @@ import com.bytezone.diskbrowser.applefile.BasicProgram;
|
|||
import com.bytezone.diskbrowser.applefile.HiResImage;
|
||||
import com.bytezone.diskbrowser.applefile.Palette;
|
||||
import com.bytezone.diskbrowser.applefile.PaletteFactory;
|
||||
import com.bytezone.diskbrowser.applefile.TextFile;
|
||||
import com.bytezone.diskbrowser.applefile.VisicalcFile;
|
||||
import com.bytezone.diskbrowser.disk.DataDisk;
|
||||
import com.bytezone.diskbrowser.disk.FormattedDisk;
|
||||
|
@ -54,7 +55,9 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL
|
|||
|
||||
private static final String PREFS_PRODOS_SORT_DIRECTORIES = "prodosSortDirectories";
|
||||
|
||||
// private static final String PREFS_DEBUGGING = "debugging";
|
||||
private static final String PREFS_TEXT_SHOW_OFFSETS = "showTextOffsets";
|
||||
private static final String PREFS_TEXT_SHOW_HEADER = "showTextHeader";
|
||||
|
||||
private static final String PREFS_PALETTE = "palette";
|
||||
|
||||
FormattedDisk currentDisk;
|
||||
|
@ -73,11 +76,16 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL
|
|||
private final List<ProdosPreferencesListener> prodosPreferencesListeners =
|
||||
new ArrayList<> ();
|
||||
|
||||
private final TextPreferences textPreferences = new TextPreferences ();
|
||||
private final List<TextPreferencesListener> textPreferencesListeners =
|
||||
new ArrayList<> ();
|
||||
|
||||
JMenuBar menuBar = new JMenuBar ();
|
||||
JMenu fileMenu = new JMenu ("File");
|
||||
JMenu formatMenu = new JMenu ("Format");
|
||||
JMenu imageMenu = new JMenu ("Images");
|
||||
JMenu applesoftMenu = new JMenu ("Applesoft");
|
||||
JMenu textMenu = new JMenu ("Text");
|
||||
JMenu assemblerMenu = new JMenu ("Assembler");
|
||||
JMenu prodosMenu = new JMenu ("Prodos");
|
||||
JMenu helpMenu = new JMenu ("Help");
|
||||
|
@ -132,6 +140,10 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL
|
|||
// Prodos menu items
|
||||
final JMenuItem prodosSortDirectoriesItem = new JCheckBoxMenuItem ("Sort directories");
|
||||
|
||||
// Text menu items
|
||||
final JMenuItem showTextOffsetsItem = new JCheckBoxMenuItem ("Show offsets");
|
||||
final JMenuItem showTextHeaderItem = new JCheckBoxMenuItem ("Show header");
|
||||
|
||||
ButtonGroup paletteGroup = new ButtonGroup ();
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
|
@ -144,6 +156,7 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL
|
|||
menuBar.add (applesoftMenu);
|
||||
menuBar.add (assemblerMenu);
|
||||
menuBar.add (prodosMenu);
|
||||
menuBar.add (textMenu);
|
||||
menuBar.add (helpMenu);
|
||||
|
||||
fileMenu.add (rootItem);
|
||||
|
@ -216,6 +229,9 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL
|
|||
assemblerMenu.add (showAssemblerStringsItem);
|
||||
assemblerMenu.add (showAssemblerHeaderItem);
|
||||
|
||||
textMenu.add (showTextOffsetsItem);
|
||||
textMenu.add (showTextHeaderItem);
|
||||
|
||||
prodosMenu.add (prodosSortDirectoriesItem);
|
||||
|
||||
ActionListener basicPreferencesAction = new ActionListener ()
|
||||
|
@ -248,6 +264,16 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL
|
|||
}
|
||||
};
|
||||
|
||||
ActionListener textPreferencesAction = new ActionListener ()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed (ActionEvent e)
|
||||
{
|
||||
setTextPreferences ();
|
||||
notifyTextPreferencesListeners ();
|
||||
}
|
||||
};
|
||||
|
||||
splitRemarkItem.addActionListener (basicPreferencesAction);
|
||||
alignAssignItem.addActionListener (basicPreferencesAction);
|
||||
showBasicTargetsItem.addActionListener (basicPreferencesAction);
|
||||
|
@ -261,6 +287,9 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL
|
|||
|
||||
prodosSortDirectoriesItem.addActionListener (prodosPreferencesAction);
|
||||
|
||||
showTextOffsetsItem.addActionListener (textPreferencesAction);
|
||||
showTextHeaderItem.addActionListener (textPreferencesAction);
|
||||
|
||||
helpMenu.add (new JMenuItem (new EnvironmentAction ()));
|
||||
|
||||
sector256Item.setActionCommand ("256");
|
||||
|
@ -374,10 +403,33 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL
|
|||
listener.setProdosPreferences (prodosPreferences);
|
||||
}
|
||||
|
||||
// void addHelpMenuAction (Action action, String functionName)
|
||||
// {
|
||||
// helpMenu.add (new JMenuItem (action));
|
||||
// }
|
||||
// ---------------------------------------------------------------------------------//
|
||||
private void setTextPreferences ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
textPreferences.showTextOffsets = showTextOffsetsItem.isSelected ();
|
||||
textPreferences.showHeader = showTextHeaderItem.isSelected ();
|
||||
TextFile.setTextPreferences (textPreferences);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
void addTextPreferencesListener (TextPreferencesListener listener)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
if (!textPreferencesListeners.contains (listener))
|
||||
{
|
||||
textPreferencesListeners.add (listener);
|
||||
listener.setTextPreferences (textPreferences);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
void notifyTextPreferencesListeners ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
for (TextPreferencesListener listener : textPreferencesListeners)
|
||||
listener.setTextPreferences (textPreferences);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
private void addLauncherMenu ()
|
||||
|
@ -436,6 +488,9 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL
|
|||
|
||||
prefs.putBoolean (PREFS_PRODOS_SORT_DIRECTORIES,
|
||||
prodosSortDirectoriesItem.isSelected ());
|
||||
|
||||
prefs.putBoolean (PREFS_TEXT_SHOW_OFFSETS, showTextOffsetsItem.isSelected ());
|
||||
prefs.putBoolean (PREFS_TEXT_SHOW_HEADER, showTextHeaderItem.isSelected ());
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
|
@ -483,9 +538,13 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL
|
|||
prodosSortDirectoriesItem
|
||||
.setSelected (prefs.getBoolean (PREFS_PRODOS_SORT_DIRECTORIES, true));
|
||||
|
||||
showTextOffsetsItem.setSelected (prefs.getBoolean (PREFS_TEXT_SHOW_OFFSETS, true));
|
||||
showTextHeaderItem.setSelected (prefs.getBoolean (PREFS_TEXT_SHOW_HEADER, true));
|
||||
|
||||
setBasicPreferences ();
|
||||
setAssemblerPreferences ();
|
||||
setProdosPreferences ();
|
||||
setTextPreferences ();
|
||||
|
||||
int paletteIndex = prefs.getInt (PREFS_PALETTE, 0);
|
||||
PaletteFactory paletteFactory = HiResImage.getPaletteFactory ();
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package com.bytezone.diskbrowser.gui;
|
||||
|
||||
// -----------------------------------------------------------------------------------//
|
||||
public class TextPreferences
|
||||
//-----------------------------------------------------------------------------------//
|
||||
{
|
||||
public boolean showTextOffsets;
|
||||
public boolean showHeader = true;
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public String toString ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
StringBuilder text = new StringBuilder ();
|
||||
|
||||
text.append (String.format ("Show offsets .......... %s%n", showTextOffsets));
|
||||
text.append (String.format ("Show header ........... %s", showHeader));
|
||||
|
||||
return text.toString ();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package com.bytezone.diskbrowser.gui;
|
||||
|
||||
// -----------------------------------------------------------------------------------//
|
||||
public interface TextPreferencesListener
|
||||
//-----------------------------------------------------------------------------------//
|
||||
{
|
||||
public void setTextPreferences (TextPreferences textPreferences);
|
||||
}
|
Loading…
Reference in New Issue