Scripting language for style


#1

Hi there !

I wrote an open source library to ease OSC based communication between apps (and auto-discovery).

I am now building the GUI with Juce (the forum convinced me and I’m very glad of my choice). The idea behind the GUI is that it gets the layout of the elements (sliders, buttons, etc) from the remote “worker” it is controlling (just like html for web pages).

I am asking for some advice between two formats for this “layout” information. I hesitate between:

  1. Lua
  2. Json
  3. xml + CSS ?

I know these are not exactly the same kind of beasts, but I have built a JSON parser so it would be easy to parse and I know Lua pretty well and it’s used a lot in the remote scripts.

  1. Lua

slider1 = slider1 or Slider:new("/amp/gain")
slider1.set{x=34, y=45, width=10, height=200, connect="/amp/gain"}

  1. Json

{“slider1”:{“x”:34, “y”:45, “width”:10, “height”:200, “connect”:"/amp/gain"}
}

  1. xml+CSS

slider.tiny { width:10px; height:200px; }
#slider_group slider { margin-left:10px; }

The last would be great, just a tad harder to implement. I know Jules wants to go deep into styling, any hint on the direction this is going to take and if it might be useable for my needs ?


#2

My current plans are all about look-and-feel rather than component layout, so not really related to what you’re doing there. As I start working on it, some ideas about this kind of thing might emerge, but haven’t got any strong opinions on it yet!


#3

Ok, so I’ll go for xml+CSS: I like functional languages :slight_smile: .

If anyone else wants to play with ragel and this CSS+xml idea, I’ll be coding stuff in http://bit.ly/5xz6NE (mimas on github).


#4

I recently did something similar. Had xml parser, which parsed the xml and filled up a structure and handed over the structure to a component, which based on the tags created components and placed it on itself.

My xml

[quote]



[/quote]

ItemType is an identifier for the component to be added.

1 -> text
3 -> image
4 -> progress bar

and then the location where the components have to be placed int he component. Intention was to change the look of the component on the fly. My application has to downlaod a new version of the xml and that would change the way my component looks.


#5