HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Trigger Editor Syntax Highlightning

03-31-2007, 01:01 PM#1
SFilip
Yes, finally a way to do it. I found out that a component can be injected intro another process by using the SetParent API function. The result was scintilla editor placed right above the (hidden) custom text area in the trigger editor.
Two things you should know about:
-The component refreshes the state every 0.5 seconds by default. This can be changed through the Options dialog (right click on the scintilla component and click on Options in the popup menu). When the custom text area is not active (in a GUI trigger, trigger comment etc.) then it will check every 2 seconds to see if the state changed, this can also be changed through the options dialog.
-The component doesn't always repaint itself so you might want to hit the Refresh button if you notice it looking odd (certain parts becoming grey for instance). This doesn't happen often when you're actively using it (usually after a minimize) so its not much of a problem. It is also possible to refresh it automatically every couple of seconds, this can again be turned on through the options dialog.

Code:
Changelog:

0.4
-fixed the issue where TESH would constantly update triggers thus always making the map unsaved
-Find and Replace added
-you can now load the header "on the fly" by right clicking on the component and selecting Load Header (under the condition it is currently selected in the trigger list)

0.3
-it is now possible to include a .j file by putting it into the includes directory - this way TESH will import any functions that file contains so that they would be highlighted and put on AutoComplete
-you can now syntax check your current trigger (using PJass) by pressing a button
-TESH now automatically applies the changes as you type, but the Save/Discard options can still be enabled from the options
-title of the window TESH tries to find ("Trigger Editor" by default) can be changed through the INI file, this should make it compatible with non-English WE versions

0.2.1
-fixed a bug where null, true and false were impossible to change/remove

0.2
-fixed the max height constrain
-code folding now works fine for constant functions, private methods etc.
-customizable highlighting colors and style
-customizable line numbers font
-option to undo the changes that happen after switching a trigger

0.1
-initial release

Enjoy, hopefully someone finds this useful

To compile the source you need the Delphi Scintilla Interface Components.
Attached Images
File type: jpgscreenshot.jpg (147.3 KB)
Attached Files
File type: zipTESH04.zip (640.1 KB)
File type: zipTESH04_src.zip (86.6 KB)
03-31-2007, 01:21 PM#2
Vexorian
...

- The syntax editor doesn't fit all the space available in my trigger editor (1280x1024)

- private functions and methods are not code-folded.

