This commit is contained in:
Konloch 2021-08-07 00:31:36 -07:00
commit 8e4582417d
18 changed files with 61 additions and 62 deletions

View file

@ -1 +0,0 @@
41d368cd63ae76bba69ccb6e967866fe

View file

@ -1 +0,0 @@
96f9c3d3bee336c4653abf42444c025b6dfd1836

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.weisj</groupId>
<artifactId>darklaf-bcv</artifactId>
<version>2.6.2bcv</version>
</project>

View file

@ -1 +0,0 @@
74478ea2fe1166fa888c71a79567301d

View file

@ -1 +0,0 @@
d30064114889fe65ffd7c6c27f295351dec57586

View file

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>com.github.weisj</groupId>
<artifactId>darklaf-bcv</artifactId>
<versioning>
<release>2.6.2bcv</release>
<versions>
<version>2.6.2bcv</version>
</versions>
<lastUpdated>20210724002216</lastUpdated>
</versioning>
</metadata>

View file

@ -1 +0,0 @@
75dd4d459bc5baedf71904887dc0b60e

View file

@ -1 +0,0 @@
cc64fe02e94fab19ada3c4e39a6d984d5bf541b1

12
pom.xml
View file

@ -17,10 +17,6 @@
<id>local-maven-repo</id> <id>local-maven-repo</id>
<url>file:///${project.basedir}/libs</url> <url>file:///${project.basedir}/libs</url>
</repository> </repository>
<repository>
<id>sonatype-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository> <!-- TODO Remove when DarkLaf is properly updated -->
<repository> <repository>
<id>jitpack.io</id> <id>jitpack.io</id>
<url>https://jitpack.io</url> <url>https://jitpack.io</url>
@ -86,7 +82,7 @@
<dependency> <dependency>
<groupId>org.codehaus.janino</groupId> <groupId>org.codehaus.janino</groupId>
<artifactId>commons-compiler</artifactId> <artifactId>commons-compiler</artifactId>
<version>3.1.4</version> <version>3.1.6</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
@ -131,7 +127,7 @@
<dependency> <dependency>
<groupId>org.codehaus.janino</groupId> <groupId>org.codehaus.janino</groupId>
<artifactId>janino</artifactId> <artifactId>janino</artifactId>
<version>3.1.4</version> <version>3.1.6</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.jd</groupId> <groupId>com.jd</groupId>
@ -225,8 +221,8 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.github.weisj</groupId> <groupId>com.github.weisj</groupId>
<artifactId>darklaf-bcv</artifactId> <artifactId>darklaf-core</artifactId>
<version>2.6.2bcv</version> <version>2.7.2</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.github.weisj</groupId> <groupId>com.github.weisj</groupId>

View file

@ -84,7 +84,7 @@ import static the.bytecode.club.bytecodeviewer.Constants.*;
* *
* TODO DarkLAF Specific Bugs: * TODO DarkLAF Specific Bugs:
* + Resource List creates swing lag with large project * + Resource List creates swing lag with large project
* + JMenuBar can only be displayed on a JFrame, a work around is needed for this * + JMenuBar can only be displayed on a JFrame, a work around is needed for this (Partially solved)
* *
* TODO IN-PROGRESS: * TODO IN-PROGRESS:
* + Resource Exporter/Save/Decompile As Zip needs to be rewritten * + Resource Exporter/Save/Decompile As Zip needs to be rewritten

View file

