Skip to content

Commit

Permalink
Reorganize files for java 17 support with 0.04 version
Browse files Browse the repository at this point in the history
  • Loading branch information
Retera committed Feb 5, 2022
1 parent 760341b commit 4e44edc
Show file tree
Hide file tree
Showing 282 changed files with 1,810 additions and 4,779 deletions.
66 changes: 33 additions & 33 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,83 +7,83 @@ buildscript {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://maven.nikr.net/" }
jcenter()
gradlePluginPortal()
google()
}
}


repositories {
mavenCentral()
}



allprojects {
apply plugin: "eclipse"
apply plugin: "idea"

version = '1.0'
version = '0.4.3'
ext {
appName = "retera-jwc3"
jtattooVersion = '1.6.11'
xstreamVersion = '1.4.9'
jtattooVersion = '1.6.12'
miglayoutVersion = '4.2'
lwjglVersion = '2.9.3'
image4jVersion = '0.7'
rsyntaxtextareaVersion = '3.0.2'
nashornVersion = '15.2'
}

repositories {
mavenLocal()
mavenCentral()
google()
gradlePluginPortal()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://maven.nikr.net/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
}
}

project(":matrixeater") {
apply plugin: "java"


dependencies {
compile project(":craft3data")
compile project(":craft3editor")
compile "com.fifesoft:rsyntaxtextarea:$rsyntaxtextareaVersion"
}
}

project(":disarm") {
apply plugin: "java"
apply plugin: "java-library"


dependencies {
compile project(":craft3data")
compile project(":craft3editor")
compile project(":matrixeater")
implementation project(":craft3data")
implementation project(":craft3editor")
api "com.fifesoft:rsyntaxtextarea:$rsyntaxtextareaVersion"
api "org.openjdk.nashorn:nashorn-core:${nashornVersion}"
}
}

project(":craft3editor") {
apply plugin: "java"
apply plugin: "java-library"


dependencies {
compile project(":craft3data")
compile "org.jclarion:image4j:$image4jVersion"
implementation project(":craft3data")
api "org.jclarion:image4j:$image4jVersion"
}
}

project(":craft3data") {
apply plugin: "java"
apply plugin: "java-library"


dependencies {
compile "com.jtattoo:JTattoo:$jtattooVersion"
compile "com.miglayout:miglayout-swing:$miglayoutVersion"
compile "org.lwjgl:lwjgl:${lwjglVersion}"
compile "org.lwjgl:lwjgl-platform:${lwjglVersion}:natives-windows"
compile "org.lwjgl:lwjgl-platform:${lwjglVersion}:natives-linux"
compile "org.lwjgl:lwjgl-platform:${lwjglVersion}:natives-osx"
compile "org.lwjgl.lwjgl:lwjgl_util:${lwjglVersion}"
compile "net.nikr:dds:1.0.0"
compile "com.google.guava:guava:23.5-jre"
api "com.jtattoo:JTattoo:$jtattooVersion"
api "com.miglayout:miglayout-swing:$miglayoutVersion"
api "org.lwjgl.lwjgl:lwjgl:${lwjglVersion}"
api "org.lwjgl.lwjgl:lwjgl-platform:${lwjglVersion}:natives-windows"
api "org.lwjgl.lwjgl:lwjgl-platform:${lwjglVersion}:natives-linux"
api "org.lwjgl.lwjgl:lwjgl-platform:${lwjglVersion}:natives-osx"
api "org.lwjgl.lwjgl:lwjgl_util:${lwjglVersion}"
api "net.nikr:dds:1.0.0"
api "com.google.guava:guava:23.5-jre"
// compile "com.github.ebourg:infonode:master"
// compile "com.github.DrSuperGood:blp-iio-plugin:master"
compile files(fileTree(dir:'../jars', includes: ['*.jar']))
api files(fileTree(dir:'../jars', includes: ['*.jar']))
}
}

Expand Down
3 changes: 0 additions & 3 deletions craft3data/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
apply plugin: "java"