- I think the no refreshing issue really needs some fixing, as a matter of fact Zoxc's addition of synedit to WEHelper doesn't suffer from this. (It is unable to keep the trigger after you change focus, I always told Zoxc to use this method but he didn't do it for some reason)

- The colors of the syntax highlighting are terrible, by this I don't mean you should change them, but you should at least add a file you could modify to change the style..

- Add an options button to the top.

- The font of the line numbers is pretty odd.

- Add UTF-8 support.

- If this was OS this could be added to grimoire... .. in a more friendlier way than this whole hook button stuff
03-31-2007, 04:24 PM#3
grim001
Even with those complaints I love this.

You don't know how annoying it is trying to edit a 600 line function when you can't fold the code down.


It seems any function or method with a keyword in front of it is not foldable.
Static, private, public, etc.

Another problem is that the view gets messed up when I tab out (like to write this post)

Another thing is that I really think you shouldn't discard changes just because the trigger page was changed. Perhaps prompt that there are modified triggers which have not yet been saved/discarded when the user attempts to save the map. At the very least a warning message that you're about to lose your work if you change pages would be nice.

also the spacing seems to leave behind weird characters that the parser does not like.
03-31-2007, 06:47 PM#4
Zoxc
Source please.
04-03-2007, 08:14 PM#5
SFilip
Thanks for the comments, new version released (changelog and DL in the first post).

> I think the no refreshing issue really needs some fixing
I did a lot of testing, yet still couldn't find a solution for it. Doesn't seem to be too much of a problem though as it doesn't occur when the TE window is active. Just a tap on the Refresh button (or Alt+S) from time to time should do the trick, at least until I find a better solution.

> If this was OS
> Source please.
I'll release the source soon enough, but I'd like to have a somewhat stable version first.

> view gets messed up when I tab out
That would be the repainting issue I mentioned in the first post. No real solution for now unfortunately.

> spacing seems to leave behind weird characters that the parser does not like
Never encountered anything similar, and couldn't reproduce this bug when I tried. Are you sure it's TESH causing this?

Anyway as a solution to the discarding issue the undo buffer does not clear anymore when the trigger changes (but this can be changed through the options). So if you accidentally change the trigger without saving just come back to the previous one and do a couple Undo-s to get it back.
04-03-2007, 08:24 PM#6
Vexorian
[activism]OS trusts in the "release early, release often" motto by this, if you make your work open source you might get things fixed sooner since other people might help you with that[/activism]

As I said, WEHelper has a hidden feature in which it adds synedit to the trigger editor (but no saving is supported) it does not suffer from this whole refreshing issue.

Anyways, it seriously needs UTF8 support, make it a priority.
04-03-2007, 08:46 PM#7
Earth-Fury
After having used this for a little bit, theres one thing thats starting to piss me off:
"null", "false", and "true" can not be deleted. at all. you have to ither unhook, or add gibberish letters to change them to thigns like "ttrue" inorder to delete them.

Other then that... im in love <3
04-03-2007, 10:22 PM#8
SFilip
Ouch, good find, fixed in 0.2.1.
I also enabled UTF8 in the scintilla component, that should do the trick, but I didn't have the time to test it throughly.
04-04-2007, 03:13 AM#9
Earth-Fury
Ok, now, as i go thogh and comment my code (i need to comment more... then maybe i wont have to go back and clean up code as much..) its annoying to get the function list poping up on comment lines.
Eg:
// P
makes the function list pop up. It wouldn't be as big an issue if I didn't have to refresh the window after the function list disapears. (leaves a big gray box where it was)

I'm still in love, tho <3

Edit:
i just noticed:
requires, initializer, uses, and needs are not syntax highligted keywords.
04-04-2007, 02:34 PM#10
Zoxc
Quote:
Originally Posted by SFilip
> Source please.
I'll release the source soon enough, but I'd like to have a somewhat stable version first.

Well I'd like to see how you "replaced" the window and how you made/changed a Lexer for Scintilla.

Also UTF8 support is broken =P
04-04-2007, 09:30 PM#11
SFilip
Source released.
Please let me know if you find a way to resolve the repaining issue.
04-04-2007, 09:40 PM#12
MaD[Lion]
jass shop pro is old classic and good to use :P
04-04-2007, 09:49 PM#13
Vexorian
It is also obsolete.
04-06-2007, 09:03 PM#14
1337D00D
Hmm, it would really bee cool if it automatically corrected caps in functions, like when you enter "polledwait(" it converts it to "PolledWait(".

And it would really be helpful if you could add custom functions to the list, like the Caster System functions. (Especially for those ones that take lotsa things)

But still, me likey!

EDIT: Autocomplete dosen't seem to work when used in an argument, ex: "I2R(GetUnitAbilityLevel(caster,'A001'))", GetUnitAbilityLevel() won't pop up the box.
04-07-2007, 06:28 AM#15
Earth-Fury
Quote:
Originally Posted by 1337D00D
Hmm, it would really bee cool if it automatically corrected caps in functions, like when you enter "polledwait(" it converts it to "PolledWait(".
Unless the precidence is set up REALLY well, no. I hate JSP and JassCraft for constantly changing player into Player.

Quote:
Originally Posted by 1337D00D
And it would really be helpful if you could add custom functions to the list, like the Caster System functions. (Especially for those ones that take lotsa things)

Would be best if it had all functions in a map show up, but that would be rather hard to do, i assume =(