-
-
Notifications
You must be signed in to change notification settings - Fork 162
Adds new Processing sketch templates to enhance the user's initial coding experience in the Processing IDE. #1020
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
Changes from 4 commits
f727013
db4b6b9
0e5507a
089607d
7276460
152b14c
6ba547a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -586,9 +586,7 @@ public JMenu initDefaultFileMenu() { | |
| item.addActionListener(e -> handleNew()); | ||
| defaultFileMenu.add(item); | ||
|
|
||
| item = Toolkit.newJMenuItem(Language.text("menu.file.open"), 'O'); | ||
| item.addActionListener(e -> handleOpenPrompt()); | ||
| defaultFileMenu.add(item); | ||
|
|
||
|
|
||
| item = Toolkit.newJMenuItemShift(Language.text("menu.file.sketchbook"), 'K'); | ||
| item.addActionListener(e -> showSketchbookFrame()); | ||
|
|
@@ -598,6 +596,10 @@ public JMenu initDefaultFileMenu() { | |
| item.addActionListener(e -> thinkDifferentExamples()); | ||
| defaultFileMenu.add(item); | ||
|
|
||
| item = Toolkit.newJMenuItem(Language.text("menu.file.templates"), 'T'); | ||
| //item.addActionListener(e -> handleTemplates()); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One more comment |
||
| defaultFileMenu.add(item); | ||
|
|
||
| return defaultFileMenu; | ||
| } | ||
|
|
||
|
|
@@ -1095,16 +1097,15 @@ public void modeRemoved(Mode mode) { | |
| /** | ||
| * Create a new untitled document in a new sketch window. | ||
| */ | ||
| public void handleNew() { | ||
| // long t1 = System.currentTimeMillis(); | ||
| public Editor handleNew() { | ||
| try { | ||
| // In 0126, untitled sketches will begin in the temp folder, | ||
| // and then moved to a new location because Save will default to Save As. | ||
| //File sketchbookDir = getSketchbookFolder(); | ||
| File newbieDir = SketchName.nextFolder(untitledFolder); | ||
|
|
||
| // User was told to go outside or other problem happened inside naming. | ||
| if (newbieDir == null) return; | ||
| if (newbieDir == null) return null; | ||
|
|
||
| // Make the directory for the new sketch | ||
| if (!newbieDir.mkdirs()) { | ||
|
|
@@ -1124,16 +1125,16 @@ public void handleNew() { | |
| } | ||
|
|
||
| String path = newbieFile.getAbsolutePath(); | ||
| handleOpenUntitled(path); | ||
| return handleOpenUntitled(path); | ||
|
|
||
| } catch (IOException e) { | ||
| Messages.showTrace("That's new to me", | ||
| "A strange and unexplainable error occurred\n" + | ||
| "while trying to create a new sketch.", e, false); | ||
| "A strange and unexplainable error occurred\n" + | ||
| "while trying to create a new sketch.", e, false); | ||
| return null; | ||
| } | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * Prompt for a sketch to open, and open it in a new window. | ||
| */ | ||
|
|
@@ -1288,6 +1289,8 @@ private void openContribBundle(String path) { | |
| }); | ||
| } | ||
|
|
||
| // Open templates to start with any work | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another |
||
|
|
||
|
|
||
| /** | ||
| * Return true if it's an obvious sketch folder: only .pde files, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,7 @@ menu.file.recent = Open Recent | |
| menu.file.sketchbook = Sketchbook... | ||
| menu.file.sketchbook.empty = Empty Sketchbook | ||
| menu.file.examples = Examples... | ||
| menu.file.templates=Templates | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe this should be cc @Stefterv
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. okay sir |
||
| menu.file.close = Close | ||
| menu.file.save = Save | ||
| menu.file.save_as = Save As... | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| // Basic Template | ||
| void setup() { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and @SableRaf named these in his original suggestion, so please change the file names to those of something else more appropriate
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure |
||
| size(800, 600); | ||
| background(255); | ||
| } | ||
|
|
||
| void draw() { | ||
| // Drawing code here | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| // Shape Drawing Template | ||
| void setup() { | ||
| size(800, 600); | ||
| background(255); | ||
| } | ||
|
|
||
| void draw() { | ||
| fill(150, 0, 0); | ||
| rect(100, 100, 200, 200); | ||
|
|
||
| fill(0, 150, 0); | ||
| ellipse(400, 300, 150, 150); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| // Animation Template | ||
| float x = 0; | ||
| float speed = 2; | ||
|
|
||
| void setup() { | ||
| size(800, 600); | ||
| background(255); | ||
| } | ||
|
|
||
| void draw() { | ||
| background(255); | ||
| ellipse(x, height/2, 50, 50); | ||
| x += speed; | ||
| if (x > width || x < 0) { | ||
| speed *= -1; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| // Interactive Template | ||
| void setup() { | ||
| size(800, 600); | ||
| background(255); | ||
| } | ||
|
|
||
| void draw() { | ||
| background(255); | ||
| fill(0, 0, 150); | ||
| ellipse(mouseX, mouseY, 50, 50); | ||
| } | ||
|
|
||
| void mousePressed() { | ||
| background(0, 255, 0); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realised that the file->open menu item certainly should not be deleted here