@ -3,8 +3,10 @@ package the.bytecode.club.bytecodeviewer.gui.components;
import com.github.weisj.darklaf.icons.ThemedSVGIcon; import com.github.weisj.darklaf.icons.ThemedSVGIcon;
import the.bytecode.club.bytecodeviewer.Configuration; import the.bytecode.club.bytecodeviewer.Configuration;
import the.bytecode.club.bytecodeviewer.gui.resourceviewer.Workspace; import the.bytecode.club.bytecodeviewer.gui.resourceviewer.Workspace;
import the.bytecode.club.bytecodeviewer.gui.theme.LAFTheme;
import the.bytecode.club.bytecodeviewer.resources.IconResources; import the.bytecode.club.bytecodeviewer.resources.IconResources;
import javax.swing.BorderFactory;
import javax.swing.JInternalFrame; import javax.swing.JInternalFrame;
/*************************************************************************** /***************************************************************************
@ -41,6 +43,15 @@ public abstract class VisibleComponent extends JInternalFrame
this.setDefaultIcon(); this.setDefaultIcon();
} }
@Override
public void updateUI() {
if (Configuration.lafTheme != LAFTheme.SYSTEM)
setBorder(BorderFactory.createEmptyBorder());
else
setBorder(null);
super.updateUI();
}
public void setDefaultIcon() public void setDefaultIcon()
{ {
try { try {

View file

@ -1,5 +1,7 @@
package the.bytecode.club.bytecodeviewer.gui.hexviewer; package the.bytecode.club.bytecodeviewer.gui.hexviewer;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -160,8 +162,11 @@ public class JHexEditor extends JPanel implements FocusListener, AdjustmentListe
fn.getHeight() + 1); fn.getHeight() + 1);
} }
protected void printString(Graphics g, String s, int x, int y) { protected void printString(Graphics graphics, String s, int x, int y) {
Graphics2D g = (Graphics2D) graphics;
FontMetrics fn = getFontMetrics(font); FontMetrics fn = getFontMetrics(font);
g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
g.drawString(s, ((fn.stringWidth(" ") + 1) * x) + border, g.drawString(s, ((fn.stringWidth(" ") + 1) * x) + border,
((fn.getHeight() * (y + 1)) - fn.getMaxDescent()) + border); ((fn.getHeight() * (y + 1)) - fn.getMaxDescent()) + border);
} }

View file

@ -43,17 +43,20 @@ public class ResourceTree extends JTree
StringMetricsUtil m = null; StringMetricsUtil m = null;
@Override @Override
public void paint(final Graphics g) public void paint(final Graphics graphics)
{ {
try try
{ {
Graphics2D g = (Graphics2D) graphics;
super.paint(g); super.paint(g);
if (m == null) if (m == null)
{ {
m = new StringMetricsUtil((Graphics2D) g); m = new StringMetricsUtil(g);
} }
if (treeRoot.getChildCount() < 1) if (treeRoot.getChildCount() < 1)
{ {
g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
g.setColor(new Color(0, 0, 0, 100)); g.setColor(new Color(0, 0, 0, 100));
g.fillRect(0, 0, getWidth(), getHeight()); g.fillRect(0, 0, getWidth(), getHeight());
g.setColor(Color.white); g.setColor(Color.white);
@ -63,7 +66,7 @@ public class ResourceTree extends JTree
getHeight() / 2); getHeight() / 2);
} }
} }
catch (InternalError | NullPointerException ignored) catch (InternalError | NullPointerException | ClassCastException ignored)
{ {
} }
} }

View file

@ -6,7 +6,6 @@ import org.apache.commons.compress.utils.FileNameUtils;
import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.Configuration; import the.bytecode.club.bytecodeviewer.Configuration;
import the.bytecode.club.bytecodeviewer.gui.resourceviewer.viewer.ComponentViewer; import the.bytecode.club.bytecodeviewer.gui.resourceviewer.viewer.ComponentViewer;
import the.bytecode.club.bytecodeviewer.gui.theme.LAFTheme;
import the.bytecode.club.bytecodeviewer.resources.IconResources; import the.bytecode.club.bytecodeviewer.resources.IconResources;
import the.bytecode.club.bytecodeviewer.gui.components.FileChooser; import the.bytecode.club.bytecodeviewer.gui.components.FileChooser;
import the.bytecode.club.bytecodeviewer.gui.components.SearchableRSyntaxTextArea; import the.bytecode.club.bytecodeviewer.gui.components.SearchableRSyntaxTextArea;
@ -18,6 +17,7 @@ import the.bytecode.club.bytecodeviewer.util.MiscUtils;
import the.bytecode.club.bytecodeviewer.util.SyntaxLanguage; import the.bytecode.club.bytecodeviewer.util.SyntaxLanguage;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.LineBorder;
import java.awt.*; import java.awt.*;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -123,15 +123,17 @@ public class PluginWriter extends JFrame
JPanel p = new JPanel(new BorderLayout()); JPanel p = new JPanel(new BorderLayout());
JPanel p2 = new JPanel(new BorderLayout()); JPanel p2 = new JPanel(new BorderLayout());
p.add(p2, BorderLayout.NORTH); p.add(p2, BorderLayout.NORTH);
p.add(component, BorderLayout.CENTER); p.add(component, BorderLayout.CENTER);
if(Configuration.lafTheme == LAFTheme.SYSTEM) JMenuBar menuBar = getJMenuBar();
p2.add(getJMenuBar(), BorderLayout.CENTER); // As the Darklaf windows decorations steal the menu bar from the frame
else //TODO DarkLAF wont display the jMenuBar due to how it handles them, instead display the menu // it sets the preferred size to (0,0). Because we want to steal the menu bar ourselves.
//TODO make the menu interactable and display the menu manually // we have to revert this change.
p2.add(getJMenuBar().getMenu(0), BorderLayout.CENTER); // Remove when https://github.com/weisJ/darklaf/issues/258 is fixed and available in a
// release.
menuBar.setPreferredSize(null);
p2.add(menuBar, BorderLayout.CENTER);
ComponentViewer.addComponentAsTab(pluginName, p); ComponentViewer.addComponentAsTab(pluginName, p);
} }

View file

@ -73,16 +73,18 @@ public class ResourceContainerImporter
try try
{ {
//attempt to import using Java ZipInputStream //attempt to import using Java ZipInputStream
importZipInputStream(false); return importZipInputStream(false);
} }
catch (IOException e) catch (Throwable t)
{ {
e.printStackTrace(); try {
//fallback to apache commons ZipFile
//fallback to apache commons ZipFile return importApacheZipFile(false);
importApacheZipFile(false); } catch (Throwable t1) {
t1.addSuppressed(t);
throw t1;
}
} }
return this;
} }
/** /**
@ -93,9 +95,9 @@ public class ResourceContainerImporter
{ {
//TODO remove this .class check and just look for cafebabe //TODO remove this .class check and just look for cafebabe
if (name.endsWith(".class")) if (name.endsWith(".class"))
addClassResource(name, stream); return addClassResource(name, stream);
else if(!classesOnly) else if (!classesOnly)
addResource(name, stream); return addResource(name, stream);
return this; return this;
} }

View file

@ -44,4 +44,10 @@ public class TranslatedJMenu extends JMenu
componentReference.translate(); componentReference.translate();
} }
} }
@Override
public boolean isEnabled()
{
return super.isEnabled() && getMenuComponentCount() > 0;
}
} }

View file

@ -444,10 +444,10 @@ public class FileDrop {
boolean support; boolean support;
try { try {
final Class arbitraryDndClass = Class final Class arbitraryDndClass = Class
.forName("DnDConstants"); .forName("java.awt.dnd.DnDConstants");
support = true; support = true;
} // end try } // end try
catch (final Exception e) { catch (final Throwable t) {
support = false; support = false;
} // end catch } // end catch
supportsDnD = support; supportsDnD = support;