mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-19 13:54:23 +01:00
Fixing help menu links, integrating copy as html, and modifying EditorToolbar labels (Run -> Verify, Export -> Upload).
This commit is contained in:
parent
d589209e92
commit
5f26d058e6
@ -1636,7 +1636,16 @@ public class Base {
|
||||
File referenceFile = new File(referenceFolder, filename);
|
||||
openURL(referenceFile.getAbsolutePath());
|
||||
}
|
||||
|
||||
|
||||
static public void showGettingStarted() {
|
||||
if (Base.isMacOS()) {
|
||||
Base.showReference("Guide_MacOSX.html");
|
||||
} else if (Base.isWindows()) {
|
||||
Base.showReference("Guide_Windows.html");
|
||||
} else {
|
||||
Base.openURL("http://www.arduino.cc/playground/Learning/Linux");
|
||||
}
|
||||
}
|
||||
|
||||
static public void showReference() {
|
||||
showReference("index.html");
|
||||
@ -1644,7 +1653,7 @@ public class Base {
|
||||
|
||||
|
||||
static public void showEnvironment() {
|
||||
showReference("environment" + File.separator + "index.html");
|
||||
showReference("Guide_Environment.html");
|
||||
}
|
||||
|
||||
|
||||
@ -1654,9 +1663,14 @@ public class Base {
|
||||
|
||||
|
||||
static public void showTroubleshooting() {
|
||||
showReference("troubleshooting" + File.separator + "index.html");
|
||||
showReference("Guide_Troubleshooting.html");
|
||||
}
|
||||
|
||||
|
||||
|
||||
static public void showFAQ() {
|
||||
showReference("faq.html");
|
||||
}
|
||||
|
||||
|
||||
// .................................................................
|
||||
|
||||
|
@ -981,7 +981,7 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
item = new JMenuItem("Getting Started");
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Base.openURL("http://processing.org/learning/gettingstarted/");
|
||||
Base.showGettingStarted();
|
||||
}
|
||||
});
|
||||
menu.add(item);
|
||||
@ -1023,15 +1023,15 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
item = new JMenuItem("Frequently Asked Questions");
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Base.openURL("http://processing.org/faq.html");
|
||||
Base.showFAQ();
|
||||
}
|
||||
});
|
||||
menu.add(item);
|
||||
|
||||
item = newJMenuItem("Visit Processing.org", '5');
|
||||
item = new JMenuItem("Visit Arduino.cc");
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Base.openURL("http://processing.org/");
|
||||
Base.openURL("http://arduino.cc/");
|
||||
}
|
||||
});
|
||||
menu.add(item);
|
||||
@ -1039,7 +1039,7 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
// macosx already has its own about menu
|
||||
if (!Base.isMacOS()) {
|
||||
menu.addSeparator();
|
||||
item = new JMenuItem("About Processing");
|
||||
item = new JMenuItem("About Arduino");
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
base.handleAbout();
|
||||
@ -1089,7 +1089,19 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
// SwingUtilities.invokeLater(new Runnable() {
|
||||
// public void run() {
|
||||
new DiscourseFormat(Editor.this).show();
|
||||
new DiscourseFormat(Editor.this, false).show();
|
||||
// }
|
||||
// });
|
||||
}
|
||||
});
|
||||
menu.add(item);
|
||||
|
||||
item = newJMenuItemAlt("Copy as HTML", 'C');
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
// SwingUtilities.invokeLater(new Runnable() {
|
||||
// public void run() {
|
||||
new DiscourseFormat(Editor.this, true).show();
|
||||
// }
|
||||
// });
|
||||
}
|
||||
@ -1560,7 +1572,12 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
|
||||
|
||||
protected void handleDiscourseCopy() {
|
||||
new DiscourseFormat(Editor.this).show();
|
||||
new DiscourseFormat(Editor.this, false).show();
|
||||
}
|
||||
|
||||
|
||||
protected void handleHTMLCopy() {
|
||||
new DiscourseFormat(Editor.this, true).show();
|
||||
}
|
||||
|
||||
|
||||
@ -2367,6 +2384,14 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
});
|
||||
this.add(discourseItem);
|
||||
|
||||
discourseItem = new JMenuItem("Copy as HTML");
|
||||
discourseItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
handleHTMLCopy();
|
||||
}
|
||||
});
|
||||
this.add(discourseItem);
|
||||
|
||||
item = new JMenuItem("Paste");
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
@ -35,7 +35,7 @@ import javax.swing.event.*;
|
||||
public class EditorToolbar extends JComponent implements MouseInputListener {
|
||||
|
||||
static final String title[] = {
|
||||
"Run", "Stop", "New", "Open", "Save", "Export"
|
||||
"Verify", "Stop", "New", "Open", "Save", "Upload"
|
||||
};
|
||||
|
||||
static final int BUTTON_COUNT = title.length;
|
||||
|
@ -55,6 +55,7 @@ public class DiscourseFormat {
|
||||
Editor editor;
|
||||
// JTextArea of the actual Editor
|
||||
JEditTextArea textarea;
|
||||
boolean html;
|
||||
|
||||
|
||||
/**
|
||||
@ -62,9 +63,10 @@ public class DiscourseFormat {
|
||||
* from the actual Processing Tab ready to send to the processing discourse
|
||||
* web (copy & paste)
|
||||
*/
|
||||
public DiscourseFormat(Editor editor) {
|
||||
public DiscourseFormat(Editor editor, boolean html) {
|
||||
this.editor = editor;
|
||||
this.textarea = editor.getTextArea();
|
||||
this.html = html;
|
||||
}
|
||||
|
||||
|
||||
@ -73,7 +75,7 @@ public class DiscourseFormat {
|
||||
*/
|
||||
public void show() {
|
||||
// [code] tag cancels other tags, using [quote]
|
||||
StringBuffer cf = new StringBuffer("[quote]\n");
|
||||
StringBuffer cf = new StringBuffer(html ? "<pre>\n" : "[quote]\n");
|
||||
|
||||
int selStart = textarea.getSelectionStart();
|
||||
int selStop = textarea.getSelectionStop();
|
||||
@ -97,7 +99,7 @@ public class DiscourseFormat {
|
||||
appendFormattedLine(cf, i);
|
||||
}
|
||||
|
||||
cf.append("\n[/quote]");
|
||||
cf.append(html ? "\n</pre>" : "\n[/quote]");
|
||||
|
||||
StringSelection formatted = new StringSelection(cf.toString());
|
||||
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
|
||||
@ -107,8 +109,9 @@ public class DiscourseFormat {
|
||||
}
|
||||
});
|
||||
|
||||
editor.statusNotice("Code formatted for processing.org/discourse " +
|
||||
"has been copied to the clipboard.");
|
||||
editor.statusNotice("Code formatted for " +
|
||||
(html ? "HTML" : "the Arduino forum ") +
|
||||
" has been copied to the clipboard.");
|
||||
}
|
||||
|
||||
|
||||
@ -178,12 +181,12 @@ public class DiscourseFormat {
|
||||
// fm = painter.getFontMetrics();
|
||||
} else {
|
||||
// Place open tags []
|
||||
cf.append("[color=#");
|
||||
cf.append(html ? "<span style=\"color: #" : "[color=#");
|
||||
cf.append(PApplet.hex(styles[id].getColor().getRGB() & 0xFFFFFF, 6));
|
||||
cf.append("]");
|
||||
cf.append(html ? ";\">" : "]");
|
||||
|
||||
if (styles[id].isBold())
|
||||
cf.append("[b]");
|
||||
cf.append(html ? "<b>" : "[b]");
|
||||
|
||||
// fm = styles[id].getFontMetrics(defaultFont);
|
||||
}
|
||||
@ -193,7 +196,7 @@ public class DiscourseFormat {
|
||||
char c = segmentArray[segmentOffset + offset + j];
|
||||
if (offset == 0 && c == ' ') {
|
||||
// Works on Safari but not Camino 1.6.3 or Firefox 2.x on OS X.
|
||||
cf.append('\u00A0'); //
|
||||
cf.append(html ? " " : '\u00A0'); //
|
||||
// if ((j % 2) == 1) {
|
||||
// cf.append("[b]\u00A0[/b]");
|
||||
// } else {
|
||||
@ -204,9 +207,9 @@ public class DiscourseFormat {
|
||||
}
|
||||
// Place close tags [/]
|
||||
if (j == (length - 1) && id != Token.NULL && styles[id].isBold())
|
||||
cf.append("[/b]");
|
||||
cf.append(html ? "</b>" : "[/b]");
|
||||
if (j == (length - 1) && id != Token.NULL)
|
||||
cf.append("[/color]");
|
||||
cf.append(html ? "</span>" : "[/color]");
|
||||
// int charWidth;
|
||||
// if (c == '\t') {
|
||||
// charWidth = (int) painter
|
||||
|
Loading…
x
Reference in New Issue
Block a user