diff --git a/ivette/src/renderer/ASTview.tsx b/ivette/src/renderer/ASTview.tsx index d9388c0ca6fc03d0f82e375255c5330fbc21266f..b383770585a19e2eef98f8beba4d58850cf84a03 100644 --- a/ivette/src/renderer/ASTview.tsx +++ b/ivette/src/renderer/ASTview.tsx @@ -96,9 +96,6 @@ const ASTview = () => { }, [buffer, theMarker]); // Callbacks - const doPrevSelect = () => { updateSelection('GO_BACK'); }; - const doNextSelect = () => { updateSelection('GO_FORWARD'); }; - const zoomIn = () => fontSize < 48 && setFontSize(fontSize + 2); const zoomOut = () => fontSize > 4 && setFontSize(fontSize - 2); @@ -134,18 +131,6 @@ const ASTview = () => { return ( <> <TitleBar> - <IconButton - icon="MEDIA.PREV" - onClick={doPrevSelect} - disabled={!selection || selection.prevSelections.length === 0} - title="Previous location" - /> - <IconButton - icon="MEDIA.NEXT" - onClick={doNextSelect} - disabled={!selection || selection.nextSelections.length === 0} - title="Next location" - /> <IconButton icon="ZOOM.OUT" onClick={zoomOut} diff --git a/ivette/src/renderer/Application.tsx b/ivette/src/renderer/Application.tsx index e3c343f52bd17df20d95344b3d7e8594ec368b8f..16b901ab603d95f3cb156ce79304360966118e4b 100644 --- a/ivette/src/renderer/Application.tsx +++ b/ivette/src/renderer/Application.tsx @@ -4,6 +4,7 @@ import React from 'react'; import * as Dome from 'dome'; +import * as States from 'frama-c/states'; import { Vfill } from 'dome/layout/boxes'; import { Splitter } from 'dome/layout/splitters'; import * as Toolbar from 'dome/frame/toolbars'; @@ -18,6 +19,34 @@ import Properties from './Properties'; import ASTview from './ASTview'; import ASTinfo from './ASTinfo'; +// -------------------------------------------------------------------------- +// --- Selection Controls +// -------------------------------------------------------------------------- + +const SelectionControls = () => { + const [selection, updateSelection] = States.useSelection(); + + const doPrevSelect = () => { updateSelection('GO_BACK'); }; + const doNextSelect = () => { updateSelection('GO_FORWARD'); }; + + return ( + <Toolbar.ButtonGroup> + <Toolbar.Button + icon="MEDIA.PREV" + onClick={doPrevSelect} + disabled={!selection || selection.prevSelections.length === 0} + title="Previous location" + /> + <Toolbar.Button + icon="MEDIA.NEXT" + onClick={doNextSelect} + disabled={!selection || selection.nextSelections.length === 0} + title="Next location" + /> + </Toolbar.ButtonGroup> + ); +}; + // -------------------------------------------------------------------------- // --- Main View // -------------------------------------------------------------------------- @@ -42,6 +71,7 @@ export default (() => { onClick={flipSidebar} /> <Controller.Control /> + <SelectionControls /> <Toolbar.Filler /> <Toolbar.Button icon="ITEMS.GRID"