Skip to content

IDE: prevent multiple 'bad name' notifications. #3122

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

Closed
wants to merge 10 commits into from
Closed
16 changes: 16 additions & 0 deletions app/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
charset = utf-8

[*.{md,adoc}]
indent_style = space
trim_trailing_whitespace = false
2 changes: 1 addition & 1 deletion app/src/processing/app/Base.java
Original file line number Diff line number Diff line change
Expand Up @@ -1787,7 +1787,7 @@ public void paint(Graphics g) {

g.setFont(new Font("SansSerif", Font.PLAIN, 11));
g.setColor(Color.white);
g.drawString(BaseNoGui.VERSION_NAME, 33, 20);
g.drawString(BaseNoGui.VERSION_NAME_LONG, 33, 20);
}
};
window.addMouseListener(new MouseAdapter() {
Expand Down
14 changes: 7 additions & 7 deletions app/src/processing/app/Editor.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
import java.util.zip.*;

import javax.swing.*;
import javax.swing.border.EmptyBorder;
import javax.swing.border.MatteBorder;
import javax.swing.event.*;
import javax.swing.text.*;
import javax.swing.undo.*;
Expand Down Expand Up @@ -256,7 +256,7 @@ public void windowDeactivated(WindowEvent e) {

// RTextScrollPane
scrollPane = new RTextScrollPane(textarea, true);
scrollPane.setBorder(new EmptyBorder(0, 0, 0, 0));
scrollPane.setBorder(new MatteBorder(0, 6, 0, 0, Theme.getColor("editor.bgcolor")));
scrollPane.setViewportBorder(BorderFactory.createEmptyBorder());
scrollPane.setLineNumbersEnabled(Preferences.getBoolean("editor.linenumbers"));
scrollPane.setIconRowHeaderEnabled(false);
Expand All @@ -265,7 +265,7 @@ public void windowDeactivated(WindowEvent e) {
gutter.setBookmarkingEnabled(false);
//gutter.setBookmarkIcon(CompletionsRenderer.getIcon(CompletionType.TEMPLATE));
gutter.setIconRowHeaderInheritsGutterBackground(true);

upper.add(scrollPane);
splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, upper, consolePanel);

Expand Down Expand Up @@ -1119,7 +1119,9 @@ public int compare(BoardPort o1, BoardPort o2) {
} else {
lastProtocolTranslated = port.getProtocol();
}
serialMenu.add(new JMenuItem(_(lastProtocolTranslated)));
JMenuItem lastProtocolMenuItem = new JMenuItem(_(lastProtocolTranslated));
lastProtocolMenuItem.setEnabled(false);
serialMenu.add(lastProtocolMenuItem);
}
String address = port.getAddress();
String label = port.getLabel();
Expand Down Expand Up @@ -2297,9 +2299,7 @@ protected boolean handleOpenInternal(File sketchFile) {
return false;
}
header.rebuild();
// Set the title of the window to "sketch_070752a - Processing 0126"
setTitle(I18n.format(_("{0} | Arduino {1}"), sketch.getName(),
BaseNoGui.VERSION_NAME));
setTitle(I18n.format(_("{0} | Arduino {1}"), sketch.getName(), BaseNoGui.VERSION_NAME_LONG));
// Disable untitled setting from previous document, if any
untitled = false;

Expand Down
2 changes: 1 addition & 1 deletion app/src/processing/app/EditorStatus.java
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ public void keyTyped(KeyEvent event) {
copyErrorButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String message = "";
message += _("Arduino: ") + BaseNoGui.VERSION_NAME + " (" + System.getProperty("os.name") + "), ";
message += _("Arduino: ") + BaseNoGui.VERSION_NAME_LONG + " (" + System.getProperty("os.name") + "), ";
message += _("Board: ") + "\"" + Base.getBoardPreferences().get("name") + "\"\n\n";
message += editor.console.consoleTextPane.getText().trim();
if ((PreferencesData.getBoolean("build.verbose")) == false) {
Expand Down
16 changes: 16 additions & 0 deletions arduino-core/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
charset = utf-8

[*.{md,adoc}]
indent_style = space
trim_trailing_whitespace = false
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import java.io.InputStream;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;

import static processing.app.I18n._;

Expand All @@ -57,6 +58,8 @@ public class LibrariesIndexer {
private final File indexFile;
private final File stagingFolder;
private File sketchbookLibrariesFolder;

private static final List<String> badLibNotified = new ArrayList<String>();

public LibrariesIndexer(File preferencesFolder) {
indexFile = new File(preferencesFolder, "library_index.json");
Expand Down Expand Up @@ -117,11 +120,18 @@ private void scanInstalledLibraries(File folder, boolean isSketchbook) {

for (File subfolder : list) {
if (!BaseNoGui.isSanitaryName(subfolder.getName())) {
String mess = I18n.format(_("The library \"{0}\" cannot be used.\n"

// Detect whether the current folder name has already had a notification.
if(!badLibNotified.contains(subfolder.getName())) {

badLibNotified.add(subfolder.getName());

String mess = I18n.format(_("The library \"{0}\" cannot be used.\n"
+ "Library names must contain only basic letters and numbers.\n"
+ "(ASCII only and no spaces, and it cannot start with a number)"),
subfolder.getName());
BaseNoGui.showMessage(_("Ignoring bad library name"), mess);
BaseNoGui.showMessage(_("Ignoring bad library name"), mess);
}
continue;
}

Expand Down
17 changes: 16 additions & 1 deletion arduino-core/src/processing/app/BaseNoGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,22 @@ public class BaseNoGui {
/** Version string to be used for build */
public static final int REVISION = 10605;
/** Extended version string displayed on GUI */
static String VERSION_NAME = "1.6.5";
public static final String VERSION_NAME = "1.6.5";
public static final String VERSION_NAME_LONG;

static {
String versionNameLong = VERSION_NAME;
File hourlyBuildTxt = new File(getContentFile("lib"), "hourlyBuild.txt");
if (hourlyBuildTxt.exists() && hourlyBuildTxt.canRead()) {
versionNameLong += " Hourly Build";
try {
versionNameLong += " " + FileUtils.readFileToString(hourlyBuildTxt).trim();
} catch (IOException e) {
//noop
}
}
VERSION_NAME_LONG = versionNameLong;
}

static File buildFolder;

Expand Down
28 changes: 19 additions & 9 deletions build/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
<!--echo message="os.arch = ${os.arch}" /-->
<!--echo message="os.version = ${os.version}" /-->

<tstamp>
<format property="BUILD_DATE" pattern="yyyy/MM/dd hh:mm"/>
</tstamp>

<!-- Sets properties for macosx/windows/linux depending on current system -->
<condition property="platform" value="macosx-old">
<and>
Expand Down Expand Up @@ -59,6 +63,8 @@

<target name="build" description="Build Arduino.">
<antcall target="${platform}-build" />

<antcall target="generate-hourly-build-txt"/>
</target>

<target name="run" description="Run Arduino.">
Expand Down Expand Up @@ -385,15 +391,15 @@
<antcall target="macosx-run-common"/>
</target>

<target name="macosx-run" depends="macosx-build" description="Run Mac OS X version">
<target name="macosx-run" depends="build" description="Run Mac OS X version">
<antcall target="macosx-run-common"/>
</target>

<target name="macosx-old-debug" depends="macosx-old-build" description="Run Mac OS X version">
<antcall target="macosx-debug-common"/>
</target>

<target name="macosx-debug" depends="macosx-build" description="Run Mac OS X version">
<target name="macosx-debug" depends="build" description="Run Mac OS X version">
<antcall target="macosx-debug-common"/>
</target>

Expand Down Expand Up @@ -468,7 +474,7 @@
<antcall target="macosx-dist-common"/>
</target>

<target name="macosx-dist" if="macosx" depends="macosx-build" description="Create a downloadable .zip for the Mac OS X version">
<target name="macosx-dist" if="macosx" depends="build" description="Create a downloadable .zip for the Mac OS X version">
<antcall target="macosx-dist-common"/>
</target>

Expand Down Expand Up @@ -637,11 +643,11 @@
<antcall target="package-library-index-json-bundle"/>
</target>

<target name="linux32-run" depends="linux32-build" description="Run Linux (32-bit) version">
<target name="linux32-run" depends="build" description="Run Linux (32-bit) version">
<exec executable="./linux/work/arduino" spawn="false" failonerror="true"/>
</target>

<target name="linux64-run" depends="linux64-build" description="Run Linux (64-bit) version">
<target name="linux64-run" depends="build" description="Run Linux (64-bit) version">
<exec executable="./linux/work/arduino" spawn="false" failonerror="true"/>
</target>

Expand Down Expand Up @@ -756,7 +762,7 @@
<target name="download-launch4j-windows">
<antcall target="unzip-with-ant-task">
<param name="archive_file" value="windows/launch4j-3.7-win32.zip"/>
<param name="archive_url" value="http://switch.dl.sourceforge.net/project/launch4j/launch4j-3/3.7/launch4j-3.7-win32.zip"/>
<param name="archive_url" value="http://downloads.sourceforge.net/project/launch4j/launch4j-3/3.7/launch4j-3.7-win32.zip"/>
<param name="final_folder" value="windows/launcher/launch4j"/>
<param name="dest_folder" value="windows/launcher/"/>
</antcall>
Expand All @@ -765,7 +771,7 @@
<target name="download-launch4j-linux">
<antcall target="untar">
<param name="archive_file" value="windows/launch4j-3.7-linux.tgz"/>
<param name="archive_url" value="http://switch.dl.sourceforge.net/project/launch4j/launch4j-3/3.7/launch4j-3.7-linux.tgz"/>
<param name="archive_url" value="http://downloads.sourceforge.net/project/launch4j/launch4j-3/3.7/launch4j-3.7-linux.tgz"/>
<param name="final_folder" value="windows/launcher/launch4j"/>
<param name="dest_folder" value="windows/launcher/"/>
</antcall>
Expand Down Expand Up @@ -858,12 +864,12 @@
<antcall target="package-library-index-json-bundle"/>
</target>

<target name="windows-run" depends="windows-build"
<target name="windows-run" depends="build"
description="Run windows version">
<exec executable="windows/work/arduino.exe" dir="windows/work" spawn="true" failonerror="true"/>
</target>

<target name="windows-dist" depends="windows-build" description="Create .zip files of windows version">
<target name="windows-dist" depends="build" description="Create .zip files of windows version">

<loadproperties srcfile="${WINDOWS_BUNDLED_JVM}/release" prefix="windows"/>

Expand Down Expand Up @@ -989,4 +995,8 @@
</exec>
</target>

<target name="generate-hourly-build-txt" if="hourly">
<echo file="${staging_folder}/work/${staging_hardware_folder}/../lib/hourlyBuild.txt">${BUILD_DATE}</echo>
</target>

</project>
10 changes: 10 additions & 0 deletions build/shared/lib/keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ INTERNAL LITERAL2 AnalogReference RESERVED_WORD_2
INTERNAL1V1 LITERAL2 AnalogReference RESERVED_WORD_2
INTERNAL2V56 LITERAL2 AnalogReference RESERVED_WORD_2

auto LITERAL2
constexpr LITERAL2 RESERVED_WORD_2
decltype LITERAL2 RESERVED_WORD_2
nullptr LITERAL2 RESERVED_WORD_2
char16_t LITERAL2 RESERVED_WORD_2
char32_t LITERAL2 RESERVED_WORD_2
static_assert LITERAL2 RESERVED_WORD_2
operator LITERAL2 RESERVED_WORD_2
enum LITERAL2 RESERVED_WORD_2
delete LITERAL2 RESERVED_WORD_2
boolean LITERAL2 BooleanVariables RESERVED_WORD_2
byte LITERAL2 Byte RESERVED_WORD_2
char LITERAL2 Char RESERVED_WORD_2
Expand Down
2 changes: 0 additions & 2 deletions build/windows/launcher/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@
</classPath>
<jre>
<path>java</path>
<minVersion>1.8.0</minVersion>
<jdkPreference>preferJre</jdkPreference>
<runtimeBits>32</runtimeBits>
<opt>-splash:./lib/splash.png</opt>
<opt>-Dsun.java2d.d3d=false</opt>
Expand Down
2 changes: 0 additions & 2 deletions build/windows/launcher/config_debug.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@
</classPath>
<jre>
<path>java</path>
<minVersion>1.8.0</minVersion>
<jdkPreference>preferJre</jdkPreference>
<runtimeBits>32</runtimeBits>
<opt>-Dsun.java2d.d3d=false</opt>
</jre>
Expand Down
14 changes: 10 additions & 4 deletions libraries/LiquidCrystal/src/LiquidCrystal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,18 @@ void LiquidCrystal::begin(uint8_t cols, uint8_t lines, uint8_t dotsize) {

}

/*
in some 16x4 LCD when line 3 and 4 are not placed correctly you may try:
setRowOffsets(0x00, 0x40, 0x14, 0x54)
or
setRowOffsets(0x00, 0x40, 0x10, 0x50)
*/
void LiquidCrystal::setRowOffsets(int row0, int row1, int row2, int row3)
{
_row_offsets[0] = row0;
_row_offsets[1] = row1;
_row_offsets[2] = row2;
_row_offsets[3] = row3;
_row_offsets[0] = row0;
_row_offsets[1] = row1;
_row_offsets[2] = row2;
_row_offsets[3] = row3;
}

/********** high level commands, for the user! */
Expand Down