lmi
[Top][All Lists]
Advanced

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

Re[2]: [lmi] Wrong wxFlexGridSizer usage in about_dialog.cpp


From: Vadim Zeitlin
Subject: Re[2]: [lmi] Wrong wxFlexGridSizer usage in about_dialog.cpp
Date: Wed, 13 Jan 2010 22:51:48 +0100

On Wed, 13 Jan 2010 13:45:44 +0000 Greg Chicares <address@hidden> wrote:

GC> > +    // Unlike in ShowModal() above, we don't want to size this window to 
fit
GC> > +    // its contents vertically as the license text is so long that it 
will
GC> > +    // almost surely not fit the display. Hence just (arbitrarily) make 
it
GC> > +    // slightly larger than the main dialog so that this one appears to 
be on
GC> > +    // top of it.
GC> > +    int height = (3*GetSize().y)/2;
GC> > +    html_window->SetMinSize(wxSize(width, height));
GC> 
GC> An arbitrary 3/2 adjustment feels wrong. And indeed it doesn't DTRT
GC> on msw at 800x600 resolution: I can't scroll all the way to the bottom
GC> of the license.

 I see, sorry for not thinking about it, it's true that 1.5 times the
parent dialog size may already be bigger than the client (i.e. without hte
taskbar height, so even less than 600 pixels) screen size.

GC> The last line I can see is:
GC> | proprietary programs.  If your program is a subroutine library, you may
GC> and I can't see the "Close" button. At 1600x1200 resolution, OTOH, the
GC> window is only about half as high as it "wants" to be, so the inability
GC> to resize it feels like a defect.

 FWIW I think the inability to resize _any_ window is a defect. I
definitely have no idea why do we forbid the user to resize this one. Is
there any reason for this?

GC> This is the first thing a new user sees when running the program for the
GC> first time, so I'm concerned about first impressions. Isn't there some way
GC> to make it behave the way it used to? I suppose we want something like:
GC> 
GC>   int height = html_window->GetInternalRepresentation()->GetHeight();
GC>   int max_height = /* the height that a maximized window would have */
GC>   height = std::min(height, max_height);
GC>   html_window->SetMinSize(wxSize(width, height));
GC> 
GC> so I think my only question is how to use wx to ascertain what height a
GC> maximized window would have.

 This is given by "wxDisplay::GetClientArea().height". And we know the
display we're on because it's "wxDisplay::GetFromWindow(this)". However we
shouldn't fix this as the size of the HTML window as this is the maximal
height for the full dialog and so the button would still be cut off if we
did this. Instead, we should simply maximize the dialog vertically by using

        dialog.SetSize(whatever,
          wxDisplay(wxDisplay::GetFromWindow(this)).GetClientArea(),height);

instead of Fit(). However I think that automatically creating a vertically
maximized window might be slightly surprising for the user. I don't think I
saw many programs doing it. IMHO using a more golden-ratioesque proportion
would look better.

GC> And what about the eighty-column width, e.g. at 1600x1200, where the
GC> GPL looks like a lone column in a newspaper? We could apply the patch
GC> below [0] to format the license as html paragraphs (instead of wrapping
GC> the raw eighty-column text in 'pre' tags), and then set both height and
GC> width to occupy the whole screen.

 If we wanted to do this, then it would be enough to simply call
Maximize(), no complicated size calculations needed. OTOH I'm even less
sure if it's appropriate to open a full screen window in this case. Reading
1600-pixel wide lines is not nice at all neither (but 1600 horizontal
resolution is ideal for putting 2 80-column text windows side by side).

 Regards,
VZ

reply via email to

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