Skip to content

Commit

Permalink
initial wip
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasero committed Dec 1, 2015
1 parent 03e35bb commit fe88d38
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 14 deletions.
33 changes: 19 additions & 14 deletions src/vs/workbench/electron-browser/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@

<!-- Startup Code -->
<script type="text/javascript">
var webFrame = require('web-frame');

var mainStarted = false;
var args = parseURLQueryArgs();
var configuration = JSON.parse(args['config']);
Expand All @@ -108,8 +110,24 @@

registerListeners(enableDeveloperTools);

// We get the global settings through a remote call from the browser
// because its value can change dynamically.
var globalSettings;
var globalSettingsValue = remote.getGlobal('globalSettingsValue');
if (globalSettingsValue) {
globalSettings = JSON.parse(globalSettingsValue);
} else {
globalSettings = {
settings: {},
keybindings: []
};
}

// disable pinch zoom
require('web-frame').setZoomLevelLimits(1, 1);
webFrame.setZoomLevelLimits(1, 1);

// apply zoom level very early to avoid glitches
webFrame.setZoomLevel(globalSettings.settings.window.zoomLevel);

var rootUrl = uriFromPath(configuration.appRoot) + '/out';
createScript(rootUrl + '/vs/loader.js', function() {
Expand Down Expand Up @@ -153,19 +171,6 @@
], function() {
timers.afterLoad = new Date();

// We get the global settings through a remote call from the browser
// because its value can change dynamically.
var globalSettings;
var globalSettingsValue = remote.getGlobal('globalSettingsValue');
if (globalSettingsValue) {
globalSettings = JSON.parse(globalSettingsValue);
} else {
globalSettings = {
settings: {},
keybindings: []
};
}

var main = require('vs/workbench/electron-browser/main');
main.startup(configuration, globalSettings).then(function() {
mainStarted = true;
Expand Down
9 changes: 9 additions & 0 deletions src/vs/workbench/electron-browser/integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybindingService';
import {IWorkspaceContextService}from 'vs/workbench/services/workspace/common/contextService';
import {IWindowService}from 'vs/workbench/services/window/electron-browser/windowService';
import {IConfigurationService, IConfigurationServiceEvent, ConfigurationServiceEventTypes} from 'vs/platform/configuration/common/configuration';

import win = require('vs/workbench/electron-browser/window');

import remote = require('remote');
import ipc = require('ipc');
import webFrame = require('web-frame');

export class ElectronIntegration {

Expand All @@ -31,6 +33,7 @@ export class ElectronIntegration {
@IPartService private partService: IPartService,
@IWorkspaceContextService private contextService: IWorkspaceContextService,
@ITelemetryService private telemetryService: ITelemetryService,
@IConfigurationService private configurationService: IConfigurationService,
@IKeybindingService private keybindingService: IKeybindingService,
@IStorageService private storageService: IStorageService,
@IMessageService private messageService: IMessageService
Expand Down Expand Up @@ -97,6 +100,12 @@ export class ElectronIntegration {
ipc.on('vscode:changeTheme', (theme:string) => {
this.storageService.store('workbench.theme', theme, StorageScope.GLOBAL);
});

// Configuration changes
this.configurationService.addListener(ConfigurationServiceEventTypes.UPDATED, (e: IConfigurationServiceEvent) => {
let zoomLevel = e.config && e.config.window && e.config.window.zoomLevel;
webFrame.setZoomLevel(zoomLevel);
});
}

private resolveKeybindings(actionIds: string[]): TPromise<{ id: string; binding: number; }[]> {
Expand Down
5 changes: 5 additions & 0 deletions src/vs/workbench/electron-browser/main.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ configurationRegistry.registerConfiguration({
'enum': ['none', 'one', 'all'],
'default': 'one',
'description': nls.localize('reopenFolders', "Controls how folders are being reopened after a restart. Select 'none' to never reopen a folder, 'one' to reopen the last folder you worked on or 'all' to reopen all folders of your last session.")
},
'window.zoomLevel': {
'type': 'number',
'default': '0',
'description': nls.localize('zoomLevel', "Zoom level todo")
}
}
});
Expand Down
6 changes: 6 additions & 0 deletions src/vs/workbench/electron-browser/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ export interface IPath {
columnNumber?: number;
}

export interface IMainConfiguration {
window: {

}
}

export interface IMainEnvironment extends IEnvironment {
workspacePath?: string;
autoSaveDelay?: number;
Expand Down
1 change: 1 addition & 0 deletions src/vs/workbench/electron-browser/shell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ import { IServiceCtor, isServiceEvent } from 'vs/base/common/service';
import { connect, Client } from 'vs/base/node/service.net';
import { IExtensionsService } from 'vs/workbench/parts/extensions/common/extensions';
import { ExtensionsService } from 'vs/workbench/parts/extensions/node/extensionsService';
import webFrame = require('web-frame');

/**
* This ugly beast is needed because at the point when we need shared services
Expand Down

0 comments on commit fe88d38

Please sign in to comment.