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
28fb400a
Commit
28fb400a
authored
3 years ago
by
Loïc Correnson
Committed by
David Bühler
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[dome] only create menu items from primary window
parent
753d6e77
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ivette/src/dome/main/dome.ts
+25
-7
25 additions, 7 deletions
ivette/src/dome/main/dome.ts
with
25 additions
and
7 deletions
ivette/src/dome/main/dome.ts
+
25
−
7
View file @
28fb400a
...
...
@@ -167,6 +167,7 @@ function obtainGlobalSettings() {
type
Store
=
{
[
key
:
string
]:
unknown
};
interface
Handle
{
primary
:
boolean
;
// Primary window
window
:
BrowserWindow
;
// Also prevents Gc
frame
:
Electron
.
Rectangle
;
// Window frame
devtools
:
boolean
;
// Developper tools visible
...
...
@@ -348,6 +349,7 @@ function lookupConfig(pwd = '.') {
// --------------------------------------------------------------------------
function
createBrowserWindow
(
primary
:
boolean
,
config
:
BrowserWindowConstructorOptions
,
argv
?:
string
[],
wdir
?:
string
,
...
...
@@ -387,6 +389,7 @@ function createBrowserWindow(
const
wid
=
webContents
.
id
;
const
handle
:
Handle
=
{
primary
,
window
:
theWindow
,
config
:
configFile
,
reloaded
:
false
,
...
...
@@ -487,7 +490,7 @@ function createPrimaryWindow() {
applyThemeSettings
(
globals
);
// Create Window
createBrowserWindow
({
title
:
appName
},
argv
,
wdir
);
createBrowserWindow
(
true
,
{
title
:
appName
},
argv
,
wdir
);
}
let
appCount
=
1
;
...
...
@@ -503,13 +506,15 @@ function createSecondaryWindow(
argString
=
argString
.
substring
(
argStart
.
length
);
const
electronArgv
=
JSON
.
parse
(
argString
);
const
argv
=
stripElectronArgv
(
electronArgv
);
createBrowserWindow
({
title
:
`
${
appName
}
#
${
++
appCount
}
`
},
argv
,
wdir
);
const
title
=
`
${
appName
}
#
${
++
appCount
}
`
;
createBrowserWindow
(
false
,
{
title
},
argv
,
wdir
);
}
}
function
createDesktopWindow
()
{
const
wdir
=
app
.
getPath
(
'
home
'
);
createBrowserWindow
({
title
:
`
${
appName
}
#
${
++
appCount
}
`
},
[],
wdir
);
const
title
=
`
${
appName
}
#
${
++
appCount
}
`
;
createBrowserWindow
(
false
,
{
title
},
[],
wdir
);
}
// --------------------------------------------------------------------------
...
...
@@ -541,7 +546,8 @@ let PreferenceWindow: BrowserWindow | undefined;
function
showSettingsWindow
()
{
if
(
!
PreferenceWindow
)
PreferenceWindow
=
createBrowserWindow
({
PreferenceWindow
=
createBrowserWindow
(
false
,
{
title
:
`
${
appName
}
Settings`
,
width
:
256
,
height
:
248
,
...
...
@@ -645,9 +651,21 @@ export function setMenuItem(spec: Menubar.CustomMenuItem) {
Menubar
.
setMenuItem
(
spec
);
}
ipcMain
.
on
(
'
dome.ipc.menu.addmenu
'
,
(
_evt
,
label
)
=>
addMenu
(
label
));
ipcMain
.
on
(
'
dome.ipc.menu.addmenuitem
'
,
(
_evt
,
spec
)
=>
addMenuItem
(
spec
));
ipcMain
.
on
(
'
dome.ipc.menu.setmenuitem
'
,
(
_evt
,
spec
)
=>
setMenuItem
(
spec
));
function
isPrimary
(
evt
:
IpcMainEvent
):
boolean
{
const
h
=
WindowHandles
.
get
(
evt
.
sender
.
id
);
return
h
?
h
.
primary
:
false
;
}
ipcMain
.
on
(
'
dome.ipc.menu.addmenu
'
,
(
evt
,
label
)
=>
isPrimary
(
evt
)
&&
Menubar
.
addMenu
(
label
)
);
ipcMain
.
on
(
'
dome.ipc.menu.addmenuitem
'
,
(
evt
,
spec
)
=>
isPrimary
(
evt
)
&&
Menubar
.
addMenuItem
(
spec
)
);
ipcMain
.
on
(
'
dome.ipc.menu.setmenuitem
'
,
(
_evt
,
spec
)
=>
// Always update menu items
Menubar
.
setMenuItem
(
spec
)
);
// --------------------------------------------------------------------------
// --- Dialogs Management
...
...
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