fixed the hide panel actions
This commit is contained in:
parent
dc551285bb
commit
ea0a827331
|
@ -438,6 +438,7 @@ public class DataPanel extends JTabbedPane
|
||||||
{
|
{
|
||||||
setSelectedIndex (0);
|
setSelectedIndex (0);
|
||||||
setDataSource (null);
|
setDataSource (null);
|
||||||
|
|
||||||
if (event.getFormattedDisk () != null)
|
if (event.getFormattedDisk () != null)
|
||||||
setDataSource (event.getFormattedDisk ().getCatalog ().getDataSource ());
|
setDataSource (event.getFormattedDisk ().getCatalog ().getDataSource ());
|
||||||
else
|
else
|
||||||
|
|
|
@ -6,6 +6,8 @@ import java.awt.Desktop;
|
||||||
import java.awt.EventQueue;
|
import java.awt.EventQueue;
|
||||||
import java.awt.event.WindowAdapter;
|
import java.awt.event.WindowAdapter;
|
||||||
import java.awt.event.WindowEvent;
|
import java.awt.event.WindowEvent;
|
||||||
|
import java.beans.PropertyChangeEvent;
|
||||||
|
import java.beans.PropertyChangeListener;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.prefs.Preferences;
|
import java.util.prefs.Preferences;
|
||||||
|
@ -22,7 +24,8 @@ import javax.swing.UIManager;
|
||||||
import com.bytezone.diskbrowser.duplicates.RootFolderData;
|
import com.bytezone.diskbrowser.duplicates.RootFolderData;
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------//
|
// -----------------------------------------------------------------------------------//
|
||||||
public class DiskBrowser extends JFrame implements DiskSelectionListener, QuitListener
|
public class DiskBrowser extends JFrame
|
||||||
|
implements DiskSelectionListener, QuitListener, PropertyChangeListener
|
||||||
// -----------------------------------------------------------------------------------//
|
// -----------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
private static String[] args;
|
private static String[] args;
|
||||||
|
@ -37,6 +40,12 @@ public class DiskBrowser extends JFrame implements DiskSelectionListener, QuitLi
|
||||||
|
|
||||||
private final List<QuitListener> quitListeners = new ArrayList<> ();
|
private final List<QuitListener> quitListeners = new ArrayList<> ();
|
||||||
|
|
||||||
|
private final JPanel catalogBorderPanel;
|
||||||
|
private final JPanel layoutBorderPanel;
|
||||||
|
|
||||||
|
HideCatalogAction hideCatalogAction = new HideCatalogAction ();
|
||||||
|
HideLayoutAction hideLayoutAction = new HideLayoutAction ();
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
public DiskBrowser ()
|
public DiskBrowser ()
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
|
@ -61,7 +70,7 @@ public class DiskBrowser extends JFrame implements DiskSelectionListener, QuitLi
|
||||||
|
|
||||||
// create and add the left-hand catalog panel
|
// create and add the left-hand catalog panel
|
||||||
CatalogPanel catalogPanel = new CatalogPanel (redoHandler);
|
CatalogPanel catalogPanel = new CatalogPanel (redoHandler);
|
||||||
JPanel catalogBorderPanel = addPanel (catalogPanel, "Catalog", BorderLayout.WEST);
|
catalogBorderPanel = addPanel (catalogPanel, "Catalog", BorderLayout.WEST);
|
||||||
|
|
||||||
// create and add the centre output panel
|
// create and add the centre output panel
|
||||||
DataPanel dataPanel = new DataPanel (menuHandler);
|
DataPanel dataPanel = new DataPanel (menuHandler);
|
||||||
|
@ -69,8 +78,7 @@ public class DiskBrowser extends JFrame implements DiskSelectionListener, QuitLi
|
||||||
|
|
||||||
// create and add the right-hand disk layout panel
|
// create and add the right-hand disk layout panel
|
||||||
DiskLayoutPanel diskLayoutPanel = new DiskLayoutPanel ();
|
DiskLayoutPanel diskLayoutPanel = new DiskLayoutPanel ();
|
||||||
JPanel layoutBorderPanel =
|
layoutBorderPanel = addPanel (diskLayoutPanel, "Disk layout", BorderLayout.EAST);
|
||||||
addPanel (diskLayoutPanel, "Disk layout", BorderLayout.EAST);
|
|
||||||
|
|
||||||
// create actions
|
// create actions
|
||||||
DuplicateAction duplicateAction = new DuplicateAction (rootFolderData);
|
DuplicateAction duplicateAction = new DuplicateAction (rootFolderData);
|
||||||
|
@ -80,13 +88,13 @@ public class DiskBrowser extends JFrame implements DiskSelectionListener, QuitLi
|
||||||
// PreferencesAction preferencesAction = new PreferencesAction (this, prefs);
|
// PreferencesAction preferencesAction = new PreferencesAction (this, prefs);
|
||||||
AbstractAction print = new PrintAction (dataPanel);
|
AbstractAction print = new PrintAction (dataPanel);
|
||||||
// AboutAction aboutAction = new AboutAction ();
|
// AboutAction aboutAction = new AboutAction ();
|
||||||
HideCatalogAction hideCatalogAction =
|
// HideLayoutAction hideLayoutAction = new HideLayoutAction (this, layoutBorderPanel);
|
||||||
new HideCatalogAction (this, catalogBorderPanel);
|
ShowFreeSectorsAction showFreeAction = new ShowFreeSectorsAction ();
|
||||||
HideLayoutAction hideLayoutAction = new HideLayoutAction (this, layoutBorderPanel);
|
|
||||||
ShowFreeSectorsAction showFreeAction =
|
|
||||||
new ShowFreeSectorsAction (menuHandler, diskLayoutPanel);
|
|
||||||
CloseTabAction closeTabAction = new CloseTabAction (catalogPanel);
|
CloseTabAction closeTabAction = new CloseTabAction (catalogPanel);
|
||||||
|
|
||||||
|
hideCatalogAction.addPropertyChangeListener (this);
|
||||||
|
hideLayoutAction.addPropertyChangeListener (this);
|
||||||
|
|
||||||
// add action buttons to toolbar
|
// add action buttons to toolbar
|
||||||
toolBar.add (rootDirectoryAction);
|
toolBar.add (rootDirectoryAction);
|
||||||
toolBar.add (refreshTreeAction);
|
toolBar.add (refreshTreeAction);
|
||||||
|
@ -132,6 +140,8 @@ public class DiskBrowser extends JFrame implements DiskSelectionListener, QuitLi
|
||||||
menuHandler.duplicateItem.setAction (duplicateAction);
|
menuHandler.duplicateItem.setAction (duplicateAction);
|
||||||
menuHandler.closeTabItem.setAction (closeTabAction);
|
menuHandler.closeTabItem.setAction (closeTabAction);
|
||||||
|
|
||||||
|
showFreeAction.addPropertyChangeListener (diskLayoutPanel);
|
||||||
|
|
||||||
quitListeners.add (rootDirectoryAction);
|
quitListeners.add (rootDirectoryAction);
|
||||||
quitListeners.add (menuHandler);
|
quitListeners.add (menuHandler);
|
||||||
quitListeners.add (catalogPanel);
|
quitListeners.add (catalogPanel);
|
||||||
|
@ -173,9 +183,9 @@ public class DiskBrowser extends JFrame implements DiskSelectionListener, QuitLi
|
||||||
|
|
||||||
// Remove the two optional panels if they were previously hidden
|
// Remove the two optional panels if they were previously hidden
|
||||||
if (!menuHandler.showLayoutItem.isSelected ())
|
if (!menuHandler.showLayoutItem.isSelected ())
|
||||||
hideLayoutAction.set (false);
|
setLayoutPanel (false);
|
||||||
if (!menuHandler.showCatalogItem.isSelected ())
|
if (!menuHandler.showCatalogItem.isSelected ())
|
||||||
hideCatalogAction.set (false);
|
setCatalogPanel (false);
|
||||||
|
|
||||||
menuHandler.addBasicPreferencesListener (dataPanel);
|
menuHandler.addBasicPreferencesListener (dataPanel);
|
||||||
menuHandler.addAssemblerPreferencesListener (dataPanel);
|
menuHandler.addAssemblerPreferencesListener (dataPanel);
|
||||||
|
@ -211,6 +221,41 @@ public class DiskBrowser extends JFrame implements DiskSelectionListener, QuitLi
|
||||||
return panel;
|
return panel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
@Override
|
||||||
|
public void propertyChange (PropertyChangeEvent evt)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
{
|
||||||
|
if (evt.getSource () == hideCatalogAction)
|
||||||
|
setCatalogPanel ((boolean) evt.getNewValue ());
|
||||||
|
else if (evt.getSource () == hideLayoutAction)
|
||||||
|
setLayoutPanel ((boolean) evt.getNewValue ());
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
private void setCatalogPanel (boolean show)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
{
|
||||||
|
if (show)
|
||||||
|
add (catalogBorderPanel, BorderLayout.WEST);
|
||||||
|
else
|
||||||
|
remove (catalogBorderPanel);
|
||||||
|
|
||||||
|
validate ();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
private void setLayoutPanel (boolean show)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
{
|
||||||
|
if (show)
|
||||||
|
add (layoutBorderPanel, BorderLayout.EAST);
|
||||||
|
else
|
||||||
|
remove (layoutBorderPanel);
|
||||||
|
|
||||||
|
validate ();
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
@Override
|
@Override
|
||||||
public void diskSelected (DiskSelectedEvent e)
|
public void diskSelected (DiskSelectedEvent e)
|
||||||
|
|
|
@ -12,6 +12,8 @@ import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.awt.event.MouseAdapter;
|
import java.awt.event.MouseAdapter;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
|
import java.beans.PropertyChangeEvent;
|
||||||
|
import java.beans.PropertyChangeListener;
|
||||||
|
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
@ -25,8 +27,8 @@ import com.bytezone.diskbrowser.gui.RedoHandler.RedoEvent;
|
||||||
import com.bytezone.diskbrowser.gui.RedoHandler.RedoListener;
|
import com.bytezone.diskbrowser.gui.RedoHandler.RedoListener;
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------//
|
// -----------------------------------------------------------------------------------//
|
||||||
class DiskLayoutPanel extends JPanel
|
class DiskLayoutPanel extends JPanel implements DiskSelectionListener,
|
||||||
implements DiskSelectionListener, FileSelectionListener, RedoListener
|
FileSelectionListener, RedoListener, PropertyChangeListener
|
||||||
// -----------------------------------------------------------------------------------//
|
// -----------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
private static final int SIZE = 15; // basic unit of a display block
|
private static final int SIZE = 15; // basic unit of a display block
|
||||||
|
@ -134,6 +136,14 @@ class DiskLayoutPanel extends JPanel
|
||||||
diskLayoutImage.setShowFreeSectors (free);
|
diskLayoutImage.setShowFreeSectors (free);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
@Override
|
||||||
|
public void propertyChange (PropertyChangeEvent evt)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
{
|
||||||
|
setFree ((Boolean) evt.getNewValue ());
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
public void addSectorSelectionListener (SectorSelectionListener listener)
|
public void addSectorSelectionListener (SectorSelectionListener listener)
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
|
|
|
@ -85,14 +85,13 @@ class DiskLegendPanel extends DiskPanel
|
||||||
int val = formattedDisk.falseNegativeBlocks ();
|
int val = formattedDisk.falseNegativeBlocks ();
|
||||||
if (val > 0)
|
if (val > 0)
|
||||||
{
|
{
|
||||||
g.drawString (
|
g.drawString (val + " unused sector" + (val == 1 ? "" : "s") //
|
||||||
val + " unused sector" + (val == 1 ? "" : "s") + " marked as unavailable", 10,
|
+ " marked as unavailable", 10, y);
|
||||||
y);
|
|
||||||
y += lineHeight;
|
y += lineHeight;
|
||||||
}
|
}
|
||||||
val = formattedDisk.falsePositiveBlocks ();
|
val = formattedDisk.falsePositiveBlocks ();
|
||||||
if (val > 0)
|
if (val > 0)
|
||||||
g.drawString (val + " used sector" + (val == 1 ? "" : "s") + " marked as available",
|
g.drawString (val + " used sector" + (val == 1 ? "" : "s") //
|
||||||
10, y);
|
+ " marked as available", 10, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -22,7 +22,8 @@ class FileSelectedEvent extends EventObject
|
||||||
this.appleFileSource = appleFileSource;
|
this.appleFileSource = appleFileSource;
|
||||||
|
|
||||||
// If a file is selected from a disk which is part of a hybrid disk, then the
|
// If a file is selected from a disk which is part of a hybrid disk, then the
|
||||||
// parent must be told so that it can ensure its internal currentDisk is set correctly
|
// parent must be told so that it can ensure its internal currentDisk is set
|
||||||
|
// correctly
|
||||||
FormattedDisk fd = appleFileSource.getFormattedDisk ();
|
FormattedDisk fd = appleFileSource.getFormattedDisk ();
|
||||||
HybridDisk ddd = (HybridDisk) fd.getParent ();
|
HybridDisk ddd = (HybridDisk) fd.getParent ();
|
||||||
if (ddd != null)
|
if (ddd != null)
|
||||||
|
|
|
@ -1,33 +1,26 @@
|
||||||
package com.bytezone.diskbrowser.gui;
|
package com.bytezone.diskbrowser.gui;
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
|
|
||||||
import javax.swing.AbstractAction;
|
import javax.swing.AbstractAction;
|
||||||
import javax.swing.Action;
|
import javax.swing.Action;
|
||||||
import javax.swing.JFrame;
|
|
||||||
import javax.swing.JMenuItem;
|
import javax.swing.JMenuItem;
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.KeyStroke;
|
import javax.swing.KeyStroke;
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------//
|
// -----------------------------------------------------------------------------------//
|
||||||
class HideCatalogAction extends AbstractAction
|
class HideCatalogAction extends AbstractAction
|
||||||
// -----------------------------------------------------------------------------------//
|
// -----------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
JFrame owner;
|
|
||||||
JPanel catalogPanel;
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
public HideCatalogAction (JFrame owner, JPanel catalogPanel)
|
public HideCatalogAction ()
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
super ("Show catalog panel");
|
super ("Show catalog panel");
|
||||||
|
|
||||||
putValue (Action.SHORT_DESCRIPTION, "Show/hide the catalog panel");
|
putValue (Action.SHORT_DESCRIPTION, "Show/hide the catalog panel");
|
||||||
putValue (Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke ("alt C"));
|
putValue (Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke ("alt C"));
|
||||||
putValue (Action.MNEMONIC_KEY, KeyEvent.VK_C);
|
putValue (Action.MNEMONIC_KEY, KeyEvent.VK_C);
|
||||||
this.owner = owner;
|
|
||||||
this.catalogPanel = catalogPanel;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
|
@ -35,22 +28,7 @@ class HideCatalogAction extends AbstractAction
|
||||||
public void actionPerformed (ActionEvent e)
|
public void actionPerformed (ActionEvent e)
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
set (((JMenuItem) e.getSource ()).isSelected ());
|
firePropertyChange (e.getActionCommand (), null,
|
||||||
}
|
((JMenuItem) e.getSource ()).isSelected ());
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
|
||||||
public void set (boolean show)
|
|
||||||
// ---------------------------------------------------------------------------------//
|
|
||||||
{
|
|
||||||
if (show)
|
|
||||||
{
|
|
||||||
owner.add (catalogPanel, BorderLayout.WEST);
|
|
||||||
owner.validate ();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
owner.remove (catalogPanel);
|
|
||||||
owner.validate ();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,33 +1,26 @@
|
||||||
package com.bytezone.diskbrowser.gui;
|
package com.bytezone.diskbrowser.gui;
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
|
|
||||||
import javax.swing.AbstractAction;
|
import javax.swing.AbstractAction;
|
||||||
import javax.swing.Action;
|
import javax.swing.Action;
|
||||||
import javax.swing.JFrame;
|
|
||||||
import javax.swing.JMenuItem;
|
import javax.swing.JMenuItem;
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.KeyStroke;
|
import javax.swing.KeyStroke;
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------//
|
// -----------------------------------------------------------------------------------//
|
||||||
class HideLayoutAction extends AbstractAction
|
class HideLayoutAction extends AbstractAction
|
||||||
// -----------------------------------------------------------------------------------//
|
// -----------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
JFrame owner;
|
|
||||||
JPanel layoutPanel;
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
public HideLayoutAction (JFrame owner, JPanel layoutPanel)
|
public HideLayoutAction ()
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
super ("Show disk layout panel");
|
super ("Show disk layout panel");
|
||||||
|
|
||||||
putValue (Action.SHORT_DESCRIPTION, "Show/hide the disk layout panel");
|
putValue (Action.SHORT_DESCRIPTION, "Show/hide the disk layout panel");
|
||||||
putValue (Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke ("alt D"));
|
putValue (Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke ("alt D"));
|
||||||
putValue (Action.MNEMONIC_KEY, KeyEvent.VK_D);
|
putValue (Action.MNEMONIC_KEY, KeyEvent.VK_D);
|
||||||
this.owner = owner;
|
|
||||||
this.layoutPanel = layoutPanel;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
|
@ -35,22 +28,7 @@ class HideLayoutAction extends AbstractAction
|
||||||
public void actionPerformed (ActionEvent e)
|
public void actionPerformed (ActionEvent e)
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
set (((JMenuItem) e.getSource ()).isSelected ());
|
firePropertyChange (e.getActionCommand (), null,
|
||||||
}
|
((JMenuItem) e.getSource ()).isSelected ());
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
|
||||||
public void set (boolean show)
|
|
||||||
// ---------------------------------------------------------------------------------//
|
|
||||||
{
|
|
||||||
if (show)
|
|
||||||
{
|
|
||||||
owner.add (layoutPanel, BorderLayout.EAST);
|
|
||||||
owner.validate ();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
owner.remove (layoutPanel);
|
|
||||||
owner.validate ();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -76,7 +76,6 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL
|
||||||
|
|
||||||
private static final String PREFS_PALETTE = "palette";
|
private static final String PREFS_PALETTE = "palette";
|
||||||
|
|
||||||
FormattedDisk currentDisk;
|
|
||||||
final SaveDiskAction saveDiskAction = new SaveDiskAction ();
|
final SaveDiskAction saveDiskAction = new SaveDiskAction ();
|
||||||
final SaveFileAction saveFileAction = new SaveFileAction ();
|
final SaveFileAction saveFileAction = new SaveFileAction ();
|
||||||
final SaveSectorsAction saveSectorsAction = new SaveSectorsAction ();
|
final SaveSectorsAction saveSectorsAction = new SaveSectorsAction ();
|
||||||
|
@ -186,6 +185,8 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL
|
||||||
|
|
||||||
ButtonGroup paletteGroup = new ButtonGroup ();
|
ButtonGroup paletteGroup = new ButtonGroup ();
|
||||||
|
|
||||||
|
FormattedDisk currentDisk;
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
MenuHandler ()
|
MenuHandler ()
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
|
@ -558,60 +559,6 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL
|
||||||
fileMenu.addSeparator ();
|
fileMenu.addSeparator ();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
|
||||||
@Override
|
|
||||||
public void quit (Preferences prefs)
|
|
||||||
// ---------------------------------------------------------------------------------//
|
|
||||||
{
|
|
||||||
prefs.putBoolean (PREFS_LINE_WRAP, lineWrapItem.isSelected ());
|
|
||||||
prefs.putBoolean (PREFS_SHOW_LAYOUT, showLayoutItem.isSelected ());
|
|
||||||
prefs.putBoolean (PREFS_SHOW_CATALOG, showCatalogItem.isSelected ());
|
|
||||||
prefs.putBoolean (PREFS_SHOW_FREE_SECTORS, showFreeSectorsItem.isSelected ());
|
|
||||||
prefs.putBoolean (PREFS_COLOUR_QUIRKS, colourQuirksItem.isSelected ());
|
|
||||||
prefs.putBoolean (PREFS_MONOCHROME, monochromeItem.isSelected ());
|
|
||||||
prefs.putInt (PREFS_PALETTE,
|
|
||||||
HiResImage.getPaletteFactory ().getCurrentPaletteIndex ());
|
|
||||||
fontAction.quit (prefs);
|
|
||||||
|
|
||||||
int scale = scale1Item.isSelected () ? 1 : scale2Item.isSelected () ? 2 : 3;
|
|
||||||
prefs.putInt (PREFS_SCALE, scale);
|
|
||||||
|
|
||||||
prefs.putBoolean (PREFS_SHOW_HEADER, showHeaderItem.isSelected ());
|
|
||||||
prefs.putBoolean (PREFS_SHOW_ALL_FORMAT, showAllFormatItem.isSelected ());
|
|
||||||
prefs.putBoolean (PREFS_SHOW_ALL_XREF, showAllXrefItem.isSelected ());
|
|
||||||
|
|
||||||
prefs.putBoolean (PREFS_APPLE_LINE_WRAP, appleLineWrapItem.isSelected ());
|
|
||||||
|
|
||||||
prefs.putBoolean (PREFS_SPLIT_REMARKS, splitRemarkItem.isSelected ());
|
|
||||||
prefs.putBoolean (PREFS_SPLIT_DIM, splitDimItem.isSelected ());
|
|
||||||
prefs.putBoolean (PREFS_ALIGN_ASSIGN, alignAssignItem.isSelected ());
|
|
||||||
prefs.putBoolean (PREFS_SHOW_CARET, showCaretItem.isSelected ());
|
|
||||||
prefs.putBoolean (PREFS_SHOW_THEN, showThenItem.isSelected ());
|
|
||||||
prefs.putBoolean (PREFS_BLANK_AFTER_RETURN, blankAfterReturnItem.isSelected ());
|
|
||||||
prefs.putBoolean (PREFS_FORMAT_REM, formatRemItem.isSelected ());
|
|
||||||
prefs.putBoolean (PREFS_DELETE_EXTRA_DATA_SPACE, deleteExtraDataSpace.isSelected ());
|
|
||||||
|
|
||||||
prefs.putBoolean (PREFS_SHOW_GOSUB_GOTO, showXrefItem.isSelected ());
|
|
||||||
prefs.putBoolean (PREFS_SHOW_CALLS, showCallsItem.isSelected ());
|
|
||||||
prefs.putBoolean (PREFS_SHOW_SYMBOLS, showSymbolsItem.isSelected ());
|
|
||||||
prefs.putBoolean (PREFS_SHOW_FUNCTIONS, showFunctionsItem.isSelected ());
|
|
||||||
prefs.putBoolean (PREFS_SHOW_CONSTANTS, showConstantsItem.isSelected ());
|
|
||||||
prefs.putBoolean (PREFS_SHOW_DUPLICATE_SYMBOLS,
|
|
||||||
showDuplicateSymbolsItem.isSelected ());
|
|
||||||
|
|
||||||
prefs.putBoolean (PREFS_SHOW_ASSEMBLER_TARGETS,
|
|
||||||
showAssemblerTargetsItem.isSelected ());
|
|
||||||
prefs.putBoolean (PREFS_SHOW_ASSEMBLER_STRINGS,
|
|
||||||
showAssemblerStringsItem.isSelected ());
|
|
||||||
prefs.putBoolean (PREFS_SHOW_ASSEMBLER_HEADER, showAssemblerHeaderItem.isSelected ());
|
|
||||||
|
|
||||||
prefs.putBoolean (PREFS_PRODOS_SORT_DIRECTORIES,
|
|
||||||
prodosSortDirectoriesItem.isSelected ());
|
|
||||||
|
|
||||||
prefs.putBoolean (PREFS_TEXT_SHOW_OFFSETS, showTextOffsetsItem.isSelected ());
|
|
||||||
prefs.putBoolean (PREFS_TEXT_SHOW_HEADER, showTextHeaderItem.isSelected ());
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
@Override
|
@Override
|
||||||
public void restore (Preferences prefs)
|
public void restore (Preferences prefs)
|
||||||
|
@ -701,6 +648,60 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL
|
||||||
fontAction.restore (prefs);
|
fontAction.restore (prefs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
@Override
|
||||||
|
public void quit (Preferences prefs)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
{
|
||||||
|
prefs.putBoolean (PREFS_LINE_WRAP, lineWrapItem.isSelected ());
|
||||||
|
prefs.putBoolean (PREFS_SHOW_LAYOUT, showLayoutItem.isSelected ());
|
||||||
|
prefs.putBoolean (PREFS_SHOW_CATALOG, showCatalogItem.isSelected ());
|
||||||
|
prefs.putBoolean (PREFS_SHOW_FREE_SECTORS, showFreeSectorsItem.isSelected ());
|
||||||
|
prefs.putBoolean (PREFS_COLOUR_QUIRKS, colourQuirksItem.isSelected ());
|
||||||
|
prefs.putBoolean (PREFS_MONOCHROME, monochromeItem.isSelected ());
|
||||||
|
prefs.putInt (PREFS_PALETTE,
|
||||||
|
HiResImage.getPaletteFactory ().getCurrentPaletteIndex ());
|
||||||
|
fontAction.quit (prefs);
|
||||||
|
|
||||||
|
int scale = scale1Item.isSelected () ? 1 : scale2Item.isSelected () ? 2 : 3;
|
||||||
|
prefs.putInt (PREFS_SCALE, scale);
|
||||||
|
|
||||||
|
prefs.putBoolean (PREFS_SHOW_HEADER, showHeaderItem.isSelected ());
|
||||||
|
prefs.putBoolean (PREFS_SHOW_ALL_FORMAT, showAllFormatItem.isSelected ());
|
||||||
|
prefs.putBoolean (PREFS_SHOW_ALL_XREF, showAllXrefItem.isSelected ());
|
||||||
|
|
||||||
|
prefs.putBoolean (PREFS_APPLE_LINE_WRAP, appleLineWrapItem.isSelected ());
|
||||||
|
|
||||||
|
prefs.putBoolean (PREFS_SPLIT_REMARKS, splitRemarkItem.isSelected ());
|
||||||
|
prefs.putBoolean (PREFS_SPLIT_DIM, splitDimItem.isSelected ());
|
||||||
|
prefs.putBoolean (PREFS_ALIGN_ASSIGN, alignAssignItem.isSelected ());
|
||||||
|
prefs.putBoolean (PREFS_SHOW_CARET, showCaretItem.isSelected ());
|
||||||
|
prefs.putBoolean (PREFS_SHOW_THEN, showThenItem.isSelected ());
|
||||||
|
prefs.putBoolean (PREFS_BLANK_AFTER_RETURN, blankAfterReturnItem.isSelected ());
|
||||||
|
prefs.putBoolean (PREFS_FORMAT_REM, formatRemItem.isSelected ());
|
||||||
|
prefs.putBoolean (PREFS_DELETE_EXTRA_DATA_SPACE, deleteExtraDataSpace.isSelected ());
|
||||||
|
|
||||||
|
prefs.putBoolean (PREFS_SHOW_GOSUB_GOTO, showXrefItem.isSelected ());
|
||||||
|
prefs.putBoolean (PREFS_SHOW_CALLS, showCallsItem.isSelected ());
|
||||||
|
prefs.putBoolean (PREFS_SHOW_SYMBOLS, showSymbolsItem.isSelected ());
|
||||||
|
prefs.putBoolean (PREFS_SHOW_FUNCTIONS, showFunctionsItem.isSelected ());
|
||||||
|
prefs.putBoolean (PREFS_SHOW_CONSTANTS, showConstantsItem.isSelected ());
|
||||||
|
prefs.putBoolean (PREFS_SHOW_DUPLICATE_SYMBOLS,
|
||||||
|
showDuplicateSymbolsItem.isSelected ());
|
||||||
|
|
||||||
|
prefs.putBoolean (PREFS_SHOW_ASSEMBLER_TARGETS,
|
||||||
|
showAssemblerTargetsItem.isSelected ());
|
||||||
|
prefs.putBoolean (PREFS_SHOW_ASSEMBLER_STRINGS,
|
||||||
|
showAssemblerStringsItem.isSelected ());
|
||||||
|
prefs.putBoolean (PREFS_SHOW_ASSEMBLER_HEADER, showAssemblerHeaderItem.isSelected ());
|
||||||
|
|
||||||
|
prefs.putBoolean (PREFS_PRODOS_SORT_DIRECTORIES,
|
||||||
|
prodosSortDirectoriesItem.isSelected ());
|
||||||
|
|
||||||
|
prefs.putBoolean (PREFS_TEXT_SHOW_OFFSETS, showTextOffsetsItem.isSelected ());
|
||||||
|
prefs.putBoolean (PREFS_TEXT_SHOW_HEADER, showTextHeaderItem.isSelected ());
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
@Override
|
@Override
|
||||||
public void diskSelected (DiskSelectedEvent event)
|
public void diskSelected (DiskSelectedEvent event)
|
||||||
|
|
|
@ -5,26 +5,23 @@ import java.awt.event.KeyEvent;
|
||||||
|
|
||||||
import javax.swing.AbstractAction;
|
import javax.swing.AbstractAction;
|
||||||
import javax.swing.Action;
|
import javax.swing.Action;
|
||||||
|
import javax.swing.JMenuItem;
|
||||||
import javax.swing.KeyStroke;
|
import javax.swing.KeyStroke;
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------//
|
// -----------------------------------------------------------------------------------//
|
||||||
class ShowFreeSectorsAction extends AbstractAction
|
class ShowFreeSectorsAction extends AbstractAction
|
||||||
// -----------------------------------------------------------------------------------//
|
// -----------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
DiskLayoutPanel panel;
|
|
||||||
MenuHandler mh;
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
ShowFreeSectorsAction (MenuHandler mh, DiskLayoutPanel panel)
|
ShowFreeSectorsAction ()
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
super ("Show free sectors");
|
super ("Show free sectors");
|
||||||
|
|
||||||
putValue (Action.SHORT_DESCRIPTION,
|
putValue (Action.SHORT_DESCRIPTION,
|
||||||
"Display which sectors are marked free in the disk layout panel");
|
"Display which sectors are marked free in the disk layout panel");
|
||||||
putValue (Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke ("alt F"));
|
putValue (Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke ("alt F"));
|
||||||
putValue (Action.MNEMONIC_KEY, KeyEvent.VK_F);
|
putValue (Action.MNEMONIC_KEY, KeyEvent.VK_F);
|
||||||
this.panel = panel;
|
|
||||||
this.mh = mh;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
|
@ -32,6 +29,7 @@ class ShowFreeSectorsAction extends AbstractAction
|
||||||
public void actionPerformed (ActionEvent e)
|
public void actionPerformed (ActionEvent e)
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
panel.setFree (mh.showFreeSectorsItem.isSelected ());
|
firePropertyChange (e.getActionCommand (), null,
|
||||||
|
((JMenuItem) e.getSource ()).isSelected ());
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue