Skip to content

Commit 2c5a86e

Browse files
committed
Merge branch 'master' of github.com:arduino/Arduino into LUFA_bootloader
2 parents c46e178 + 0db906f commit 2c5a86e

File tree

8 files changed

+105
-21
lines changed

8 files changed

+105
-21
lines changed

app/src/processing/app/EditorStatus.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
import java.awt.*;
2727
import java.awt.event.*;
2828
import javax.swing.*;
29+
import java.awt.datatransfer.*;
30+
import static processing.app.I18n._;
2931

3032

3133
/**
@@ -68,6 +70,7 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
6870
JButton okButton;
6971
JTextField editField;
7072
JProgressBar progressBar;
73+
JButton copyErrorButton;
7174

7275
//Thread promptThread;
7376
int response;
@@ -108,6 +111,7 @@ public void empty() {
108111
public void notice(String message) {
109112
mode = NOTICE;
110113
this.message = message;
114+
copyErrorButton.setVisible(false);
111115
//update();
112116
repaint();
113117
}
@@ -120,6 +124,7 @@ public void unnotice(String unmessage) {
120124
public void error(String message) {
121125
mode = ERR;
122126
this.message = message;
127+
copyErrorButton.setVisible(true);
123128
repaint();
124129
}
125130

@@ -177,6 +182,7 @@ public void progress(String message)
177182
this.message = message;
178183
progressBar.setIndeterminate(false);
179184
progressBar.setVisible(true);
185+
copyErrorButton.setVisible(false);
180186
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
181187
repaint();
182188
}
@@ -189,6 +195,7 @@ public void progressIndeterminate(String message)
189195
progressBar.setIndeterminate(true);
190196
progressBar.setValue(50);
191197
progressBar.setVisible(true);
198+
copyErrorButton.setVisible(false);
192199
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
193200
repaint();
194201
}
@@ -207,6 +214,7 @@ public void unprogress()
207214
if (Preferences.getBoolean("editor.beep.compile")) {
208215
Toolkit.getDefaultToolkit().beep();
209216
}
217+
if (progressBar == null) return;
210218
progressBar.setVisible(false);
211219
progressBar.setValue(0);
212220
setCursor(null);
@@ -216,6 +224,7 @@ public void unprogress()
216224

217225
public void progressUpdate(int value)
218226
{
227+
if (progressBar == null) return;
219228
progressBar.setValue(value);
220229
repaint();
221230
}
@@ -438,6 +447,29 @@ public void keyTyped(KeyEvent event) {
438447
add(progressBar);
439448
progressBar.setVisible(false);
440449

450+
copyErrorButton = new JButton(_("Copy To Clipboard"));
451+
add(copyErrorButton);
452+
//copyErrorButton.setVisible(true);
453+
copyErrorButton.setVisible(false);
454+
System.out.println("create copyErrorButton");
455+
copyErrorButton.addActionListener(new ActionListener() {
456+
public void actionPerformed(ActionEvent e) {
457+
String message="";
458+
if ((Preferences.getBoolean("build.verbose")) == false) {
459+
message = " " + _("This report would have more information with") + "\n";
460+
message += " \"" + _("Show verbose output during compilation") + "\"\n";
461+
message += " " + _("enabled in File > Preferences.") + "\n";
462+
}
463+
message += _("Arduino: ") + Base.VERSION_NAME + " (" + System.getProperty("os.name") + "), ";
464+
message += _("Board: ") + "\"" + Base.getBoardPreferences().get("name") + "\"\n";
465+
message += editor.console.consoleTextPane.getText().trim();
466+
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
467+
StringSelection data = new StringSelection(message);
468+
clipboard.setContents(data, null);
469+
Clipboard unixclipboard = Toolkit.getDefaultToolkit().getSystemSelection();
470+
if (unixclipboard != null) unixclipboard.setContents(data, null);
471+
}
472+
});
441473
}
442474
}
443475

@@ -470,6 +502,10 @@ protected void setButtonBounds() {
470502
editField.setBounds(yesLeft - Preferences.BUTTON_WIDTH, editTop,
471503
editWidth, editHeight);
472504
progressBar.setBounds(noLeft, editTop, editWidth, editHeight);
505+
506+
Dimension copyErrorButtonSize = copyErrorButton.getPreferredSize();
507+
copyErrorButton.setLocation(sizeW - copyErrorButtonSize.width - 5, top);
508+
copyErrorButton.setSize(copyErrorButtonSize.width, Preferences.BUTTON_HEIGHT);
473509
}
474510

475511

app/src/processing/app/syntax/JEditTextArea.java

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1187,6 +1187,16 @@ public void select(int start, int end)
11871187
selectionEndLine = newEndLine;
11881188
biasLeft = newBias;
11891189

1190+
if (newStart != newEnd) {
1191+
Clipboard unixclipboard = getToolkit().getSystemSelection();
1192+
if (unixclipboard != null) {
1193+
String selection = getSelectedText();
1194+
if (selection != null) {
1195+
unixclipboard.setContents(new StringSelection(selection), null);
1196+
}
1197+
}
1198+
}
1199+
11901200
fireCaretEvent();
11911201
}
11921202

@@ -1649,7 +1659,11 @@ public void copy()
16491659
for(int i = 0; i < repeatCount; i++)
16501660
buf.append(selection);
16511661

1652-
clipboard.setContents(new StringSelection(buf.toString()),null);
1662+
Transferable t = new StringSelection(buf.toString());
1663+
clipboard.setContents(t, null);
1664+
1665+
Clipboard unixclipboard = getToolkit().getSystemSelection();
1666+
if (unixclipboard != null) unixclipboard.setContents(t, null);
16531667
}
16541668
}
16551669

@@ -2206,6 +2220,25 @@ public void mousePressed(MouseEvent evt)
22062220
return;
22072221
}
22082222

2223+
// on Linux, middle button pastes selected text
2224+
if ((evt.getModifiers() & InputEvent.BUTTON2_MASK) != 0) {
2225+
Clipboard unixclipboard = getToolkit().getSystemSelection();
2226+
if (unixclipboard != null) {
2227+
Transferable t = unixclipboard.getContents(null);
2228+
if (t != null && t.isDataFlavorSupported(DataFlavor.stringFlavor)) {
2229+
try {
2230+
String s = (String)t.getTransferData(DataFlavor.stringFlavor);
2231+
s = s.replace('\u00A0', ' ');
2232+
if (editable) setSelectedText(s);
2233+
} catch (Exception e) {
2234+
System.err.println(e);
2235+
e.printStackTrace();
2236+
}
2237+
}
2238+
return;
2239+
}
2240+
}
2241+
22092242
int line = yToLine(evt.getY());
22102243
int offset = xToOffset(line,evt.getX());
22112244
int dot = getLineStartOffset(line) + offset;

app/src/processing/app/tools/DiscourseFormat.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ public void lostOwnership(Clipboard clipboard, Transferable contents) {
108108
// i don't care about ownership
109109
}
110110
});
111+
Clipboard unixclipboard = Toolkit.getDefaultToolkit().getSystemSelection();
112+
if (unixclipboard != null) unixclipboard.setContents(formatted, null);
111113

112114
editor.statusNotice("Code formatted for " +
113115
(html ? "HTML" : "the Arduino forum ") +

build/shared/examples/02.Digital/Debounce/Debounce.ino

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,18 @@
1919
by David A. Mellis
2020
modified 30 Aug 2011
2121
by Limor Fried
22+
modified 28 Dec 2012
23+
by Mike Walters
2224
23-
This example code is in the public domain.
25+
This example code is in the public domain.
2426
2527
http://www.arduino.cc/en/Tutorial/Debounce
2628
*/
2729

2830
// constants won't change. They're used here to
2931
// set pin numbers:
30-
const int buttonPin = 2; // the number of the pushbutton pin
31-
const int ledPin = 13; // the number of the LED pin
32+
const int buttonPin = 2; // the number of the pushbutton pin
33+
const int ledPin = 13; // the number of the LED pin
3234

3335
// Variables will change:
3436
int ledState = HIGH; // the current state of the output pin
@@ -43,6 +45,9 @@ long debounceDelay = 50; // the debounce time; increase if the output flicker
4345
void setup() {
4446
pinMode(buttonPin, INPUT);
4547
pinMode(ledPin, OUTPUT);
48+
49+
// set initial LED state
50+
digitalWrite(ledPin, ledState);
4651
}
4752

4853
void loop() {
@@ -62,11 +67,20 @@ void loop() {
6267
if ((millis() - lastDebounceTime) > debounceDelay) {
6368
// whatever the reading is at, it's been there for longer
6469
// than the debounce delay, so take it as the actual current state:
65-
buttonState = reading;
70+
71+
// if the button state has changed:
72+
if (reading != buttonState) {
73+
buttonState = reading;
74+
75+
// only toggle the LED if the new button state is HIGH
76+
if (buttonState == HIGH) {
77+
ledState = !ledState;
78+
}
79+
}
6680
}
6781

68-
// set the LED using the state of the button:
69-
digitalWrite(ledPin, buttonState);
82+
// set the LED:
83+
digitalWrite(ledPin, ledState);
7084

7185
// save the reading. Next time through the loop,
7286
// it'll be the lastButtonState:

build/shared/examples/09.USB/Keyboard/KeyboardMessage/KeyboardMessage.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
http://www.arduino.cc/en/Tutorial/KeyboardButton
1919
*/
2020

21-
const int buttonPin = 2; // input pin for pushbutton
21+
const int buttonPin = 4; // input pin for pushbutton
2222
int previousButtonState = HIGH; // for checking the state of a pushButton
2323
int counter = 0; // button push counter
2424

libraries/Ethernet/examples/WebServer/WebServer.ino

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
// The IP address will be dependent on your local network:
2323
byte mac[] = {
2424
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
25-
IPAddress ip(192,168,1, 177);
25+
IPAddress ip(192,168,1,177);
2626

2727
// Initialize the Ethernet server library
2828
// with the IP address and port you want to use
@@ -63,12 +63,11 @@ void loop() {
6363
// send a standard http response header
6464
client.println("HTTP/1.1 200 OK");
6565
client.println("Content-Type: text/html");
66-
client.println("Connection: close");
66+
client.println("Connection: close"); // the connection will be closed after completion of the response
67+
client.println("Refresh: 5"); // refresh the page automatically every 5 sec
6768
client.println();
6869
client.println("<!DOCTYPE HTML>");
6970
client.println("<html>");
70-
// add a meta refresh tag, so the browser pulls again every 5 seconds:
71-
client.println("<meta http-equiv=\"refresh\" content=\"5\">");
7271
// output the value of each analog input pin
7372
for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
7473
int sensorReading = analogRead(analogChannel);

libraries/SPI/examples/DigitalPotControl/DigitalPotControl.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ void loop() {
6060

6161
}
6262

63-
int digitalPotWrite(int address, int value) {
63+
void digitalPotWrite(int address, int value) {
6464
// take the SS pin low to select the chip:
6565
digitalWrite(slaveSelectPin,LOW);
6666
// send in the address and value via SPI:
6767
SPI.transfer(address);
6868
SPI.transfer(value);
6969
// take the SS pin high to de-select the chip:
7070
digitalWrite(slaveSelectPin,HIGH);
71-
}
71+
}

libraries/WiFi/examples/WiFiWebServer/WiFiWebServer.ino

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include <WiFi.h>
2323

2424

25-
char ssid[] = "yourNetwork"; // your network SSID (name)
25+
char ssid[] = "yourNetwork"; // your network SSID (name)
2626
char pass[] = "secretPassword"; // your network password
2727
int keyIndex = 0; // your network key Index number (needed only for WEP)
2828

@@ -78,12 +78,11 @@ void loop() {
7878
// send a standard http response header
7979
client.println("HTTP/1.1 200 OK");
8080
client.println("Content-Type: text/html");
81-
client.println("Connection: close");
81+
client.println("Connection: close"); // the connection will be closed after completion of the response
82+
client.println("Refresh: 5"); // refresh the page automatically every 5 sec
8283
client.println();
8384
client.println("<!DOCTYPE HTML>");
8485
client.println("<html>");
85-
// add a meta refresh tag, so the browser pulls again every 5 seconds:
86-
client.println("<meta http-equiv=\"refresh\" content=\"5\">");
8786
// output the value of each analog input pin
8887
for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
8988
int sensorReading = analogRead(analogChannel);
@@ -108,9 +107,10 @@ void loop() {
108107
}
109108
// give the web browser time to receive the data
110109
delay(1);
111-
// close the connection:
112-
client.stop();
113-
Serial.println("client disonnected");
110+
111+
// close the connection:
112+
client.stop();
113+
Serial.println("client disonnected");
114114
}
115115
}
116116

0 commit comments

Comments
 (0)