Scintilla


#1

Hi,

I just registered, so hello to everybody :slight_smile:

Im just tryin juce on both win and linux, and everything is just perfect… I wish I could use juce but I NEED Scintilla (absolutely mandatory), is there a way to use it in juce? under Qt I used QScintilla (a qt widget port by riverbank)… I know there are widgets for Wxwidgets and some other toolkit, but couldnt find anything regarding juce…

TY


#2

There is no reason that you could not simply use Scintilla from an otherwise JUCE application. You could have something like this:

#if JUCE_WINDOWS
SendMessage() // Or SCN_MACRO…
#elif JUCE_LINUX
scintilla_send_message()
#endif

It would be nice to wrap up the interface into a class (glancing at the docs it seems a bit craptacular), but not really required.


#3

Afaik scintilla exposes itself as a gtk widget, but ill chek today, i think i should change every gtk specific code into juce equivalents, if possible. Im not much into scintilla dev and didt really had even a glance at its code but i thought it was a bit messier thannjust defining a macro for its sendmessage…


#4

Well, messy is the word. It was clearly written as a Windows control (controlled via Windows messages). The source already includes a bunch of defines for that. The GTK+ port ia real kludge, mimicing the same messaging model. But GTK+ itself has a C interface. You would link to it, and would need to do the instance/interface calls (see even the Scintilla examples).

The point of the #ifdefs is that you don’t need to wait for someone else to write a wrapper for this crappy code. You can use the same platform defines that JUCE uses to deal with platform specific implementations.


#5

is there a valid (even commercial) alternative?

We need python editing with syntax highlighting, code completion and api support (popups with different calls and parameters for a given object/method while editing)… and code folding and line numbering… braket matching, auto indent…

We already have all this in QScintilla but maybe theres something else less crappy…


#6

we investigated wrapping/porting scintillagtk and its not feasible imho (everything is possible, but this doesnt fit with our deadlines)… we have a quite large commercial project based on qt and planned to switch to Juce but our dependence on Scintilla just prevents us to do so (sadly)… the switch would have been quite easy thou since the ui we deal with is minimal… im gettin depressed…


#7

I’ve never heard of Scintilla before, but if it’s a Windows control, can’t you just embed it with the ActiveXComponent class?


#8

Scintilla is a code editor widget, features code completion, auto indent, line numbering, lexers, folding and so on.
Juce CodeEditorComponent was the first thing I checked but Scintilla sadly goes far beyond that

btw its a window control under win32 and a gtk widget under linux/bsd/whatever. I didnt check the ActiveXComponent class but the OsX/Linux issue remains


#9

Well, if the linux version can provide an X Window handle, you could add it to a juce window using native calls.


#10

gettin an handle seems possible…
dont wanna bother you but could you elaborate this a bit? TY


#11

Well, you can use Component::getNativeHandle() to get the X Window handle of the juce component, and then use whatever the X calls are to add your own window to it as a child. You’d need to keep it positioned correctly, and the ComponentMovementWatcher would be good for that.

Personally, I’d suggest looking at how ActiveXControlComponent, NSViewComponent and UIViewComponent work, which basically all just do the same job in OSX/MS Windows. (In fact, maybe someone else out there has already written a similar class for embedding X Windows?)


#12

gonna check TY


#13

FWIW, it’s not (or wasnt’) an activeX control in Windows. It’s a DLL which creates a custom Window Class (vintage Win32 stuff). You could access it with the Native window stuff. The GTK+ is a bit weirder. They didn’t have a good fit for the standard message model, so they have a wrapper method which packages stuff up for internal messages.

I once audited a project that used it, but haven’t ever selected it for editing myself.

EDIT: FWIW, the main site for the component is here: http://www.scintilla.org/

Answering the question above, juce has a very simple source editor class and I recall some Scintilla alternatives floating around (AvalonEdit?) Also, there are a lot of source editors in source form (JEdit, vim, GEdit, etc.) where you could pick up context coloring, index logic, etc. I’m not trying to dissuade you from Scintilla, I just saw folks run into a bunch of problems using it on one project (problems that popup when you search StackOverflow). If it’s working for you, I see no reason you can’t fit it into a juce app.


#14

Out of curiosity: What is the reason to switch an existing project from Qt to Juce? I’m currently considerung to port a project from win32 to Juce or Qt. My main concern with Qt is the immense bloat, apart from that it seems totally mature. My concerns with Juce are its blurry appearance and its focus on mostly sound-related applications (as opposed to document-related applications like text- graphic- or music-notation-editors). Could you briefly tell us some of your considerations? Thanks a lot!


#15

[quote=“jfitzpat”]
Answering the question above, juce has a very simple source editor class and I recall some Scintilla alternatives floating around (AvalonEdit?) Also, there are a lot of source editors in source form (JEdit, vim, GEdit, etc.) where you could pick up context coloring, index logic, etc. I’m not trying to dissuade you from Scintilla, I just saw folks run into a bunch of problems using it on one project (problems that popup when you search StackOverflow). If it’s working for you, I see no reason you can’t fit it into a juce app.[/quote]

The problem relies with scintilla APIs… we already use it for code completion… syntax highlighting is just a very little part of it. We need code folding as well, and other things we have almost out-of-the box with scintilla. We checked scintillagtk in order to plan a port to juce components, but it is absolutely unaffordable in deadline terms.

I personally never checked avalonEdit, I will. btw every alternative Ive found always misses something crucial… either code completion, code folding, line numbering or things like that…

doesnt matter how much Id like to use it on juce, seems we cant right now.


#16

[quote=“Christof”][quote=“u56237z”]
Out of curiosity: What is the reason to switch an existing project from Qt to Juce?[/quote][/quote]

In our case its simple. We work on closed source commercial, and (altoug the project is quite large) its gui is actually a window with a menubar.

We-re still waitin to purchase Qt’s commercial licence (we cant go LGPL) but I personally feel Id rather not spend +4K euros just to use a window/menubar and get keystrokes & mouse input.

And no, writing per-platform window/mouse/keyboard is not an option as things are a bit more complex.


#17

Please keep us updated on your progress! It would be great to be able to use Scintilla within Juce apps!