Create account / Log in

Persistent window size

Suggestions for additional features for the module editor and Vassal engine.

Moderators: uckelman, Tim M

Persistent window size

Postby mcbeth » May 16th, 2008, 4:34 pm

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)
User avatar
mcbeth
 
Posts: 22
Joined: December 20th, 2007, 7:27 pm

Persistent window size

Postby uckelman » May 16th, 2008, 7:57 pm

Thus spake "mcbeth":
With the new saved-game metadata facilities, one feature that would be nice a
nd not too terribly difficult to implement is a per saved game window size (s
aved 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 sty
mieing me. (I've only done XML in the context of hand-coding SVG and boost::
serialize)

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
http://forums.vassalengine.org/mailman/ ... engine.org

Post generated using Mail2Forum (http://www.mail2forum.com)
User avatar
uckelman
Site Admin
 
Posts: 8571
Joined: December 10th, 2007, 9:48 am
Location: Durham, England

Persistent window size

Postby tar » May 17th, 2008, 4:05 am

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

Just to be clear, I'm planning on including width/height but not x/y
location. I've personally burned too many times by switching from a
xinerama screen to my laptop screen and having stupid app/window
manager
interactions popping the window up off the screen.

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
http://forums.vassalengine.org/mailman/ ... engine.org

Post generated using Mail2Forum (http://www.mail2forum.com)
User avatar
tar
 
Posts: 776
Joined: January 2nd, 2008, 6:53 pm
Location: Los Angeles area

Persistent window size

Postby Brent Easton » May 17th, 2008, 5:09 am

Hi Jeffrey,

(I haven't written Java in almost a decade), but not the first (I
can create the attribute but have no idea how to extract them).

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
http://forums.vassalengine.org/mailman/ ... engine.org

Post generated using Mail2Forum (http://www.mail2forum.com)
User avatar
Brent Easton
 
Posts: 2983
Joined: December 21st, 2007, 3:06 am
Location: Berry, NSW, Australia

Persistent window size

Postby uckelman » May 17th, 2008, 9:55 am

Thus spake Jeffrey Brent McBeth:
Just to be clear, I'm planning on including width/height but not x/y
location. I've personally burned too many times by switching from a
xinerama screen to my laptop screen and having stupid app/window manager
interactions popping the window up off the screen.

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

Is there a preference for having width/height as attributes to a single
element or two elements? I'm pretty sure I have a handle on accomplishing
the second (I haven't written Java in almost a decade), but not the first (I
can create the attribute but have no idea how to extract them). Feel free
to ignore my blathering, as this is more thinking as I learn this piece of
the codebase as opposed to any true cry for help.

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

<window width="800" height="600" />

--
J.

_______________________________________________
Messages mailing list
Messages@forums.vassalengine.org
http://forums.vassalengine.org/mailman/ ... engine.org

Post generated using Mail2Forum (http://www.mail2forum.com)
User avatar
uckelman
Site Admin
 
Posts: 8571
Joined: December 10th, 2007, 9:48 am
Location: Durham, England

Persistent window size

Postby uckelman » May 17th, 2008, 10:02 am

Thus spake "Brent Easton":
Hi Jeffrey,

(I haven't written Java in almost a decade), but not the first (I
can create the attribute but have no idea how to extract them).

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 wi
ll want them one way, your opponent differently. You will need multiple entri
es for window size, identified by player name, and maintain other players win
dow sizes that you load when read a saved game.

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
http://forums.vassalengine.org/mailman/ ... engine.org

Post generated using Mail2Forum (http://www.mail2forum.com)
User avatar
uckelman
Site Admin
 
Posts: 8571
Joined: December 10th, 2007, 9:48 am
Location: Durham, England

Persistent window size

Postby rk » May 20th, 2008, 8:30 am

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 (http://www.mail2forum.com)
rk
Site Admin
 
Posts: 536
Joined: October 21st, 2007, 3:31 am


Return to Feature Requests

Who is online

Users browsing this forum: No registered users and 1 guest