Re: Problem with hidden second project window on Windows WAS: Re: wxGetClientDisplayRect

1 message Options
Embed this post
Permalink
Gale (Audacity Team)

Re: Problem with hidden second project window on Windows WAS: Re: wxGetClientDisplayRect

Reply Threaded More More options
Print post
Permalink

| From "Ed Musgrove" <[hidden email]>
| Sat, 17 Oct 2009 20:36:01 -0700
| Subject: I think you might like this new project behavior

Thanks for the latest suggestion to fix large new project
windows being hidden. Can we keep this on the list please,
in case others have comments?

I applied the patch below, tested on XP. Two things first:

If I start with an initialised .cfg, launch Audacity, maximise it,
exit and re-launch it, then click "Restore Down", the project
window moves up so that the Title bar is off screen. If I exit
like that, .cfg has  

X=-4
Y=-29
Width=1028
Height=712
Maximized=0

so Audacity restarts like that.

If I re-initialise .cfg, so it opens with a small normalised
window at top left, do File > New six times then exit using
that last new window, Audacity relaunches with the x,y of
the default window, not the one that was exited with.  I
think that's reasonable, but also think you had this on your
list of possible improvements, is that correct?

In my test case with a large more or less square project
window:

X=0
Y=0
Width=689
Height=662
Maximized=0

the first new project window opens offset down and to right;
the second and subsequent new ones are offset only to right
at the same vertical position and window size. When the right
edge of the screen is reached, then the subsequent new
windows start decreasing in size. Could we be more exotic
(such as offsetting alternate windows up and down when
they cannot go lower)? Otherwise, IMO this now works
quite well and is definitely acceptable (to me).  

I noticed when the windows cannot be decreased further in
size at the right edge, no new windows are added when you
File > New,  and  the Selection Toolbar end/length buttons
blackout. Audacity then becomes unresponsive to mouse
unless you realise you can use CTRL + W to get out of the
problem. This does not happen until I have over 20 windows
on my 1024 x 768 screen, but could be an issue on smaller
screens. Can we do what we used to do when no more windows
can be added at right, and start the next new window at the
stored .cfg position? Or some other idea?

If I start with a small window not at the top of the screen such
as:

X=147
Y=105
Width=482
Height=485
Maximized=0

then new windows don't now exhibit the "jump to top" problem
as far as I can see, which is great.

So apart from the "Restore Down" problem, I think we could
have cracked this one now. Once restore down is fixed, I'll try
the patch on Linux too. Thanks, Ed.




Gale


   


