Code editor, 2D


#1

Hello!

I just found JUCE, please, I have a few questions about it:

- I saw the projuicer and that I can editor code inside of it. I then saw that there is this "CodeEditorComponent" API. What editing component does JUCE use? Its own? If so, that is quite a feat, could you compare it to, say, Scintilla?

- Is there anything like 2D scene graph? Something like browser's DOM, where one draws a line in SVG and if its position gets changes via JavaScript the scene (or the "view" of it) get automatically updated/redrawn? Does it support the concept of "z-index" where one could define the order in which the graphic items are drawn? Again, what does JUCE use for the basic drawing? Cairo? Its own engine?

Thanks!


#2

Both the Projucer and the Introjucer uses JUCE's own CodeEditorComponent. It's not yet as fully featured as Scintella, but it works very well and most things can be achieved with it given some time and patience. Check out the demo for examples of this, and how JUCE does its drawing.


#3

JUCE's CodeEditorComponent is missing a lot of features that a "serious" code editor would have. Some that I can think of off the top of my head are multiple selections (I think), line wrapping, bold/underlined text, etc. It's not bad by any means, but it's hard to create a really good text text editor from it. I started to use it for a text editor I'm working on, but I ended up having to copy the code and customize it that way. I ended up just using another framework because the other framework has a lot of features I wanted, plus some good tutorials/examples and a lot of user code floating around. You certainly can make make it fit your needs, but you won't get something like Scintilla by default. The IntroJucer uses it, so that might be something you'd want to look at. 


#4

In the past it was never intended to be much more than a very simple editor, but now that the Projucer's out there and we're using the editor ourselves, I suspect it'll get a bit more attention and improvement over the coming years!


#5

Ah, I've been meaning to ask if you were planning on improving it fit the IntroJucer. I wanted to use JUCE for this project so bad, but it seemed like I would've had to build it from the ground up. 

One thing that really annoyed me, which is easy to change, is not being able to change the font size of the line numbers. I personally think they should be the same size as the Editor's text and I think most editors do that. 


#6

The editors I use daily are Xcode, Visual Studio and TextWrangler, and 2 out of 3 of them use a smaller font for the line numbers. Probably for the same reason I did that in juce - i.e. to be able to fit larger numbers in there without it looking silly, and to make it easy to see that it's not part of the file content.

But we will almost certainly want to make the gutter more customisable, as we'll want to add more things in there like breakpoints, errors etc.


#7

I should look at that more closely next time I'm on. It looks pretty much identical to my font. Maybe it's that it's identical to the default font. That does make sense though. The current one just seemed a bit too small for me. That's great to know you're wanting to add things like that to the gutter. ProJucer definitely has the potential to be an awesome development environment.

Edit: Yeah, Visual Studio's line numbers do actually match the font. Sublime Text has the same behavior.  Okay, so Atom has this behavior too. It looks like this is the standard way of doing it, at least from the editors i use and love. I'll have to try others. 

If the ProJucer does go that route, one thing I (and other Vim users) won't be able to live without is some kind of Vim mode. That's my main concern with the project I'm working on, actually. There's a lot of awesome open source Vim emulation plugins out there to get ideas from, so hopefully I can create something useful. I actually doing even use Vim because it's just too constraining in ways, but can't live without the plugins in the editors I use.

Something else that's been weighing on me is how, and if, I can create a plugin system. There's where most of the awesome editor features come from. I'm thinking Python would be a good language to create it for since it can communicate with C, but idk. JavaScript seems pretty doable now too. That's something I'll probably hold off on for a while. There's some neat tools coming out that help with integrating other languages with C++. There was a talk at CppCon about this product that's beginning to do work with Python. I can't remember the name of it right now though.