If I create a widget_class with sub widgets (in an its own .fl file) and then I use its instance in another .fl file, the widget_class's sub widgets are drawn with the wrong size.
I made a little project which shows the issue (and propose a fix): ewc.tar.gz
Here is a picture of what I observe:
And this is what I expect:
I think the problem is in how the xywh fields of the widget_class are converted in the .rs output file:
$diff expected_my_class_ui.rs observed_my_class_ui.rs
28c28
< let mut base_group = Group::new(0, 0, 150, 150, label);
---
> let mut base_group = Group::new(x, y, w, h, label);
30c30
< let mut fl2rust_widget_2 = Frame::new(0, 0, 150, 25, None);
---
> let mut fl2rust_widget_2 = Frame::new(0 + x, 0 + y, 150 + w, 25 + h, None);
35c35
< let mut fl2rust_widget_3 = Group::new(0, 25, 150, 125, None);
---
> let mut fl2rust_widget_3 = Group::new(0 + x, 25 + y, 150 + w, 125 + h, None);
42c42
< let mut fl2rust_widget_4 = Frame::new(5, 30, 65, 115, None);
---
> let mut fl2rust_widget_4 = Frame::new(5 + x, 30 + y, 65 + w, 115 + h, None);
47c47
< let mut fl2rust_widget_5 = Frame::new(80, 30, 65, 115, None);
---
> let mut fl2rust_widget_5 = Frame::new(80 + x, 30 + y, 65 + w, 115 + h, None);
52d51
< base_group.resize(x,y,w,h);
I made a patch which makes fl2rust produces the .rs output I expect (see the file 0001-Fix-size-of-embedded-widget_class-sub-widgets.patch that I put it in the attached ewc.tar.gz).
Indeed the expected output for Rust shall be in par with the C++ output produced by fluid
If I create a
widget_class
with sub widgets (in an its own .fl file) and then I use its instance in another .fl file, thewidget_class
's sub widgets are drawn with the wrong size.I made a little project which shows the issue (and propose a fix): ewc.tar.gz
Here is a picture of what I observe:
And this is what I expect:
I think the problem is in how the
xywh
fields of thewidget_class
are converted in the .rs output file:I made a patch which makes fl2rust produces the .rs output I expect (see the file 0001-Fix-size-of-embedded-widget_class-sub-widgets.patch that I put it in the attached ewc.tar.gz).
Indeed the expected output for Rust shall be in par with the C++ output produced by fluid