Reremaining tasks for beta3

Done (finally!) in swampwallaby-work@3710. For bonus points, I am saving the Module Manager window position, size and the split divider location in prefs.

This was a bugger of thing to fix. To fix the bug where the splitter on the main map was not setting correctly, Rodney was setting the divider location in ComponentSplitter usinf SwingUtilities.invokeLater(). This was causing all sorts of race conditions in the Module Manager assuming the split was there.

The only way I could eventually get this to work was to remove the invokeLater in the SplitPane.hideComponent() method. My testing indicates that this was not needed to fix the original bug, only the ones in showComponent().

Brent.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Brent Easton”:

Is saving the window position a good idea? Shouldn’t your window manager
take care of that?

Thanks very much. I was pretty sure that this wasn’t a superficial
problem, as I spent something like six hours on it myself before saying
to hell with it.


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

I’m saving the Module Manager position when you quit the Module Manager. When you next start it up, it opens the same size, in the same position with the same divider setting. Current behaviour is to reset everything to a standard size.

B.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

On Jun 3, 2008, at 4:00 AM, Brent Easton wrote:

Is there a check to make sure that the window is on-screen?
This can be a problem if

  1. The user changes screen resolution between runs.
  2. A laptop user switches between a larger, external screen and
    the smaller, built-in screen.

I’m a fan of remembering the positions and sizes, but there also needs
to be a sanity check in there as well.

Especially for Mac users, it would also be good if the total size of
the window didn’t exceed the current screen size (plus an allowance
for the menu bar…), since the resize area is at the bottom left
corner (only!), so if the window is too tall, the only way to resize
it is to use the “zoom” button in the upper left to get the lower
right corner on-screen.

Looking at <http://codeidol.com/java/swing/Transparent-and-Animated-Windows/Slide-Notes-Out-from-the-Taskbar/

I found the following advice:

“The key to figuring out your available space is to get the local
GraphicsEnvironment, which describes the display, and then call
getMaximumWindowBounds( ). This method, introduced in Java 1.4,
returns a Rectangle representing the largest centered Window that
could fit on the display, accounting for objects that intrude on the
display’s usable space, like the Windows taskbar or the Mac’s
monolithic menu bar”

The site also has some sample code showing an application of this
technique.

It looks like the key call would be:

GraphicsEnvironment
.getLocalGraphicsEnvironment().getMaximumWindowBounds()


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Hi Jeffrey, Thomas,

Thanks for your input.

The window preference saving uses a standard Vassal class (PositionOption) to save and restore window sizes in Preferences. It already attempted to adjust the window size to the screen size, but did not do a very good job.

I have fixed PositionOption to

a) Ensure the window size is no greater than the desktop size and
b) The entire window is slid over to be completely on the desktop if any part of it is off the desktop.

Thomas, thanks very much for pointer to

GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds()

We has been using

Toolkit.getDefaultToolkit().getScreenSize()

which does not take into account things like toolbars. It can leave windows obscured by the Windows Taskbar for example. Multiple desktops would also potentially cause problems.

Joel, swampwallaby-work@3712 contains this fix.

Jeff wrote:

I guess you mean the main Player window? Individual Map windows already have the save position feature enabled, but they will now take advantage of my changes to PositionOption.

I’ll have a look at adding this to PlayerWindow.

Regards,
Brent.

*********** REPLY SEPARATOR ***********

On 3/06/2008 at 8:51 AM Thomas Russ wrote:


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Thus spake Thomas Russ:

There’s another problem with remembering window size: You need to check
whether the window is maximized, and only save the size the window
would have unmaximized, but also save a maximized flag. It’s going to
be extremely annoying if I quit VASSAL when it’s maximized and I then
lose the unmaxized size as a result.


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Can do.

What should the default behaviour on startup be? When you restart Vassal, should the window be maximized again, or should it go back to it’s unmaximized size?

My feeling is it should return to the unmaximized size. This is only an issue for the three main windows, all the subsidiary windoes in Vassal do not support maximization.

B.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

If I maximized a window (and left it that way), I would expect it to be maximized the next time I start. This normal program behavior, and Vassal is about the only one I see not doing it.

Thus spake “Rindis”:

I concur.


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)