mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
Fix so disabled background image doesn't come back when changing themes
This commit is contained in:
@@ -147,6 +147,8 @@ public class FPanel extends JPanel implements ILocalRepaint {
|
|||||||
|
|
||||||
/** @param img0   {@link java.awt.Image} */
|
/** @param img0   {@link java.awt.Image} */
|
||||||
public void setForegroundImage(final Image img0) {
|
public void setForegroundImage(final Image img0) {
|
||||||
|
skin.resetForegroundImage(); //must reset if non-skin image set
|
||||||
|
|
||||||
if (img0 == null) {
|
if (img0 == null) {
|
||||||
this.foregroundImage = null;
|
this.foregroundImage = null;
|
||||||
return;
|
return;
|
||||||
@@ -193,6 +195,8 @@ public class FPanel extends JPanel implements ILocalRepaint {
|
|||||||
|
|
||||||
/** @param img0   {@link java.awt.Image} */
|
/** @param img0   {@link java.awt.Image} */
|
||||||
public void setBackgroundTexture(final Image img0) {
|
public void setBackgroundTexture(final Image img0) {
|
||||||
|
skin.resetBackgroundTexture(); //must reset if non-skin image set
|
||||||
|
|
||||||
if (img0 == null) { return; }
|
if (img0 == null) { return; }
|
||||||
|
|
||||||
this.backgroundTexture = img0;
|
this.backgroundTexture = img0;
|
||||||
|
|||||||
@@ -423,24 +423,32 @@ public enum FSkin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setForegroundImage(SkinImage skinIcon) {
|
public void setForegroundImage(SkinImage skinIcon) {
|
||||||
|
this.comp.setForegroundImage(skinIcon.image); //must call this first since it will call resetForegroundImage
|
||||||
this.foregroundImage = skinIcon;
|
this.foregroundImage = skinIcon;
|
||||||
this.comp.setForegroundImage(skinIcon.image);
|
|
||||||
this.needRepaintOnReapply = true; //foreground image draw during paint
|
this.needRepaintOnReapply = true; //foreground image draw during paint
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void resetForegroundImage() {
|
||||||
|
this.foregroundImage = null;
|
||||||
|
}
|
||||||
|
|
||||||
public void setBackgroundTexture(SkinImage skinIcon) {
|
public void setBackgroundTexture(SkinImage skinIcon) {
|
||||||
|
this.comp.setBackgroundTexture(skinIcon.image); //must call this first since it will call resetBackgroundTexture
|
||||||
this.backgroundTexture = skinIcon;
|
this.backgroundTexture = skinIcon;
|
||||||
this.comp.setBackgroundTexture(skinIcon.image);
|
|
||||||
this.needRepaintOnReapply = true; //background texture drawn during paint
|
this.needRepaintOnReapply = true; //background texture drawn during paint
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void resetBackgroundTexture() {
|
||||||
|
this.backgroundTexture = null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void reapply() {
|
protected void reapply() {
|
||||||
if (this.foregroundImage != null) {
|
if (this.foregroundImage != null) {
|
||||||
this.comp.setForegroundImage(this.foregroundImage.image);
|
this.setForegroundImage(this.foregroundImage); //use skin function so foregroundImage field retained
|
||||||
}
|
}
|
||||||
if (this.backgroundTexture != null) {
|
if (this.backgroundTexture != null) {
|
||||||
this.comp.setBackgroundTexture(this.backgroundTexture.image);
|
this.setBackgroundTexture(this.backgroundTexture); //use skin function so backgroundTexture field retained
|
||||||
}
|
}
|
||||||
super.reapply();
|
super.reapply();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user