sourceCompatibility = 1.8
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'

sourceSets.main.java.srcDirs = [ "src/" ]
Expand Down
3 changes: 2 additions & 1 deletion craft3data/src/com/hiveworkshop/wc3/gui/BLPHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import java.nio.file.StandardCopyOption;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;

import javax.imageio.ImageIO;
Expand Down Expand Up @@ -97,7 +98,7 @@ public GPUReadyTexture loadTexture(final DataSource dataSource, final String fil

public BufferedImage getTexture(final DataSource dataSource, final String filepath) {
try {
final String lowerCaseFilepath = filepath.toLowerCase();
final String lowerCaseFilepath = filepath.toLowerCase(Locale.US);
BufferedImage resultImage = cache.get(lowerCaseFilepath);
if (resultImage != null) {
return resultImage;
Expand Down
29 changes: 0 additions & 29 deletions craft3data/src/com/hiveworkshop/wc3/gui/GlobalIcons.java

This file was deleted.

Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public void reload() {
threeDCameraPanButton = MouseButtonPreference.MIDDLE;
}
if (theme == null) {
theme = GUITheme.WINDOWS;
theme = GUITheme.DARK;
}
if (quickBrowse == null) {
quickBrowse = Boolean.TRUE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@
import javax.swing.Timer;

import com.hiveworkshop.wc3.gui.GUITheme;
import com.hiveworkshop.wc3.gui.GlobalIcons;
import com.hiveworkshop.wc3.gui.ProgramPreferences;
import com.hiveworkshop.wc3.gui.animedit.TimeSliderTimeListener.TimeSliderTimeNotifier;
import com.hiveworkshop.wc3.gui.icons.RMSIcons;
import com.hiveworkshop.wc3.gui.modeledit.UndoAction;
import com.hiveworkshop.wc3.gui.modeledit.actions.newsys.ModelStructureChangeListener;
import com.hiveworkshop.wc3.gui.modeledit.activity.UndoActionListener;
Expand Down Expand Up @@ -352,10 +352,10 @@ public void mousePressed(final MouseEvent e) {
}
}
if (!foundMatch) {
if ((lastMousePoint.x < (GlobalIcons.PLAY.getIconWidth() / 2))
if ((lastMousePoint.x < (RMSIcons.PLAY.getIconWidth() / 2))
&& (lastMousePoint.y > (VERTICAL_SLIDER_HEIGHT + 4))
&& (lastMousePoint.y < (VERTICAL_SLIDER_HEIGHT + 4
+ (GlobalIcons.PLAY.getIconHeight() / 2)))) {
+ (RMSIcons.PLAY.getIconHeight() / 2)))) {
if (liveAnimationTimer.isRunning()) {
liveAnimationTimer.stop();
} else {
Expand Down Expand Up @@ -986,8 +986,8 @@ protected void paintComponent(final Graphics g) {
g.setColor(GLASS_TICK_COVER_BORDER_COLOR);
g.drawRect(currentTimePixelX - 4, VERTICAL_SLIDER_HEIGHT, 8, VERTICAL_TICKS_HEIGHT);

final Image playImage = liveAnimationTimer.isRunning() ? GlobalIcons.PAUSE.getImage()
: GlobalIcons.PLAY.getImage();
final Image playImage = liveAnimationTimer.isRunning() ? RMSIcons.PAUSE.getImage()
: RMSIcons.PLAY.getImage();
g.drawImage(playImage, 0, VERTICAL_SLIDER_HEIGHT + 4, playImage.getWidth(null) / 2,
playImage.getWidth(null) / 2, null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,39 +59,17 @@
import com.hiveworkshop.blizzard.casc.io.WarcraftIIICASC.FileSystem;
import com.hiveworkshop.nio.ByteBufferInputStream;
import com.hiveworkshop.wc3.gui.ExceptionPopup;
import com.hiveworkshop.wc3.gui.icons.RMSIcons;
import com.hiveworkshop.wc3.user.WindowsRegistry;
import com.jtattoo.plaf.acryl.AcrylLookAndFeel;
import com.jtattoo.plaf.aluminium.AluminiumLookAndFeel;
import com.jtattoo.plaf.hifi.HiFiLookAndFeel;
import com.jtattoo.plaf.noire.NoireLookAndFeel;

public class DataSourceChooserPanel extends JPanel {
private static final ImageIcon CASCIcon;
private static final ImageIcon MPQIcon;
private static final ImageIcon FolderIcon;
static {
ImageIcon cascIcon = null;
try {
cascIcon = new ImageIcon(ImageIO.read(DataSourceChooserPanel.class.getResource("icons/CASC.png"))
.getScaledInstance(16, 16, Image.SCALE_SMOOTH));
} catch (final IOException e) {
}
CASCIcon = cascIcon;
ImageIcon mpqIcon = null;
try {
mpqIcon = new ImageIcon(ImageIO.read(DataSourceChooserPanel.class.getResource("icons/MPQ.png"))
.getScaledInstance(16, 16, Image.SCALE_SMOOTH));
} catch (final IOException e) {
}
MPQIcon = mpqIcon;
ImageIcon folderIcon = null;
try {
folderIcon = new ImageIcon(ImageIO.read(DataSourceChooserPanel.class.getResource("icons/Folder.png"))
.getScaledInstance(16, 16, Image.SCALE_SMOOTH));
} catch (final IOException e) {
}
FolderIcon = folderIcon;
}
private static final ImageIcon CASCIcon = RMSIcons.loadDataSourceImageIcon("CASC.png");
private static final ImageIcon MPQIcon = RMSIcons.loadDataSourceImageIcon("MPQ.png");
private static final ImageIcon FolderIcon = RMSIcons.loadDataSourceImageIcon("Folder.png");

private final List<DataSourceDescriptor> dataSourceDescriptors;
private String wcDirectory;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package com.hiveworkshop.wc3.gui.datachooser;


import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.nio.file.Files;
import java.util.Collection;
import java.util.Collections;

public class JavaJarDataSource implements DataSource {
@Override
public InputStream getResourceAsStream(final String filepath) throws IOException {
return JavaJarDataSource.class.getResourceAsStream("/" + filepath.replace('\\', '/'));
}

@Override
public File getFile(final String filepath) throws IOException {
final InputStream newInputStream = getResourceAsStream(filepath);
String tmpdir = System.getProperty("java.io.tmpdir");
if (!tmpdir.endsWith(File.separator)) {
tmpdir += File.separator;
}
final String tempDir = tmpdir + "RMSExtract/";
final File tempProduct = new File(tempDir + filepath.replace('\\', File.separatorChar));
tempProduct.delete();
tempProduct.getParentFile().mkdirs();
Files.copy(newInputStream, tempProduct.toPath());
tempProduct.deleteOnExit();
return tempProduct;
}

@Override
public ByteBuffer read(final String path) throws IOException {
final InputStream stream = getResourceAsStream(path);
if (stream == null) {
return null;
}
return ByteBuffer.wrap(stream.readAllBytes());
}

@Override
public boolean has(final String filepath) {
return JavaJarDataSource.class.getResource("/" + filepath.replace('\\', '/')) != null;
}

@Override
public boolean allowDownstreamCaching(final String filepath) {
return true;
}

@Override
public Collection<String> getListfile() {
return Collections.emptySet(); // breaks API but not easy from Java and not needed
}

@Override
public void close() throws IOException {
// breaks API but not easy from Java and not needed
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.hiveworkshop.wc3.gui.datachooser;

public class JavaJarDataSourceDescriptor implements DataSourceDescriptor {
@Override
public DataSource createDataSource() {
return new JavaJarDataSource();
}

@Override
public String getDisplayName() {
return "JAR";
}

@Override
public DataSourceDescriptor duplicate() {
return this;
}
}
Loading

0 comments on commit 4e44edc

Please sign in to comment.