garrigue / lablgtk

LablGTK 2 and 3: an interface to the GIMP Tool Kit
https://garrigue.github.io/lablgtk
Other
89 stars 40 forks source link

Add WRAP_WIDTH, WRAP_MODE tags to cell_properties_text, supported since gtk 2.8 #146

Closed nguermond closed 2 years ago

nguermond commented 2 years ago

Allow text wrapping in cells in tree view.

Description of wrap-width: https://docs.gtk.org/gtk3/property.CellRendererText.wrap-width.html

I can't figure out how to get wrap-mode to work: https://docs.gtk.org/gtk3/property.CellRendererText.wrap-mode.html

garrigue commented 2 years ago

Since it is there since 2.8, this should also probably go into lablgtk2.

garrigue commented 2 years ago

What is your problem with wrap-mode. Since pango_wrap_mode is already defined, the conversions should be available.

nguermond commented 2 years ago

When I recompile gtkTree.props I get

      propcc src/gtkTreeProps.ml,src/ogtkTreeProps.ml
Warning: no conversion for type PangoAttrList in class GtkCellRendererText
Warning: no conversion for type PangoWrapMode in class GtkCellRendererText

As a result, when cell_renderer_text_param x is called in gTree.ml,

Error: This expression has type
         [> ...
          | `WRAP_MODE of Pango.Tags.wrap_mode
          | `WRAP_WIDTH of int ]
       but an expression was expected of type
         [< ...
          | `WRAP_WIDTH of int ]
       The second variant type does not allow tag(s) `WRAP_MODE
garrigue commented 2 years ago

I see. You just need to add WrapMode in propcc.ml4, line 79:

  [ "Stretch"; "Style"; "Underline"; "Variant"; "EllipsizeMode"; "WrapMode" ];

Then run make dev.

nguermond commented 2 years ago

This seems to work!

nguermond commented 2 years ago

Should I make a similar pull request to master?

garrigue commented 2 years ago

Should I make a similar pull request to master?

No need, I'll take care of this.