Skip to content

Commit c7e97f2

Browse files
author
Akos Kitta
committed
chore: Switched to window.zoomLevel preference
Deprecated `arduino.window.zoomLevel`. Closes #1657 Signed-off-by: Akos Kitta <[email protected]>
1 parent ac9cce1 commit c7e97f2

File tree

4 files changed

+20
-18
lines changed

4 files changed

+20
-18
lines changed

Diff for: arduino-ide-extension/src/browser/arduino-frontend-contribution.tsx

+8-9
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import { EditorCommands, EditorMainMenu } from '@theia/editor/lib/browser';
3131
import { MonacoMenus } from '@theia/monaco/lib/browser/monaco-menu';
3232
import { FileNavigatorCommands } from '@theia/navigator/lib/browser/navigator-contribution';
3333
import { TerminalMenus } from '@theia/terminal/lib/browser/terminal-frontend-contribution';
34-
import { ArduinoPreferences } from './arduino-preferences';
34+
import { ElectronWindowPreferences } from '@theia/core/lib/electron-browser/window/electron-window-preferences';
3535
import { BoardsServiceProvider } from './boards/boards-service-provider';
3636
import { BoardsToolBarItem } from './boards/boards-toolbar-item';
3737
import { ArduinoMenus } from './menu/arduino-menus';
@@ -58,8 +58,8 @@ export class ArduinoFrontendContribution
5858
@inject(CommandRegistry)
5959
private readonly commandRegistry: CommandRegistry;
6060

61-
@inject(ArduinoPreferences)
62-
private readonly arduinoPreferences: ArduinoPreferences;
61+
@inject(ElectronWindowPreferences)
62+
private readonly electronWindowPreferences: ElectronWindowPreferences;
6363

6464
@inject(FrontendApplicationStateService)
6565
private readonly appStateService: FrontendApplicationStateService;
@@ -78,10 +78,10 @@ export class ArduinoFrontendContribution
7878
}
7979

