Skip to content

Do not clear serial monitor if the port is disabled for upload #9644

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
Feb 12, 2020
Merged
Show file tree
Hide file tree
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
4 changes: 1 addition & 3 deletions app/src/processing/app/AbstractMonitor.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package processing.app;

import cc.arduino.packages.BoardPort;
import cc.arduino.packages.DiscoveryManager;
import processing.app.legacy.PApplet;

import javax.swing.*;
Expand All @@ -10,7 +9,6 @@
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.List;

@SuppressWarnings("serial")
public abstract class AbstractMonitor extends JFrame implements ActionListener {
Expand Down Expand Up @@ -85,7 +83,7 @@ public void actionPerformed(ActionEvent ae) {
suspend();
}
} else {
if (closed && (Editor.isUploading() == false)) {
if (closed && !Editor.isUploading()) {
resume(boardPort);
}
}
Expand Down
23 changes: 20 additions & 3 deletions app/src/processing/app/AbstractTextMonitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static processing.app.I18n.tr;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
Expand Down Expand Up @@ -170,9 +171,25 @@ public void windowGainedFocus(WindowEvent e) {
}

@Override
protected void onEnableWindow(boolean enable)
{
textArea.setEnabled(enable);
protected void onEnableWindow(boolean enable) {
// never actually disable textArea, so people can
// still select & copy text, even when the port
// is closed or disconnected
textArea.setEnabled(true);
if (enable) {
// setting these to null for system default
// gives a wrong gray background on Windows
// so assume black text on white background
textArea.setForeground(Color.BLACK);
textArea.setBackground(Color.WHITE);
} else {
// In theory, UIManager.getDefaults() should
// give us the system's colors for disabled
// windows. But it doesn't seem to work. :(
textArea.setForeground(new Color(64, 64, 64));
textArea.setBackground(new Color(238, 238, 238));
}
textArea.invalidate();
clearButton.setEnabled(enable);
scrollPane.setEnabled(enable);
textField.setEnabled(enable);
Expand Down
2 changes: 0 additions & 2 deletions app/src/processing/app/SerialMonitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

Expand Down Expand Up @@ -143,7 +142,6 @@ public void close() throws Exception {
int[] location = getPlacement();
String locationStr = PApplet.join(PApplet.str(location), ",");
PreferencesData.set("last.serial.location", locationStr);
textArea.setText("");
serial.dispose();
serial = null;
}
Expand Down