Now component animations and MainPagePanel animation can be disabled
This commit is contained in:
@@ -30,6 +30,7 @@ import org.jackhuang.hmcl.util.CollectionUtils;
|
|||||||
import org.jackhuang.hmcl.api.HMCLApi;
|
import org.jackhuang.hmcl.api.HMCLApi;
|
||||||
import org.jackhuang.hmcl.api.event.config.ProfileChangedEvent;
|
import org.jackhuang.hmcl.api.event.config.ProfileChangedEvent;
|
||||||
import org.jackhuang.hmcl.api.event.config.ProfileLoadingEvent;
|
import org.jackhuang.hmcl.api.event.config.ProfileLoadingEvent;
|
||||||
|
import org.jackhuang.hmcl.laf.utils.AnimationController;
|
||||||
import org.jackhuang.hmcl.util.sys.FileUtils;
|
import org.jackhuang.hmcl.util.sys.FileUtils;
|
||||||
import org.jackhuang.hmcl.util.MessageBox;
|
import org.jackhuang.hmcl.util.MessageBox;
|
||||||
import org.jackhuang.hmcl.util.UpdateChecker;
|
import org.jackhuang.hmcl.util.UpdateChecker;
|
||||||
@@ -56,6 +57,7 @@ public final class Settings {
|
|||||||
static {
|
static {
|
||||||
SETTINGS = initSettings();
|
SETTINGS = initSettings();
|
||||||
DownloadType.setSuggestedDownloadType(SETTINGS.getDownloadSource().name());
|
DownloadType.setSuggestedDownloadType(SETTINGS.getDownloadSource().name());
|
||||||
|
AnimationController.ENABLE_ANIMATION = SETTINGS.isEnableAnimation();
|
||||||
if (!getProfiles().containsKey(DEFAULT_PROFILE))
|
if (!getProfiles().containsKey(DEFAULT_PROFILE))
|
||||||
getProfiles().put(DEFAULT_PROFILE, new Profile(DEFAULT_PROFILE));
|
getProfiles().put(DEFAULT_PROFILE, new Profile(DEFAULT_PROFILE));
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.jackhuang.hmcl.ui;
|
package org.jackhuang.hmcl.ui;
|
||||||
|
|
||||||
|
import java.awt.Font;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import javax.swing.text.Document;
|
import javax.swing.text.Document;
|
||||||
@@ -53,6 +54,11 @@ public class LogWindow extends javax.swing.JFrame {
|
|||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
setLocationRelativeTo(null);
|
setLocationRelativeTo(null);
|
||||||
txtLog.setEditable(false);
|
txtLog.setEditable(false);
|
||||||
|
Font font = Font.decode("Consolas");
|
||||||
|
if (font == null)
|
||||||
|
font = Font.decode("Monospace");
|
||||||
|
if (font != null)
|
||||||
|
txtLog.setFont(font);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,8 @@ public class MainPagePanel extends Page {
|
|||||||
void initGui() {
|
void initGui() {
|
||||||
initComponents();
|
initComponents();
|
||||||
|
|
||||||
|
animationEnabled = Settings.getInstance().isEnableAnimation();
|
||||||
|
|
||||||
pnlButtons = new javax.swing.JPanel();
|
pnlButtons = new javax.swing.JPanel();
|
||||||
pnlButtons.setLayout(null);
|
pnlButtons.setLayout(null);
|
||||||
|
|
||||||
|
|||||||
@@ -60,6 +60,8 @@ import org.jackhuang.hmcl.laf.utils.TMSchema.Part;
|
|||||||
* @author Igor Kushnirskiy
|
* @author Igor Kushnirskiy
|
||||||
*/
|
*/
|
||||||
public class AnimationController implements ActionListener, PropertyChangeListener {
|
public class AnimationController implements ActionListener, PropertyChangeListener {
|
||||||
|
|
||||||
|
public static boolean ENABLE_ANIMATION = true;
|
||||||
|
|
||||||
private static AnimationController INSTANCE = new AnimationController();
|
private static AnimationController INSTANCE = new AnimationController();
|
||||||
private static final String ANIMATION_CONTROLLER_KEY = "BeautyEye.AnimationController";
|
private static final String ANIMATION_CONTROLLER_KEY = "BeautyEye.AnimationController";
|
||||||
@@ -205,7 +207,8 @@ public class AnimationController implements ActionListener, PropertyChangeListen
|
|||||||
|
|
||||||
public static void paintSkin(JComponent component, Skin skin,
|
public static void paintSkin(JComponent component, Skin skin,
|
||||||
Graphics g, int dx, int dy, int dw, int dh, State state) {
|
Graphics g, int dx, int dy, int dw, int dh, State state) {
|
||||||
triggerAnimation(component, skin.getPart(component), state);
|
if (ENABLE_ANIMATION)
|
||||||
|
triggerAnimation(component, skin.getPart(component), state);
|
||||||
AnimationController controller = getAnimationController(component);
|
AnimationController controller = getAnimationController(component);
|
||||||
synchronized (controller) {
|
synchronized (controller) {
|
||||||
AnimationState animationState = null;
|
AnimationState animationState = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user