8080
onStart(app: FrontendApplication): void {
81-
this.arduinoPreferences.onPreferenceChanged((event) => {
81+
this.electronWindowPreferences.onPreferenceChanged((event) => {
8282
if (event.newValue !== event.oldValue) {
8383
switch (event.preferenceName) {
84-
case 'arduino.window.zoomLevel':
84+
case 'window.zoomLevel':
8585
if (typeof event.newValue === 'number') {
8686
const webContents = remote.getCurrentWebContents();
8787
webContents.setZoomLevel(event.newValue || 0);
@@ -91,11 +91,10 @@ export class ArduinoFrontendContribution
9191
}
9292
});
9393
this.appStateService.reachedState('ready').then(() =>
94-
this.arduinoPreferences.ready.then(() => {
94+
this.electronWindowPreferences.ready.then(() => {
9595
const webContents = remote.getCurrentWebContents();
96-
const zoomLevel = this.arduinoPreferences.get(
97-
'arduino.window.zoomLevel'
98-
);
96+
const zoomLevel =
97+
this.electronWindowPreferences.get('window.zoomLevel');
9998
webContents.setZoomLevel(zoomLevel);
10099
})
101100
);

Diff for: arduino-ide-extension/src/browser/arduino-preferences.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,12 @@ export const ArduinoConfigSchema: PreferenceSchema = {
114114
},
115115
'arduino.window.zoomLevel': {
116116
type: 'number',
117-
description: nls.localize(
118-
'arduino/preferences/window.zoomLevel',
119-
'Adjust the zoom level of the window. The original size is 0 and each increment above (e.g. 1) or below (e.g. -1) represents zooming 20% larger or smaller. You can also enter decimals to adjust the zoom level with a finer granularity.'
120-
),
117+
description: '',
121118
default: 0,
119+
deprecationMessage: nls.localize(
120+
'arduino/preferences/window.zoomLevel/deprecationMessage',
121+
"Deprecated. Use 'window.zoomLevel' instead."
122+
),
122123
},
123124
'arduino.ide.updateChannel': {
124125
type: 'string',
@@ -270,7 +271,6 @@ export interface ArduinoConfiguration {
270271
'arduino.upload.verbose': boolean;
271272
'arduino.upload.verify': boolean;
272273
'arduino.window.autoScale': boolean;
273-
'arduino.window.zoomLevel': number;
274274
'arduino.ide.updateChannel': UpdateChannel;
275275
'arduino.ide.updateBaseUrl': string;
276276
'arduino.board.certificates': string;

Diff for: arduino-ide-extension/src/browser/dialogs/settings/settings.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,17 @@ import { ElectronCommands } from '@theia/core/lib/electron-browser/menu/electron
2828
import { DefaultTheme } from '@theia/application-package/lib/application-props';
2929
import { FrontendApplicationConfigProvider } from '@theia/core/lib/browser/frontend-application-config-provider';
3030

31+
export const WINDOW_SETTING = 'window';
3132
export const EDITOR_SETTING = 'editor';
3233
export const FONT_SIZE_SETTING = `${EDITOR_SETTING}.fontSize`;
3334
export const AUTO_SAVE_SETTING = `files.autoSave`;
3435
export const QUICK_SUGGESTIONS_SETTING = `${EDITOR_SETTING}.quickSuggestions`;
3536
export const ARDUINO_SETTING = 'arduino';
36-
export const WINDOW_SETTING = `${ARDUINO_SETTING}.window`;
37+
export const ARDUINO_WINDOW_SETTING = `${ARDUINO_SETTING}.window`;
3738
export const COMPILE_SETTING = `${ARDUINO_SETTING}.compile`;
3839
export const UPLOAD_SETTING = `${ARDUINO_SETTING}.upload`;
3940
export const SKETCHBOOK_SETTING = `${ARDUINO_SETTING}.sketchbook`;
40-
export const AUTO_SCALE_SETTING = `${WINDOW_SETTING}.autoScale`;
41+
export const AUTO_SCALE_SETTING = `${ARDUINO_WINDOW_SETTING}.autoScale`;
4142
export const ZOOM_LEVEL_SETTING = `${WINDOW_SETTING}.zoomLevel`;
4243
export const COMPILE_VERBOSE_SETTING = `${COMPILE_SETTING}.verbose`;
4344
export const COMPILE_WARNINGS_SETTING = `${COMPILE_SETTING}.warnings`;
@@ -55,7 +56,7 @@ export interface Settings {
5556
currentLanguage: string;
5657

5758
autoScaleInterface: boolean; // `arduino.window.autoScale`
58-
interfaceScale: number; // `arduino.window.zoomLevel` https://github.com/eclipse-theia/theia/issues/8751
59+
interfaceScale: number; // `window.zoomLevel`
5960
verboseOnCompile: boolean; // `arduino.compile.verbose`
6061
compilerWarnings: CompilerWarnings; // `arduino.compile.warnings`
6162
verboseOnUpload: boolean; // `arduino.upload.verbose`

Diff for: i18n/en.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,9 @@
371371
"upload.verbose": "True for verbose upload output. False by default.",
372372
"verifyAfterUpload": "Verify code after upload",
373373
"window.autoScale": "True if the user interface automatically scales with the font size.",
374-
"window.zoomLevel": "Adjust the zoom level of the window. The original size is 0 and each increment above (e.g. 1) or below (e.g. -1) represents zooming 20% larger or smaller. You can also enter decimals to adjust the zoom level with a finer granularity."
374+
"window.zoomLevel": {
375+
"deprecationMessage": "Deprecated. Use 'window.zoomLevel' instead."
376+
}
375377
},
376378
"replaceMsg": "Replace the existing version of {0}?",
377379
"selectZip": "Select a zip file containing the library you'd like to add",

0 commit comments

Comments
 (0)