vslavik / poedit

Translations editor for Mac, Windows and Unix
https://poedit.net
MIT License
1.79k stars 278 forks source link

ID column doesn't appear until window is resized #643

Closed Spixmaster closed 2 years ago

Spixmaster commented 4 years ago

Environment Operating System: Arch Linux KDE Plasma Version: 5.19.2 KDE Frameworks Version: 5.71.0 Qt Version: 5.15.0 Kernel Version: 5.7.7-arch1-1 OS Type: 64-bit Processors: 8 × Intel® Core™ i5-8265U CPU @ 1.60GHz Memory: 7.7 GiB of RAM Graphics Processor: Mesa Intel® UHD Graphics 620 DE: Plasma WM: KWin

Bug The string ID on the right does not appear if a .po file is just opened. It only appears if the window is resized to a smaller resolution and then resized to full screen.

vslavik commented 3 years ago

Quoting another report by Antonio Rosella:

I'm using poedit 2.4.2 on an MXLInux 19.2 distribution ( an AntiX-Debian derivative, XFCE desktop https://mxlinux.org/ ). The package came from the distribution stable repository

Linux htpc 5.9.0-3mx-amd64 #1 SMP Debian 5.9.9-1~mx19+1 (2020-11-21) x86_64 GNU/Linux

Here attached you can find 3 snap that hopefully describe the issue. The first (poedit_1.jpg) is the opening window that pop up at the program startup: as you can notice, column "ID" it is not present at all, even if "View -> Show String ID" is selected

Now, if I enlarge the window on the right side, the ID colum show itself. (poedit_2.jpg) . You have to resize the full windows: if you try to resize only the "Translation suggestions" subwindow nothing happen

Again, reducing the window size, i can be noticed that the column "ID" start to resize, until it disappear completely (image poedit_3.jpg is a snap in the middle of the process...). It is at this point that the massages I sent you pop up on the console, arguing about "Negative content width -7 (allocation 5, extents 6x6) while allocating gadget (node button, owner GtkButton)"

It seems that on shrink of the window, the column "ID" start to reduce his size further than allowed

super7ramp commented 2 years ago

I can reproduce the issue with the following environment:

I think the issue comes from the fact the sizing of the ID column is not immediate - at least on wxGTK [^note].

So in PoeditListCtrl::UpdateColumns:

    if (m_displayIDs)
    {
        // determine best fitting width only once, then set it as fixed, because IDs are immutable
        m_colID->SetWidth(wxCOL_WIDTH_AUTOSIZE);
        m_colID->SetWidth(m_colID->GetWidth());
    }

the width returned by m_coldID->GetWidth() can actually be 0, hence the observed behaviour.

The CallAfter at the end of the method:

#ifdef __WXGTK__
    // wxGTK has delayed sizing computation, apparently
    CallAfter([=]{ SizeColumns(); });
#endif

has no effect since on the sizing of the ID column is made in UpdateColumns, not SizeColumns.

[^note]: This might be related to this node in wxDataViewColumn documentation:

> Note
>     In wxGTK, setting the width of the column doesn't happen immediately when [SetWidth()](https://docs.wxwidgets.org/trunk/classwx_settable_header_column.html#aac89bf5d893ccf57c3e50e3d1acbebea) is called, but only slightly later and [GetWidth()](https://docs.wxwidgets.org/trunk/classwx_header_column.html#a992a31984563a35b0222adf5a06b0a77) will return the old width (0 initially) until this happens. If the column widths are set before [wxDataViewCtrl](https://docs.wxwidgets.org/trunk/classwx_data_view_ctrl.html) is initially shown, they will only be effectively set when it becomes visible.