diff --git a/ivette/src/frama-c/states.ts b/ivette/src/frama-c/states.ts index 546ba86370f1e843ae3e6361c0518b1ec435d0cf..d337a74dfd46f8f5927d92d66ec2dad9e5f46252 100644 --- a/ivette/src/frama-c/states.ts +++ b/ivette/src/frama-c/states.ts @@ -645,8 +645,6 @@ function reducer(s: Selection, action: SelectionActions): Selection { if (action.locations.length === 0) return s; const selection = selectLocation(s, action.locations[0]); - if (action.locations.length === 1) - return selection; return { ...selection, multiple: { diff --git a/ivette/src/renderer/Locations.tsx b/ivette/src/renderer/Locations.tsx index 268d5c1bb99bf02a84175146962fed3c0941a743..2f30598f93f8ca21b28d902c781c2328a18fb7b2 100644 --- a/ivette/src/renderer/Locations.tsx +++ b/ivette/src/renderer/Locations.tsx @@ -8,8 +8,9 @@ import * as States from 'frama-c/states'; import { CompactModel } from 'dome/table/arrays'; import { Table, Column } from 'dome/table/views'; import { Label } from 'dome/controls/labels'; -import * as Toolbar from 'dome/frame/toolbars'; -import { Component } from 'frama-c/LabViews'; +import { IconButton } from 'dome/controls/buttons'; +import { Space } from 'dome/frame/toolbars'; +import { Component, TitleBar } from 'frama-c/LabViews'; // -------------------------------------------------------------------------- // --- Locations Panel @@ -51,45 +52,44 @@ const LocationsTable = () => { // Component return ( <> - <Toolbar.ToolBar> - <Toolbar.Button + <TitleBar> + <IconButton icon="RELOAD" onClick={reload} - enabled={numberOfSelections > 1} - title="Reload the current location of the multiple selection" + enabled={numberOfSelections > 0} + title="Reload the current location" /> - <Toolbar.ButtonGroup> - <Toolbar.Button - icon="ANGLE.LEFT" - onClick={() => updateSelection('MULTIPLE_PREV')} - enabled={numberOfSelections > 1 && multiple?.index > 0} - title="Previous location of the multiple selection" - /> - <Toolbar.Button - icon="ANGLE.RIGHT" - onClick={() => updateSelection('MULTIPLE_NEXT')} - enabled={ - numberOfSelections > 1 && - multiple?.index < numberOfSelections - 1 - } - title="Next location of the multiple selection" - /> - </Toolbar.ButtonGroup> + <IconButton + icon="ANGLE.LEFT" + onClick={() => updateSelection('MULTIPLE_PREV')} + enabled={numberOfSelections > 1 && multiple?.index > 0} + title="Previous location" + /> + <IconButton + icon="ANGLE.RIGHT" + onClick={() => updateSelection('MULTIPLE_NEXT')} + enabled={ + numberOfSelections > 1 && + multiple?.index < numberOfSelections - 1 + } + title="Next location" + /> + <Space /> <Label className="component-info" - title={`${numberOfSelections} selected locations`} - display={numberOfSelections > 1} + title={`${numberOfSelections} selected location(s)`} > - {multiple?.index + 1} / {numberOfSelections} + {multiple?.allSelections.length === 0 ? + '0 / 0' : `${multiple?.index + 1} / ${numberOfSelections}`} </Label> - <Toolbar.Filler /> - <Toolbar.Button - icon="CIRC.CLOSE" + <Space /> + <IconButton + icon="TRASH" onClick={() => updateSelection('MULTIPLE_CLEAR')} - enabled={numberOfSelections > 1} - title="Clear the multiple selection" + enabled={numberOfSelections > 0} + title="Clear the location(s)" /> - </Toolbar.ToolBar> + </TitleBar> <Table model={model} selection={multiple?.index}