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
19ba78e4
Commit
19ba78e4
authored
4 years ago
by
David Bühler
Browse files
Options
Downloads
Patches
Plain Diff
[ivette] New component MultipleSelection: table of multiple selected locations.
parent
52af885d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ivette/src/renderer/Application.tsx
+2
-0
2 additions, 0 deletions
ivette/src/renderer/Application.tsx
ivette/src/renderer/MultipleSelection.tsx
+118
-0
118 additions, 0 deletions
ivette/src/renderer/MultipleSelection.tsx
with
120 additions
and
0 deletions
ivette/src/renderer/Application.tsx
+
2
−
0
View file @
19ba78e4
...
@@ -20,6 +20,7 @@ import ASTview from './ASTview';
...
@@ -20,6 +20,7 @@ import ASTview from './ASTview';
import
ASTinfo
from
'
./ASTinfo
'
;
import
ASTinfo
from
'
./ASTinfo
'
;
import
Globals
from
'
./Globals
'
;
import
Globals
from
'
./Globals
'
;
import
Properties
from
'
./Properties
'
;
import
Properties
from
'
./Properties
'
;
import
MultipleSelection
from
'
./MultipleSelection
'
;
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
// --- Selection Controls
// --- Selection Controls
...
@@ -99,6 +100,7 @@ export default (() => {
...
@@ -99,6 +100,7 @@ export default (() => {
<
Properties
/>
<
Properties
/>
<
ASTview
/>
<
ASTview
/>
<
ASTinfo
/>
<
ASTinfo
/>
<
MultipleSelection
/>
</
Group
>
</
Group
>
</
LabView
>
</
LabView
>
</
Splitter
>
</
Splitter
>
...
...
This diff is collapsed.
Click to expand it.
ivette/src/renderer/MultipleSelection.tsx
0 → 100644
+
118
−
0
View file @
19ba78e4
// --------------------------------------------------------------------------
// --- Table of multiple selection
// --------------------------------------------------------------------------
import
React
from
'
react
'
;
import
*
as
States
from
'
frama-c/states
'
;
import
{
ArrayModel
}
from
'
dome/table/arrays
'
;
import
{
Table
,
Column
}
from
'
dome/table/views
'
;
import
{
Label
}
from
'
dome/controls/labels
'
;
import
*
as
Toolbar
from
'
dome/frame/toolbars
'
;
import
{
Component
}
from
'
frama-c/LabViews
'
;
// --------------------------------------------------------------------------
// --- Multiple Selection Panel
// --------------------------------------------------------------------------
const
SelectionTable
=
()
=>
{
// Hooks
const
[
selection
,
updateSelection
]
=
States
.
useSelection
();
const
length
=
selection
?.
multiple
?.
length
;
const
multiple
:
States
.
Location
[]
=
selection
?.
multiple
;
const
model
=
React
.
useMemo
(()
=>
new
ArrayModel
(
'
id
'
),
[]);
// Updates [[model]] with the current multiple selection.
React
.
useEffect
(()
=>
{
if
(
multiple
?.
length
>
0
)
{
const
array
=
multiple
.
map
((
d
,
i
)
=>
({
...
d
,
id
:
i
}));
model
.
replace
(
array
);
}
else
model
.
clear
();
},
[
multiple
,
model
]);
// Callbacks
const
onTableSelection
=
React
.
useCallback
(
({
id
})
=>
updateSelection
({
index
:
id
}),
[
updateSelection
],
);
const
reload
=
()
=>
{
const
location
=
multiple
[
selection
?.
index
];
updateSelection
({
location
});
};
// Component
return
(
<>
<
Toolbar
.
ToolBar
>
<
Toolbar
.
Button
icon
=
"RELOAD"
onClick
=
{
reload
}
enabled
=
{
length
>
1
}
title
=
"Reload the current location of the multiple selection"
/>
<
Toolbar
.
ButtonGroup
>
<
Toolbar
.
Button
icon
=
"ANGLE.LEFT"
onClick
=
{
()
=>
updateSelection
(
'
PREV
'
)
}
enabled
=
{
length
>
1
&&
selection
?.
index
>
0
}
title
=
"Previous location of the multiple selection"
/>
<
Toolbar
.
Button
icon
=
"ANGLE.RIGHT"
onClick
=
{
()
=>
updateSelection
(
'
NEXT
'
)
}
enabled
=
{
length
>
1
&&
selection
?.
index
<
length
-
1
}
title
=
"Next location of the multiple selection"
/>
</
Toolbar
.
ButtonGroup
>
<
Label
className
=
"component-info"
title
=
{
`
${
length
}
selected locations`
}
display
=
{
length
>
1
}
>
{
selection
?.
index
+
1
}
/
{
length
}
</
Label
>
<
Toolbar
.
Filler
/>
<
Toolbar
.
Button
icon
=
"CIRC.CLOSE"
onClick
=
{
()
=>
updateSelection
(
'
CLEAR
'
)
}
enabled
=
{
length
>
1
}
title
=
"Clear the multiple selection"
/>
</
Toolbar
.
ToolBar
>
<
Table
model
=
{
model
}
selection
=
{
selection
?.
index
}
onSelection
=
{
onTableSelection
}
>
<
Column
id
=
"id"
label
=
"#"
align
=
"center"
width
=
{
25
}
getter
=
{
(
r
:
{
id
:
number
})
=>
r
.
id
+
1
}
/>
<
Column
id
=
"function"
label
=
"Function"
width
=
{
120
}
/>
<
Column
id
=
"marker"
label
=
"Marker"
fill
/>
</
Table
>
</>
);
};
// --------------------------------------------------------------------------
// --- Export Component
// --------------------------------------------------------------------------
export
default
()
=>
(
<
Component
id
=
"frama-c.selection"
label
=
"Multiple Selection"
title
=
"Browse a selection of multiple locations"
>
<
SelectionTable
/>
</
Component
>
);
// --------------------------------------------------------------------------
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