Skip to content

Commit

Permalink
Fix RPTools#106 add reset size popup menu entry
Browse files Browse the repository at this point in the history
  • Loading branch information
source-knights committed Mar 23, 2019
1 parent bed59e2 commit ef43554
Showing 1 changed file with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,11 @@ protected JMenu createSizeMenu() {

JCheckBoxMenuItem freeSize = new JCheckBoxMenuItem(new FreeSizeAction());
freeSize.setSelected(!tokenUnderMouse.isSnapToScale());

sizeMenu.add(freeSize);

JCheckBoxMenuItem resetSize = new JCheckBoxMenuItem(new ResetSizeAction());
sizeMenu.add(resetSize);

sizeMenu.addSeparator();

Grid grid = renderer.getZone().getGrid();
Expand Down Expand Up @@ -416,6 +419,26 @@ public void actionPerformed(ActionEvent e) {
}
}

public class ResetSizeAction extends AbstractAction {
public ResetSizeAction() {
//putValue(Action.NAME, tokenUnderMouse.isStamp() ? "Free Size" : "Native Size");
putValue(Action.NAME, "Reset Size");
}

public void actionPerformed(ActionEvent e) {
for (GUID tokenGUID : selectedTokenSet) {
Token token = renderer.getZone().getToken(tokenGUID);
if (token == null) {
continue;
}
token.setFootprint(renderer.getZone().getGrid(), renderer.getZone().getGrid().getDefaultFootprint() );
token.setSnapToScale(true);
MapTool.serverCommand().putToken(renderer.getZone().getId(), token);
}
renderer.repaint();
}
}

public class CopyAction extends AbstractAction {
public CopyAction() {
putValue(Action.NAME, I18N.getText("action.copyTokens"));
Expand Down

0 comments on commit ef43554

Please sign in to comment.