lmi
[Top][All Lists]
Advanced

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

Re: [lmi] [PATCH] Skin appearance improvements


From: Vadim Zeitlin
Subject: Re: [lmi] [PATCH] Skin appearance improvements
Date: Sun, 3 Jul 2016 00:46:04 +0200

On Sat, 2 Jul 2016 22:24:52 +0000 Greg Chicares <address@hidden> wrote:

GC> On 2016-07-01 18:36, Vadim Zeitlin wrote:
GC> > On Fri, 1 Jul 2016 16:28:54 +0000 Greg Chicares <address@hidden> wrote:
GC> > 
GC> > GC> Here's an odd thing I notice, either with or without this patch.
GC> > GC> When I first open the tabbed dialog, the "Policy" listbox is
GC> > GC> narrow: perhaps thirty pixels wide. If I change the dialog's size
GC> > GC> in either dimension, the width grows to perhaps fifty pixels; it
GC> > GC> retains that width if I resize the dialog again.
GC> > 
GC> >  I don't see quite the same behaviour: when I create a new illustration
GC> > using the single premium skin, the listbox is initially wider than it
GC> > becomes after resizing (it's ~140px wide initially and ~80px wide later).
GC> 
GC> How can that be: I see it grow, while you see it shrink? Is it because
GC> I'm using 192 DPI and you're using a default 96?

 Ah, yes, of course, I should have thought of this. The hard-coded 100px
corresponds to 50px at normal DPI for you (this is slightly complicated
that the extra margins were already computed using the average character
width, i.e. did scale with DPI).

 Also notice that 100px in the code is not scaled, unlike "100" in an XRC
file which is scaled by the DPI-dependent factor with wxWidgets 3.1+.


GC> I've determined that a width of 90 looks best to me at 192 DPI; should
GC> I code it as
GC>   <size>90,-1d</size>
GC> or should I be using dialog units instead?

 Yes, you should be using dialog units, but you already do this above, "d"
applies to both size components.

GC> I know we've discussed this
GC> before, but I've re-read everything on this mailing list that contains
GC> the string "dialog unit" and I'm still unsure. This documentation:
GC>   
http://docs.wxwidgets.org/trunk/overview_xrcformat.html#overview_xrcformat_type_size
GC> says that "90" above represents DPI-independent pixel units.

 Without "d" this would be correct. Some time ago we decided that it made
sense to use DPI-independent pixels in XRC because it's impossible to
implement proper scaling in XRC otherwise, so it's the only way for
XRC-based layouts to look right in high DPI. Note that this does *not*
apply to the pixel values used in C++ code because there it is possible
(and even quite common, although not universal) to use already scaled
values, e.g. anything based on GetCharWidth() would already scale with DPI.

GC> I want DPI independence, especially because I use a different DPI
GC> setting than most or all end users, so wouldn't I always want <size>
GC> values without the 'd' suffix?

 You should still be using dialog units for something like this because, in
addition to the DPI, the default font size can also vary and dialog units
map directly to the "size in characters", unlike pixel values, even
DPI-independent ones. But even raw values in XRC are still DPI-independent.

GC> BTW, why did you suggest
GC> >   <size>50,-1d</size>
GC> above, with 'd' only on the second element?

 This is just how XRC syntax works, quoting the very same URL mentioned
above the grammar is

        size := x "," y ["d"]

and "d", if specified, applies to both x and y. I don't think this can be a
problem in practice because if you try using "50d,-1" you're going to get
an error when trying to load the XRC file (and hopefully when validating it
too, although I didn't check this), so there is no possibility of confusion.

 Regards,
VZ


reply via email to

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