Syntax highlighting of Celestia Catalogs in Notepad++
-
Topic authorChuft-Captain
- Posts: 1779
- Joined: 18.12.2005
- With us: 19 years 1 month
Syntax highlighting of Celestia Catalogs in Notepad++
For a long time now NOTEPAD++ has been my editor of choice when working with Celestia catalog files (or other files) because, well to put it simply, it's just a great editor. Simple to use, yet powerful and extensible.
Celestia's catalog language is NOT included in the long list of common languages recognized automatically by NOTEPAD++, HOWEVER, like any good editor, NOTEPAD++ can be extended to recognize custom languages by creating a "user-defined language".
I've been meaning to do this for ages, and finally made a start on this last night.
So, if you use NOTEPAD++, you're tired of this plain look :
and you'd rather see something more helpful like this:
... then you might find this tool useful.
VERSION 5 DOWNLOAD:
(added CELX script handler as requested.)
INSTALLATION:
Find the existing userDefineLang.XML file in your installation.
in XP: "...\Documents and Settings\...[User]...l\Application Data\Notepad++"
in Win7: "%APPDATA%\Notepad++"
If you haven't already made any other user defined languages for NOTEPAD++, then you can simply replace the existing (empty) XML file with this one. (Take a backup if you're not sure).
WARNING: If you do have other user defined languages, then you'll need to cut and paste from this one into the existing one, rather than just replacing it.
Now open any Celestia ssc, ctx, stc, dsc, dat, cfg, or celx file and you should see the syntax highlighted automatically.
If not, you can select the language manually from the Language menu.
-- Down the bottom...
CelSSC (for ssc, ctx, dat, or cfg files),
CelSTC (for stc, dsc),
CelX (for celx).
Hope someone finds this useful. Any feedback welcome.
(Please let me know of any omissions.)
I have done nothing for CELX files as they are probably reasonably well serviced by the LUA language syntax already provided with NOTEPAD++. However it might be worth adding specific celX keywords in the future (ie. the non LUA elements)
UPDATE:VERSION 5 now adds this functionality.
CC
Celestia's catalog language is NOT included in the long list of common languages recognized automatically by NOTEPAD++, HOWEVER, like any good editor, NOTEPAD++ can be extended to recognize custom languages by creating a "user-defined language".
I've been meaning to do this for ages, and finally made a start on this last night.
So, if you use NOTEPAD++, you're tired of this plain look :
and you'd rather see something more helpful like this:
... then you might find this tool useful.
VERSION 5 DOWNLOAD:
(added CELX script handler as requested.)
INSTALLATION:
Find the existing userDefineLang.XML file in your installation.
in XP: "...\Documents and Settings\...[User]...l\Application Data\Notepad++"
in Win7: "%APPDATA%\Notepad++"
If you haven't already made any other user defined languages for NOTEPAD++, then you can simply replace the existing (empty) XML file with this one. (Take a backup if you're not sure).
WARNING: If you do have other user defined languages, then you'll need to cut and paste from this one into the existing one, rather than just replacing it.
Now open any Celestia ssc, ctx, stc, dsc, dat, cfg, or celx file and you should see the syntax highlighted automatically.
If not, you can select the language manually from the Language menu.
-- Down the bottom...
CelSSC (for ssc, ctx, dat, or cfg files),
CelSTC (for stc, dsc),
CelX (for celx).
Hope someone finds this useful. Any feedback welcome.
(Please let me know of any omissions.)
I have done nothing for CELX files as they are probably reasonably well serviced by the LUA language syntax already provided with NOTEPAD++. However it might be worth adding specific celX keywords in the future (ie. the non LUA elements)
UPDATE:VERSION 5 now adds this functionality.
CC
Last edited by Chuft-Captain on 20.11.2017, 01:10, edited 41 times in total.
"Is a planetary surface the right place for an expanding technological civilization?"
-- Gerard K. O'Neill (1969)
CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS
-- Gerard K. O'Neill (1969)
CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS
-
- Posts: 114
- Joined: 21.07.2004
- Age: 50
- With us: 20 years 6 months
- Location: Regensburg, Germany
Re: Syntax highlighting of Celestia Catalogs in Notepad++
Thanks, CC!
Very good idea indeed, I will definitely use it.
Regards
Andy
Very good idea indeed, I will definitely use it.
Regards
Andy
Re: Syntax highlighting of Celestia Catalogs in Notepad++
Yes, thank you
Michael
Michael
-
Topic authorChuft-Captain
- Posts: 1779
- Joined: 18.12.2005
- With us: 19 years 1 month
Re: Syntax highlighting of Celestia Catalogs in Notepad++
Version 2 upgrade is available.
This version...
DOWNLOAD and INSTALL INSTRUCTIONS: in first post.
This version...
- * changes the colors to be a bit less "in your face"
* enables the "Treat keyword as symbol" option on the comment symbol #, to make sure all comments are recognized correctly
* implements "syntax folding" on braces {}
DOWNLOAD and INSTALL INSTRUCTIONS: in first post.
"Is a planetary surface the right place for an expanding technological civilization?"
-- Gerard K. O'Neill (1969)
CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS
-- Gerard K. O'Neill (1969)
CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS
Re: Syntax highlighting of Celestia Catalogs in Notepad++
CC,
I don't see anything in your posts that can be downloaded -- neither an attachment nor a link to another site.
I don't see anything in your posts that can be downloaded -- neither an attachment nor a link to another site.
Selden
-
Topic authorChuft-Captain
- Posts: 1779
- Joined: 18.12.2005
- With us: 19 years 1 month
Re: Syntax highlighting of Celestia Catalogs in Notepad++
Should be there now Selden. (I was updating the post as you looked at it).
"Is a planetary surface the right place for an expanding technological civilization?"
-- Gerard K. O'Neill (1969)
CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS
-- Gerard K. O'Neill (1969)
CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS
Re: Syntax highlighting of Celestia Catalogs in Notepad++
Thanks Chuft. This is ought to be definitely adopted by the Notepad++ team, imho.
Never at rest.
Massimo
Massimo
Re: Syntax highlighting of Celestia Catalogs in Notepad++
thanks a lot,Chuft-Captain!
it's very useful!!
Ciao
Pierluigi
PS
I have added
- the filetype "ctx" (used for VTs) to ext
- the keyword "VirtualTexture" to Words1
- the keywords "ImageDirectory BaseSplit TileSize TileType" to Words3
this way also ctx files have syntax coloring!
Perhaps there is a typo in the words from DELIMINER1 to 3: I think they should be DELIMITER1 to 3.
it's very useful!!
Ciao
Pierluigi
PS
I have added
- the filetype "ctx" (used for VTs) to ext
- the keyword "VirtualTexture" to Words1
- the keywords "ImageDirectory BaseSplit TileSize TileType" to Words3
this way also ctx files have syntax coloring!
Perhaps there is a typo in the words from DELIMINER1 to 3: I think they should be DELIMITER1 to 3.
-
Topic authorChuft-Captain
- Posts: 1779
- Joined: 18.12.2005
- With us: 19 years 1 month
Re: Syntax highlighting of Celestia Catalogs in Notepad++
Graci Pierluigi,
I had forgotton about the CTX files, so thank you for that.
I have now included your CTX additions and made some other changes, including:
In addition, given that the syntax differences between SSC and STC files are far greater than the similarities, I decided it would be more useful to have 2 separate language handlers. So the original CelestiaCC language is replaced by:
When keywords are common to both SSC and STC syntaxes, then this separation of handlers gives more freedom to handle them in the style most appropriate to the context.
For example, in a DSC file "Axis" is a first-order attribute of a Galaxy, so I want it to be blue, however in an SSC file "Axis" is a keyword associated with a ReferenceFrame, so I want it to be a dark red color.
This is just my preference. Feel free however to [EDIT] re-design my scheme, or come up with your own layout/colors to your liking, and if you do, please share it here in this thread as well. (Just zip up your userDefineLang.xml and upload it)
Version 3 (has now been superseded by VERSION 4). DOWNLOAD: in first post
Cheers
CC
PS. Pink Floyd fans are always welcome here!
In fact, for making changes to your UDL themes, I recommend that you use the "View-->User-Defined Dialog" tool within Notepad++, rather than editing the XML file directly:
... you can see the effect on any open files immediately, and no danger of accidentally damaging the TAG structure. Any changes you make in this dialog are saved to the userDefineLang.xml file, each time you close Notepad++.
I had forgotton about the CTX files, so thank you for that.
I have now included your CTX additions and made some other changes, including:
- * Keywords I had overlooked. eg. ScriptedRotation.
* Language handlers are now case-insensitive.
* Most keywords are now treated as symbols.
(The reason for this, is that braces {} often can follow keywords without an intervening space, depending on the individuals style of writing code (although that's not my style). This ensures that they are recognized in all circumstances.
In addition, given that the syntax differences between SSC and STC files are far greater than the similarities, I decided it would be more useful to have 2 separate language handlers. So the original CelestiaCC language is replaced by:
- CelSSC which handles SSC, CTX, DAT, and CFG files,
and
CelSTC which takes care of STC, and DSC files.
When keywords are common to both SSC and STC syntaxes, then this separation of handlers gives more freedom to handle them in the style most appropriate to the context.
For example, in a DSC file "Axis" is a first-order attribute of a Galaxy, so I want it to be blue, however in an SSC file "Axis" is a keyword associated with a ReferenceFrame, so I want it to be a dark red color.
This is just my preference. Feel free however to [EDIT] re-design my scheme, or come up with your own layout/colors to your liking, and if you do, please share it here in this thread as well. (Just zip up your userDefineLang.xml and upload it)
Version 3 (has now been superseded by VERSION 4). DOWNLOAD: in first post
Cheers
CC
PS. Pink Floyd fans are always welcome here!
I agree, but don't change that. That's a tag that is defined and used by the UDL dialog. (Probably a typo by some rather hasty Notepad++ developer, but that is how it is defined and used.)piellepi wrote:Perhaps there is a typo in the words from DELIMINER1 to 3: I think they should be DELIMITER1 to 3.
In fact, for making changes to your UDL themes, I recommend that you use the "View-->User-Defined Dialog" tool within Notepad++, rather than editing the XML file directly:
... you can see the effect on any open files immediately, and no danger of accidentally damaging the TAG structure. Any changes you make in this dialog are saved to the userDefineLang.xml file, each time you close Notepad++.
Last edited by Chuft-Captain on 15.11.2017, 02:35, edited 4 times in total.
"Is a planetary surface the right place for an expanding technological civilization?"
-- Gerard K. O'Neill (1969)
CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS
-- Gerard K. O'Neill (1969)
CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS
Re: Syntax highlighting of Celestia Catalogs in Notepad++
Hi Chuft: I use the "obsidian" theme and your layouts looks like a charm.
Never at rest.
Massimo
Massimo
-
Topic authorChuft-Captain
- Posts: 1779
- Joined: 18.12.2005
- With us: 19 years 1 month
Re: Syntax highlighting of Celestia Catalogs in Notepad++
I may have misled you Fenerit. When I referred to "theme"'s I was merely referring to the design and color scheme of the Notepad++ UDL handler(s) created by me. I think you're talking however about a windows "theme". I wasn't talking about windows "themes" at all. -- (Perhaps "theme" was an unfortunate choice of words on my part.) -- I've edited the post above to make it less ambiguous.Fenerit wrote:Hi Chuft: I use the "obsidian" theme and your layouts looks like a charm.
eg. The use of green italic comments, blue for main keywords, crimson for ReferenceFrame stuff, and purple for secondary attributes could be thought of as a Notepad++ "theme". If you perhaps didn't like the colors I've chosen, you could easily change them, or any other aspect of the UDL handler and your version could then be known as the "Fenerit" theme, or the "Italian" theme if everything was Ferrari red.
Cheers
CC
"Is a planetary surface the right place for an expanding technological civilization?"
-- Gerard K. O'Neill (1969)
CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS
-- Gerard K. O'Neill (1969)
CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS
-
Topic authorChuft-Captain
- Posts: 1779
- Joined: 18.12.2005
- With us: 19 years 1 month
Re: Syntax highlighting of Celestia Catalogs in Notepad++
Yet another update! (Every time I look at another catalog file, I seem to discover something I've missed. )
Added some keywords which I had overlooked in the STC handler, which can in fact be present in .STC's or .DSC's. Namely:
Also, the comment delimiter # wasn't being treated as a symbol in the CelSTC handler, so some comment lines were not displayed with the correct color. FIXED.
VERSION 4 DOWNLOAD: in first post
Added some keywords which I had overlooked in the STC handler, which can in fact be present in .STC's or .DSC's. Namely:
- CustomOrbit
CustomTemplate
UniformRotation
Obliquity
EquatorAscendingNode
RotationPeriod
Temperature
Also, the comment delimiter # wasn't being treated as a symbol in the CelSTC handler, so some comment lines were not displayed with the correct color. FIXED.
VERSION 4 DOWNLOAD: in first post
"Is a planetary surface the right place for an expanding technological civilization?"
-- Gerard K. O'Neill (1969)
CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS
-- Gerard K. O'Neill (1969)
CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS
Re: Syntax highlighting of Celestia Catalogs in Notepad++
A quibble: the keyword CustomOrbit should never be present in an STC. It is used to select a Solar System planet or moon orbit function which is hard-coded within Celestia. No star orbits are known to a precision which would justify Chris (or another Celestia developer) having written the appropriate C++ functions.
Selden
-
Topic authorChuft-Captain
- Posts: 1779
- Joined: 18.12.2005
- With us: 19 years 1 month
Re: Syntax highlighting of Celestia Catalogs in Notepad++
A very good point Selden, however there is one star whose "orbit" is very precisely known...
... reminds me of the classic quiz show question:
Q: "Name the closest star to Earth"
A: "Alpha Centauri".
... reminds me of the classic quiz show question:
Q: "Name the closest star to Earth"
A: "Alpha Centauri".
Last edited by Chuft-Captain on 15.11.2017, 02:36, edited 1 time in total.
"Is a planetary surface the right place for an expanding technological civilization?"
-- Gerard K. O'Neill (1969)
CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS
-- Gerard K. O'Neill (1969)
CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS
Re: Syntax highlighting of Celestia Catalogs in Notepad++
Chuft-Captain wrote:I may have misled you Fenerit. When I referred to "theme"'s I was merely referring to the design and color scheme of the Notepad++ UDL handler(s) created by me. I think you're talking however about a windows "theme". I wasn't talking about windows "themes" at all. -- (Perhaps "theme" was an unfortunate choice of words on my part.) -- I've edited the post above to make it less ambiguous.Fenerit wrote:Hi Chuft: I use the "obsidian" theme and your layouts looks like a charm.
eg. The use of green italic comments, blue for main keywords, crimson for ReferenceFrame stuff, and purple for secondary attributes could be thought of as a Notepad++ "theme". If you perhaps didn't like the colors I've chosen, you could easily change them, or any other aspect of the UDL handler and your version could then be known as the "Fenerit" theme, or the "Italian" theme if everything was Ferrari red.
Cheers
CC
My fault Chuft: read "style". FYI my custom colors like Perl language
In the zip there are all the CMOD directives. Maybe it can help you.
Never at rest.
Massimo
Massimo
-
Topic authorChuft-Captain
- Posts: 1779
- Joined: 18.12.2005
- With us: 19 years 1 month
Re: Syntax highlighting of Celestia Catalogs in Notepad++
Graci Massimo,
Very retro theme. You must have done some change to your preferences in Notepad++ as well, in order to have a black background?
CC
Very retro theme. You must have done some change to your preferences in Notepad++ as well, in order to have a black background?
CC
"Is a planetary surface the right place for an expanding technological civilization?"
-- Gerard K. O'Neill (1969)
CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS
-- Gerard K. O'Neill (1969)
CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS
Re: Syntax highlighting of Celestia Catalogs in Notepad++
Yes. It can comes with the "obsidian" theme. Menu: "Settings" > "Style Configurator" > "Select theme" > "obsidian". You must check/uncheck the "Enable global background colour" checkbox whether you want to hold/reject your language's background. As "experiment" it has been assigned like global background into the xml above just to see what should be happened.Chuft-Captain wrote:Graci Massimo,
Very retro theme. You must have done some change to your preferences in Notepad++ as well, in order to have a black background?
CC
With your Celestia's language colours it doesn't looks bad, apart the black, red and blue strings which are either too faints or too "in your face".
EDIT LATER:
Just a question I wonder now: what Notepad++ version do you use? Mine is the 5.9.
Never at rest.
Massimo
Massimo
Re: Syntax highlighting of Celestia Catalogs in Notepad++
Celestia language Perl-like VERSION 2
Fixes:
- All string backgrounds are now white. Choose "bespin, blackboard,choco, deepblack, obsidian etc." themes for the dark background.
- Changed colours from green to cyan for "array/hashes" alike directives (Atmosphere, UniformRotation, EllipticalOrbit, Galaxy, Globular, etc)
- (SSC) Add LunarLambert CloudNormalMap Source DoublePrecision Interpolation Kernel Origin Beginning BoundingRadius SpiceOrbit SpiceRotation Base BaseFrame Observer Vector Freeze;
- (STC) Fixed the comment lines' wrong colour from green to gray;
- (STC) Removed the "CustomOrbit" directive;
- (STC) add BoloCorrection GlobularCluster Mesh Position
- (CMOD) Add up to ten texture[0] (texture0... texture10) and color[0] (color0... color10) for redundant purpose;
- (CMOD) Add "f4", which was lacking;
EDIT LATER:
- Added support for CMS (CMOD), CFG, XYZ, XYZV (SSC) formats;
- Changed colours for SpiceOrbit/SpiceRotation (Source, Kernel, Origin, Frame, BaseFrame) ScriptedOrbit (Module, Function): now cyan:
- Changed colours for Add, Modify, Replace in maroon, like Perl's regex
- Changed color for [ ], now they are white like { }
This is definitely a customization for people who like to write on the black background.
Fixes:
- All string backgrounds are now white. Choose "bespin, blackboard,choco, deepblack, obsidian etc." themes for the dark background.
- Changed colours from green to cyan for "array/hashes" alike directives (Atmosphere, UniformRotation, EllipticalOrbit, Galaxy, Globular, etc)
- (SSC) Add LunarLambert CloudNormalMap Source DoublePrecision Interpolation Kernel Origin Beginning BoundingRadius SpiceOrbit SpiceRotation Base BaseFrame Observer Vector Freeze;
- (STC) Fixed the comment lines' wrong colour from green to gray;
- (STC) Removed the "CustomOrbit" directive;
- (STC) add BoloCorrection GlobularCluster Mesh Position
- (CMOD) Add up to ten texture[0] (texture0... texture10) and color[0] (color0... color10) for redundant purpose;
- (CMOD) Add "f4", which was lacking;
EDIT LATER:
- Added support for CMS (CMOD), CFG, XYZ, XYZV (SSC) formats;
- Changed colours for SpiceOrbit/SpiceRotation (Source, Kernel, Origin, Frame, BaseFrame) ScriptedOrbit (Module, Function): now cyan:
- Changed colours for Add, Modify, Replace in maroon, like Perl's regex
- Changed color for [ ], now they are white like { }
This is definitely a customization for people who like to write on the black background.
Never at rest.
Massimo
Massimo
Re: Syntax highlighting of Celestia Catalogs in Notepad++
Celestia language Perl-like VERSION 3
- Added: FixedPosition Planetographic FixedAttitude Heading LabelColor's directives;
- All the directives are listed in alphabetical order; check it through "user-defined dialogue..."'s menu for a better view.
- Removed "prefix" and "ignore case" options for syntax lightning purpose; words without capitals and uncorrect directives are not lightened even whether the typing is continued after the right word.
- Minor fixes;
- Added: FixedPosition Planetographic FixedAttitude Heading LabelColor's directives;
- All the directives are listed in alphabetical order; check it through "user-defined dialogue..."'s menu for a better view.
- Removed "prefix" and "ignore case" options for syntax lightning purpose; words without capitals and uncorrect directives are not lightened even whether the typing is continued after the right word.
- Minor fixes;
Never at rest.
Massimo
Massimo