Skip to content

Commit

Permalink
Merge pull request #1427 from SJuliez/debug-help
Browse files Browse the repository at this point in the history
Debug helper update
  • Loading branch information
HammerGS authored Feb 14, 2024
2 parents 211024a + d50f051 commit 2ede437
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions megameklab/src/megameklab/ui/generalUnit/StatusBar.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 - The MegaMek Team. All Rights Reserved.
* Copyright (c) 2023, 2024 - The MegaMek Team. All Rights Reserved.
*
* This file is part of MegaMekLab.
*
Expand All @@ -25,17 +25,18 @@
import megamek.client.ui.swing.GUIPreferences;
import megamek.client.ui.swing.calculationReport.CalculationReport;
import megamek.common.*;
import megamek.common.verifier.TestBattleArmor;
import megamek.common.verifier.TestEntity;
import megamek.utilities.DebugEntity;
import megameklab.ui.MegaMekLabMainUI;
import megameklab.ui.util.ITab;
import megameklab.ui.util.RefreshListener;
import megameklab.util.ImageHelper;
import megameklab.util.UnitUtil;

import javax.swing.*;
import javax.swing.border.MatteBorder;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.InputEvent;
import java.io.File;
import java.text.DecimalFormat;

Expand Down Expand Up @@ -63,7 +64,7 @@ public StatusBar(MegaMekLabMainUI parent) {
formatter = new DecimalFormat();

JButton btnValidate = new JButton("Validate Unit");
btnValidate.addActionListener(evt -> UnitUtil.showValidation(getEntity(), getParentFrame()));
btnValidate.addActionListener(validationListener);

JButton btnFluffImage = new JButton("Set Fluff Image");
btnFluffImage.addActionListener(evt -> getFluffImage());
Expand Down Expand Up @@ -174,6 +175,14 @@ public void addRefreshedListener(RefreshListener refreshListener) {
refresh = refreshListener;
}

private final ActionListener validationListener = e -> {
if ((e.getModifiers() & Event.CTRL_MASK) != 0) {
DebugEntity.copyEquipmentState(getEntity());
} else {
UnitUtil.showValidation(getEntity(), getParentFrame());
}
};

/**
* Returns an estimated value of the total heat generation for Meks and Aeros (0 for other types).
* This method is very specific to this use and cannot be generalized. It shouldn't be used elsewhere. It is
Expand Down

0 comments on commit 2ede437

Please sign in to comment.