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

View file

@ -84,7 +84,7 @@ import static the.bytecode.club.bytecodeviewer.Constants.*;
*
* TODO DarkLAF Specific Bugs:
* + 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:
* + 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 the.bytecode.club.bytecodeviewer.Configuration;
import the.bytecode.club.bytecodeviewer.gui.resourceviewer.Workspace;
import the.bytecode.club.bytecodeviewer.gui.theme.LAFTheme;
import the.bytecode.club.bytecodeviewer.resources.IconResources;
import javax.swing.BorderFactory;
import javax.swing.JInternalFrame;
/***************************************************************************
@ -40,7 +42,16 @@ public abstract class VisibleComponent extends JInternalFrame
super(title, false, false, false, false);
this.setDefaultIcon();
}
@Override
public void updateUI() {
if (Configuration.lafTheme != LAFTheme.SYSTEM)
setBorder(BorderFactory.createEmptyBorder());
else
setBorder(null);
super.updateUI();
}
public void setDefaultIcon()
{
try {

View file

@ -1,5 +1,7 @@
package the.bytecode.club.bytecodeviewer.gui.hexviewer;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import java.awt.BorderLayout;
@ -160,8 +162,11 @@ public class JHexEditor extends JPanel implements FocusListener, AdjustmentListe
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);
g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
g.drawString(s, ((fn.stringWidth(" ") + 1) * x) + border,
((fn.getHeight() * (y + 1)) - fn.getMaxDescent()) + border);
}

View file

@ -43,17 +43,20 @@ public class ResourceTree extends JTree
StringMetricsUtil m = null;
@Override
public void paint(final Graphics g)
public void paint(final Graphics graphics)
{
try
{
Graphics2D g = (Graphics2D) graphics;
super.paint(g);
if (m == null)
{
m = new StringMetricsUtil((Graphics2D) g);
m = new StringMetricsUtil(g);
}
if (treeRoot.getChildCount() < 1)
{
g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
g.setColor(new Color(0, 0, 0, 100));
g.fillRect(0, 0, getWidth(), getHeight());
g.setColor(Color.white);
@ -63,7 +66,7 @@ public class ResourceTree extends JTree
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.Configuration;
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.gui.components.FileChooser;
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 javax.swing.*;
import javax.swing.border.LineBorder;
import java.awt.*;
import java.io.File;
import java.io.IOException;
@ -123,16 +123,18 @@ public class PluginWriter extends JFrame
JPanel p = new JPanel(new BorderLayout());
JPanel p2 = new JPanel(new BorderLayout());
p.add(p2, BorderLayout.NORTH);
p.add(component, BorderLayout.CENTER);
if(Configuration.lafTheme == LAFTheme.SYSTEM)
p2.add(getJMenuBar(), BorderLayout.CENTER);
else //TODO DarkLAF wont display the jMenuBar due to how it handles them, instead display the menu
//TODO make the menu interactable and display the menu manually
p2.add(getJMenuBar().getMenu(0), BorderLayout.CENTER);
JMenuBar menuBar = getJMenuBar();
// As the Darklaf windows decorations steal the menu bar from the frame
// it sets the preferred size to (0,0). Because we want to steal the menu bar ourselves.
// we have to revert this change.
// 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);
}
else

View file

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

View file

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

View file

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