diff --git a/ivette/src/dome/src/renderer/controls/buttons.tsx b/ivette/src/dome/src/renderer/controls/buttons.tsx index 8404310393afa56f12408a72e708647d6593e8ac..871c37c1221660b797f502e089f64f6fe8b632e4 100644 --- a/ivette/src/dome/src/renderer/controls/buttons.tsx +++ b/ivette/src/dome/src/renderer/controls/buttons.tsx @@ -239,7 +239,7 @@ export const CircButton = (props: ButtonProps) => { // -------------------------------------------------------------------------- export type IconButtonKind = - undefined | 'default' | 'negative' | 'positive' | 'warning'; + undefined | 'selected' | 'default' | 'negative' | 'positive' | 'warning'; export interface IconButtonProps { /** Icon identifier. Displayed on the left side of the label. */ @@ -266,6 +266,7 @@ export interface IconButtonProps { display?: boolean; /** Styled bytton: - `'default'`: normal button; + - `'selected'`: selection button, in blue; - `'warning'`: warning button, in orange; - `'positive'`: positive button, in green; - `'negative'`: negative button, in red. diff --git a/ivette/src/frama-c/eva/Values.tsx b/ivette/src/frama-c/eva/Values.tsx index 1a005761e881bc599030150bf9194446ab64dd63..c2580b783143d1e705fc3d1f7a0143c7015db590 100644 --- a/ivette/src/frama-c/eva/Values.tsx +++ b/ivette/src/frama-c/eva/Values.tsx @@ -52,8 +52,10 @@ function ProbeEditor() { const rank = probe?.rank; const stmt = rank ? `@S${rank}` : undefined; const { cols, rows } = sizeof(code); + const visible = probe ? !!code : model.getRowCount() > 0; + const visibility = visible ? 'visible' : 'hidden'; return ( - <Hpack className="eva-probe"> + <Hpack style={{ visibility }} className="eva-probe"> <Label className="eva-probe-label">{label && `${label}:`}</Label> <div className="eva-probe-code"> <SizedArea cols={cols} rows={rows}>{code}</SizedArea> @@ -61,8 +63,7 @@ function ProbeEditor() { <Code className="eva-probe-stmt">{stmt}</Code> <IconButton className="eva-probe-button" - visible={!!code} - kind={transient ? 'positive' : 'negative'} + kind={transient ? 'selected' : 'warning'} icon={transient ? 'CIRC.CHECK' : 'CIRC.CLOSE'} onClick={() => { if (probe) probe.setTransient(!transient); }} title={transient ? 'Make the probe persistent' : 'Release the probe'} @@ -73,7 +74,7 @@ function ProbeEditor() { } // -------------------------------------------------------------------------- -// --- Table Cell +// --- Table Cell Layout // -------------------------------------------------------------------------- interface TableCellProps { @@ -85,10 +86,11 @@ const CELLPADDING = 4; function TableCell(props: TableCellProps) { const model = useModel(); + const [selection, setSelection] = States.useSelection(); const { probe, kind } = props; const minWidth = CELLPADDING + WSIZER.dimension(probe.minCols); const maxWidth = CELLPADDING + WSIZER.dimension(probe.maxCols); - const style = { minWidth, maxWidth }; + const style = { width: minWidth, maxWidth }; let styling = 'dome-text-code'; let contents: React.ReactNode = props.probe.marker; const { transient, label, code } = probe; @@ -96,7 +98,7 @@ function TableCell(props: TableCellProps) { case 'probes': if (transient) { styling = 'dome-text-label'; - contents = '« Current »'; + contents = '« Probe »'; } else if (label) { styling = 'dome-text-label'; contents = label; @@ -105,9 +107,15 @@ function TableCell(props: TableCellProps) { } break; case 'values': - contents = ( - model.cache.getValues(probe.marker).values - ); + { + const { values } = model.cache.getValues(probe.marker); + const { cols, rows } = sizeof(values); + contents = ( + <SizedArea cols={cols} rows={rows}> + {values} + </SizedArea> + ); + } break; } const isFocused = model.getFocused() === probe; @@ -117,8 +125,19 @@ function TableCell(props: TableCellProps) { transient && 'eva-transient', !transient && isFocused && 'eva-focused', ); + const onClick = () => { + if (probe) { + const fct = selection?.current?.function; + const location = { function: fct, marker: probe.marker }; + setSelection({ location }); + } + }; return ( - <div className={className} style={style}> + <div + className={className} + style={style} + onClick={onClick} + > {contents} </div> ); diff --git a/ivette/src/frama-c/eva/probes.ts b/ivette/src/frama-c/eva/probes.ts index b7e6186b0c70e46f8667bf8237bc28510ab012d9..3b121c23f0f55b64dc9cfa4b82b045b21ddd25a9 100644 --- a/ivette/src/frama-c/eva/probes.ts +++ b/ivette/src/frama-c/eva/probes.ts @@ -107,8 +107,6 @@ export class Probe { const rq = q.rank ?? 0; if (rp < rq) return (-1); if (rp > rq) return (+1); - if (p.transient && !q.transient) return (-1); - if (!p.transient && q.transient) return (+1); if (p.marker < q.marker) return (-1); if (p.marker > q.marker) return (+1); return 0;