Persistent window size

With the new saved-game metadata facilities, one feature that would be nice and not too terribly difficult to implement is a per saved game window size (saved each time the window closes). As I’m one that subscribes to the code-it-yourself camp, I am probably 50% of the way there, but the SAX parser is stymieing me. (I’ve only done XML in the context of hand-coding SVG and boost::serialize)

Thus spake “mcbeth”:

The SAX parser is very simple. There’s a function which is called when
an element is opened, and a function which is called when an element
is closed. If you need to deal with the CDATA inside an element, then
you handle the element when it closes; if you don’t need to read any
contents, then you handle the element when it opens.

J.


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

Post generated using Mail2Forum (mail2forum.com)

On May 16, 2008, at 3:02 PM, Jeffrey Brent McBeth wrote:

It would also be good, even with ensuring that windows are on-screen,
that they aren’t too big.

On a Mac, the only resizing control is in the lower-left corner, and
if that is off-screen, you can be in trouble. If the window is
zoomable, you can usually get it resize enough so that you can get at
that box. But if the zoom control isn’t there, you are hosed.

Perhaps the right thing to do is to make sure that the window isn’t
any bigger than the available screen real-estate. Available screen
real estate is also a bit tricky, considering the presence of menu
bars (Mac), system tray (windows), or dock (Mac again). But that is
really what should be done.


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

Post generated using Mail2Forum (mail2forum.com)

Hi Jeffrey,

Have a look at ModuleMetaData.read() and AbstractMetaData.XMLHandler.

If you are saving the Window positions for restitution when the save game is loaded, then it is a user preference and is different for each player. One will want them one way, your opponent differently. You will need multiple entries for window size, identified by player name, and maintain other players window sizes that you load when read a saved game.

When a Save Game is opened, we need to read the Metadata and keep it available as the ‘current’ metadata for the current game in progress. Saving the game should just update the ‘current’ metadata, not create a fresh copy as it does now.

This will all happen in GameState. It will be good as it will enable us to carry information over from saveGame to saveGame (comments, player details, sequence numbers, etc.) and will help Joel with his task in the future of linking log files together.

Cheers,
Brent.


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

Post generated using Mail2Forum (mail2forum.com)

Thus spake Jeffrey Brent McBeth:

Persistent location would be annoying—I want my window manager to
determine that.

I think width and height should not be elements at all, but rather
attributes of some element, possibly like this:


J.


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

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Brent Easton”:

Ack, now I understand what this is about. It should be saved in neither the
module metadata nor the save metadata, but in the Preferences. A player
isn’t going to have different preferences for window size from save to
save, just module to module.


J.


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

Post generated using Mail2Forum (mail2forum.com)

The established pattern for this would be to make it part of the Map’s getRestoreCommand(). If you store the window size in the saved game, then you need to save it along with the player’s password so that players can maintain separate window sizes. Let’s avoid putting things into the meta-data except for information that you really need to know before loading the game.

rk

Post generated using Mail2Forum (mail2forum.com)