icons

Anywhere you can load a png, gif or jpg in 3.0, you can now load an svg image instead.

There has been some discussion of having GamePieceImages generate svg’s, but currently, there are no other plans beyond allowing them to be used in place of existing images.

B.


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

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Brent Easton”:

There’s no threading problem with the methods which return an Icon, BTW,
as that’s a Swing component and so those methods should only ever be called
from the EDT anyhow. It’s just the ones which return something else from
the map.

Yes, except that they wouldn’t need to be methods calls at all—you’d just
have a private static member called instance, and call methods on that.

Well, it doesn’t need to be an inner private class, but there are some
benefits of having it be one. In particular, it’s nicer to have an inner
private class if the alternative is having a huge static block for
initialization—all of that stuff can be put into the ctor of the inner
private class, then. Also, having an inner private class future-proofs us
somewhat, as fewer changes need to be made if we decide someday that this
shouldn’t be a singleton anymore.


J.


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

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Tim M”:

Right now, we don’t have plans to do more, but our present plans extend
into only about 3.3 or so. What you’re suggesting here had never occurred
to me, actually. It’s not a bad idea, but probaby won’t get any attention
in the next 6-9 months.


J.


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

Post generated using Mail2Forum (mail2forum.com)

Joel,

What’s the best way to report a bug if you are in a section of code and realise something has gone wrong, but no Exception has actually been raised. I’d like to raise a Bug dialog with an error message and a stack trace to where I am now in the code.

Ta,
B.


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

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Brent Easton”:

I would create an exception to throw, and then catch it. This gets you
your stack trace with the least amount of fuss, I think.

try {

if (mojo == bad) throw new BadMojoException(e);

}
catch (BadMojoException e) {
ErrorDialog.bug(e);
}


J.


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

Post generated using Mail2Forum (mail2forum.com)

On Jan 20, 2009, at 2:00 AM, Joel Uckelman wrote:

Not that it’s difficult to create this without needing the whole
exception catching machinery:

new Throwable().printStackTrace();

will print out the current stack trace. This can be wrapped up with a
StringOutputStream and a dialog in a fairly simple utility method if
needed, although it does add one additional method call to the stack:

public void showStack() {
StringWriter s = new StringWriter();
new Throwable().printStackTrace(s);
JOptionPane.showMessageDialog(null, s.toString());
}


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

Post generated using Mail2Forum (mail2forum.com)

Joel,

Thanks.

Next task is to wrap my head around the threading issues. It is not something I have looked into in detail before.

New version in swampwallaby-work@4927 which I think resolves Concurrency and Error Handling issues.

The idea is that the IconFactory scan of the Vassal installation might take a little time, so I fire it off in a background thread to allow the module to continue initializing. However, it is possible a request to getIcon() might come in before the scan has completed and will need to wait for the preload thread to complete.

Once the preload thread is complete, concurrency on the iconFamilies map is no longer an issue. Concurrency is handled when individual icons are needed to be built in the IconFamily class.

Thanks,
B.


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

Post generated using Mail2Forum (mail2forum.com)

This reminds me of an idea I had the other night. We should add a “Report a Bug” entry to the Help menu! Let people report bugs manually just like the automated bug reporter does, but without having to go to the SourceForge site. We’ll always upload the errorLog of course, so no more hassling people to remember to include the VASSAL version, Java version, OS, module name, etc.

rk

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Rodney Kinney”:

That’s been on my list of things to do since I created the Bug Dialog. The
reason I haven’t done it yet is that the dialog text needs to be different,
as well as the path through the panes in the dialog.

I think it’s too late to do this for 3.1, since it would require going back
to the translators again.


J.


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

Post generated using Mail2Forum (mail2forum.com)

Yes, let’s not try to fit it into 3.1.

rk

Post generated using Mail2Forum (mail2forum.com)

Another thing worthwhile in the help menu (or somewhere) would be connected links in module library/module directly to main website and forums for users to find things not bug related perhaps

From: Joel Uckelman uckelman@nomic.net
To: VASSAL Engine Forums Mailing List messages@forums.vassalengine.org
Sent: Tuesday, January 20, 2009 3:38:59 PM
Subject: Re: [Developers]icons

