Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
frama-c
Commits
e798d851
Commit
e798d851
authored
2 months ago
by
Remi Lazarini
Committed by
David Bühler
2 months ago
Browse files
Options
Downloads
Patches
Plain Diff
[Ivette] sidebar files : fixed autoscroll with title
parent
270a9e49
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ivette/src/dome/renderer/frame/style.css
+2
-0
2 additions, 0 deletions
ivette/src/dome/renderer/frame/style.css
ivette/src/frama-c/kernel/Globals.tsx
+88
-53
88 additions, 53 deletions
ivette/src/frama-c/kernel/Globals.tsx
with
90 additions
and
53 deletions
ivette/src/dome/renderer/frame/style.css
+
2
−
0
View file @
e798d851
...
@@ -83,6 +83,8 @@
...
@@ -83,6 +83,8 @@
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
.dome-xSideBar
{
.dome-xSideBar
{
display
:
flex
;
flex-direction
:
column
;
width
:
100%
;
width
:
100%
;
height
:
100%
;
height
:
100%
;
overflow-x
:
hidden
;
overflow-x
:
hidden
;
...
...
This diff is collapsed.
Click to expand it.
ivette/src/frama-c/kernel/Globals.tsx
+
88
−
53
View file @
e798d851
...
@@ -579,25 +579,32 @@ export function Types(): JSX.Element {
...
@@ -579,25 +579,32 @@ export function Types(): JSX.Element {
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
// --- Files Section
// --- Files Section
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
type
FilesProps
=
{
showFunction
:
(
fct
:
functionsData
)
=>
boolean
;
showFctsState
:
[
boolean
,
()
=>
void
];
showVariable
:
(
vi
:
Ast
.
globalsData
)
=>
boolean
showVarsState
:
[
boolean
,
()
=>
void
];
}
&
ScrollableParent
export
function
Files
(
props
:
ScrollableParent
):
JSX
.
Element
{
export
function
Files
(
props
:
FilesProps
):
JSX
.
Element
{
const
{
scrollableParent
}
=
props
;
const
{
showFunction
,
showFctsState
,
showVariable
,
showVarsState
,
scrollableParent
}
=
props
;
// Hooks
// Hooks
const
scope
=
States
.
useCurrentScope
();
const
scope
=
States
.
useCurrentScope
();
const
getDecl
=
States
.
useSyncArrayGetter
(
Ast
.
declAttributes
);
const
currentSection
=
React
.
useMemo
(()
=>
{
return
getDecl
(
scope
)?.
source
.
file
;
},
[
scope
,
getDecl
]);
// functions
// functions
const
ker
=
States
.
useSyncArrayProxy
(
Ast
.
functions
);
const
ker
=
States
.
useSyncArrayProxy
(
Ast
.
functions
);
const
eva
=
States
.
useSyncArrayProxy
(
Eva
.
functions
);
const
eva
=
States
.
useSyncArrayProxy
(
Eva
.
functions
);
const
fcts
=
React
.
useMemo
(()
=>
computeFcts
(
ker
,
eva
),
[
ker
,
eva
]);
const
fcts
=
React
.
useMemo
(()
=>
computeFcts
(
ker
,
eva
),
[
ker
,
eva
]);
const
{
showFunction
,
contextFctMenuItems
}
=
useFunctionFilter
();
const
[
showFcts
,
]
=
showFctsState
;
const
[
showFcts
,
flipShowFcts
]
=
Dome
.
useFlipSettings
(
'
ivette.files.show.functions
'
,
true
);
// Variables
// Variables
const
variables
=
States
.
useSyncArrayData
(
Ast
.
globals
);
const
variables
=
States
.
useSyncArrayData
(
Ast
.
globals
);
const
{
showVariable
,
contextVarMenuItems
}
=
useVariableFilter
();
const
[
showVars
,
]
=
showVarsState
;
const
[
showVars
,
flipShowVars
]
=
Dome
.
useFlipSettings
(
'
ivette.files.show.globals
'
,
true
);
interface
InfosFile
{
interface
InfosFile
{
label
:
string
,
label
:
string
,
...
@@ -631,15 +638,6 @@ export function Files(props: ScrollableParent): JSX.Element {
...
@@ -631,15 +638,6 @@ export function Files(props: ScrollableParent): JSX.Element {
return
newFiles
;
return
newFiles
;
},
[
fcts
,
showFunction
,
variables
,
showVariable
]);
},
[
fcts
,
showFunction
,
variables
,
showVariable
]);
const
currentSection
=
React
.
useMemo
(()
=>
{
for
(
const
path
of
Object
.
keys
(
files
))
{
if
(
files
[
path
].
fcts
.
find
(
e
=>
e
.
decl
===
scope
)
||
files
[
path
].
vars
.
find
(
e
=>
e
.
decl
===
scope
)
)
return
path
;
}
return
undefined
;
},
[
files
,
scope
]);
function
getList
([
path
,
infos
]:
[
string
,
InfosFile
]):
JSX
.
Element
|
null
{
function
getList
([
path
,
infos
]:
[
string
,
InfosFile
]):
JSX
.
Element
|
null
{
const
{
label
,
fcts
,
vars
}
=
infos
;
const
{
label
,
fcts
,
vars
}
=
infos
;
const
fctsComp
:
JSX
.
Element
[]
=
showFcts
?
const
fctsComp
:
JSX
.
Element
[]
=
showFcts
?
...
@@ -667,38 +665,6 @@ export function Files(props: ScrollableParent): JSX.Element {
...
@@ -667,38 +665,6 @@ export function Files(props: ScrollableParent): JSX.Element {
}
}
return
<>
return
<>
<
Hbox
className
=
'dome-xSideBar-title'
>
<
Hbox
style
=
{
{
flexWrap
:
'
wrap
'
,
alignContent
:
'
center
'
}
}
>
<
Title
label
=
'Files'
/>
</
Hbox
>
<
Hbox
>
<
Toolbar
.
ButtonGroup
>
<
Toolbar
.
Button
icon
=
"FUNCTION"
title
=
{
'
Show functions
'
}
selected
=
{
showFcts
}
onClick
=
{
()
=>
flipShowFcts
()
}
/>
<
Toolbar
.
Button
icon
=
'TUNINGS'
onClick
=
{
()
=>
Dome
.
popupMenu
(
contextFctMenuItems
)
}
/>
</
Toolbar
.
ButtonGroup
>
<
Toolbar
.
ButtonGroup
>
<
Toolbar
.
Button
icon
=
"VARIABLE"
title
=
{
'
Show variables
'
}
selected
=
{
showVars
}
onClick
=
{
()
=>
flipShowVars
()
}
/>
<
Toolbar
.
Button
icon
=
'TUNINGS'
onClick
=
{
()
=>
Dome
.
popupMenu
(
contextVarMenuItems
)
}
/>
</
Toolbar
.
ButtonGroup
>
</
Hbox
>
</
Hbox
>
{
{
Object
.
entries
(
files
)
Object
.
entries
(
files
)
.
sort
((
v1
,
v2
)
=>
alpha
(
v1
[
1
].
label
,
v2
[
1
].
label
))
.
sort
((
v1
,
v2
)
=>
alpha
(
v1
[
1
].
label
,
v2
[
1
].
label
))
...
@@ -707,16 +673,85 @@ export function Files(props: ScrollableParent): JSX.Element {
...
@@ -707,16 +673,85 @@ export function Files(props: ScrollableParent): JSX.Element {
</>;
</>;
}
}
interface
SidebarFilesTitleProps
{
showFctsState
:
[
boolean
,
()
=>
void
];
contextFctMenuItems
:
Dome
.
PopupMenuItem
[];
showVarsState
:
[
boolean
,
()
=>
void
];
contextVarMenuItems
:
Dome
.
PopupMenuItem
[];
}
function
SidebarFilesTitle
(
props
:
SidebarFilesTitleProps
):
JSX
.
Element
{
const
{
showFctsState
,
contextFctMenuItems
,
showVarsState
,
contextVarMenuItems
}
=
props
;
const
[
showFcts
,
flipShowFcts
]
=
showFctsState
;
const
[
showVars
,
flipShowVars
]
=
showVarsState
;
return
<
Hbox
className
=
'dome-xSideBar-title'
>
<
Hbox
style
=
{
{
flexWrap
:
'
wrap
'
,
alignContent
:
'
center
'
}
}
>
<
Title
label
=
'Files'
/>
</
Hbox
>
<
Hbox
>
<
Toolbar
.
ButtonGroup
>
<
Toolbar
.
Button
icon
=
"FUNCTION"
title
=
{
'
Show functions
'
}
selected
=
{
showFcts
}
onClick
=
{
()
=>
flipShowFcts
()
}
/>
<
Toolbar
.
Button
icon
=
'TUNINGS'
onClick
=
{
()
=>
Dome
.
popupMenu
(
contextFctMenuItems
)
}
/>
</
Toolbar
.
ButtonGroup
>
<
Toolbar
.
ButtonGroup
>
<
Toolbar
.
Button
icon
=
"VARIABLE"
title
=
{
'
Show variables
'
}
selected
=
{
showVars
}
onClick
=
{
()
=>
flipShowVars
()
}
/>
<
Toolbar
.
Button
icon
=
'TUNINGS'
onClick
=
{
()
=>
Dome
.
popupMenu
(
contextVarMenuItems
)
}
/>
</
Toolbar
.
ButtonGroup
>
</
Hbox
>
</
Hbox
>;
}
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
// --- All globals
// --- All globals
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
export
function
GlobalByFiles
():
JSX
.
Element
{
export
function
GlobalByFiles
():
JSX
.
Element
{
const
scrollableArea
=
React
.
useRef
<
HTMLDivElement
>
(
null
);
const
scrollableArea
=
React
.
useRef
<
HTMLDivElement
>
(
null
);
return
(
<
div
ref
=
{
scrollableArea
}
className
=
"globals-scrollable-area"
>
// functions
<
Files
scrollableParent
=
{
scrollableArea
}
/>
const
{
showFunction
,
contextFctMenuItems
}
=
useFunctionFilter
();
</
div
>
const
showFctsState
=
Dome
.
useFlipSettings
(
'
ivette.files.show.functions
'
,
true
);
// Variables
const
{
showVariable
,
contextVarMenuItems
}
=
useVariableFilter
();
const
showVarsState
=
Dome
.
useFlipSettings
(
'
ivette.files.show.globals
'
,
true
);
return
(<>
<
SidebarFilesTitle
showFctsState
=
{
showFctsState
}
contextFctMenuItems
=
{
contextFctMenuItems
}
showVarsState
=
{
showVarsState
}
contextVarMenuItems
=
{
contextVarMenuItems
}
/>
<
div
ref
=
{
scrollableArea
}
className
=
"globals-scrollable-area"
>
<
Files
scrollableParent
=
{
scrollableArea
}
showFctsState
=
{
showFctsState
}
showFunction
=
{
showFunction
}
showVarsState
=
{
showVarsState
}
showVariable
=
{
showVariable
}
/>
</
div
>
</>
);
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment