Various new Drag & Drop deck editor improvements

* Shift-Click / Shift-Drag now work as expected as far as multi-selection
* Deck editor saves split pane split positions
* Card layout and sort settings are now saved along side the a deck when saving to the .dck format, so that you have back the exact same deck layout when you re-load the deck.
* Fixed the symbol image downloader to work around some of the large-size symbol images being missing on gatherer. Falls back to the medium sized images currently for those symbols.
This commit is contained in:
Mark Langen 2016-10-04 00:04:13 -06:00
parent 38cbf1a687
commit f6d50ce04f
11 changed files with 516 additions and 238 deletions

View file

@ -153,11 +153,13 @@ public class ManaSymbols {
sizedSymbols.put(symbol, notResized);
} else {
Rectangle r = new Rectangle(size, size);
Image image = UI.getImageIcon(file.getAbsolutePath()).getImage();
BufferedImage resized = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB), r);
//Image image = UI.getImageIcon(file.getAbsolutePath()).getImage();
BufferedImage image = ImageIO.read(file);
//BufferedImage resized = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB), r);
BufferedImage resized = ImageHelper.getResizedImage(image, r);
sizedSymbols.put(symbol, resized);
}
} catch (Exception e) {
} catch (IOException e) {
LOGGER.error("Error for symbol:" + symbol);
fileErrors = true;
}

View file

@ -73,6 +73,28 @@ public class GathererSymbols implements Iterable<DownloadJob> {
String symbol = sym.replaceAll("/", "");
File dst = new File(dir, symbol + ".gif");
/**
* Handle a bug on Gatherer where a few symbols are missing at the large size.
* Fall back to using the medium symbol for those cases.
*/
int modSizeIndex = sizeIndex;
if (sizeIndex == 2) {
switch (sym) {
case "WP":
case "UP":
case "BP":
case "RP":
case "GP":
case "E":
case "C":
modSizeIndex = 1;
break;
default:
// Nothing to do, symbol is available in the large size
}
}
switch (symbol) {
case "T":
symbol = "tap";
@ -85,7 +107,7 @@ public class GathererSymbols implements Iterable<DownloadJob> {
break;
}
String url = format(urlFmt, sizes[sizeIndex], symbol);
String url = format(urlFmt, sizes[modSizeIndex], symbol);
return new DownloadJob(sym, fromURL(url), toFile(dst));
}