From 9e94bdfe50079fef5c0329d0dc4d597742f93cae Mon Sep 17 00:00:00 2001 From: Denis Molony Date: Thu, 8 Aug 2019 20:12:34 +1000 Subject: [PATCH] added menu option --- .../bytezone/diskbrowser/gui/BasicPreferences.java | 14 ++++++++------ src/com/bytezone/diskbrowser/gui/MenuHandler.java | 9 +++++++++ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/com/bytezone/diskbrowser/gui/BasicPreferences.java b/src/com/bytezone/diskbrowser/gui/BasicPreferences.java index 8546286..479206e 100644 --- a/src/com/bytezone/diskbrowser/gui/BasicPreferences.java +++ b/src/com/bytezone/diskbrowser/gui/BasicPreferences.java @@ -6,7 +6,7 @@ public class BasicPreferences public boolean alignAssign = true; public boolean showTargets = true; public boolean showHeader = true; - public boolean onlyShowTargetLineNumbers = false; + public boolean onlyShowTargetLineNumbers = true; public boolean showCaret = false; public int wrapPrintAt = 40; public int wrapRemAt = 60; @@ -16,11 +16,13 @@ public class BasicPreferences { StringBuilder text = new StringBuilder (); - text.append (String.format ("Split remark ...... %s%n", splitRem)); - text.append (String.format ("Align assign ...... %s%n", alignAssign)); - text.append (String.format ("Show targets ...... %s%n", showTargets)); - text.append (String.format ("Show header ....... %s%n", showHeader)); - text.append (String.format ("Show caret ........ %s", showCaret)); + text.append (String.format ("Split remark .......... %s%n", splitRem)); + text.append (String.format ("Align assign .......... %s%n", alignAssign)); + text.append (String.format ("Show targets .......... %s%n", showTargets)); + text.append ( + String.format ("Only target lines ..... %s%n", onlyShowTargetLineNumbers)); + text.append (String.format ("Show header ........... %s%n", showHeader)); + text.append (String.format ("Show caret ............ %s", showCaret)); return text.toString (); } diff --git a/src/com/bytezone/diskbrowser/gui/MenuHandler.java b/src/com/bytezone/diskbrowser/gui/MenuHandler.java index fe53a4f..1f29857 100755 --- a/src/com/bytezone/diskbrowser/gui/MenuHandler.java +++ b/src/com/bytezone/diskbrowser/gui/MenuHandler.java @@ -33,6 +33,7 @@ public class MenuHandler private static final String PREFS_SPLIT_REMARKS = "splitRemarks"; private static final String PREFS_ALIGN_ASSIGN = "alignAssign"; private static final String PREFS_SHOW_TARGETS = "showTargets"; + private static final String PREFS_ONLY_SHOW_TARGETS = "onlyShowTargets"; private static final String PREFS_SHOW_HEADER = "showHeader"; private static final String PREFS_SHOW_CARET = "showCaret"; @@ -84,6 +85,8 @@ public class MenuHandler final JMenuItem splitRemarkItem = new JCheckBoxMenuItem ("Split remarks"); final JMenuItem alignAssignItem = new JCheckBoxMenuItem ("Align assign"); final JMenuItem showTargetsItem = new JCheckBoxMenuItem ("Show targets"); + final JMenuItem onlyShowTargetLinesItem = + new JCheckBoxMenuItem ("Only show target lines"); final JMenuItem showHeaderItem = new JCheckBoxMenuItem ("Show header"); final JMenuItem showCaretItem = new JCheckBoxMenuItem ("Show caret"); @@ -154,6 +157,7 @@ public class MenuHandler applesoftMenu.add (splitRemarkItem); applesoftMenu.add (alignAssignItem); applesoftMenu.add (showTargetsItem); + applesoftMenu.add (onlyShowTargetLinesItem); applesoftMenu.add (showHeaderItem); applesoftMenu.add (showCaretItem); @@ -170,6 +174,7 @@ public class MenuHandler splitRemarkItem.addActionListener (basicPreferencesAction); alignAssignItem.addActionListener (basicPreferencesAction); showTargetsItem.addActionListener (basicPreferencesAction); + onlyShowTargetLinesItem.addActionListener (basicPreferencesAction); showHeaderItem.addActionListener (basicPreferencesAction); showCaretItem.addActionListener (basicPreferencesAction); @@ -200,6 +205,7 @@ public class MenuHandler basicPreferences.showCaret = showCaretItem.isSelected (); basicPreferences.showHeader = showHeaderItem.isSelected (); basicPreferences.showTargets = showTargetsItem.isSelected (); + basicPreferences.onlyShowTargetLineNumbers = onlyShowTargetLinesItem.isSelected (); BasicProgram.setBasicPreferences (basicPreferences); } @@ -262,6 +268,7 @@ public class MenuHandler prefs.putBoolean (PREFS_SHOW_CARET, showCaretItem.isSelected ()); prefs.putBoolean (PREFS_SHOW_HEADER, showHeaderItem.isSelected ()); prefs.putBoolean (PREFS_SHOW_TARGETS, showTargetsItem.isSelected ()); + prefs.putBoolean (PREFS_ONLY_SHOW_TARGETS, onlyShowTargetLinesItem.isSelected ()); } @Override @@ -280,6 +287,8 @@ public class MenuHandler showCaretItem.setSelected (prefs.getBoolean (PREFS_SHOW_CARET, false)); showHeaderItem.setSelected (prefs.getBoolean (PREFS_SHOW_HEADER, true)); showTargetsItem.setSelected (prefs.getBoolean (PREFS_SHOW_TARGETS, false)); + onlyShowTargetLinesItem + .setSelected (prefs.getBoolean (PREFS_ONLY_SHOW_TARGETS, false)); setBasicPreferences ();