> In the file:
> Audacity\src\Project.cpp
> At or near line number 543, replace the contents of the
> GetNextWindowPlacement () function with the following (I've attached a patch
> if that would be preferable) :
>
> void GetNextWindowPlacement(wxRect *nextRect, bool *bMaximized)
> {
>    int inc = 25;
>    *bMaximized = false;
>    wxRect defaultWindowRect;
>    GetDefaultWindowRect(&defaultWindowRect);
>
>    if (gAudacityProjects.IsEmpty()) {
>       //Read the values from the registry, or use the defaults
>       nextRect->SetX(gPrefs->Read(wxT("/Window/X"),
> defaultWindowRect.GetX()));
>       nextRect->SetY(gPrefs->Read(wxT("/Window/Y"),
> defaultWindowRect.GetY()));
>       nextRect->SetWidth(gPrefs->Read(wxT("/Window/Width"),
> defaultWindowRect.GetWidth()));
>       nextRect->SetHeight(gPrefs->Read(wxT("/Window/Height"),
> defaultWindowRect.GetHeight()));
>
>       gPrefs->Read(wxT("/Window/Maximized"), bMaximized);
>    }
>    else {
>       //This code was heavily modified to deal with iconized project windows
>       //Ed Musgrove 28 September 2009
>       bool validWindowSize = FALSE;
>       AudacityProject * validProject = NULL;
>       size_t numProjects = gAudacityProjects.Count();
>       for (int i = numProjects; i > 0 ; i--)
>       //   read these backwards so that new project locations will increment
> off the newest project window
>       {
>          if (!gAudacityProjects[i-1]->IsIconized()) {
>              validWindowSize = TRUE;
>              validProject = gAudacityProjects[i-1];
>              i = 0;
>          }
>       }
>       if (validWindowSize)
>       {
>          *nextRect = validProject->GetRect();
>          *bMaximized = validProject->IsMaximized();
>       }
>       else
>       {
>           nextRect->SetX(gPrefs->Read(wxT("/Window/X"),
> defaultWindowRect.GetX()));
>           nextRect->SetY(gPrefs->Read(wxT("/Window/Y"),
> defaultWindowRect.GetY()));
>           nextRect->SetWidth(gPrefs->Read(wxT("/Window/Width"),
> defaultWindowRect.GetWidth()));
>           nextRect->SetHeight(gPrefs->Read(wxT("/Window/Height"),
> defaultWindowRect.GetHeight()));
>           gPrefs->Read(wxT("/Window/Maximized"), bMaximized);
>       }
>
>       //Placement depends on the increments
>       nextRect->x += inc;
>       nextRect->y += inc;
>    }
>
>    //Make sure that the Window will be completely visible
>    //Get the size of the screen
>    wxRect screenRect = wxGetClientDisplayRect();
>
>    // We do not want to reset the increments unless the top left corner of
> the new window
>    //    gets too near the bottom right hand corner of the screen -- also,
> make sure the
>    //    window fits on the screen
>    // Ed Musgrove
>    // 16 October 2009
>          //Have we hit the right side of the screen?
>    wxPoint bottomRight = nextRect->GetBottomRight();
>    if (bottomRight.x > screenRect.GetRight()) {
>       nextRect->width = screenRect.width-nextRect->x;
>    }
>       //Have we hit the bottom of the screen?
>    if (bottomRight.y > screenRect.GetBottom()) {
>       nextRect->y  -= inc;
>    }
> }
>
> From "Gale (Audacity Team)":
> | From "Ed Musgrove" <[hidden email]>
> | Sat, 17 Oct 2009 18:20:59 -0700
> | Subject: [Audacity-devel] Problem with hidden second project window
> | on Windows WAS: Re: wxGetClientDisplayRect
> > My choice of the word "excessive" was poor. What I meant to say was, why
> > should the new window open any taller than it needs to open? If one is
> > starting a project with no tracks, it might be reasonable to open tall
> > enough to support all the users toolbars plus the additional height required
> > for one track. If one is opening a stereo project, it should open just tall
> > enough again to support the toolbars and two tracks (and so forth for
> > multi-track projects) but no larger than will fit on the screen.
>
> Isn't adjusting the window height automatically to the content upon
> launch rather non-standard, so would be unexpected? For example,
> if I had my windows arranged so that Audacity normally opened to
> cover another normalised window behind it, I might not appreciate
> it deciding to open at a lesser height when I launched it by clicking
> its .exe rather than right-clicking over a stereo file.
>
> However your idea of remembering the previous normalised window
> state is something I would like to see implemented because that
> would appear to be standard behaviour which we aren't following.  
> This is the case when you exit normalised to a small window, relaunch,
> exit maximised, relaunch and then click "Restore Down", you get
> a window that is hardly any smaller, not the window at your last
> "normalised" exit.
>  
>
>
> Gale
>  
>
>  
> > > -----Original Message-----
> > > From: Gale Andrews [mailto:[hidden email]]
> > > Sent: Saturday, October 17, 2009 6:07 PM
> > > To: [hidden email]
> > > Subject: Re: [Audacity-devel] Problem with hidden second project window
> > > on Windows WAS: Re: wxGetClientDisplayRect
> > >
> > >
> > > | From "Ed Musgrove" <[hidden email]> Sat, 17 Oct 2009
> > > | 17:02:56 -0700
> > > | Subject: [Audacity-devel] Problem with hidden second project window on
> > > | Windows WAS: Re: wxGetClientDisplayRect
> > > > I'll have some time after dinner tonight play with this. Doing it the
> > > > Foxfire way involves rummaging through all the open projects to find
> > > > one best suited to building a new Project window on.
> > >
> > > On the face of it, that Firefox behaviour works quite well, which doesn't
> > > necessarily mean we have to do that.
> > >
> > >
> > > > Since the new project that you are opening has no track in it, why
> > > > does it need to be excessively tall?
> > >
> > > If I open a stereo audio file by right-click over the file in Explorer >
> > Open With
> > > > Audacity, the stereo track fits neatly in that window.  Same if I
> > generate a
> > > stereo track. I don't call that 600px or so height "excessive".
> > >
> > >
> > > > Currently, I am basing it on the default project size and location.
> > > > Maybe the real answer is to give the user a preference for size and
> > > > location of the default window.  That is the way I would prefer to do
> > > > it. As an alternative a more code intensive solution would be to
> > > "automatically"
> > > > resize the project window when a new track is added.
> > >
> > > I don't think we need or want a preference, just a reasonable offset
> > > behaviour for new windows that maintains the height and ideally the size
> > > until both edges are reached. Existing behaviour seems to largely achieve
> > > that, the issues it has being:
> > >
> > > * hiding of some new windows if they are large
> > >
> > > * the "jump to top" problem (which has been complained about
> > >    before, now I recall, and we should fix while we're about it if
> > >    possible).
> > >
> > >
> > >
> > > Thanks
> > >
> > >
> > > Gale
> > >
> > >
> > >
> > > > > -----Original Message-----
> > > > > From: Gale Andrews [mailto:[hidden email]]
> > > > > Sent: Saturday, October 17, 2009 3:40 PM
> > > > > To: [hidden email]
> > > > > Subject: Re: [Audacity-devel] Problem with hidden second project
> > > > > window on Windows WAS: Re: wxGetClientDisplayRect
> > > > >
> > > > >
> > > > > | From "Ed Musgrove" <[hidden email]>  Fri, 16 Oct
> > > 2009
> > > > > |23:20:15 -0700
> > > > > | Subject: [Audacity-devel] Problem with hidden second project
> > > > > |window on Windows WAS: Re: wxGetClientDisplayRect
> > > > > > Gale, if you are satisfied with the provided repair, please commit
> > > > > > the patch attached.
> > > > >
> > > > > Hi Ed,
> > > > >
> > > > > Just checked on Windows (not Linux). I'm not an expert with
> > > > > normalised windows. But I have to be honest, I really don't like the
> > > > > solution of continually reducing the height of each new window once
> > > > > the bottom edge is reached.
> > > > >
> > > > > For example where the original is already close to maximum height:
> > > > >
> > > > > X=0
> > > > > Y=0
> > > > > Width=600
> > > > > Height=643
> > > > > Maximized=0
> > > > >
> > > > > on a 1024x768 screen with a 60px high taskbar, I get one new window
> > > > > at the same size, offset down and right. The next new window offsets
> > > > > down but jumps to the right edge of the screen, so is actually much
> > > > > wider than the previous windows. Subsequent new windows become
> > > less
> > > > > wide again due to the left edge being offset, but are also at
> > > > > increasingly reduced height.
> > > > >
> > > > > The height of the window IMO is much more important to maintain than
> > > > > the width (because of people having multiple tracks in the project).
> > > > >
> > > > > Admittedly Firefox reduces the height of the first new window if the
> > > > original
> > > > > is at maximum height, but then merely offsets further new ones
> > > > > (vertically and horizontally) without reducing the height.
> > > > >
> > > > > Pre-patch, if the normalised window that Audacity opens with is
> > > > > close to maximum height and is offset from the top of the screen,
> > > > > the first new window jumps to the top. That isn't ideal, but the
> > > > > following new windows seem to maintain their size until they reach
> > both
> > > edges.
> > > > > When the bottom edge is reached, the subsequent new windows carry
> > > on
> > > > > being offset to right, maintaining their size, until the right edge
> > > > > is
> > > > reached.
> > > > >
> > > > > Can we do without resizing where it obviously isn't necessary? Just
> > > > > offset
> > > > so
> > > > > that the next new window always comes up on top and can't be
> > > > > entirely hidden, which is the main problem at the moment. I suppose
> > > > > if the original window is already at maximum height and close to
> > > > > maximum width, a few windows offset to right with reduced width
> > > > > might be OK. But that would then need some kind of rule to discover
> > > > > how many new, less wide windows there could be before the next new
> > > window is an offset of the original.
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > Gale
> > > > >
 

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel