GUI: added missing image info in card popup hint (works in any render mode, support cards, tokens, emblems, etc - can be disabled in Preferences, related to #7759, #2158);

This commit is contained in:
Oleg Agafonov 2024-02-19 12:40:35 +04:00
parent e26445774b
commit 34816be219
7 changed files with 83 additions and 52 deletions

View file

@ -9,9 +9,11 @@ import mage.constants.*;
import mage.view.CardView;
import mage.view.CounterView;
import mage.view.PermanentView;
import net.java.truevfs.access.TFile;
import org.jdesktop.swingx.JXPanel;
import org.mage.card.arcane.ManaSymbols;
import org.mage.card.arcane.UI;
import org.mage.plugins.card.utils.CardImageUtils;
import javax.swing.*;
import java.awt.*;
@ -402,6 +404,15 @@ public final class GuiDisplayUtil {
buffer.append("<p style='margin: 2px'><b>Card Zone:</b> ").append(zone).append("</p>");
}
// missing image info in card popup
boolean displayFullImagePath = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_SHOW_FULL_IMAGE_PATH, "false").equals("true");
if (displayFullImagePath) {
String imageFile = CardImageUtils.buildImagePathToCardView(card);
if (imageFile.startsWith("ERROR") || !(new TFile(imageFile).exists())) {
buffer.append("<p style='margin: 2px'><b>Missing image:</b> ").append(imageFile).append("</p>");
}
}
buffer.append("<br></body></html>");
return buffer;
}