We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOther Libraries › Tool: Initialize sketch from a template file.
Page Index Toggle Pages: 1
Tool: Initialize sketch from a template file. (Read 4147 times)
Tool: Initialize sketch from a template file.
Dec 15th, 2009, 7:11pm
 
Hello!

I'd like to share my new P5 tool.
InitSketchFromTemplate Tool!

See it in action>>>

This tool reads a txt file located in the same folder as the tool jar file and loads it as a template for new sketches, you edit the default template in a plain text editor and use the Tools menu option to load the text and make it appear as the first lines of code for your new sketches.

Read the included usage.txt file for further details. Source code is included.

Check it out and send some feedback and workarounds or code optimizations whenever you'd like.

Good coding! Smiley

History:

December 15, 2009: FIRST RELEASE.

December 18, 1009: UPDATED TO VERION 0.2

December 20, 2009: PORTED PROJECT TO SOURCEFORGE.NET
Re: Tool: Initialize sketch from a template file.
Reply #1 - Dec 16th, 2009, 9:23am
 
nice! this will save some time. and was something i was thinking about for a while.
Another idea i had, that would maybe be helpfull. To put some of the most used snippeds. like key pressed or a for loop for example to a little menue you get when right clicking the mouse.
Re: Tool: Initialize sketch from a template file.
Reply #2 - Dec 16th, 2009, 10:08am
 
i was wondering why it didnt work at the beginning. i guess there is one folder that shouldnt be there. in the source folder is another initSketchFromTemplate folder...
Re: Tool: Initialize sketch from a template file.
Reply #3 - Dec 18th, 2009, 6:52pm
 
Uploaded version 0.2 of the tool, optimized the code, cleansed the innaccurate doc comments, included Javadoc. removed the extra InitSketchFromTemplate extra folder inside of src.

InitSketchFromTemplate P5 Tool (version 0.2)! (redirected to SourceForge)

Sourcecode is still included.

Enjoy! Smiley
Re: Tool: Initialize sketch from a template file.
Reply #4 - Dec 18th, 2009, 10:46pm
 
Thanks for the feedback, Cedric!

Cedric wrote on Dec 16th, 2009, 9:23am:
Another idea i had, that would maybe be helpfull. To put some of the most used snippeds. like key pressed or a for loop for example to a little menue you get when right clicking the mouse.


I have not investigated the P5's editor in deep, but if I can get inside of the context menu of the editor definetely will make that happen, or hope so Tongue

If anybody knows if this is possible please let me know Smiley
Re: Tool: Initialize sketch from a template file.
Reply #5 - Dec 19th, 2009, 4:07am
 
Tools cannot have keyboard shortcuts assigned to them, and I'm pretty sure that tools are also unable to modify the context menu.
Re: Tool: Initialize sketch from a template file.
Reply #6 - Dec 19th, 2009, 4:30am
 
thats sad, how would you be able to programm some useful tools if there are no ways to integrate them into the IDE.
Re: Tool: Initialize sketch from a template file.
Reply #7 - Dec 19th, 2009, 1:00pm
 
d.rifkin wrote on Dec 19th, 2009, 4:07am:
Tools cannot have keyboard shortcuts assigned to them, and I'm pretty sure that tools are also unable to modify the context menu.


Is it possible to develop a P5 extension, not a tool, that gets inside the editor context menu

Inserting for loops, while loops, do-while loops, switch statements, ArrayList iterators and such code in that way would be awesome! Smiley
Re: Tool: Initialize sketch from a template file.
Reply #8 - Dec 19th, 2009, 2:05pm
 
The editor is open source, so you should be able to patch it and rebuild it to get into the context menu or something like that.  The problem with that is (to my knowledge) there's no easy way to just distribute an extension.

However, I wouldn't be surprised if tools eventually got the ability to use shortcuts.  

From the tools developer documentation:
Quote:
Not doing shortcuts for now, because resolving them between tools
(and the rest of the interface) is fugly. We would also need additional
modifiers for shift and alt. It just gets messy quick.


I think getting tools to be more popular will probably help speed up any development of the tools API, and for that I thank you for making a new tool.

edit: looked around a bit more and found a recent bug tracker discussion about adding shortcuts to tools.
Re: Tool: Initialize sketch from a template file.
Reply #9 - Dec 19th, 2009, 3:21pm
 
Thank you very much for your words d.rifkin Smiley

I think I'll keep myself out of the core hacking until I get a lot more experience.

The discussion you posted in your reply edit looks nice, let's hope that such an enhancement can arrive some day Smiley
Re: Tool: Initialize sketch from a template file.
Reply #10 - Dec 19th, 2009, 10:42pm
 
Ported the Project to SourceForge.net (Link to direct download)

I'll be filling in the Subversion repository as soon as I learn more about that. Webpage may me created in the following days, thanks for following.

Re: Tool: Initialize sketch from a template file.
Reply #11 - Dec 27th, 2009, 4:24pm
 
I made a simple tutorial on how to use and customize the tool, take a seat and enjoy!

http://www.vimeo.com/8343334

You can also brouse the source repository:
http://inittemplatep5.svn.sourceforge.net/viewvc/inittemplatep5/
Page Index Toggle Pages: 1