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
e676dddf
Commit
e676dddf
authored
3 years ago
by
Loïc Correnson
Browse files
Options
Downloads
Patches
Plain Diff
[ivette/prefs] Rename « System » theme
parent
16044313
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/ivette/prefs.tsx
+2
-2
2 additions, 2 deletions
ivette/src/ivette/prefs.tsx
ivette/src/renderer/Preferences.tsx
+12
-12
12 additions, 12 deletions
ivette/src/renderer/Preferences.tsx
with
14 additions
and
14 deletions
ivette/src/ivette/prefs.tsx
+
2
−
2
View file @
e676dddf
...
@@ -44,7 +44,7 @@ import { ipcRenderer } from 'electron';
...
@@ -44,7 +44,7 @@ import { ipcRenderer } from 'electron';
export
const
THEMES
=
[
export
const
THEMES
=
[
{
id
:
'
light
'
,
label
:
'
Light
'
},
{
id
:
'
light
'
,
label
:
'
Light
'
},
{
id
:
'
dark
'
,
label
:
'
Dark
'
},
{
id
:
'
dark
'
,
label
:
'
Dark
'
},
{
id
:
'
system
'
,
label
:
'
System
'
},
{
id
:
'
system
'
,
label
:
'
System
Defaults
'
},
];
];
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
...
@@ -86,7 +86,7 @@ ipcRenderer.on('dome.ipc.settings.defaults', () => {
...
@@ -86,7 +86,7 @@ ipcRenderer.on('dome.ipc.settings.defaults', () => {
export
function
useThemeColors
()
{
export
function
useThemeColors
()
{
const
[
themeColors
]
=
Settings
.
useGlobalSettings
(
ColorTheme
);
const
[
themeColors
]
=
Settings
.
useGlobalSettings
(
ColorTheme
);
const
invoke
=
()
=>
ipcRenderer
.
invoke
(
'
theme-color:which-system
'
);
const
invoke
=
()
=>
ipcRenderer
.
invoke
(
'
theme-color:which-system
'
);
const
{
result
}
:
{
result
:
'
dark
'
|
'
light
'
}
=
usePromise
(
invoke
());
const
{
result
}:
{
result
:
'
dark
'
|
'
light
'
}
=
usePromise
(
invoke
());
if
(
themeColors
===
'
system
'
)
if
(
themeColors
===
'
system
'
)
return
result
===
'
dark
'
?
'
dark-code
'
:
'
default
'
;
return
result
===
'
dark
'
?
'
dark-code
'
:
'
default
'
;
return
themeColors
===
'
dark
'
?
'
dark-code
'
:
'
default
'
;
return
themeColors
===
'
dark
'
?
'
dark-code
'
:
'
default
'
;
...
...
This diff is collapsed.
Click to expand it.
ivette/src/renderer/Preferences.tsx
+
12
−
12
View file @
e676dddf
...
@@ -39,13 +39,13 @@ import React from 'react';
...
@@ -39,13 +39,13 @@ import React from 'react';
import
*
as
Settings
from
'
dome/data/settings
'
;
import
*
as
Settings
from
'
dome/data/settings
'
;
import
*
as
Forms
from
'
dome/layout/forms
'
;
import
*
as
Forms
from
'
dome/layout/forms
'
;
import
*
as
P
from
'
ivette/prefs
'
;
import
*
as
IvettePrefs
from
'
ivette/prefs
'
;
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
// --- Font Forms
// --- Font Forms
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
function
ThemeFields
(
props
:
P
.
ThemeProps
)
{
function
ThemeFields
(
props
:
IvettePrefs
.
ThemeProps
)
{
const
fontsize
=
Forms
.
useValid
(
const
fontsize
=
Forms
.
useValid
(
Settings
.
useGlobalSettings
(
props
.
fontSize
),
Settings
.
useGlobalSettings
(
props
.
fontSize
),
);
);
...
@@ -73,12 +73,12 @@ function ThemeFields(props: P.ThemeProps) {
...
@@ -73,12 +73,12 @@ function ThemeFields(props: P.ThemeProps) {
}
}
function
ColorThemeFields
()
{
function
ColorThemeFields
()
{
const
[
theme
,
setTheme
]
=
Settings
.
useGlobalSettings
(
P
.
ColorTheme
);
const
[
theme
,
setTheme
]
=
Settings
.
useGlobalSettings
(
IvettePrefs
.
ColorTheme
);
const
elements
=
P
.
THEMES
.
map
(({
id
,
label
})
=>
{
const
elements
=
IvettePrefs
.
THEMES
.
map
(({
id
,
label
})
=>
{
return
<
option
value
=
{
id
}
key
=
{
id
}
>
{
label
}
</
option
>;
return
<
option
value
=
{
id
}
key
=
{
id
}
>
{
label
}
</
option
>;
});
});
const
set
=
(
t
:
string
|
undefined
)
=>
{
const
set
=
(
t
:
string
|
undefined
)
=>
{
if
(
t
)
{
P
.
forceThemeUpdate
(
t
);
setTheme
(
t
);
}
if
(
t
)
{
IvettePrefs
.
forceThemeUpdate
(
t
);
setTheme
(
t
);
}
};
};
return
(
return
(
<
Forms
.
SelectField
label
=
{
'
Color theme
'
}
state
=
{
[
theme
,
undefined
,
set
]
}
>
<
Forms
.
SelectField
label
=
{
'
Color theme
'
}
state
=
{
[
theme
,
undefined
,
set
]
}
>
...
@@ -91,7 +91,7 @@ function ColorThemeFields() {
...
@@ -91,7 +91,7 @@ function ColorThemeFields() {
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
// --- Editor Command Forms
// --- Editor Command Forms
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
function
EditorCommandFields
(
props
:
P
.
EditorCommandProps
)
{
function
EditorCommandFields
(
props
:
IvettePrefs
.
EditorCommandProps
)
{
const
cmd
=
Forms
.
useDefined
(
Forms
.
useValid
(
const
cmd
=
Forms
.
useDefined
(
Forms
.
useValid
(
Settings
.
useGlobalSettings
(
props
.
command
),
Settings
.
useGlobalSettings
(
props
.
command
),
));
));
...
@@ -110,24 +110,24 @@ export default function Preferences() {
...
@@ -110,24 +110,24 @@ export default function Preferences() {
return
(
return
(
<
Forms
.
Page
>
<
Forms
.
Page
>
<
Forms
.
Section
label
=
"Theme"
unfold
>
<
Forms
.
Section
label
=
"Theme"
unfold
>
<
ColorThemeFields
/>
<
ColorThemeFields
/>
</
Forms
.
Section
>
</
Forms
.
Section
>
<
Forms
.
Section
label
=
"AST View"
unfold
>
<
Forms
.
Section
label
=
"AST View"
unfold
>
<
ThemeFields
<
ThemeFields
target
=
"Internal AST"
target
=
"Internal AST"
fontSize
=
{
P
.
AstFontSize
}
fontSize
=
{
IvettePrefs
.
AstFontSize
}
wrapText
=
{
P
.
AstWrapText
}
wrapText
=
{
IvettePrefs
.
AstWrapText
}
/>
/>
</
Forms
.
Section
>
</
Forms
.
Section
>
<
Forms
.
Section
label
=
"Source View"
unfold
>
<
Forms
.
Section
label
=
"Source View"
unfold
>
<
ThemeFields
<
ThemeFields
target
=
"Source Code"
target
=
"Source Code"
fontSize
=
{
P
.
SourceFontSize
}
fontSize
=
{
IvettePrefs
.
SourceFontSize
}
wrapText
=
{
P
.
SourceWrapText
}
wrapText
=
{
IvettePrefs
.
SourceWrapText
}
/>
/>
</
Forms
.
Section
>
</
Forms
.
Section
>
<
Forms
.
Section
label
=
"Editor Command"
unfold
>
<
Forms
.
Section
label
=
"Editor Command"
unfold
>
<
EditorCommandFields
command
=
{
P
.
EditorCommand
}
/>
<
EditorCommandFields
command
=
{
IvettePrefs
.
EditorCommand
}
/>
</
Forms
.
Section
>
</
Forms
.
Section
>
</
Forms
.
Page
>
</
Forms
.
Page
>
);
);
...
...
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