forked from Nandanans9072/2d_to_3d_reactjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmenu.js
149 lines (148 loc) Β· 4.51 KB
/
menu.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
import { Menu, dialog } from 'electron';
import fs from 'fs';
export function createAppMenu(mainWindow) {
return Menu.buildFromTemplate([
{
label: 'File',
submenu: [
{
label: 'New Project',
click: () => mainWindow.webContents.send('new-project')
},
{
label: 'Open Project',
click: () => {
dialog.showOpenDialog({
properties: ['openFile'],
filters: [{ name: 'KAIRA Projects', extensions: ['kaira'] }],
}).then(result => {
if (!result.canceled) {
const filePath = result.filePaths[0];
fs.readFile(filePath, 'utf-8', (err, data) => {
if (err) return console.error(err);
mainWindow.webContents.send('load-project', JSON.parse(data));
});
}
}).catch(err => console.error(err));
}
},
{
label: 'Save Project',
click: () => {
dialog.showSaveDialog({
filters: [{ name: 'KAIRA Projects', extensions: ['kaira'] }],
}).then(result => {
if (!result.canceled) {
mainWindow.webContents.send('save-project-request', result.filePath);
}
}).catch(err => console.error(err));
}
},
{
label: 'Export Model',
submenu: [
{
label: 'Export as OBJ',
click: () => mainWindow.webContents.send('export-obj')
},
{
label: 'Export as STL',
click: () => mainWindow.webContents.send('export-stl')
},
{
label: 'Export as FBX',
click: () => mainWindow.webContents.send('export-fbx')
},
],
},
{
label: 'Print Floor Plan',
click: () => mainWindow.webContents.send('print-floor-plan')
},
{ type: 'separator' },
{
label: 'Exit',
click: () => mainWindow.close()
},
],
},
{
label: 'Edit',
submenu: [
{ label: 'Undo', role: 'undo' },
{ label: 'Redo', role: 'redo' },
{ type: 'separator' },
{
label: 'Add Object',
submenu: [
{ label: 'Wall', click: () => mainWindow.webContents.send('add-wall') },
{ label: 'Door', click: () => mainWindow.webContents.send('add-door') },
{ label: 'Window', click: () => mainWindow.webContents.send('add-window') },
{ label: 'Furniture', click: () => mainWindow.webContents.send('add-furniture') },
],
},
{ label: 'Delete Selected', click: () => mainWindow.webContents.send('delete-selected') },
{ label: 'Align to Grid', click: () => mainWindow.webContents.send('align-to-grid') },
],
},
{
label: 'View',
submenu: [
{ role: 'reload' },
{ role: 'togglefullscreen' },
{
label: 'Toggle 2D/3D View',
click: () => mainWindow.webContents.send('toggle-2d-3d-view')
},
{
label: 'Enable VR Mode',
click: () => mainWindow.webContents.send('enable-vr-mode')
},
{
label: 'Adjust Lighting',
click: () => mainWindow.webContents.send('adjust-lighting')
},
],
},
{
label: 'Tools',
submenu: [
{
label: 'Measure Dimensions',
click: () => mainWindow.webContents.send('measure-dimensions')
},
{
label: 'Apply Materials',
click: () => mainWindow.webContents.send('apply-materials')
},
{
label: 'Customize Textures',
click: () => mainWindow.webContents.send('customize-textures')
},
],
},
{
label: 'Help',
submenu: [
{
label: 'Tutorials',
click: () => mainWindow.webContents.send('open-tutorials')
},
{
label: 'About KAIRA',
click: () => {
dialog.showMessageBox({
type: 'info',
title: 'About KAIRA',
message: 'KAIRA: Interactive 3D and VR Floor Planning App\nVersion: 1.0.0',
}).then(() => {}).catch(err => console.error(err));
}
},
{
label: 'Documentation',
click: () => mainWindow.webContents.send('open-documentation')
},
],
},
]);
}