Newer
Older
// --------------------------------------------------------------------------
// --- Main React Component rendered by './index.js'
// --------------------------------------------------------------------------
import React from 'react';
import * as States from 'frama-c/states';
import { Vfill } from 'dome/layout/boxes';
import { Splitter } from 'dome/layout/splitters';
import * as Toolbar from 'dome/frame/toolbars';
import * as Sidebar from 'dome/frame/sidebars';
import './style.css';
import { LabView, View, Group } from 'frama-c/LabViews';
import { GridItem } from 'dome/layout/grids';
import * as Controller from './Controller';
import ASTview from './ASTview';
David Bühler
committed
import ASTinfo from './ASTinfo';
import Globals from './Globals';
import Properties from './Properties';
import Locations from './Locations';
import Values from './Values';
// --------------------------------------------------------------------------
// --- Selection Controls
// --------------------------------------------------------------------------
const HistorySelectionControls = () => {
const [selection, updateSelection] = States.useSelection();
const doPrevSelect = () => { updateSelection('HISTORY_PREV'); };
const doNextSelect = () => { updateSelection('HISTORY_NEXT'); };
return (
<Toolbar.ButtonGroup>
<Toolbar.Button
icon="ANGLE.LEFT"
disabled={!selection || selection.history.prevSelections.length === 0}
title="Previous location"
/>
<Toolbar.Button
icon="ANGLE.RIGHT"
disabled={!selection || selection.history.nextSelections.length === 0}
title="Next location"
/>
</Toolbar.ButtonGroup>
);
};
// --------------------------------------------------------------------------
// --- Main View
// --------------------------------------------------------------------------
export default (() => {
const [sidebar, flipSidebar] = Dome.useSwitch(
'frama-c.sidebar.unfold',
false,
);
const [viewbar, flipViewbar] = Dome.useSwitch(
'frama-c.viewbar.unfold',
false,
);
return (
<Vfill>
<Toolbar.ToolBar>
<Toolbar.Button
icon="SIDEBAR"
title="Show/Hide side bar"
selected={sidebar}
onClick={flipSidebar}
/>
<Controller.Control />
<HistorySelectionControls />
<Toolbar.Filler />
icon="ITEMS.GRID"
title="Customize Main View"
<Splitter dir="LEFT" settings="frame-c.sidebar.position" unfold={sidebar}>
<div className="sidebar-ruler" />
</Sidebar.SideBar>
<LabView
customize={viewbar}
<View id="dashboard" label="Dashboard" defaultView>
<GridItem id="frama-c.console" />
<Group id="frama-c" label="Frama-C" title="Frama-C Kernel Components">
<Controller.Console />
<Properties />
<ASTview />
David Bühler
committed
<ASTinfo />
<Values />
<Controller.Status />
<Toolbar.Filler />
<Controller.Stats />
</Vfill>
);
});
// --------------------------------------------------------------------------