Community
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Todo lists in TextPad

 
Post new topic   Reply to topic    Community Forum Index -> Tips
View previous topic :: View next topic  
Author Message
hillsc



Joined: 19 Jun 2003
Posts: 35

PostPosted: Fri Aug 18, 2006 3:59 pm    Post subject: Todo lists in TextPad Reply with quote

I spend a lot of time in TextPad and like to keep track of what I'm doing in a little "todo" file. (Switching to another program is a pain. I'm already in TextPad anyway!) Trouble is, every time I close and re-open the file, my special tab settings are lost.

Document Classes to the rescue!!! I don't know why I didn't think of this before. (Slaps forehead!) I created a new "todo" document class and added "*.todo" as the file type filter. Once I had a document class, I then went crazy on the customizing. It has its own syntax highlighting as well as special colors and tab settings. Here's what it looks like in action:



There are three comment characters: ==, !, and ?. I use == for headings and ! to bring my attention to something. The ? comment (not shown above) is the secondary comment, and turns a section of text gray.

Here is the syntax definition file:

Code:

PERL=1

[Syntax]
Namespace1 = 6
IgnoreCase = Yes
BracketChars = {}
OperatorChars =
CommentStart = ==
CommentEnd = ==
CommentStartAlt = ?
CommentEndAlt = ?
SingleComment = !
SingleCommentEsc = \
StringsSpanLines = No
StringStart = "
StringEnd = "
StringAlt =
StringEsc = \

[Keywords 1]
in_progress
completed
on_hold


Tab stops are at 3, 70, and 80. The background color and font are changed so it looks drastically different from the normal files I'm editing.

Just passing this on in case someone else wants to give it a try. No rocket science involved. Just another example of why TextPad is so cool. Smile

Charlie
Back to top
View user's profile Send private message
sos



Joined: 23 Jul 2006
Posts: 9

PostPosted: Wed Aug 30, 2006 7:06 pm    Post subject: Reply with quote

It's rocket science to some of us starting out. This is something I'd like to do but I don't know what the process is of setting it up. I like how you changed the text color in certain places to mark things. Most of all I want it to stay so when I reopen the file it's still marked.

Any help on how to go about doing this would be great and please remember I'm just a beginner. Thank you in advance for any help.
Back to top
View user's profile Send private message
hillsc



Joined: 19 Jun 2003
Posts: 35

PostPosted: Thu Sep 07, 2006 10:54 pm    Post subject: Reply with quote

There are two parts to it:

1. Create a new document class
2. Create a syntax definition file

The document class is based on file type. For me, I said any file that ends in .todo is a "Todo List File".

Part of defining the document class is specifying your colors, font, tabs, etc. These are all up to you, although I placed tab stops at 3, 70, and 80.

The syntax definition file is above. Copy and paste that to a file (e.g., todo.syn) and place it in your TextPad 4's system folder. When create (or modify) the document class, pick this file for syntax definition.

That's really all you have to do.

Good luck!
Back to top
View user's profile Send private message
sos



Joined: 23 Jul 2006
Posts: 9

PostPosted: Sat Sep 09, 2006 10:52 pm    Post subject: Reply with quote

I figured out how to make the document class and the syntax file. I have that all set but I can't figure out how to make the comments and so on apply to my txt files.

I tried making the files in class of the new doc class *. and *.TXT but that doesn't work. I tried changing the syntax file in text document class to mine but then it wont spell check for some reason though it does mark the text as I want. I don't understand that because the new document class has the spell checks all selected. I tried changing the text.syn to add in the things like what the brackets should be and what a comment is and alt comment. Still no luck.

Any help on how to get this new document class to effect my txt files would be a big help and really appreciated. Thanks so much.
Back to top
View user's profile Send private message
SteveH



Joined: 03 Apr 2003
Posts: 329
Location: Edinburgh, Scotland

PostPosted: Sun Sep 10, 2006 8:28 am    Post subject: Reply with quote

It sounds as though you are trying to make hillsc's syntax highlighting part of the existing text document class. Is this what you want?

The original suggestion works by creating a new document class called todo, associated with files called, say anything.todo. It is this document class that has the syntax file, tab stops and colour options set.

There is nothing that stops you making text files (*.txt) behave as a todo list but it will apply to all text files once set up. The beauty of the original suggestion is that you retain the original text file document class properties.

Hope this helps.
Back to top
View user's profile Send private message Visit poster's website
sos



Joined: 23 Jul 2006
Posts: 9

PostPosted: Mon Sep 11, 2006 5:47 pm    Post subject: Reply with quote

What I am trying to do is to have a way to mark certain places in a txt document permanently by having the text different color so it catches my eye. This seemed to be a way to do it that would be very effective..

I made a new document class and a new syntax file just as suggested here. However it does not effect my txt files. I'm trying to figure out how to get this to work. When it didn't work I changed things as mentioned in my previous post in order to try to get it to work and still had no luck so I put things back as they were after.

"it will apply to all text files once set up."

That is exactly what I want and exactly what is not happening. I may have done something wrong but I have no idea what. I'm not a programmer, just and every day person so I'm trying to figure it all out as best I can as I go. I understand that the syntax file effects the document class but at this point the new ones I made up are not effecting .txt files.
Back to top
View user's profile Send private message
SteveH



Joined: 03 Apr 2003
Posts: 329
Location: Edinburgh, Scotland

PostPosted: Mon Sep 11, 2006 6:52 pm    Post subject: Reply with quote

