-
Notifications
You must be signed in to change notification settings - Fork 291
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4030 from kuronekochomusuke/boardAllTheTime
show game board in all the game phases
- Loading branch information
Showing
31 changed files
with
2,066 additions
and
1,236 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
megamek/src/megamek/client/ui/dialogs/MiniReportDisplayDialog.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/* | ||
* Copyright (c) 2022 - The MegaMek Team. All Rights Reserved. | ||
* | ||
* This file is part of MegaMek. | ||
* | ||
* MegaMek is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* MegaMek is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with MegaMek. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package megamek.client.ui.dialogs; | ||
|
||
import megamek.client.ui.Messages; | ||
import megamek.client.ui.swing.ClientGUI; | ||
import megamek.client.ui.swing.GUIPreferences; | ||
import megamek.client.ui.swing.util.UIUtil; | ||
|
||
import javax.swing.*; | ||
import java.awt.event.KeyEvent; | ||
import java.awt.event.WindowAdapter; | ||
import java.awt.event.WindowEvent; | ||
|
||
public class MiniReportDisplayDialog extends JDialog { | ||
//region Variable Declarations | ||
private final ClientGUI clientGUI; | ||
private static final GUIPreferences GUIP = GUIPreferences.getInstance(); | ||
private static final String MSG_TITLE = Messages.getString("MiniReportDisplay.title"); | ||
//endregion Variable Declarations | ||
|
||
//region Constructors | ||
public MiniReportDisplayDialog(final JFrame frame, final ClientGUI clientGUI) { | ||
super(frame, "", false); | ||
this.setTitle(MSG_TITLE); | ||
|
||
this.setLocation(GUIP.getMiniReportPosX(), GUIP.getMiniReportPosY()); | ||
this.setSize(GUIP.getMiniReportSizeWidth(), GUIP.getMiniReportSizeHeight()); | ||
|
||
UIUtil.updateWindowBounds(this); | ||
this.setResizable(true); | ||
this.setFocusable(false); | ||
this.setFocusableWindowState(false); | ||
|
||
addWindowListener(new WindowAdapter() { | ||
@Override | ||
public void windowClosing(WindowEvent evt) { | ||
GUIP.setMiniReportEnabled(false); | ||
} | ||
}); | ||
|
||
this.clientGUI = clientGUI; | ||
} | ||
//endregion Constructors | ||
|
||
@Override | ||
protected void processWindowEvent(WindowEvent e) { | ||
super.processWindowEvent(e); | ||
if ((e.getID() == WindowEvent.WINDOW_DEACTIVATED) || (e.getID() == WindowEvent.WINDOW_CLOSING)) { | ||
GUIP.setMiniReportSizeWidth(getSize().width); | ||
GUIP.setMiniReportSizeHeight(getSize().height); | ||
GUIP.setMiniReportPosX(getLocation().x); | ||
GUIP.setMiniReportPosY(getLocation().y); | ||
} | ||
} | ||
|
||
/** | ||
* In addition to the default Dialog processKeyEvent, this method | ||
* dispatches a KeyEvent to the client gui. | ||
* This enables all the gui hotkeys. | ||
*/ | ||
@Override | ||
protected void processKeyEvent(KeyEvent evt) { | ||
evt.setSource(clientGUI); | ||
clientGUI.getMenuBar().dispatchEvent(evt); | ||
// Make the source be the ClientGUI and not the dialog | ||
// This prevents a ClassCastException in ToolTipManager | ||
clientGUI.getCurrentPanel().dispatchEvent(evt); | ||
if (!evt.isConsumed()) { | ||
super.processKeyEvent(evt); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.