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
6467f184
Commit
6467f184
authored
4 years ago
by
Loïc Correnson
Browse files
Options
Downloads
Patches
Plain Diff
[ivette] global search bar activated
parent
15db4372
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/renderer/Application.tsx
+16
-2
16 additions, 2 deletions
ivette/src/renderer/Application.tsx
ivette/src/renderer/Globals.tsx
+30
-1
30 additions, 1 deletion
ivette/src/renderer/Globals.tsx
with
46 additions
and
3 deletions
ivette/src/renderer/Application.tsx
+
16
−
2
View file @
6467f184
...
...
@@ -19,7 +19,7 @@ import * as Controller from './Controller';
import
ASTview
from
'
./ASTview
'
;
import
ASTinfo
from
'
./ASTinfo
'
;
import
Globals
from
'
./Globals
'
;
import
Globals
,
{
GlobalHint
,
useHints
}
from
'
./Globals
'
;
import
Properties
from
'
./Properties
'
;
import
Locations
from
'
./Locations
'
;
import
Values
from
'
./Values
'
;
...
...
@@ -61,6 +61,14 @@ export default (() => {
Dome
.
useFlipSettings
(
'
frama-c.sidebar.unfold
'
,
true
);
const
[
viewbar
,
flipViewbar
]
=
Dome
.
useFlipSettings
(
'
frama-c.viewbar.unfold
'
,
true
);
const
[
hints
,
onSearchHint
]
=
useHints
();
const
[,
setSelection
]
=
States
.
useSelection
();
const
onGlobalHint
=
(
h
:
GlobalHint
)
=>
{
setSelection
({
location
:
h
.
value
});
};
const
onSelectHint
=
()
=>
{
if
(
hints
.
length
===
1
)
onGlobalHint
(
hints
[
0
]);
};
return
(
<
Vfill
>
...
...
@@ -74,7 +82,13 @@ export default (() => {
<
Controller
.
Control
/>
<
HistorySelectionControls
/>
<
Toolbar
.
Filler
/>
<
Toolbar
.
SearchField
placeholder
=
"Search…"
/>
<
Toolbar
.
SearchField
placeholder
=
"Search…"
hints
=
{
hints
}
onSearch
=
{
onSearchHint
}
onSelect
=
{
onSelectHint
}
onHint
=
{
onGlobalHint
}
/>
<
Toolbar
.
Button
icon
=
"ITEMS.GRID"
title
=
"Customize Main View"
...
...
This diff is collapsed.
Click to expand it.
ivette/src/renderer/Globals.tsx
+
30
−
1
View file @
6467f184
...
...
@@ -4,12 +4,41 @@
import
React
from
'
react
'
;
import
{
Section
,
Item
}
from
'
dome/frame/sidebars
'
;
import
type
{
Hint
}
from
'
dome/frame/toolbars
'
;
import
*
as
States
from
'
frama-c/states
'
;
import
{
alpha
}
from
'
dome/data/compare
'
;
import
{
functions
,
functionsData
}
from
'
frama-c/api/kernel/ast
'
;
// --------------------------------------------------------------------------
// --- Globals Section
// --- Global Search Hints
// --------------------------------------------------------------------------
export
type
GlobalHint
=
Hint
<
States
.
Location
>
;
const
makeHint
=
(
fct
:
functionsData
):
GlobalHint
=>
({
id
:
fct
.
key
,
label
:
fct
.
name
,
title
:
fct
.
signature
,
value
:
{
function
:
fct
.
name
},
});
export
function
useHints
():
[
GlobalHint
[],
(
pattern
:
string
)
=>
void
]
{
const
fcts
=
States
.
useSyncArray
(
functions
).
getArray
();
const
[
hints
,
setHints
]
=
React
.
useState
<
GlobalHint
[]
>
([]);
const
onSearch
=
(
pattern
:
string
)
=>
{
if
(
pattern
===
''
)
setHints
([]);
else
{
const
p
=
pattern
.
toLowerCase
();
setHints
(
fcts
.
filter
((
fn
)
=>
(
0
<=
fn
.
name
.
toLowerCase
().
indexOf
(
p
)
)).
map
(
makeHint
));
}
};
return
[
hints
,
onSearch
];
}
// --------------------------------------------------------------------------
// --- Globals Section(s)
// --------------------------------------------------------------------------
export
default
()
=>
{
...
...
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