It sounds as though you want to amend the existing text document class rather than creating a new class. I had wrongly assumed that you were trying to implement the todo suggestion.

What you suggest should be possible and would be accomplished by associating a syntax file with the text document class. Start by searching your hard drive for an existing file, say perl.syn or c.syn, open that (in TextPad of course Very Happy ) and then save it as (for example) text.syn. Copy the text from hillsc's example and then edit the list of keywords under [keywords 1] to include whatever you wish to be highlighted.

To make the highlighting active you need to open TextPad preferences, expand the document classes, go to the syntax option, enable syntax highlighting and select the new syn file you have created. The actual colours displayed for keywords are also set within the document class. Apologies that I can not be too specific in this paragraph - away from Windows at the moment Very Happy

Hope this helps.
Back to top
View user's profile Send private message Visit poster's website
sos



Joined: 23 Jul 2006
Posts: 9

PostPosted: Mon Sep 11, 2006 11:54 pm    Post subject: Reply with quote

I don't know if you read my above statement with what different changes I tried but I did this. I also tried a few other things as listed which did not work.

sos wrote:
I tried making the files in class of the new doc class *. and *.TXT but that doesn't work. I tried changing the syntax file in text document class to mine but then it wont spell check for some reason though it does mark the text as I want. I don't understand that because the new document class has the spell checks all selected. I tried changing the text.syn to add in the things like what the brackets should be and what a comment is and alt comment. Still no luck.
Back to top
View user's profile Send private message
SteveH



Joined: 03 Apr 2003
Posts: 329
Location: Edinburgh, Scotland

PostPosted: Tue Sep 12, 2006 7:19 am    Post subject: Reply with quote

Did you modify a text.syn file provided with TextPad? The one on my machine has the following text:
Quote:
WARNING: Do not attempt to add keywords to this file. They will be ignored, because it starts with "TEXT=1". You should use one of the other syntax definition files as a starting point.

When I used one based upon C, the keywords I had listed were highlighted correctly.

Hope this helps.
Back to top
View user's profile Send private message Visit poster's website
sos



Joined: 23 Jul 2006
Posts: 9

PostPosted: Wed Sep 13, 2006 7:50 pm    Post subject: Reply with quote

I didn't add keywords to this file. I simply changed this part only in the "TEXT=1" syntax file thinking that would be enough to mark some color change but it didn't work.

BracketChars = []
CommentStart = ==
CommentEnd = ==
CommentStartAlt = --
CommentEndAlt = --

I also changed the colors to the ones I wanted in the text document class itself for the brackets and comments.

Quote:
When I used one based upon C, the keywords I had listed were highlighted correctly.


How do I get one based on C and one of what? Are you meaning the text.syn file? If so how do I change that to make it C? As I said I'm not a programmer so my knowledge is limited.

I would also like to understand better how something like .todo class works to effect only certain documents. Would you then just save a particulate document as "wednesday.todo" or how do you mark those files so they trigger that document class to be effected?

Sorry I hope that's not to confusing. Thank you.
Back to top
View user's profile Send private message
SteveH



Joined: 03 Apr 2003
Posts: 329
Location: Edinburgh, Scotland

PostPosted: Wed Sep 13, 2006 8:08 pm    Post subject: Reply with quote

I don't think you need to make it C specifically, the important thing is that is is not TEXT. If you look at the syntax file given in the first post you will see it begins as follows.
Code:
PERL=1
[Syntax]
Namespace1 = 6
IgnoreCase = Yes

If you find your text.syn file and edit the opening line to read PERL=1 as above this should allow syntax highlighting to work correctly.
Back to top
View user's profile Send private message Visit poster's website
sos



Joined: 23 Jul 2006
Posts: 9

PostPosted: Thu Sep 14, 2006 5:33 pm    Post subject: Reply with quote

I tried but then it wont spell check for some reason though it does mark the text as I want. I don't understand that because the new document class has the spell checks all selected they are also checked as the default document class. When I change it back to TEXT=1 the spell check works again and the markings don't. So it seems like I can either keep the spell check or the marked text but not both.
Back to top
View user's profile Send private message
SteveH



Joined: 03 Apr 2003
Posts: 329
Location: Edinburgh, Scotland

PostPosted: Fri Sep 15, 2006 7:14 am    Post subject: Reply with quote

You're right. The following is taken from the help file.

Quote:
When syntax highlighting is enabled, only comments, strings and plain text are spell checked. Checking of comments and strings can be individually enabled for each document class on the document class pages of the Properties dialog box.
Back to top
View user's profile Send private message Visit poster's website
sos



Joined: 23 Jul 2006
Posts: 9

PostPosted: Fri Sep 15, 2006 5:54 pm    Post subject: Reply with quote

Quote:
I would also like to understand better how something like .todo class works to effect only certain documents. Would you then just save a particulate document as "wednesday.todo" or how do you mark those files so they trigger that document class to be effected?


So back to my second question of how a todo class works to get only certain doccuments to use syntax highlighting. Anyone?
Back to top
View user's profile Send private message
SteveH



Joined: 03 Apr 2003
Posts: 329
Location: Edinburgh, Scotland

PostPosted: Fri Sep 15, 2006 8:05 pm    Post subject: Reply with quote

The main thing you have to do is associate a document class (todo) with a file extension (.todo). That is the key mechanism that enables TextPad to associate a specific document with a class.

If you create that definition within the document classes then only wednesday.todo or *.todo will trigger the highlighting.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Community Forum Index -> Tips All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB