From 73d2681759755b8fdcaccbc5378fd8735057420b Mon Sep 17 00:00:00 2001 From: Leland Lucius Date: Fri, 15 May 2015 21:06:30 -0500 Subject: [PATCH] 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. --- src/PluginManager.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/PluginManager.cpp b/src/PluginManager.cpp index c413c4d29..42491fa9e 100644 --- a/src/PluginManager.cpp +++ b/src/PluginManager.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -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;iGetItemCount();i++) {