Page 1 of 1

Add default text to each new code page

Posted: Wed Aug 08, 2012 6:12 pm
by blueb
Since I occasionally get bugs that could easily be solved by using EnableExplicit...

Is it possible to add an Editbox on the General Preferences Dialog that would enable a user to add some default text to each new codepage?

example:

X - Add the following text to each new codepage:

Code: Select all


; ===============================
;  Fill in specific details:
;  Date:
;  Version:
;  Coded by:
; ===============================
EnableExplicit

Re: Add default text to each new code page

Posted: Wed Aug 08, 2012 6:27 pm
by Tenaja
Yes, either a text header, or a default template file would be nice.

Re: Add default text to each new code page

Posted: Wed Aug 08, 2012 7:13 pm
by luis
You can already have many different templates in the Template tool.
Just select the one you want when starting a new program and double click on it.

I have for example a template with a minimal event loop and a window I use when I want to test something quickly.

Re: Add default text to each new code page

Posted: Thu Aug 09, 2012 12:20 am
by Tenaja
luis wrote:You can already have many different templates in the Template tool....
This is an issue with the HELP file; the word "Template" turns up only one hit--WebGadget(), of all things.

I guess it has been a while since I started a new "project". Lately, I have either been working on existing ones, or short projects that do not need a "project" file.

Re: Add default text to each new code page

Posted: Thu Aug 09, 2012 12:32 am
by luis
I'm not sure to understand the part about the projects in relation to the template tool :?:

About the template tool: if you search template"S" it will return that one too.
Sometimes you have try small variations to get a useful match from the search ...

Re: Add default text to each new code page

Posted: Thu Aug 09, 2012 3:08 am
by xorc1zt
agreed and also adding macro would be nice

netbeans use dat for automatically licensing a whole project without typing the title, author, date,... on every new files.

example with gpl 3.0

Code: Select all

<#if licenseFirst??>
${licenseFirst}
</#if>
${licensePrefix}Copyright (C) ${date?date?string("yyyy")} ${project.organization!user}
${licensePrefix?replace(" +$", "", "r")}
${licensePrefix}This program is free software; you can redistribute it and/or
${licensePrefix}modify it under the terms of the GNU General Public License
${licensePrefix}as published by the Free Software Foundation; either version 2
${licensePrefix}of the License, or (at your option) any later version.
${licensePrefix?replace(" +$", "", "r")}
${licensePrefix}This program is distributed in the hope that it will be useful,
${licensePrefix}but WITHOUT ANY WARRANTY; without even the implied warranty of
${licensePrefix}MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
${licensePrefix}GNU General Public License for more details.
${licensePrefix?replace(" +$", "", "r")}
${licensePrefix}You should have received a copy of the GNU General Public License
${licensePrefix}along with this program; if not, write to the Free Software
${licensePrefix}Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
<#if licenseLast??>
${licenseLast}
</#if>

Re: Add default text to each new code page

Posted: Thu Aug 09, 2012 3:50 am
by Tenaja
luis wrote:I'm not sure to understand the part about the projects in relation to the template tool :?:
When I read this...
Just select the one you want when starting a new program and double click on it.
...somehow my eyes replaced "new program" with "new project"... I don't know why, but maybe it is because I have never seen the template option come up in recent months, and I could not find Template in the help file, so I guessed it must have been in the new project settings. Now I see it is in the Tools menu.

Nice to see a feature request get implemented so quickly! :D

Re: Add default text to each new code page

Posted: Thu Aug 09, 2012 8:56 pm
by freak
I added the possibility to execute a tool when a new source is created. This way you can generate any header you want with a simple tool like this:

Code: Select all

; Configure as
;
; Commandline: "%TEMPFILE"
; Trigger: "New Sourcecode created"
; [x] Wait until tool quits
; [x] Reload Source after tool has quit
;      (x) into current source
; [x] Hide tool from the Main menu
;
File$ = ProgramParameter()
If CreateFile(0, File$)
  WriteStringN(0, ";")
  WriteStringN(0, "; Created on: " + FormatDate("%dd/%mm/%yyyy %hh:%ii", Date()))
  WriteStringN(0, ";")
  CloseFile(0)
EndIf
It should be available in the next beta.

Re: Add default text to each new code page

Posted: Thu Aug 09, 2012 9:41 pm
by ts-soft
freak wrote:I added the possibility to execute a tool when a new source is created.
Good Idea, thanks :D