Skip to content

Preferences: arrange checkboxes into two columns #8638

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 2, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 10 additions & 20 deletions app/src/cc/arduino/view/preferences/Preferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,7 @@ private void initComponents() {
enableCodeFoldingBox = new javax.swing.JCheckBox();
verifyUploadBox = new javax.swing.JCheckBox();
externalEditorBox = new javax.swing.JCheckBox();
cacheCompiledCore = new javax.swing.JCheckBox();
checkUpdatesBox = new javax.swing.JCheckBox();
updateExtensionBox = new javax.swing.JCheckBox();
saveVerifyUploadBox = new javax.swing.JCheckBox();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
Expand Down Expand Up @@ -248,7 +246,7 @@ public void mouseEntered(java.awt.event.MouseEvent evt) {
arduinoNotRunningLabel.setForeground(Color.GRAY);
arduinoNotRunningLabel.setText(tr("(edit only when Arduino is not running)"));

checkboxesContainer.setLayout(new javax.swing.BoxLayout(checkboxesContainer, javax.swing.BoxLayout.Y_AXIS));
checkboxesContainer.setLayout(new GridLayout(0,2));

displayLineNumbersBox.setText(tr("Display line numbers"));
checkboxesContainer.add(displayLineNumbersBox);
Expand Down Expand Up @@ -277,15 +275,9 @@ public void mouseEntered(java.awt.event.MouseEvent evt) {

checkboxesContainer.add(externalEditorBox);

cacheCompiledCore.setText(tr("Aggressively cache compiled core"));
checkboxesContainer.add(cacheCompiledCore);

checkUpdatesBox.setText(tr("Check for updates on startup"));
checkboxesContainer.add(checkUpdatesBox);

updateExtensionBox.setText(tr("Update sketch files to new extension on save (.pde -> .ino)"));
checkboxesContainer.add(updateExtensionBox);

saveVerifyUploadBox.setText(tr("Save when verifying or uploading"));
checkboxesContainer.add(saveVerifyUploadBox);

Expand Down Expand Up @@ -322,7 +314,7 @@ public void itemStateChanged(java.awt.event.ItemEvent evt) {
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(sketchbookLocationField, javax.swing.GroupLayout.DEFAULT_SIZE, 553, Short.MAX_VALUE)
.addComponent(sketchbookLocationField, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(browseButton))
.addComponent(checkboxesContainer, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
Expand Down Expand Up @@ -631,13 +623,13 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 691, Short.MAX_VALUE)
.addGap(0, 800, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 580, Short.MAX_VALUE)
.addGap(0, 400, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
Expand Down Expand Up @@ -730,7 +722,6 @@ private void autoScaleCheckBoxItemStateChanged(java.awt.event.ItemEvent evt) {//
private javax.swing.JCheckBox enableCodeFoldingBox;
private javax.swing.JButton extendedAdditionalUrlFieldWindow;
private javax.swing.JCheckBox externalEditorBox;
private javax.swing.JCheckBox cacheCompiledCore;
private javax.swing.JTextField fontSizeField;
private javax.swing.JLabel fontSizeLabel;
private javax.swing.JLabel jLabel1;
Expand Down Expand Up @@ -759,7 +750,6 @@ private void autoScaleCheckBoxItemStateChanged(java.awt.event.ItemEvent evt) {//
private javax.swing.JLabel showVerboseLabel;
private javax.swing.JTextField sketchbookLocationField;
private javax.swing.JLabel sketchbookLocationLabel;
private javax.swing.JCheckBox updateExtensionBox;
private javax.swing.JCheckBox verboseCompilationBox;
private javax.swing.JCheckBox verboseUploadBox;
private javax.swing.JCheckBox verifyUploadBox;
Expand Down Expand Up @@ -834,12 +824,8 @@ private void savePreferencesData() {

PreferencesData.setBoolean("editor.external", externalEditorBox.isSelected());

PreferencesData.setBoolean("compiler.cache_core", cacheCompiledCore.isSelected());

PreferencesData.setBoolean("update.check", checkUpdatesBox.isSelected());

PreferencesData.setBoolean("editor.update_extension", updateExtensionBox.isSelected());

PreferencesData.setBoolean("editor.save_on_verify", saveVerifyUploadBox.isSelected());

PreferencesData.set("boardsmanager.additional.urls", additionalBoardsManagerField.getText().replace("\r\n", "\n").replace("\r", "\n").replace("\n", ","));
Expand Down Expand Up @@ -906,11 +892,15 @@ private void showPreferencesData() {

externalEditorBox.setSelected(PreferencesData.getBoolean("editor.external"));

cacheCompiledCore.setSelected(PreferencesData.get("compiler.cache_core") == null || PreferencesData.getBoolean("compiler.cache_core"));
if (PreferencesData.get("compiler.cache_core") == null) {
PreferencesData.setBoolean("compiler.cache_core", true);
}

checkUpdatesBox.setSelected(PreferencesData.getBoolean("update.check"));

updateExtensionBox.setSelected(PreferencesData.get("editor.update_extension") == null || PreferencesData.getBoolean("editor.update_extension"));
if (PreferencesData.get("editor.update_extension") == null) {
PreferencesData.setBoolean("editor.update_extension", true);
}

saveVerifyUploadBox.setSelected(PreferencesData.getBoolean("editor.save_on_verify"));

Expand Down