Where in the User Preferences does one set syntax highlighting? Is there a
special package I need to load? Shaping |
Shaping wrote:
> Where in the User Preferences does one set syntax highlighting? Is there a > special package I need to load? D5 doesn't really allow you to do much to the syntax highlighting although I think that will change in D6 with the replacement of the editor. In D5 you can't change which parts of the syntax are highlighted, that is decided by the compiler. What you can do is change some of the colours that are used. Have a look at the method Compiler class>>defaultSyntaxColors. That shows the default rtf code used for each of the elements the compiler differentiates between. You can change them by using the Compiler class>>syntaxColorAt:put: method. For example, a change that some of us like to make as part of the default image is to remove the italicizing of comments. This is done by evaluating Compiler syntaxColorAt: #Comment put: '\cf4 '. You do need to know a bit about rtf format though, or be prepared to "fiddle" around until you get the result you want :-) -- Ian Use the Reply-To address to contact me. Mail sent to the From address is ignored. |
Thanks. It seem odd at this advanced stage of Dolphin's development that we
are changing colors with something like Compiler syntaxColorAt: #Comment put: '\cf4 ', which seem like a reference to a color in a standard palette. Is this as good as it gets? Can I use an RGB here? I don't see why we are forced to use a RichTextEdit to get a convenient attribute-manipulation protocol for RichText, as you demonstrated in your earlier example. Why aren't these protocols on the RichText itself, and not in the Editor? I'm thinking it terms of Text with runs of attributes, as per the VW implementation. Shaping "Ian Bartholomew" <[hidden email]> wrote in message news:420fca71$0$52219$[hidden email]... > Shaping wrote: >> Where in the User Preferences does one set syntax highlighting? Is there >> a special package I need to load? > > D5 doesn't really allow you to do much to the syntax highlighting > although I think that will change in D6 with the replacement of the > editor. > > In D5 you can't change which parts of the syntax are highlighted, that > is decided by the compiler. What you can do is change some of the > colours that are used. > > Have a look at the method Compiler class>>defaultSyntaxColors. That shows > the > default rtf code used for each of the elements the compiler differentiates > between. > > You can change them by using the Compiler class>>syntaxColorAt:put: > method. For > example, a change that some of us like to make as part of the default > image is to remove the italicizing of comments. This is done by > evaluating > > Compiler syntaxColorAt: #Comment put: '\cf4 '. > > You do need to know a bit about rtf format though, or be prepared to > "fiddle" around until you get the result you want :-) > > -- > Ian > > Use the Reply-To address to contact me. > Mail sent to the From address is ignored. > |
Shaping wrote:
> Thanks. It seem odd at this advanced stage of Dolphin's development that we > are changing colors with something like Compiler syntaxColorAt: #Comment > put: '\cf4 ', which seem like a reference to a color in a standard palette. They are indexes into the colour table defined further up the #defaultSyntaxColors method and inserted in the start of each rtf string. So cf4 refers to the fifth colour defined (zero based) and resolves to a RGB of 0/128/0 (i.e. a middling Green). > Is this as good as it gets? Yep, the syntax highlighting has never really been updated. > Can I use an RGB here? To add a new colour I imagine (i.e. I've never actually tried) you would have to add new colours at the end of the colour table, reinitialize it all, and then reference the new colour in the same way. > I don't see why we are forced to use a RichTextEdit to get a convenient > attribute-manipulation protocol for RichText, as you demonstrated in your > earlier example. Why aren't these protocols on the RichText itself, and not > in the Editor? RichTextEdit is not just an Editor, it can be used to manipulate RichText strings without having to have any visible components. However, because it's a wrapper round the Windows RichEdit control it has to be a View subclass. RichText itself doesn't do a lot and uses a RichTextEdit to do most of it's work. It's really a wrapper around a wrapper :-) > I'm thinking it terms of Text with runs of attributes, as > per the VW implementation. VW uses emulated widgets so it can do what it likes. Dolphin prefers to use OS controls so has to work in the Windows way - and using the RichEdit interface to manage rtf strings is a lot easier than trying to "do it yourself". Having said all that, I do agree with you - it is a pain to use. I've spent some time playing around with the RichEdit interface and it's not the easiest thing in the world to master. -- Ian Use the Reply-To address to contact me. Mail sent to the From address is ignored. |
Free forum by Nabble | Edit this page |