Skip to content
Snippets Groups Projects
Commit 6dcc486a authored by Michele Alberti's avatar Michele Alberti
Browse files

[ivette] Make selection controls global.

parent 490d4f56
No related branches found
No related tags found
No related merge requests found
...@@ -96,9 +96,6 @@ const ASTview = () => { ...@@ -96,9 +96,6 @@ const ASTview = () => {
}, [buffer, theMarker]); }, [buffer, theMarker]);
// Callbacks // Callbacks
const doPrevSelect = () => { updateSelection('GO_BACK'); };
const doNextSelect = () => { updateSelection('GO_FORWARD'); };
const zoomIn = () => fontSize < 48 && setFontSize(fontSize + 2); const zoomIn = () => fontSize < 48 && setFontSize(fontSize + 2);
const zoomOut = () => fontSize > 4 && setFontSize(fontSize - 2); const zoomOut = () => fontSize > 4 && setFontSize(fontSize - 2);
...@@ -134,18 +131,6 @@ const ASTview = () => { ...@@ -134,18 +131,6 @@ const ASTview = () => {
return ( return (
<> <>
<TitleBar> <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 <IconButton
icon="ZOOM.OUT" icon="ZOOM.OUT"
onClick={zoomOut} onClick={zoomOut}
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
import React from 'react'; import React from 'react';
import * as Dome from 'dome'; import * as Dome from 'dome';
import * as States from 'frama-c/states';
import { Vfill } from 'dome/layout/boxes'; import { Vfill } from 'dome/layout/boxes';
import { Splitter } from 'dome/layout/splitters'; import { Splitter } from 'dome/layout/splitters';
import * as Toolbar from 'dome/frame/toolbars'; import * as Toolbar from 'dome/frame/toolbars';
...@@ -18,6 +19,34 @@ import Properties from './Properties'; ...@@ -18,6 +19,34 @@ import Properties from './Properties';
import ASTview from './ASTview'; import ASTview from './ASTview';
import ASTinfo from './ASTinfo'; 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 // --- Main View
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
...@@ -42,6 +71,7 @@ export default (() => { ...@@ -42,6 +71,7 @@ export default (() => {
onClick={flipSidebar} onClick={flipSidebar}
/> />
<Controller.Control /> <Controller.Control />
<SelectionControls />
<Toolbar.Filler /> <Toolbar.Filler />
<Toolbar.Button <Toolbar.Button
icon="ITEMS.GRID" icon="ITEMS.GRID"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment