Skip to content

Commit 5870405

Browse files
committed
add preference to set the zoom factor
1 parent d55baaf commit 5870405

File tree

3 files changed

+29
-5
lines changed

3 files changed

+29
-5
lines changed

app/src/processing/app/ui/PreferencesFrame.java

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public class PreferencesFrame {
4949
GroupLayout layout;
5050

5151
static final Integer[] FONT_SIZES = { 10, 12, 14, 18, 24, 36, 48 };
52+
static final String[] ZOOM_OPTIONS = { "100%", "150%", "200%", "300%" };
5253

5354
JTextField sketchbookLocationField;
5455
JTextField presentColor;
@@ -71,6 +72,7 @@ public class PreferencesFrame {
7172
JCheckBox importSuggestionsBox;
7273
//JCheckBox codeCompletionTriggerBox;
7374

75+
JComboBox<String> zoomSelectionBox;
7476
JComboBox<String> displaySelectionBox;
7577
JComboBox<String> languageSelectionBox;
7678

@@ -98,7 +100,9 @@ public PreferencesFrame(Base base) {
98100

99101
final int BORDER = Toolkit.zoom(Platform.isMacOS() ? 20 : 13);
100102

101-
JLabel sketchbookLocationLabel, restartProcessingLabel;
103+
JLabel sketchbookLocationLabel;
104+
JLabel languageRestartLabel;
105+
JLabel zoomRestartLabel;
102106
JButton browseButton; //, button2;
103107

104108

@@ -135,7 +139,7 @@ public void actionPerformed(ActionEvent e) {
135139
}
136140
}
137141
languageSelectionBox.setModel(new DefaultComboBoxModel<String>(languageSelection));
138-
restartProcessingLabel = new JLabel(" (" + Language.text("preferences.requires_restart") + ")");
142+
languageRestartLabel = new JLabel(" (" + Language.text("preferences.requires_restart") + ")");
139143

140144

141145
// Editor and console font [ Source Code Pro ]
@@ -158,6 +162,17 @@ public void actionPerformed(ActionEvent e) {
158162
consoleFontSizeField = new JComboBox<Integer>(FONT_SIZES);
159163
fontSizeField.setSelectedItem(Preferences.getFont("editor.font.size"));
160164

165+
166+
// Interface scale: [ 100% ] (requires restart of Processing)
167+
168+
JLabel zoomLabel = new JLabel(Language.text("preferences.zoom") + ": ");
169+
zoomSelectionBox = new JComboBox<String>();
170+
zoomSelectionBox.setModel(new DefaultComboBoxModel<String>(ZOOM_OPTIONS));
171+
zoomRestartLabel = new JLabel(" (" + Language.text("preferences.requires_restart") + ")");
172+
173+
174+
//
175+
161176
JLabel backgroundColorLabel = new JLabel(Language.text("preferences.background_color")+": ");
162177

163178
final String colorTip = "<html>" + Language.text("preferences.background_color.tip");
@@ -392,7 +407,7 @@ public void actionPerformed(ActionEvent e) {
392407
.addGroup(layout.createSequentialGroup()
393408
.addComponent(languageLabel)
394409
.addComponent(languageSelectionBox,GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) // This makes the component non-resizable in the X direction
395-
.addComponent(restartProcessingLabel))
410+
.addComponent(languageRestartLabel))
396411
.addGroup(layout.createSequentialGroup()
397412
.addComponent(fontLabel)
398413
.addComponent(fontSelectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
@@ -402,6 +417,10 @@ public void actionPerformed(ActionEvent e) {
402417
.addComponent(fontSizeField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
403418
.addComponent(consoleFontSizeLabel)
404419
.addComponent(consoleFontSizeField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
420+
.addGroup(layout.createSequentialGroup()
421+
.addComponent(zoomLabel)
422+
.addComponent(zoomSelectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
423+
.addComponent(zoomRestartLabel))
405424
.addGroup(layout.createSequentialGroup()
406425
.addComponent(backgroundColorLabel)
407426
.addComponent(hashLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
@@ -452,7 +471,7 @@ public void actionPerformed(ActionEvent e) {
452471
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER)
453472
.addComponent(languageLabel)
454473
.addComponent(languageSelectionBox)
455-
.addComponent(restartProcessingLabel))
474+
.addComponent(languageRestartLabel))
456475
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER).
457476
addComponent(fontLabel)
458477
.addComponent(fontSelectionBox))
@@ -461,6 +480,10 @@ public void actionPerformed(ActionEvent e) {
461480
.addComponent(fontSizeField)
462481
.addComponent(consoleFontSizeLabel)
463482
.addComponent(consoleFontSizeField))
483+
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER)
484+
.addComponent(zoomLabel)
485+
.addComponent(zoomSelectionBox)
486+
.addComponent(zoomRestartLabel))
464487
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER)
465488
.addComponent(backgroundColorLabel)
466489
.addComponent(hashLabel)

app/src/processing/app/ui/Toolkit.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public class Toolkit {
111111
static public int getButtonWidth() {
112112
// Made into a method so that calling Toolkit methods doesn't require
113113
// the languages to be loaded, and with that, Base initialized completely
114-
return Integer.parseInt(Language.text("preferences.button.width"));
114+
return zoom(Integer.parseInt(Language.text("preferences.button.width")));
115115
}
116116

117117

build/shared/lib/languages/PDE.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ preferences.editor_and_console_font = Editor and Console font
166166
preferences.editor_and_console_font.tip = Select the font used in the Editor and the Console.<br>Only monospaced (fixed-width) fonts may be used,<br>though the list may be imperfect.
167167
preferences.editor_font_size = Editor font size
168168
preferences.console_font_size = Console font size
169+
preferences.zoom = Interface scale
169170
preferences.background_color = Background color when Presenting
170171
preferences.background_color.tip = Select the background color used when using Present.<br>Present is used to present a sketch in full-screen,<br>accessible from the Sketch menu.
171172
preferences.use_smooth_text = Use smooth text in editor window

0 commit comments

Comments
 (0)