diff --git a/ivette/src/dome/renderer/layout/splitters.tsx b/ivette/src/dome/renderer/layout/splitters.tsx index 37063fbfd12bc3077b58a0eaa59f76928844114b..95c90d24bb7e7ce87199fa8111dc67496799d2c8 100644 --- a/ivette/src/dome/renderer/layout/splitters.tsx +++ b/ivette/src/dome/renderer/layout/splitters.tsx @@ -42,6 +42,10 @@ import { AutoSizer, Size } from 'react-virtualized'; export interface SplitterBaseProps { /** Window settings to store the splitter position. */ settings?: string; + /** Ratio or size depending of the splitter: + - for 'horizontal' or 'vertical' split, ratio between the two panels; + - for other splits, size of the foldable component. */ + defaultPosition?: number; /** Minimal margin from container edges (minimum `32`). */ margin?: number; /** Splitter children components. */ @@ -195,7 +199,9 @@ interface SplitterLayoutProps extends SplitterFoldProps { layout: Layout } interface SplitterEngineProps extends SplitterLayoutProps { size: Size } function SplitterEngine(props: SplitterEngineProps) { - const [settings, setSettings] = Dome.useNumberSettings(props.settings, 0); + const defaultPosition = props.defaultPosition ?? 0; + const [settings, setSettings] = + Dome.useNumberSettings(props.settings, defaultPosition); const [dragging, setDragging] = React.useState<Dragging>(undefined); const { size, margin = 32, layout } = props; const { hsplit } = layout; @@ -245,7 +251,7 @@ function SplitterEngine(props: SplitterEngineProps) { const onStop: DraggableEventHandler = (evt, _data) => { if (evt.metaKey || evt.altKey || evt.ctrlKey) { - setSettings(0); + setSettings(defaultPosition); } else if (unfold && dragging) { const offsetPos = dragging.position + dragging.offset - dragging.anchor; const newPos = inRange(M, D, offsetPos); diff --git a/ivette/src/frama-c/kernel/Messages.tsx b/ivette/src/frama-c/kernel/Messages.tsx index 27dd2e84de70a9bf2a00ad73b63e67bc24ba9951..f6ec62770ba058f5861ae4ed91b210511b7b4348 100644 --- a/ivette/src/frama-c/kernel/Messages.tsx +++ b/ivette/src/frama-c/kernel/Messages.tsx @@ -469,6 +469,7 @@ export default function RenderMessages() { </TitleBar> <RSplit settings="ivette.messages.filterSplit" + defaultPosition={225} unfold={showFilter} > <Table<string, Message> diff --git a/ivette/src/frama-c/kernel/Properties.tsx b/ivette/src/frama-c/kernel/Properties.tsx index ca92fa637777ba381e9b2dd8c94b185ece5934a9..9e7b3ca97dbec5a9c8a568fb975aed23b082bc56 100644 --- a/ivette/src/frama-c/kernel/Properties.tsx +++ b/ivette/src/frama-c/kernel/Properties.tsx @@ -656,6 +656,7 @@ export default function RenderProperties() { </TitleBar> <RSplit settings="ivette.properties.filterSplit" + defaultPosition={200} unfold={showFilter} > <Table<string, Property>