1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-04 07:40:12 +01:00

Calculate icon size rather than ask for it on GTK and limit width

When requesting The icon size (under Gnome at least), the size was
overly large, so use the wxMac method and just estimate what it
will be.

And, limit the column widths so the dialog doesn't grow wider than
the screen width.
This commit is contained in:
Leland Lucius
2015-05-15 21:06:30 -05:00
parent 44900e1938
commit 73d2681759

View File

@@ -20,6 +20,7 @@
#include <wx/defs.h>
#include <wx/dialog.h>
#include <wx/dir.h>
#include <wx/display.h>
#include <wx/dynarray.h>
#include <wx/dynlib.h>
#include <wx/hashmap.h>
@@ -682,10 +683,8 @@ void PluginRegistrationDialog::RegenerateEffectsList( int iShowWhat )
// Only need to get the icon width once
if (i == 0)
{
#if defined(__WXMAC__)
// wxMac doesn't return the ICON rectangle. It returns the
// rectangle for the first column and that even comes back
// with negative numbers sometimes.
#if defined(__WXMAC__) || defined(__WXGTK__)
// wxMac and wxGtk do not return a valid width.
//
// So, just guess.
wxIcon i1(unchecked_xpm);
@@ -704,6 +703,14 @@ void PluginRegistrationDialog::RegenerateEffectsList( int iShowWhat )
i++;
}
#if defined(__WXGTK__)
// Keep dialog from getting too wide
wxDisplay d(wxDisplay::GetFromWindow(GetParent()));
int w = d.GetGeometry().GetWidth() - 100;
iNameLen = wxMin(iNameLen, w);
iPathLen = wxMin(iPathLen, w - iNameLen);
#endif
mEffects->SortItems(SortCompare, 0);
for(i=0;i<mEffects->GetItemCount();i++)
{