Thus spake “Rodney Kinney”:

That’s been on my list of things to do since I created the Bug Dialog. The
reason I haven’t done it yet is that the dialog text needs to be different,
as well as the path through the panes in the dialog.

I think it’s too late to do this for 3.1, since it would require going back
to the translators again.


J.


Messages mailing list
Messages@forums.vassalengine.org (Messages@forums.vassalengine.org)
http://forums.vassalengine.org/mailman/listinfo/messages_forums.vassalengine.org

Post generated using Mail2Forum (mail2forum.com)

Joel,

I have run into a problem displaying icons added to modules via ImageOps.

When I add an icon to Vassal, I can access it using an it OpIcon via the path

/icons/32x32/VASSAL.png

for example, and this works perfectly.

However, when I add the Icon to a module and try and access via the path

icons/32x32/go-top.png

I get a FileNotFoundException trying to access

images/icons/32x32/go-top.png

How do you want to handle this?

Thanks,
Brent.


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

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Brent Easton”:

Where are you indending for icons/32x32/go-top.png to be?


J.


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

Post generated using Mail2Forum (mail2forum.com)

for icons to be at the same level as images, as we now have in the Vassal source setup.

B.

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

On 24/01/2009 at 2:03 PM Joel Uckelman wrote:


Brent Easton
Analyst/Programmer
University of Western Sydney
Email: b.easton@exemail.com.au


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

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Brent Easton”:

No, I mean: Where are you expecting icons/32x32/go-top.png to be, in
Vengine.jar or somewhere else?


J.


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

Post generated using Mail2Forum (mail2forum.com)

I expect

/icons/32x32/go-top.png

to be in Vengine.jar

I expect

icons/32x32/go-top.png

to be in the module currently being edited/played.

I think I have tracked down the source of the problem - SourceOpBitmapImpl.eval() calls

in = archive.getImageInputStream(name);

to get the archive to return a Stream to the image, DataArchive.getImageInputStream() does this:

if (fileName.startsWith(“/”)) {
final InputStream in = getClass().getResourceAsStream(fileName);
if (in != null) return in;
throw new FileNotFoundException("Resource not found: " + fileName);
}

try {
return getInputStream(imageDir + fileName);
}
catch (FileNotFoundException e) {
}

which means that a SourceOp image can be loaded anywhere from within VEngine.jar, but is limited to being below the images directory within a module.

B.


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

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Brent Easton”:

Yes, I was going to tell you that the problem is with getImageInputStream().
I think the best solution is to stop using getImageInputStream() and just
use getInputStream() directly, now that we are pulling images from more
places than just images/.


J.


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

Post generated using Mail2Forum (mail2forum.com)

Hmm, that appears to be a fairly major rewrite of several of the ImageOp implementations, plus whatever calls them to add ‘image/’ to the file name as required.

Plus, as far as I can see, getInputStream() makes no attempt to load a path commencing with “/” from VEngine .jar.

B.


Brent Easton
Analyst/Programmer
University of Western Sydney
Email: b.easton@exemail.com.au


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

Post generated using Mail2Forum (mail2forum.com)

Joel,

Another problem is that ArchiveWriter.addImage(path, name) ignores pathnames. It loads all SVG images into /images specifically.

It looks like you did not have pathnames in mind when writing the ImageOp stuff, it only works if everything goes into /images. I am very hesitant to go hacking around in there. Can I leave this with you? I’ll suspend my Icon work until you sort it out.

I don’t believe this is a problem in 3.1, it has only come up because I am trying to stick Icon files where they won’t fit :slight_smile:

I have opened our first 3.2 bug as #2533902.

Thanks,
B.


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

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Brent Easton”:

Nope. 2521925 is our first 3.2 bug (which, BTW, I’ve looked at and I don’t
understand how it could even happen).

I’ll take care of all of this. The root of the problem is that DataArchive
was built on the assumption that all of the images would be in images/,
which is no longer the case. Requesting a path rather than just an image
name would solve this problem.


J.


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

Post generated using Mail2Forum (mail2forum.com)