Move all sources under atom/.

This commit is contained in:
Cheng Zhao 2014-03-16 08:30:26 +08:00
parent 26ddbbb0ee
commit 516d46444d
217 changed files with 519 additions and 519 deletions

View file

@ -0,0 +1,204 @@
var app = require('app');
var dialog = require('dialog');
var ipc = require('ipc');
var Menu = require('menu');
var MenuItem = require('menu-item');
var BrowserWindow = require('browser-window');
var mainWindow = null;
var menu = null;
// Quit when all windows are closed.
app.on('window-all-closed', function() {
app.terminate();
});
app.on('open-url', function(event, url) {
dialog.showMessageBox({message: url, buttons: ['OK']});
});
app.on('ready', function() {
app.commandLine.appendSwitch('js-flags', '--harmony_collections');
mainWindow = new BrowserWindow({ width: 800, height: 600 });
mainWindow.loadUrl('file://' + __dirname + '/index.html');
mainWindow.on('page-title-updated', function(event, title) {
event.preventDefault();
this.setTitle('Atom Shell - ' + title);
});
mainWindow.on('closed', function() {
mainWindow = null;
});
mainWindow.on('unresponsive', function() {
console.log('unresponsive');
});
if (process.platform == 'darwin') {
var template = [
{
label: 'Atom Shell',
submenu: [
{
label: 'About Atom Shell',
selector: 'orderFrontStandardAboutPanel:'
},
{
type: 'separator'
},
{
label: 'Hide Atom Shell',
accelerator: 'Command+H',
selector: 'hide:'
},
{
label: 'Hide Others',
accelerator: 'Command+Shift+H',
selector: 'hideOtherApplications:'
},
{
label: 'Show All',
selector: 'unhideAllApplications:'
},
{
type: 'separator'
},
{
label: 'Quit',
accelerator: 'Command+Q',
click: function() { app.quit(); }
},
]
},
{
label: 'Edit',
submenu: [
{
label: 'Undo',
accelerator: 'Command+Z',
selector: 'undo:'
},
{
label: 'Redo',
accelerator: 'Shift+Command+Z',
selector: 'redo:'
},
{
type: 'separator'
},
{
label: 'Cut',
accelerator: 'Command+X',
selector: 'cut:'
},
{
label: 'Copy',
accelerator: 'Command+C',
selector: 'copy:'
},
{
label: 'Paste',
accelerator: 'Command+V',
selector: 'paste:'
},
{
label: 'Select All',
accelerator: 'Command+A',
selector: 'selectAll:'
},
]
},
{
label: 'View',
submenu: [
{
label: 'Reload',
accelerator: 'Command+R',
click: function() { BrowserWindow.getFocusedWindow().restart(); }
},
{
label: 'Enter Fullscreen',
click: function() { BrowserWindow.getFocusedWindow().setFullscreen(true); }
},
{
label: 'Toggle DevTools',
accelerator: 'Alt+Command+I',
click: function() { BrowserWindow.getFocusedWindow().toggleDevTools(); }
},
]
},
{
label: 'Window',
submenu: [
{
label: 'Minimize',
accelerator: 'Command+M',
selector: 'performMiniaturize:'
},
{
label: 'Close',
accelerator: 'Command+W',
selector: 'performClose:'
},
{
type: 'separator'
},
{
label: 'Bring All to Front',
selector: 'arrangeInFront:'
},
]
},
];
menu = Menu.buildFromTemplate(template);
Menu.setApplicationMenu(menu);
} else {
var template = [
{
label: 'File',
submenu: [
{
label: 'Open',
accelerator: 'Ctrl+O',
},
{
label: 'Close',
accelerator: 'Ctrl+W',
click: function() { mainWindow.close(); }
},
]
},
{
label: 'View',
submenu: [
{
label: 'Reload',
accelerator: 'Ctrl+R',
click: function() { mainWindow.restart(); }
},
{
label: 'Enter Fullscreen',
click: function() { mainWindow.setFullScreen(true); }
},
{
label: 'Toggle DevTools',
accelerator: 'Alt+Ctrl+I',
click: function() { mainWindow.toggleDevTools(); }
},
]
},
];
menu = Menu.buildFromTemplate(template);
mainWindow.setMenu(menu);
}
ipc.on('message', function(processId, routingId, type) {
if (type == 'menu')
menu.popup(mainWindow);
});
});

View file

@ -0,0 +1,18 @@
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Atom Shell</title>
</head>
<body>
This is the default mode of Atom Shell, please follow the instructions in
wiki to get started.
<script type="text/javascript" charset="utf-8">
var ipc = require('ipc');
window.addEventListener('contextmenu', function (e) {
e.preventDefault();
ipc.send('menu');
}, false);
</script>
</body>
</html>

View file

@ -0,0 +1,32 @@
var app = require('app');
var path = require('path');
var optimist = require('optimist');
// Quit when all windows are closed and no other one is listening to this.
app.on('window-all-closed', function() {
if (app.listeners('window-all-closed').length == 1)
app.quit();
});
var argv = optimist(process.argv.slice(1)).boolean('ci').argv;
// Start the specified app if there is one specified in command line, otherwise
// start the default app.
if (argv._.length > 0) {
try {
require(path.resolve(argv._[0]));
} catch(e) {
if (e.code == 'MODULE_NOT_FOUND') {
console.error(e.stack);
console.error('Specified app is invalid');
process.exit(1);
} else {
throw e;
}
}
} else if (argv.version) {
console.log('v' + process.versions['atom-shell']);
process.exit(0);
} else {
require('./default_app.js');
}

View file

@ -0,0 +1,8 @@
{
"name": "atom-shell-default-app",
"version": "0.1.0",
"main": "main.js",
"dependencies": {
"optimist": "*"
}
}