Skip to content

Commit

Permalink
Merge branch 'develop' into dependabot/gradle/develop/org.apache.pdfb…
Browse files Browse the repository at this point in the history
…ox-pdfbox-2.0.27
  • Loading branch information
cwisniew authored Apr 15, 2023
2 parents 5724ff0 + d2850a3 commit 1d4d7d0
Show file tree
Hide file tree
Showing 85 changed files with 1,833 additions and 1,342 deletions.
10 changes: 5 additions & 5 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
name: Feature Request
description: Suggest and idea for this project
description: Suggest an idea for this project
title: "[Feature]: "
labels: feature
body:
- type: textarea
attributes:
label: Feature Request
description: Describe your feature request
label: Describe the Problem
description: A clear and concise description of the problem you're facing.
placeholder: |
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Ex. I'm always frustrated when [...]
validations:
required: true
- type: textarea
attributes:
label: The Solution you'd like
description: A clear and concise description of what you want to happen.
description: A clear and concise description of the feature you would like added. The feature should be a way to solve the problem stated above.
validations:
required: true
- type: textarea
Expand Down
4 changes: 4 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ changelog:
exclude:
labels:
- repo-admin
- ignore-for-release-note
authors:
- rptools-automation
categories:
Expand All @@ -17,6 +18,9 @@ changelog:
- title: Bug Fixes 🩹
labels:
- bug
- title: Code Maintenance 🔧
labels:
- code-maintenance
- title: Other Changes 💬
labels:
- "*"
3 changes: 3 additions & 0 deletions .github/workflows/verify-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ on:
- develop
- feature*
- release*
merge_group:
branches:
- develop
jobs:
formatting:
runs-on: ubuntu-latest
Expand Down
20 changes: 14 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -370,13 +370,13 @@ dependencies {
implementation 'com.formdev:flatlaf-intellij-themes:2.4'
implementation 'com.formdev:flatlaf-extras:2.4'
implementation 'com.formdev:svgSalamander:1.1.3'
implementation 'com.formdev:flatlaf-jide-oss:2.4'
implementation 'com.formdev:flatlaf-jide-oss:3.1'

// JS support for macros
implementation group: 'org.graalvm.js', name: 'js', version: '21.2.0'
implementation group: 'org.graalvm.js', name: 'js-scriptengine', version: '21.1.0'

implementation 'com.jayway.jsonpath:json-path:2.6.0'
implementation 'com.jayway.jsonpath:json-path:2.8.0'

// For PDF image extraction
implementation 'org.apache.pdfbox:pdfbox:2.0.27'
Expand Down Expand Up @@ -404,17 +404,25 @@ dependencies {
implementation group: 'com.squareup.okhttp3', name: 'okhttp', version: '4.9.3'

// Better JSON functions...
implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.9' // https://mvnrepository.com/artifact/com.google.code.gson/gson

// Declare the dependency for your favourite test framework you want to use in your tests.
// TestNG is also supported by the Gradle Test task. Just change the
// testimplementation dependency to testimplementation 'org.testng:testng:6.8.1' and add
// 'test.useTestNG()' to your build script.
//testCompile 'junit:junit:4.12'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
implementation group: 'com.google.code.gson', name: 'gson', version: '2.9.0' // https://mvnrepository.com/artifact/com.google.code.gson/gson

testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.8.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'

// For mocking features during unit tests
testImplementation group: 'org.mockito', name: 'mockito-core', version: '3.11.2'
testImplementation group: 'org.mockito', name: 'mockito-core', version: '5.3.0'

// flexmark markdown parsing / conversion
implementation 'com.vladsch.flexmark:flexmark-all:0.62.2'
implementation 'com.vladsch.flexmark:flexmark-all:0.64.0'

// Apache Tika Parsers for determining file type
implementation 'com.github.lafa.tikaNoExternal:tika-parsers:1.0.18'
Expand Down Expand Up @@ -443,9 +451,9 @@ dependencies {
implementation 'javax.ws.rs:javax.ws.rs-api:2.1.1'

// HTML Parsing
implementation 'org.jsoup:jsoup:1.14.3'
implementation 'org.jsoup:jsoup:1.15.4'
// eventbus
implementation 'com.google.guava:guava:31.0.1-jre'
implementation 'com.google.guava:guava:31.1-jre'
// compression of messages between client and server
implementation 'org.apache.commons:commons-compress:1.22'
implementation 'org.tukaani:xz:1.9'
Expand Down
91 changes: 19 additions & 72 deletions src/main/java/net/rptools/maptool/client/AppActions.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -37,41 +29,22 @@
import java.security.spec.InvalidKeySpecException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
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;
Expand All @@ -84,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;
Expand All @@ -102,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;
Expand Down Expand Up @@ -230,9 +175,7 @@ protected void executeAction() {
}
// Move to chosen token
if (chosenOne != null) {
renderer.clearSelectedTokens();
renderer.centerOn(chosenOne);
renderer.updateAfterSelection();
renderer.centerOnAndSetSelected(chosenOne);
}
}
}
Expand Down Expand Up @@ -938,8 +881,10 @@ public static void cutOrDeleteTokens(Boolean copy, Zone zone, Set<GUID> tokenSet
}
if (!tokensToRemove.isEmpty()) {
MapTool.serverCommand().removeTokens(zone.getId(), tokensToRemove);
MapTool.getFrame().getCurrentZoneRenderer().clearSelectedTokens();
MapTool.getFrame().getCurrentZoneRenderer().updateAfterSelection();
MapTool.getFrame()
.getCurrentZoneRenderer()
.getSelectionModel()
.replaceSelection(Collections.emptyList());
if (copy) {
keepIdsOnPaste = true; // pasted tokens should have same ids as cut ones
}
Expand Down Expand Up @@ -1050,8 +995,9 @@ public static void copyTokens(List<Token> tokenList) {
// Only cut if some tokens are selected. Don't want to accidentally
// lose what might already be in the clipboard.
if (!tokenList.isEmpty()) {
if (tokenCopySet != null)
if (tokenCopySet != null) {
tokenCopySet.clear(); // Just to help out the garbage collector a little bit
}

Token topLeft = tokenList.get(0);
tokenCopySet = new HashSet<Token>();
Expand Down Expand Up @@ -1190,8 +1136,7 @@ private static void pasteTokens(ZonePoint destination, Layer layer) {
token.getX() + gridCopiedFrom.getOffsetX(),
token.getY() + gridCopiedFrom.getOffsetY()));
ZonePoint zp = grid.convert(cp);
tokenOffset =
new ZonePoint(zp.x - gridCopiedFrom.getOffsetX(), zp.y - gridCopiedFrom.getOffsetY());
tokenOffset = new ZonePoint(zp.x - grid.getOffsetX(), zp.y - grid.getOffsetY());
} else {
// For gridless sources, gridless destinations, or tokens that are not SnapToGrid: just use
// the pixel offsets
Expand Down Expand Up @@ -2531,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
Expand Down
16 changes: 14 additions & 2 deletions src/main/java/net/rptools/maptool/client/AppPreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,20 @@ public class AppPreferences {
private static final String KEY_AURA_OVERLAY_OPACITY = "auraOverlayOpacity";
private static final int DEFAULT_AURA_OVERLAY_OPACITY = 60;

private static final String KEY_LIGHT_OVERLAY_OPACITY = "lightOverlayOpacity";
private static final int DEFAULT_LIGHT_OVERLAY_OPACITY = 60;

private static final String KEY_LUMENS_OVERLAY_OPACITY = "lumensOverlayOpacity";
private static final int DEFAULT_LUMENS_OVERLAY_OPACITY = 120;

private static final String KEY_LUMENS_OVERLAY_BORDER_THICKNESS = "lumensOverlayBorderThickness";
private static final int DEFAULT_LUMENS_OVERLAY_BORDER_THICKNESS = 5;

private static final String KEY_LUMENS_OVERLAY_SHOW_BY_DEFAULT = "lumensOverlayShowByDefault";
private static final boolean DEFAULT_LUMENS_OVERLAY_SHOW_BY_DEFAULT = true;
private static final boolean DEFAULT_LUMENS_OVERLAY_SHOW_BY_DEFAULT = false;

private static final String KEY_LIGHTS_SHOW_BY_DEFAULT = "lightsShowByDefault";
private static final boolean DEFAULT_LIGHTS_SHOW_BY_DEFAULT = false;
private static final boolean DEFAULT_LIGHTS_SHOW_BY_DEFAULT = true;

private static final String KEY_FOG_OVERLAY_OPACITY = "fogOverlayOpacity";
private static final int DEFAULT_FOG_OVERLAY_OPACITY = 100;
Expand Down Expand Up @@ -347,6 +350,15 @@ public static int getAuraOverlayOpacity() {
return range0to255(value);
}

public static void setLightOverlayOpacity(int size) {
prefs.putInt(KEY_LIGHT_OVERLAY_OPACITY, range0to255(size));
}

public static int getLightOverlayOpacity() {
int value = prefs.getInt(KEY_LIGHT_OVERLAY_OPACITY, DEFAULT_LIGHT_OVERLAY_OPACITY);
return range0to255(value);
}

public static void setLumensOverlayOpacity(int size) {
prefs.putInt(KEY_LUMENS_OVERLAY_OPACITY, range0to255(size));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ private void handle(StartTokenMoveMsg msg) {
msg.getSelectedTokensList().stream().map(GUID::valueOf).collect(Collectors.toSet());

var renderer = MapTool.getFrame().getZoneRenderer(zoneGUID);
renderer.addMoveSelectionSet(playerId, keyToken, selectedSet, true);
renderer.addMoveSelectionSet(playerId, keyToken, selectedSet);
});
}

Expand Down
7 changes: 7 additions & 0 deletions src/main/java/net/rptools/maptool/client/MapToolRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ public SeverConnectionDetails findInstance(String id) {
Request request = new Request.Builder().url(requestUrl).build();

try (Response response = client.newCall(request).execute()) {

// Check if we got an actual response. If we did not, just do an early return,
// the server isn't real.
if (response.body().string().isEmpty()) {
return new SeverConnectionDetails();
}

JsonObject json = JsonParser.parseString(response.body().string()).getAsJsonObject();
SeverConnectionDetails details = new SeverConnectionDetails();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ public Object childEvaluate(
entryDetails.addProperty("min", entry.getMin());
entryDetails.addProperty("max", entry.getMax());
entryDetails.addProperty("value", entry.getValue());
entryDetails.addProperty("picked", entry.getPicked() == null ? false : entry.getPicked());
entryDetails.addProperty("picked", entry.getPicked());

MD5Key imageId = entry.getImageId();
if (imageId != null) {
Expand Down
Loading

0 comments on commit 1d4d7d0

Please sign in to comment.