Skip to content
Snippets Groups Projects
Commit b4ed25cc authored by Maxime Jacquemin's avatar Maxime Jacquemin
Browse files

Merge branch 'feature/ivette/eva/probe-label' into 'master'

[ivette/eva] fixed probe label & zoom tooltip

See merge request frama-c/frama-c!3607
parents 0e91d336 099f1379
No related branches found
No related tags found
No related merge requests found
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
// React & Dome // React & Dome
import React from 'react'; import React from 'react';
import { Hpack, Filler } from 'dome/layout/boxes'; import { Hpack, Filler } from 'dome/layout/boxes';
import { Label, Code } from 'dome/controls/labels'; import { Code } from 'dome/controls/labels';
import { IconButton } from 'dome/controls/buttons'; import { IconButton } from 'dome/controls/buttons';
import { ButtonGroup, Button } from 'dome/frame/toolbars'; import { ButtonGroup, Button } from 'dome/frame/toolbars';
...@@ -48,7 +48,6 @@ function ProbeEditor(props: ModelProp): JSX.Element | null { ...@@ -48,7 +48,6 @@ function ProbeEditor(props: ModelProp): JSX.Element | null {
const { model } = props; const { model } = props;
const probe = model.getFocused(); const probe = model.getFocused();
if (!probe || !probe.code) return null; if (!probe || !probe.code) return null;
const { label } = probe;
const { code } = probe; const { code } = probe;
const { stmt, marker } = probe; const { stmt, marker } = probe;
const { cols, rows } = sizeof(code); const { cols, rows } = sizeof(code);
...@@ -57,7 +56,6 @@ function ProbeEditor(props: ModelProp): JSX.Element | null { ...@@ -57,7 +56,6 @@ function ProbeEditor(props: ModelProp): JSX.Element | null {
const { zoomable } = probe; const { zoomable } = probe;
return ( return (
<> <>
<Label className="eva-probeinfo-label">{label}</Label>
<div className="eva-probeinfo-code"> <div className="eva-probeinfo-code">
<SizedArea cols={cols} rows={rows}>{code}</SizedArea> <SizedArea cols={cols} rows={rows}>{code}</SizedArea>
</div> </div>
...@@ -67,6 +65,7 @@ function ProbeEditor(props: ModelProp): JSX.Element | null { ...@@ -67,6 +65,7 @@ function ProbeEditor(props: ModelProp): JSX.Element | null {
className="eva-probeinfo-button" className="eva-probeinfo-button"
display={zoomable} display={zoomable}
selected={zoomed} selected={zoomed}
title="Resize cells to fit values"
onClick={() => { if (probe) probe.setZoomed(!zoomed); }} onClick={() => { if (probe) probe.setZoomed(!zoomed); }}
/> />
<IconButton <IconButton
......
...@@ -33,31 +33,10 @@ import * as Ast from 'frama-c/kernel/api/ast'; ...@@ -33,31 +33,10 @@ import * as Ast from 'frama-c/kernel/api/ast';
import { ModelCallbacks } from './cells'; import { ModelCallbacks } from './cells';
/* --------------------------------------------------------------------------*/ /* --------------------------------------------------------------------------*/
/* --- Probe Labelling ---*/ /* --- Probe State ---*/
/* --------------------------------------------------------------------------*/ /* --------------------------------------------------------------------------*/
const Ka = 'A'.charCodeAt(0);
const Kz = 'Z'.charCodeAt(0);
const LabelSize = 12; const LabelSize = 12;
let La = Ka;
let Lk = 0;
function newLabel(): string {
const a = La;
const k = Lk;
const lbl = String.fromCharCode(a);
if (a < Kz) {
La++;
} else {
La = Ka;
Lk++;
}
return k > 0 ? `${lbl}${k}` : lbl;
}
/* --------------------------------------------------------------------------*/
/* --- Probe State ---*/
/* --------------------------------------------------------------------------*/
export class Probe { export class Probe {
...@@ -69,7 +48,6 @@ export class Probe { ...@@ -69,7 +48,6 @@ export class Probe {
prev?: Probe; prev?: Probe;
transient = true; transient = true;
loading = true; loading = true;
label?: string;
code?: string; code?: string;
stmt?: Ast.marker; stmt?: Ast.marker;
rank?: number; rank?: number;
...@@ -89,27 +67,20 @@ export class Probe { ...@@ -89,27 +67,20 @@ export class Probe {
requestProbeInfo(): void { requestProbeInfo(): void {
this.loading = true; this.loading = true;
this.label = '';
Server Server
.send(Values.getProbeInfo, this.marker) .send(Values.getProbeInfo, this.marker)
.then(({ code, stmt, rank, effects, condition }) => { .then(({ code, stmt, rank, effects, condition }) => {
this.code = code; this.code = code;
this.stmt = stmt; this.stmt = stmt;
this.rank = rank; this.rank = rank;
this.label = undefined;
this.effects = effects; this.effects = effects;
this.condition = condition; this.condition = condition;
this.loading = false; this.loading = false;
if (code && code.length > LabelSize)
this.label = newLabel();
else
this.label = code;
}) })
.catch(() => { .catch(() => {
this.code = '(error)'; this.code = '(error)';
this.stmt = undefined; this.stmt = undefined;
this.rank = undefined; this.rank = undefined;
this.label = undefined;
this.effects = false; this.effects = false;
this.condition = false; this.condition = false;
this.loading = false; this.loading = false;
......
...@@ -101,11 +101,10 @@ function TableCell(props: TableCellProps) { ...@@ -101,11 +101,10 @@ function TableCell(props: TableCellProps) {
// ---- Probe Contents // ---- Probe Contents
case 'probes': case 'probes':
{ {
const { stmt, code, label } = probe; const { stmt, code } = probe;
const textClass = label ? 'dome-text-label' : 'dome-text-cell';
contents = ( contents = (
<> <>
<span className={textClass}>{label ?? code}</span> <span className='dome-text-cell'>{code}</span>
<Stmt stmt={stmt} marker={marker} short /> <Stmt stmt={stmt} marker={marker} short />
</> </>
); );
......
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