Re: XML documentation for Glade files



On 28/04/2020 07:19, İsmail Arılık wrote:
Hi. Is it a how-to question or just an announcement? If it is a question, I will suggest to preprocess Glade files instead of converting them to Ada files. I think you can achieve what you want by doing this. 

27 Nis 2020 Pzt 11:26 tarihinde Bertus <bertus dries planet nl> şunu yazdı:
To users and developers of Glade,

I am trying to write a Code Sketcher for Glade files which translates The glade file to a series of Ada files that create the Ada code which has the same result as the GtkBuilder function.
The reason for this is:
  1.  As I am writing several packages that use Dialog's I want to develop in Glade I will have several Glade files that must be reached by the program in which these packages are used.
  2. As I am mostly writing multi language programs I am using packages that enable me to change the language in which the program shows itself to me and in which it responds. That means that all strings that are used in the glade file must be replaced by string variables for instance "Open" replaced by Open_var(language)  in which Open_var an array of strings is with the string value for a selected language.
So I need a complete list with all the XML statements possible and the Gtk routine which is the requested response.
Some I Understand and some are difficult to find.

In the docx file I show a possible output as I see it. In the left TextView is the complete .glade file, in the middle  a Ada Specification file for the package and in the right one the body file. Left one is not edible, the middle and the right one can be edited.

L. Dries

Reply from Barry Bird  2020-04-28:

     There is already a project in github which translates Glade files into executable C code. See https://github.com/featurespoon/GladeToC It covers most widget classes (57) and also generates a Cmake file to ease the compilation process. The only code you need to write is in the signal handlers;  GladeToC produces the handler stubs. It can run on Linux or Windows.  It supports a round-robin development process to avoid over-writing the code you wrote yourself! Another project https://github.com/featurespoon/GladeToCBuilderDemo demonstrates its output from a small Glade file wth 47 widget instances (428 lines), producing about 900 lines of code in a fraction of a second. I attach a screenshot.

    The translation is not a simple process and producing a tabular translation of all widgets and all their properties would be insufficient and comprehensiveness would be difficult.  Nevertheless, the 'front-end' of GladeToC is currently being taken and adapted to generate python code instead.  Python has the advantage of not requiring a compilation step, and, having weak typing, is less verbose.

       B. Bird

Attachment: GladeToCBuilder.jpg
Description: JPEG image



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]