widget layout progress

Caolán McNamara caolanm at redhat.com
Mon Aug 20 09:03:23 PDT 2012


Making a bit of progress in widget layout.

Seeing as I'm a bit "close" to it, I'd like to demo some sample commits
of how conversions would look to see if it makes anyone violently ill.

Basically we'd use the gtk ui builder format which is ui editable with
glade.

Full Conversion: Here's what a "full conversion" of a dialog away from
the binary res format to the xml .ui format would look like
http://cgit.freedesktop.org/libreoffice/core/commit/?h=feature/cmclayouttrans&id=064c21aec9245148e90290afd00c46b0999d19c4
i.e. 
a) remove the .src and .hrc
b) remove from the .hxx and .cxx any controls which only exist in the
code in order to get them loaded from the .res file
c) adapt the code to use "get_by_name" to find a widget if code needs to
get an explicit handle to one to set callbacks or whatever[*]

And its help ids in helpcontent2 like so..
http://cgit.freedesktop.org/libreoffice/help/commit/?h=feature/cmclayouttrans&id=4add66152cd6c1c9f4f39be35d8d016cb5b11080
i.e. help ids become the path/to/dialog + dialog name + widget name

Incremental Conversion: Here's an "incremental" conversion from the
binary format to to .ui. In this case no code changes happen at all.
Once the .ui widget ids (and their types) match the ids that the
existing code expects then "magic" makes it work out of the box if the
ui is correctly named and put in the right place.
http://cgit.freedesktop.org/libreoffice/core/commit/?h=feature/cmclayouttrans&id=aefe9698a6982eaefdae51dbaebc15a4e0bd28a7

The idea here is that, with the right conversion utility, the .src files
could be converted to some basic glade-editable skeleton and there's no
programming ability required to knock that into shape for submission.
The submitted .ui can then be dropped in as-is, and/or code then
optimized to complete the conversion.

I'll do up a wiki page with a bit more detail in a while.

C.

[*] maybe the cast-happy syntax looks a bit vile. Perhaps a bit family
of get_foos_by_name, or a get_by_name<T> template instead ?



More information about the LibreOffice mailing list