Skip to content

Commit

Permalink
Merge pull request #1656 from pavelbraginskiy/drag-drop
Browse files Browse the repository at this point in the history
Add flag to show print-mul dialog without starting the main MML gui
  • Loading branch information
HammerGS authored Nov 9, 2024
2 parents 62055be + 7e572e1 commit 6a32e8a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions megameklab/src/megameklab/MegaMekLab.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ private static void startup(String[] args) {

updateGuiScaling(); // also sets the look-and-feel

if (args.length == 1) {
if (args.length >= 1) {
try {
var name = args[0];
logger.info("Trying to open file {}", name);
Expand All @@ -117,11 +117,17 @@ private static void startup(String[] args) {
UiLoader.loadUi(e, file.toString());
return;
} else if (name.toLowerCase().endsWith(".mul")) {
SwingUtilities.invokeLater(() -> {
Runnable printMul = () -> {
var frame = new JFrame();
UnitPrintManager.printMUL(frame, CConfig.getBooleanParam(CConfig.MISC_MUL_OPEN_BEHAVIOUR), new File(name));
frame.dispose();
});
};
if (args.length >= 2 && args[1].equals("--no-startup")) {
printMul.run();
return;
} else {
SwingUtilities.invokeLater(printMul);
}
}
} catch (Exception e) {
logger.warn(e);
Expand Down

0 comments on commit 6a32e8a

Please sign in to comment.