@@ -64,6 +64,8 @@ public class BookmarkManager {
6464
6565 private final SNTUI sntui ;
6666 private final Bvv bvv ;
67+ /** BVV-injected toolbar components (e.g. slab toggle). Added via {@link #addBvvToolbarButton}. */
68+ private final java .util .List <javax .swing .JComponent > bvvToolbarButtons = new java .util .ArrayList <>();
6769 private final GuiUtils guiUtils ;
6870 private final BookmarkModel model ;
6971 private final BookmarkTable table ;
@@ -134,6 +136,17 @@ public JFrame getBvvPanel() {
134136 return bvvFrame ;
135137 }
136138
139+ /**
140+ * Adds a component to the BVV toolbar section of this panel.
141+ * The component is appended after a separator the first time this method is called.
142+ * Bvv uses this to inject context-specific controls (e.g. a slab-clip toggle).
143+ *
144+ * @param component the component to add; must not be {@code null}
145+ */
146+ public void addBvvToolbarButton (final javax .swing .JComponent component ) {
147+ bvvToolbarButtons .add (component );
148+ }
149+
137150 /** Shows or hides the floating BVV marker panel. */
138151 public void toggleBvvPanel () {
139152 final JFrame f = getBvvPanel ();
@@ -566,11 +579,22 @@ private JToolBar assembleToolbar() {
566579 final int target = (row < 0 || row >= table .getRowCount () - 1 ) ? 0 : row + 1 ;
567580 if (target < table .getRowCount ()) { table .setRowSelectionInterval (target , target ); flyTo (target ); }
568581 });
582+ final JButton resetButton = new JButton (IconFactory .menuIcon (IconFactory .GLYPH .EXPAND ));
583+ resetButton .setToolTipText ("Reset view to fit volume" );
584+ resetButton .addActionListener (e -> bvv .resetView ());
569585 final JButton helpButton = GuiUtils .Buttons .help (null );
570586 helpButton .addActionListener (e -> displayMarkerHelp ());
571587 tb .add (prevButton );
572588 tb .add (nextButton );
573589 tb .addSeparator ();
590+ tb .add (resetButton );
591+ tb .addSeparator ();
592+ tb .add (Box .createHorizontalGlue ());
593+ // Inject any BVV-provided toolbar buttons (e.g. slab-clip toggle)
594+ if (!bvvToolbarButtons .isEmpty ()) {
595+ tb .addSeparator ();
596+ bvvToolbarButtons .forEach (tb ::add );
597+ }
574598 tb .add (Box .createHorizontalGlue ());
575599 tb .add (helpButton );
576600 }
0 commit comments