This commit increases the number of sketches able to be spawned from

within the IDE. It now allows 676 sketches rather than 26 ('a' to
'zz' rather than 'a' to  'z').
This commit is contained in:
Chris--A 2015-06-19 16:10:43 +10:00
parent a1e5271015
commit 505ff17d43
1 changed files with 12 additions and 3 deletions

View File

@ -723,9 +723,10 @@ public class Base {
int day = cal.get(Calendar.DAY_OF_MONTH); // 1..31 int day = cal.get(Calendar.DAY_OF_MONTH); // 1..31
int month = cal.get(Calendar.MONTH); // 0..11 int month = cal.get(Calendar.MONTH); // 0..11
String purty = months[month] + PApplet.nf(day, 2); String purty = months[month] + PApplet.nf(day, 2);
do { do {
if (index == 26) { if (index == 26*26) {
// In 0159, avoid running past z by sending people outdoors. // In 0166, avoid running past zz by sending people outdoors.
if (!breakTime) { if (!breakTime) {
showWarning(_("Time for a Break"), showWarning(_("Time for a Break"),
_("You've reached the limit for auto naming of new sketches\n" + _("You've reached the limit for auto naming of new sketches\n" +
@ -737,7 +738,15 @@ public class Base {
} }
return null; return null;
} }
newbieName = "sketch_" + purty + ((char) ('a' + index));
int multiples = index / 26;
if(multiples > 0){
newbieName = ((char) ('a' + (multiples-1))) + "" + ((char) ('a' + (index % 26))) + "";
}else{
newbieName = ((char) ('a' + index)) + "";
}
newbieName = "sketch_" + purty + newbieName;
newbieDir = new File(newbieParentDir, newbieName); newbieDir = new File(newbieParentDir, newbieName);
index++; index++;
// Make sure it's not in the temp folder *and* it's not in the sketchbook // Make sure it's not in the temp folder *and* it's not in the sketchbook