Skip to content
Snippets Groups Projects
Commit 7736d378 authored by David Bühler's avatar David Bühler
Browse files

[ivette] New status message in the status bar.

parent faef6a98
No related branches found
No related tags found
No related merge requests found
...@@ -29,6 +29,7 @@ import * as Ivette from 'ivette'; ...@@ -29,6 +29,7 @@ import * as Ivette from 'ivette';
import History from 'frama-c/kernel/History'; import History from 'frama-c/kernel/History';
import Globals from 'frama-c/kernel/Globals'; import Globals from 'frama-c/kernel/Globals';
import Status from 'frama-c/kernel/Status';
import ASTview from 'frama-c/kernel/ASTview'; import ASTview from 'frama-c/kernel/ASTview';
import ASTinfo from 'frama-c/kernel/ASTinfo'; import ASTinfo from 'frama-c/kernel/ASTinfo';
import SourceCode from 'frama-c/kernel/SourceCode'; import SourceCode from 'frama-c/kernel/SourceCode';
...@@ -51,6 +52,7 @@ Ivette.registerGroup({ ...@@ -51,6 +52,7 @@ Ivette.registerGroup({
}, () => { }, () => {
Ivette.registerSidebar({ id: 'frama-c.globals', children: <Globals /> }); Ivette.registerSidebar({ id: 'frama-c.globals', children: <Globals /> });
Ivette.registerToolbar({ id: 'frama-c.history', children: <History /> }); Ivette.registerToolbar({ id: 'frama-c.history', children: <History /> });
Ivette.registerStatusbar({ id: 'frama-c.message', children: <Status /> });
Ivette.registerComponent({ Ivette.registerComponent({
id: 'frama-c.astview', id: 'frama-c.astview',
label: 'AST', label: 'AST',
......
/* ************************************************************************ */
/* */
/* This file is part of Frama-C. */
/* */
/* Copyright (C) 2007-2021 */
/* CEA (Commissariat à l'énergie atomique et aux énergies */
/* alternatives) */
/* */
/* you can redistribute it and/or modify it under the terms of the GNU */
/* Lesser General Public License as published by the Free Software */
/* Foundation, version 2.1. */
/* */
/* It is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU Lesser General Public License for more details. */
/* */
/* See the GNU Lesser General Public License version 2.1 */
/* for more details (enclosed in the file licenses/LGPLv2.1). */
/* */
/* ************************************************************************ */
/* --------------------------------------------------------------------------*/
/* --- Frama-C Selection History ---*/
/* --------------------------------------------------------------------------*/
import React from 'react';
import { Code } from 'dome/controls/labels';
import { LED, IconButton } from 'dome/controls/buttons';
import { Icon } from 'dome/controls/icons';
import * as Toolbars from 'dome/frame/toolbars';
import { GlobalState, useGlobalState } from 'dome/data/states';
export type kind =
'none' | 'info' | 'warning' | 'error' | 'success' | 'progress';
export interface Message {
kind: kind;
text: string;
title?: string;
}
const emptyMessage: Message = { text: '', kind: 'none' };
const GlobalMessage = new GlobalState(emptyMessage);
export function setMessage(message: Message) {
GlobalMessage.setValue(message);
}
export default function Message() {
const [message] = useGlobalState(GlobalMessage);
return (
<>
<Toolbars.Space />
{ message.kind === 'progress' && <LED status="active" blink /> }
{ message.kind === 'success' && <Icon id="CHECK" fill="green" /> }
{ message.kind === 'warning' && <Icon id="ATTENTION" /> }
{ message.kind === 'error' && <Icon id="CROSS" fill="red" /> }
{ message.kind === 'info' && <Icon id="CIRC.INFO" /> }
<Code label={message.text} title={message.title} />
<Toolbars.Space />
<IconButton
icon="CROSS"
onClick={() => setMessage(emptyMessage)}
visible={message !== emptyMessage}
title="Hide current message"
/>
<Toolbars.Space />
</>
);
}
/* --------------------------------------------------------------------------*/
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