lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] Custom wxArtProvider affects html help toolbar buttons


From: Vaclav Slavik
Subject: Re: [lmi] Custom wxArtProvider affects html help toolbar buttons
Date: Thu, 09 Oct 2008 23:02:40 +0200

Hi,

On Mon, 2008-10-06 at 21:54 +0000, Greg Chicares wrote:
>  - The icon in the wx html help titlebar is apparently some default:
>    a white rectangle with a blue bar across the top and a red pixel
>    in the northeast corner. That's the real "frame icon" (if such a
>    term is defined for msw): I had misused that term.
...
> With either experimental patch: no effect on lmi itself, but there's
> a nice effect on html help--help's msw-taskbar icon and its frame
> icon both become 'help-16.png', AFAICT.

I see. It is being caused by a series of cooperating bugs:

(1) icon_monger's desired_icon_size() incorrectly prefers 24x24 size for
_any_ icons and not only for toolbar (and, temporarily, menu icons).
That includes message box icons (too small) and frame icons (too big).
This patch fixes it:

diff -u -u -r1.7 icon_monger.cpp
--- icon_monger.cpp     4 Oct 2008 15:16:26 -0000       1.7
+++ icon_monger.cpp     9 Oct 2008 20:42:35 -0000
@@ -74,9 +74,11 @@
 #if !defined LMI_MSW
     return z;
 #else  // defined LMI_MSW
-    // For the nonce, inhibit rescaling: it's not attractive enough.
-    return wxSize(24, 24);
+#if 0 // For the nonce, inhibit rescaling: it's not attractive enough.
     if     (wxART_MENU    == client) {return wxSize(16, 16);}
+#else
+    if     (wxART_MENU    == client) {return wxSize(24, 24);}
+#endif // 0
     else if(wxART_TOOLBAR == client) {return wxSize(24, 24);}
     else                             {return z;}
 #endif // defined LMI_MSW


(2) HTML help browser requests its icon using wxART_HELP_BROWSER and not
wxART_FRAME_ICON, so wxArtProvider has no chance of knowing the correct
size (16x16; or ideally a set of both 16x16 and 32x32 on MSW).

(3) wxArtProvider::GetSizeHint() returns 16x15 and not 16x16, as it
should, for wxART_FRAME_ICON.

(4) wxTopLevelWindow::SetIcon[s]() does nothing, silently, if the icons
set doesn't contain at least one of 16x16 and 32x32 sizes. (2)+(3) above
ensure that wxArtProvider never returns 16x16 icon and so help frame's
icon is never set.

We will add checks for (4) to wx trunk and will fix (2)+(3) -- I'm not
sure if the latter is safe for 2.8 yet.

Note that the same effect can be achieved using the following without
any fixes to wx by handling this case specially:

diff -u -u -r1.7 icon_monger.cpp
--- icon_monger.cpp     4 Oct 2008 15:16:26 -0000       1.7
+++ icon_monger.cpp     9 Oct 2008 20:42:35 -0000
@@ -117,7 +119,10 @@
             }
         }
 
-    wxSize const desired_size = desired_icon_size(client, size);
+    wxSize const desired_size =
+        (id == wxART_HELP && client == wxART_HELP_BROWSER)
+        ? wxSize(16,16)
+        : desired_icon_size(client, size);
 
     std::ostringstream oss;
     oss << AddDataDir(icon_name) << '-' << desired_size.x;


> >  1. add support for icon sets to wxArtProvider
> >  2. set help browser's frame icon as a set of icons of several sizes (as
> >     any well-behaved app should do)
> >  3. fix the same thing in LMI Unix version (MSW already uses a set; we
> >     don't even need to extend XRC for this, even though it's something
> >     nice to have independently of LMI)
> 
> ...especially if we're not doing something every app should do.

We don't (on Linux), although it's only a cosmetic problem (pixelated or
blurry icons in some WMs and/or window switchers).

> >> Should I be doing something like the following?
> [snip kludge]
> > I think it's too much of a hack... I'd rather set LMI's toolbar size
> > explicitly on MSW (because it's not using what passes for standard win32
> 
> I guess pre-vista msw tends to favor 32x32 and 48x48. However,
> if we used even 32x32, then not all of lmi's current icons would
> fit in one toolbar strip at 800x600 resolution. 

On my XP system, LMI's current toolbar looks about the same size that
Explorer's toolbar, so I don't think there's a problem with its sizes. 

> > size), then would force the icons to the right size without having
> > to overwrite the size in icons_monger. (I didn't try doing it yet,
> > will do.)
> 
> Okay, sounds good.

It just occurred to me that it may not be the best thing to do. If we do
this, we will ensure that the main toolbar will have large icons (as we
want) and that the help browser will look exactly like it looked before.
But do we actually want that? Wouldn't it be better, from UI consistency
point of view, to use the same toolbar size in _all_ LMI windows,
including the help browser one?

I think it would and that we should provide LMI-specific, larger, icons
for the help browser, instead of spending time on creating inconsistent
UI with differently sized toolbars.

Regards,
Vaclav





reply via email to

[Prev in Thread] Current Thread [Next in Thread]