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

[ivette] Unify look and feel of Locations component.

- Always display all selections, even when a single one.
- Remove toolbar and use titlebar instead.
- Change icon positioning, and use trash icon to clear locations.
parent ad4b146e
No related branches found
No related tags found
No related merge requests found
...@@ -645,8 +645,6 @@ function reducer(s: Selection, action: SelectionActions): Selection { ...@@ -645,8 +645,6 @@ function reducer(s: Selection, action: SelectionActions): Selection {
if (action.locations.length === 0) if (action.locations.length === 0)
return s; return s;
const selection = selectLocation(s, action.locations[0]); const selection = selectLocation(s, action.locations[0]);
if (action.locations.length === 1)
return selection;
return { return {
...selection, ...selection,
multiple: { multiple: {
......
...@@ -8,8 +8,9 @@ import * as States from 'frama-c/states'; ...@@ -8,8 +8,9 @@ import * as States from 'frama-c/states';
import { CompactModel } from 'dome/table/arrays'; import { CompactModel } from 'dome/table/arrays';
import { Table, Column } from 'dome/table/views'; import { Table, Column } from 'dome/table/views';
import { Label } from 'dome/controls/labels'; import { Label } from 'dome/controls/labels';
import * as Toolbar from 'dome/frame/toolbars'; import { IconButton } from 'dome/controls/buttons';
import { Component } from 'frama-c/LabViews'; import { Space } from 'dome/frame/toolbars';
import { Component, TitleBar } from 'frama-c/LabViews';
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// --- Locations Panel // --- Locations Panel
...@@ -51,45 +52,44 @@ const LocationsTable = () => { ...@@ -51,45 +52,44 @@ const LocationsTable = () => {
// Component // Component
return ( return (
<> <>
<Toolbar.ToolBar> <TitleBar>
<Toolbar.Button <IconButton
icon="RELOAD" icon="RELOAD"
onClick={reload} onClick={reload}
enabled={numberOfSelections > 1} enabled={numberOfSelections > 0}
title="Reload the current location of the multiple selection" title="Reload the current location"
/> />
<Toolbar.ButtonGroup> <IconButton
<Toolbar.Button icon="ANGLE.LEFT"
icon="ANGLE.LEFT" onClick={() => updateSelection('MULTIPLE_PREV')}
onClick={() => updateSelection('MULTIPLE_PREV')} enabled={numberOfSelections > 1 && multiple?.index > 0}
enabled={numberOfSelections > 1 && multiple?.index > 0} title="Previous location"
title="Previous location of the multiple selection" />
/> <IconButton
<Toolbar.Button icon="ANGLE.RIGHT"
icon="ANGLE.RIGHT" onClick={() => updateSelection('MULTIPLE_NEXT')}
onClick={() => updateSelection('MULTIPLE_NEXT')} enabled={
enabled={ numberOfSelections > 1 &&
numberOfSelections > 1 && multiple?.index < numberOfSelections - 1
multiple?.index < numberOfSelections - 1 }
} title="Next location"
title="Next location of the multiple selection" />
/> <Space />
</Toolbar.ButtonGroup>
<Label <Label
className="component-info" className="component-info"
title={`${numberOfSelections} selected locations`} title={`${numberOfSelections} selected location(s)`}
display={numberOfSelections > 1}
> >
{multiple?.index + 1} / {numberOfSelections} {multiple?.allSelections.length === 0 ?
'0 / 0' : `${multiple?.index + 1} / ${numberOfSelections}`}
</Label> </Label>
<Toolbar.Filler /> <Space />
<Toolbar.Button <IconButton
icon="CIRC.CLOSE" icon="TRASH"
onClick={() => updateSelection('MULTIPLE_CLEAR')} onClick={() => updateSelection('MULTIPLE_CLEAR')}
enabled={numberOfSelections > 1} enabled={numberOfSelections > 0}
title="Clear the multiple selection" title="Clear the location(s)"
/> />
</Toolbar.ToolBar> </TitleBar>
<Table <Table
model={model} model={model}
selection={multiple?.index} selection={multiple?.index}
......
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