diff --git a/src/main/java/net/rptools/maptool/client/AppActions.java b/src/main/java/net/rptools/maptool/client/AppActions.java index c8b96b8fe6..2da8b66eaa 100644 --- a/src/main/java/net/rptools/maptool/client/AppActions.java +++ b/src/main/java/net/rptools/maptool/client/AppActions.java @@ -15,19 +15,11 @@ package net.rptools.maptool.client; import com.jidesoft.docking.DockableFrame; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Image; -import java.awt.Toolkit; -import java.awt.Transparency; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.InputEvent; import java.awt.image.BufferedImage; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; +import java.io.*; import java.net.MalformedURLException; import java.net.URL; import java.net.UnknownHostException; @@ -37,42 +29,22 @@ import java.security.spec.InvalidKeySpecException; import java.text.DateFormat; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; +import java.util.*; import java.util.List; -import java.util.Map; -import java.util.Set; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.zip.GZIPOutputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; import javax.crypto.NoSuchPaddingException; -import javax.swing.AbstractAction; -import javax.swing.Action; -import javax.swing.ImageIcon; -import javax.swing.JCheckBoxMenuItem; -import javax.swing.JComponent; -import javax.swing.JFileChooser; -import javax.swing.JOptionPane; -import javax.swing.JTextPane; -import javax.swing.KeyStroke; -import javax.swing.SwingWorker; +import javax.swing.*; import javax.swing.text.BadLocationException; import net.rptools.lib.FileUtil; import net.rptools.lib.MD5Key; import net.rptools.maptool.client.tool.boardtool.BoardTool; import net.rptools.maptool.client.tool.gridtool.GridTool; -import net.rptools.maptool.client.ui.AppMenuBar; -import net.rptools.maptool.client.ui.ConnectionStatusPanel; -import net.rptools.maptool.client.ui.MapToolFrame; +import net.rptools.maptool.client.ui.*; import net.rptools.maptool.client.ui.MapToolFrame.MTFrame; -import net.rptools.maptool.client.ui.PreviewPanelFileChooser; -import net.rptools.maptool.client.ui.StaticMessageDialog; -import net.rptools.maptool.client.ui.SysInfoDialog; import net.rptools.maptool.client.ui.addon.AddOnLibrariesDialog; import net.rptools.maptool.client.ui.addresource.AddResourceDialog; import net.rptools.maptool.client.ui.assetpanel.AssetPanel; @@ -85,12 +57,8 @@ import net.rptools.maptool.client.ui.connecttoserverdialog.ConnectToServerDialogPreferences; import net.rptools.maptool.client.ui.exportdialog.ExportDialog; import net.rptools.maptool.client.ui.htmlframe.HTMLOverlayManager; -import net.rptools.maptool.client.ui.io.FTPClient; -import net.rptools.maptool.client.ui.io.FTPTransferObject; +import net.rptools.maptool.client.ui.io.*; import net.rptools.maptool.client.ui.io.FTPTransferObject.Direction; -import net.rptools.maptool.client.ui.io.LoadSaveImpl; -import net.rptools.maptool.client.ui.io.ProgressBarList; -import net.rptools.maptool.client.ui.io.UpdateRepoDialog; import net.rptools.maptool.client.ui.mappropertiesdialog.MapPropertiesDialog; import net.rptools.maptool.client.ui.players.PlayerDatabaseDialog; import net.rptools.maptool.client.ui.preferencesdialog.PreferencesDialog; @@ -103,43 +71,19 @@ import net.rptools.maptool.client.ui.zone.ZoneRenderer; import net.rptools.maptool.client.utilities.DungeonDraftImporter; import net.rptools.maptool.language.I18N; -import net.rptools.maptool.model.Asset; -import net.rptools.maptool.model.AssetManager; -import net.rptools.maptool.model.Campaign; -import net.rptools.maptool.model.CampaignFactory; -import net.rptools.maptool.model.CampaignProperties; -import net.rptools.maptool.model.CellPoint; -import net.rptools.maptool.model.ExposedAreaMetaData; -import net.rptools.maptool.model.GUID; -import net.rptools.maptool.model.Grid; -import net.rptools.maptool.model.LookupTable; -import net.rptools.maptool.model.TextMessage; -import net.rptools.maptool.model.Token; -import net.rptools.maptool.model.Zone; +import net.rptools.maptool.model.*; import net.rptools.maptool.model.Zone.Layer; import net.rptools.maptool.model.Zone.VisionType; -import net.rptools.maptool.model.ZoneFactory; -import net.rptools.maptool.model.ZonePoint; import net.rptools.maptool.model.campaign.CampaignManager; import net.rptools.maptool.model.drawing.DrawableTexturePaint; -import net.rptools.maptool.model.player.LocalPlayer; -import net.rptools.maptool.model.player.PasswordDatabaseException; -import net.rptools.maptool.model.player.PasswordFilePlayerDatabase; -import net.rptools.maptool.model.player.PersistedPlayerDatabase; -import net.rptools.maptool.model.player.Player; +import net.rptools.maptool.model.player.*; import net.rptools.maptool.model.player.Player.Role; -import net.rptools.maptool.model.player.PlayerDatabase; -import net.rptools.maptool.model.player.PlayerDatabaseFactory; import net.rptools.maptool.model.player.PlayerDatabaseFactory.PlayerDatabaseType; import net.rptools.maptool.server.ServerConfig; import net.rptools.maptool.server.ServerPolicy; -import net.rptools.maptool.util.ImageManager; -import net.rptools.maptool.util.MessageUtil; -import net.rptools.maptool.util.PasswordGenerator; -import net.rptools.maptool.util.PersistenceUtil; +import net.rptools.maptool.util.*; import net.rptools.maptool.util.PersistenceUtil.PersistedCampaign; import net.rptools.maptool.util.PersistenceUtil.PersistedMap; -import net.rptools.maptool.util.UPnPUtil; import org.apache.commons.io.FileUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -2532,6 +2476,8 @@ public static void disconnectFromServer() { MapTool.stopServer(); MapTool.disconnect(); MapTool.getFrame().getToolbarPanel().getMapselect().setVisible(true); + MapTool.getFrame().getToolbarPanel().setTokenSelectionGroupEnabled(true); + try { MapTool.startPersonalServer(campaign); } catch (IOException diff --git a/src/main/java/net/rptools/maptool/client/ServerDisconnectHandler.java b/src/main/java/net/rptools/maptool/client/ServerDisconnectHandler.java index 2875a1af6a..7e2ced97b5 100644 --- a/src/main/java/net/rptools/maptool/client/ServerDisconnectHandler.java +++ b/src/main/java/net/rptools/maptool/client/ServerDisconnectHandler.java @@ -45,7 +45,7 @@ public void handleDisconnect(AbstractConnection connection) { MapTool.getFrame().getToolbarPanel().getMapselect().setVisible(true); MapTool.getFrame().getAssetPanel().enableAssets(); new CampaignManager().clearCampaignData(); - + MapTool.getFrame().getToolbarPanel().setTokenSelectionGroupEnabled(true); try { MapTool.startPersonalServer(CampaignFactory.createBasicCampaign()); } catch (IOException diff --git a/src/main/java/net/rptools/maptool/client/ui/AppMenuBar.java b/src/main/java/net/rptools/maptool/client/ui/AppMenuBar.java index 605e5b8af1..cd945428ad 100644 --- a/src/main/java/net/rptools/maptool/client/ui/AppMenuBar.java +++ b/src/main/java/net/rptools/maptool/client/ui/AppMenuBar.java @@ -24,14 +24,8 @@ import java.util.stream.Stream; import javax.swing.*; import net.rptools.lib.FileUtil; -import net.rptools.maptool.client.AppActions; +import net.rptools.maptool.client.*; import net.rptools.maptool.client.AppActions.OpenUrlAction; -import net.rptools.maptool.client.AppConstants; -import net.rptools.maptool.client.AppSetup; -import net.rptools.maptool.client.AppState; -import net.rptools.maptool.client.AppUtil; -import net.rptools.maptool.client.MRUCampaignManager; -import net.rptools.maptool.client.MapTool; import net.rptools.maptool.client.ui.MapToolFrame.MTFrame; import net.rptools.maptool.client.ui.htmlframe.HTMLOverlayManager; import net.rptools.maptool.client.ui.theme.Icons; diff --git a/src/main/java/net/rptools/maptool/client/ui/ToolbarPanel.java b/src/main/java/net/rptools/maptool/client/ui/ToolbarPanel.java index 9be301cebd..446d4e57e6 100644 --- a/src/main/java/net/rptools/maptool/client/ui/ToolbarPanel.java +++ b/src/main/java/net/rptools/maptool/client/ui/ToolbarPanel.java @@ -15,6 +15,7 @@ package net.rptools.maptool.client.ui; import java.awt.*; +import java.util.Enumeration; import java.util.Hashtable; import javax.swing.*; import javax.swing.plaf.basic.BasicToolBarUI; @@ -487,6 +488,14 @@ public void setVisible(boolean visible) { } } + public void setTokenSelectionGroupEnabled(boolean enabled) { + Enumeration enumeration = tokenSelectionbuttonGroup.getElements(); + while (enumeration.hasMoreElements()) { + AbstractButton button = enumeration.nextElement(); + button.setEnabled(enabled); + } + } + private class OptionPanel extends JToolBar { private Class firstTool; diff --git a/src/main/java/net/rptools/maptool/server/ClientHandshake.java b/src/main/java/net/rptools/maptool/server/ClientHandshake.java index 3600d95e36..f431480b74 100644 --- a/src/main/java/net/rptools/maptool/server/ClientHandshake.java +++ b/src/main/java/net/rptools/maptool/server/ClientHandshake.java @@ -30,9 +30,7 @@ import javax.crypto.BadPaddingException; import javax.crypto.IllegalBlockSizeException; import javax.crypto.NoSuchPaddingException; -import javax.swing.JDialog; -import javax.swing.JOptionPane; -import javax.swing.SwingUtilities; +import javax.swing.*; import net.rptools.clientserver.simple.MessageHandler; import net.rptools.clientserver.simple.client.ClientConnection; import net.rptools.lib.MD5Key; @@ -51,18 +49,8 @@ import net.rptools.maptool.model.player.Player.Role; import net.rptools.maptool.model.player.PlayerDatabaseFactory; import net.rptools.maptool.model.player.PlayerDatabaseFactory.PlayerDatabaseType; -import net.rptools.maptool.server.proto.AuthTypeEnum; -import net.rptools.maptool.server.proto.ClientAuthMsg; -import net.rptools.maptool.server.proto.ClientInitMsg; -import net.rptools.maptool.server.proto.ConnectionSuccessfulMsg; -import net.rptools.maptool.server.proto.HandshakeMsg; +import net.rptools.maptool.server.proto.*; import net.rptools.maptool.server.proto.HandshakeMsg.MessageTypeCase; -import net.rptools.maptool.server.proto.HandshakeResponseCodeMsg; -import net.rptools.maptool.server.proto.PublicKeyAddedMsg; -import net.rptools.maptool.server.proto.PublicKeyUploadMsg; -import net.rptools.maptool.server.proto.RequestPublicKeyMsg; -import net.rptools.maptool.server.proto.RoleDto; -import net.rptools.maptool.server.proto.UseAuthTypeMsg; import net.rptools.maptool.util.cipher.CipherUtil; import net.rptools.maptool.util.cipher.CipherUtil.Key; import net.rptools.maptool.util.cipher.PublicPrivateKeyStore; @@ -337,6 +325,10 @@ private void handle(ConnectionSuccessfulMsg connectionSuccessfulMsg) throws IOEx throw new IOException(e.getCause()); } } + if (!policy.isUseIndividualViews()) { + MapTool.getFrame().getToolbarPanel().setTokenSelectionGroupEnabled(false); + log.info("No individual views, disabling FoW buttons"); + } var libraryManager = new LibraryManager(); for (var library : connectionSuccessfulMsg.getAddOnLibraryListDto().getLibrariesList()) { var md5key = new MD5Key(library.getMd5Hash());