Add the base files to the Launcher Git.
This commit is contained in:
parent
d1b3d2168c
commit
7242015c76
376 changed files with 27499 additions and 2 deletions
36
launcher-fancy/build.gradle
Normal file
36
launcher-fancy/build.gradle
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
plugins {
|
||||
id 'application'
|
||||
id "com.github.johnrengelman.shadow"
|
||||
id 'io.freefair.lombok'
|
||||
}
|
||||
|
||||
application {
|
||||
mainClassName = "com.skcraft.launcher.FancyLauncher"
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name = 'bbkr.space maven'
|
||||
url = 'https://server.bbkr.space/artifactory/libs-snapshot'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(path: ':launcher')
|
||||
implementation 'io.github.cottonmc.insubstantial:substance:7.3.1-SNAPSHOT'
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
dependsOn ':launcher:shadowJar'
|
||||
archiveClassifier.set("")
|
||||
}
|
||||
|
||||
// Work around gradle shadow bug
|
||||
// see https://github.com/johnrengelman/shadow/issues/713
|
||||
startScripts.dependsOn(':launcher:shadowJar')
|
||||
distTar.dependsOn(':launcher:shadowJar')
|
||||
distZip.dependsOn(':launcher:shadowJar')
|
||||
|
||||
build {
|
||||
dependsOn(shadowJar)
|
||||
}
|
||||
2
launcher-fancy/lombok.config
Normal file
2
launcher-fancy/lombok.config
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# This file is generated by the 'io.freefair.lombok' Gradle plugin
|
||||
config.stopBubbling = true
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* SKCraft Launcher
|
||||
* Copyright (C) 2010-2014 Albert Pham <http://www.sk89q.com> and contributors
|
||||
* Please see LICENSE.txt for license information.
|
||||
*/
|
||||
|
||||
package com.skcraft.launcher;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.io.IOException;
|
||||
|
||||
public class FancyBackgroundPanel extends JPanel {
|
||||
|
||||
private Image background;
|
||||
|
||||
public FancyBackgroundPanel() {
|
||||
try {
|
||||
background = ImageIO.read(FancyBackgroundPanel.class.getResourceAsStream("launcher_bg.jpg"));
|
||||
} catch (IOException e) {
|
||||
background = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintComponent(Graphics g) {
|
||||
super.paintComponent(g);
|
||||
if (background != null) {
|
||||
double multi;
|
||||
int w, h;
|
||||
|
||||
// Calculate Aspect Ratio Multiplier depending on window size
|
||||
if (this.getHeight() <= this.getWidth()) {
|
||||
multi = this.getWidth() / (float)background.getWidth(null);
|
||||
}
|
||||
else {
|
||||
multi = this.getHeight() / (float)background.getHeight(null);
|
||||
}
|
||||
|
||||
// Calculate new width and height
|
||||
w = (int) Math.floor((float)background.getWidth(null) * multi);
|
||||
h = (int) Math.floor((float)background.getHeight(null) * multi);
|
||||
|
||||
// Check if it needs to be switched (eg. in case of a square window)
|
||||
if (h < this.getHeight() || w < this.getWidth()) {
|
||||
if (h < this.getHeight()) {
|
||||
multi = this.getHeight() / (float)background.getHeight(null);
|
||||
}
|
||||
else if (w < this.getWidth()) {
|
||||
multi = this.getWidth() / (float) background.getWidth(null);
|
||||
}
|
||||
|
||||
w = (int) Math.floor((float)background.getWidth(null) * multi);
|
||||
h = (int) Math.floor((float)background.getHeight(null) * multi);
|
||||
}
|
||||
|
||||
g.drawImage(background, 0, 0, w, h,null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
* SKCraft Launcher
|
||||
* Copyright (C) 2010-2014 Albert Pham <http://www.sk89q.com> and contributors
|
||||
* Please see LICENSE.txt for license information.
|
||||
*/
|
||||
|
||||
package com.skcraft.launcher;
|
||||
|
||||
import com.google.common.base.Supplier;
|
||||
import com.skcraft.launcher.swing.SwingHelper;
|
||||
import lombok.extern.java.Log;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.logging.Level;
|
||||
|
||||
@Log
|
||||
public class FancyLauncher {
|
||||
|
||||
public static void main(final String[] args) {
|
||||
Launcher.setupLogger();
|
||||
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Thread.currentThread().setContextClassLoader(FancyLauncher.class.getClassLoader());
|
||||
UIManager.getLookAndFeelDefaults().put("ClassLoader", FancyLauncher.class.getClassLoader());
|
||||
UIManager.getDefaults().put("SplitPane.border", BorderFactory.createEmptyBorder());
|
||||
JFrame.setDefaultLookAndFeelDecorated(true);
|
||||
JDialog.setDefaultLookAndFeelDecorated(true);
|
||||
System.setProperty("sun.awt.noerasebackground", "true");
|
||||
System.setProperty("substancelaf.windowRoundedCorners", "false");
|
||||
|
||||
if (!SwingHelper.setLookAndFeel("com.skcraft.launcher.skin.LauncherLookAndFeel")) {
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
}
|
||||
|
||||
Launcher launcher = Launcher.createFromArguments(args);
|
||||
launcher.setMainWindowSupplier(new CustomWindowSupplier(launcher));
|
||||
launcher.showLauncherWindow();
|
||||
} catch (Throwable t) {
|
||||
log.log(Level.WARNING, "Load failure", t);
|
||||
SwingHelper.showErrorDialog(null, "Uh oh! The updater couldn't be opened because a " +
|
||||
"problem was encountered.", "Launcher error", t);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static class CustomWindowSupplier implements Supplier<Window> {
|
||||
|
||||
private final Launcher launcher;
|
||||
|
||||
private CustomWindowSupplier(Launcher launcher) {
|
||||
this.launcher = launcher;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Window get() {
|
||||
return new FancyLauncherFrame(launcher);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* SKCraft Launcher
|
||||
* Copyright (C) 2010-2014 Albert Pham <http://www.sk89q.com> and contributors
|
||||
* Please see LICENSE.txt for license information.
|
||||
*/
|
||||
|
||||
package com.skcraft.launcher;
|
||||
|
||||
import com.skcraft.launcher.dialog.LauncherFrame;
|
||||
import com.skcraft.launcher.swing.SwingHelper;
|
||||
import com.skcraft.launcher.swing.WebpagePanel;
|
||||
import lombok.NonNull;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class FancyLauncherFrame extends LauncherFrame {
|
||||
|
||||
/**
|
||||
* Create a new frame.
|
||||
*
|
||||
* @param launcher the launcher
|
||||
*/
|
||||
public FancyLauncherFrame(@NonNull Launcher launcher) {
|
||||
super(launcher);
|
||||
|
||||
setSize(800, 500);
|
||||
setLocationRelativeTo(null);
|
||||
|
||||
SwingHelper.removeOpaqueness(getInstancesTable());
|
||||
SwingHelper.removeOpaqueness(getInstanceScroll());
|
||||
getInstanceScroll().setBorder(BorderFactory.createEmptyBorder());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JPanel createContainerPanel() {
|
||||
return new FancyBackgroundPanel();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected WebpagePanel createNewsPanel() {
|
||||
WebpagePanel panel = super.createNewsPanel();
|
||||
panel.setBrowserBorder(BorderFactory.createEmptyBorder());
|
||||
return panel;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* SKCraft Launcher
|
||||
* Copyright (C) 2010-2014 Albert Pham <http://www.sk89q.com> and contributors
|
||||
* Please see LICENSE.txt for license information.
|
||||
*/
|
||||
|
||||
package com.skcraft.launcher.skin;
|
||||
|
||||
import org.pushingpixels.substance.api.shaper.ClassicButtonShaper;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class LauncherButtonShaper extends ClassicButtonShaper {
|
||||
|
||||
public Dimension getPreferredSize(AbstractButton button, Dimension uiPreferredSize) {
|
||||
Dimension size = super.getPreferredSize(button, uiPreferredSize);
|
||||
return new Dimension(size.width + 5, size.height + 4);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* SKCraft Launcher
|
||||
* Copyright (C) 2010-2014 Albert Pham <http://www.sk89q.com> and contributors
|
||||
* Please see LICENSE.txt for license information.
|
||||
*/
|
||||
|
||||
package com.skcraft.launcher.skin;
|
||||
|
||||
import org.pushingpixels.substance.api.SubstanceLookAndFeel;
|
||||
|
||||
public class LauncherLookAndFeel extends SubstanceLookAndFeel {
|
||||
|
||||
public LauncherLookAndFeel() {
|
||||
super(new LauncherSkin());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
* SKCraft Launcher
|
||||
* Copyright (C) 2010-2014 Albert Pham <http://www.sk89q.com> and contributors
|
||||
* Please see LICENSE.txt for license information.
|
||||
*/
|
||||
|
||||
package com.skcraft.launcher.skin;
|
||||
|
||||
import org.pushingpixels.substance.api.*;
|
||||
import org.pushingpixels.substance.api.painter.border.ClassicBorderPainter;
|
||||
import org.pushingpixels.substance.api.painter.border.CompositeBorderPainter;
|
||||
import org.pushingpixels.substance.api.painter.border.DelegateBorderPainter;
|
||||
import org.pushingpixels.substance.api.painter.decoration.FlatDecorationPainter;
|
||||
import org.pushingpixels.substance.api.painter.fill.FractionBasedFillPainter;
|
||||
import org.pushingpixels.substance.api.painter.highlight.ClassicHighlightPainter;
|
||||
import org.pushingpixels.substance.api.skin.GraphiteSkin;
|
||||
|
||||
public class LauncherSkin extends GraphiteSkin {
|
||||
|
||||
public LauncherSkin() {
|
||||
ColorSchemes schemes = SubstanceSkin.getColorSchemes("com/skcraft/launcher/skin/graphite.colorschemes");
|
||||
|
||||
SubstanceColorScheme activeScheme = schemes.get("Graphite Active");
|
||||
SubstanceColorScheme selectedDisabledScheme = schemes.get("Graphite Selected Disabled");
|
||||
SubstanceColorScheme selectedScheme = schemes.get("Graphite Selected");
|
||||
SubstanceColorScheme disabledScheme = schemes.get("Graphite Disabled");
|
||||
SubstanceColorScheme enabledScheme = schemes.get("Graphite Enabled");
|
||||
SubstanceColorScheme backgroundScheme = schemes.get("Graphite Background");
|
||||
SubstanceColorScheme highlightScheme = schemes.get("Graphite Highlight");
|
||||
SubstanceColorScheme borderScheme = schemes.get("Graphite Border");
|
||||
SubstanceColorScheme separatorScheme = schemes.get("Graphite Separator");
|
||||
SubstanceColorScheme textHighlightScheme = schemes.get("Graphite Text Highlight");
|
||||
SubstanceColorScheme highlightMarkScheme = schemes.get("Graphite Highlight Mark");
|
||||
SubstanceColorScheme tabHighlightScheme = schemes.get("Graphite Tab Highlight");
|
||||
|
||||
SubstanceColorSchemeBundle scheme = new SubstanceColorSchemeBundle(activeScheme, enabledScheme, disabledScheme);
|
||||
|
||||
// highlight fill scheme + custom alpha for rollover unselected state
|
||||
scheme.registerHighlightColorScheme(highlightScheme, 0.6f, ComponentState.ROLLOVER_UNSELECTED);
|
||||
scheme.registerHighlightColorScheme(highlightScheme, 0.8f, ComponentState.SELECTED);
|
||||
scheme.registerHighlightColorScheme(highlightScheme, 1.0f, ComponentState.ROLLOVER_SELECTED);
|
||||
scheme.registerHighlightColorScheme(highlightScheme, 0.75f, ComponentState.ARMED, ComponentState.ROLLOVER_ARMED);
|
||||
|
||||
// highlight border scheme
|
||||
scheme.registerColorScheme(highlightScheme, ColorSchemeAssociationKind.HIGHLIGHT_BORDER, ComponentState.getActiveStates());
|
||||
scheme.registerColorScheme(borderScheme, ColorSchemeAssociationKind.BORDER);
|
||||
scheme.registerColorScheme(separatorScheme, ColorSchemeAssociationKind.SEPARATOR);
|
||||
|
||||
// text highlight scheme
|
||||
scheme.registerColorScheme(textHighlightScheme, ColorSchemeAssociationKind.TEXT_HIGHLIGHT, ComponentState.SELECTED, ComponentState.ROLLOVER_SELECTED);
|
||||
scheme.registerColorScheme(highlightScheme, ComponentState.ARMED, ComponentState.ROLLOVER_ARMED);
|
||||
scheme.registerColorScheme(highlightMarkScheme, ColorSchemeAssociationKind.HIGHLIGHT_MARK, ComponentState.getActiveStates());
|
||||
scheme.registerColorScheme(highlightMarkScheme, ColorSchemeAssociationKind.MARK, ComponentState.ROLLOVER_SELECTED, ComponentState.ROLLOVER_UNSELECTED);
|
||||
scheme.registerColorScheme(borderScheme, ColorSchemeAssociationKind.MARK, ComponentState.SELECTED);
|
||||
scheme.registerColorScheme(disabledScheme, 0.5f, ComponentState.DISABLED_UNSELECTED);
|
||||
scheme.registerColorScheme(selectedDisabledScheme, 0.65f, ComponentState.DISABLED_SELECTED);
|
||||
scheme.registerColorScheme(highlightScheme, ComponentState.ROLLOVER_SELECTED);
|
||||
scheme.registerColorScheme(selectedScheme, ComponentState.SELECTED);
|
||||
|
||||
scheme.registerColorScheme(tabHighlightScheme, ColorSchemeAssociationKind.TAB, ComponentState.ROLLOVER_SELECTED);
|
||||
|
||||
this.registerDecorationAreaSchemeBundle(scheme, backgroundScheme, DecorationAreaType.NONE);
|
||||
|
||||
this.setSelectedTabFadeStart(0.1);
|
||||
this.setSelectedTabFadeEnd(0.3);
|
||||
|
||||
this.buttonShaper = new LauncherButtonShaper();
|
||||
this.watermark = null;
|
||||
this.fillPainter = new FractionBasedFillPainter("Graphite",
|
||||
new float[] { 0.0f, 0.5f, 1.0f },
|
||||
new ColorSchemeSingleColorQuery[] {
|
||||
ColorSchemeSingleColorQuery.ULTRALIGHT,
|
||||
ColorSchemeSingleColorQuery.LIGHT,
|
||||
ColorSchemeSingleColorQuery.LIGHT });
|
||||
this.decorationPainter = new FlatDecorationPainter();
|
||||
this.highlightPainter = new ClassicHighlightPainter();
|
||||
this.borderPainter = new CompositeBorderPainter("Graphite",
|
||||
new ClassicBorderPainter(), new DelegateBorderPainter(
|
||||
"Graphite Inner", new ClassicBorderPainter(),
|
||||
0xA0FFFFFF, 0x60FFFFFF, 0x60FFFFFF,
|
||||
new ColorSchemeTransform() {
|
||||
@Override
|
||||
public SubstanceColorScheme transform(
|
||||
SubstanceColorScheme scheme) {
|
||||
return scheme.tint(0.25f);
|
||||
}
|
||||
}));
|
||||
|
||||
this.highlightBorderPainter = new ClassicBorderPainter();
|
||||
|
||||
this.watermarkScheme = schemes.get("Graphite Watermark");
|
||||
}
|
||||
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
|
|
@ -0,0 +1,153 @@
|
|||
Graphite Enabled {
|
||||
kind=Dark
|
||||
colorUltraLight=#4A4A4A
|
||||
colorExtraLight=#464646
|
||||
colorLight=#424242
|
||||
colorMid=#3F3F3F
|
||||
colorDark=#353535
|
||||
colorUltraDark=#313131
|
||||
colorForeground=#B4B4B4
|
||||
}
|
||||
|
||||
Graphite Border {
|
||||
kind=Dark
|
||||
colorUltraLight=#616161
|
||||
colorExtraLight=#5A5A5A
|
||||
colorLight=#4F4F4F
|
||||
colorMid=#414141
|
||||
colorDark=#323232
|
||||
colorUltraDark=#2B2B2B
|
||||
colorForeground=#EDEDED
|
||||
}
|
||||
|
||||
Graphite Background {
|
||||
kind=Dark
|
||||
colorUltraLight=#555555
|
||||
colorExtraLight=#444444
|
||||
colorLight=#333333
|
||||
colorMid=#222222
|
||||
colorDark=#111111
|
||||
colorUltraDark=#000000
|
||||
colorForeground=#B4B4B4
|
||||
}
|
||||
|
||||
Graphite Watermark {
|
||||
kind=Dark
|
||||
colorUltraLight=#555555
|
||||
colorExtraLight=#444444
|
||||
colorLight=#333333
|
||||
colorMid=#222222
|
||||
colorDark=#111111
|
||||
colorUltraDark=#000000
|
||||
colorForeground=#B4B4B4
|
||||
}
|
||||
|
||||
Graphite Active {
|
||||
kind=Dark
|
||||
colorUltraLight=#777777
|
||||
colorExtraLight=#6F6F6F
|
||||
colorLight=#636363
|
||||
colorMid=#535353
|
||||
colorDark=#434343
|
||||
colorUltraDark=#3B3B3B
|
||||
colorForeground=#C8C8C8
|
||||
}
|
||||
|
||||
Graphite Selected {
|
||||
kind=Dark
|
||||
colorUltraLight=#727272
|
||||
colorExtraLight=#696969
|
||||
colorLight=#606060
|
||||
colorMid=#505050
|
||||
colorDark=#404040
|
||||
colorUltraDark=#383838
|
||||
colorForeground=#C8C8C8
|
||||
}
|
||||
|
||||
Graphite Selected Disabled {
|
||||
kind=Dark
|
||||
colorUltraLight=#777777
|
||||
colorExtraLight=#6F6F6F
|
||||
colorLight=#636363
|
||||
colorMid=#535353
|
||||
colorDark=#434343
|
||||
colorUltraDark=#3B3B3B
|
||||
colorForeground=#202020
|
||||
}
|
||||
|
||||
Graphite Disabled {
|
||||
kind=Dark
|
||||
colorUltraLight=#646464
|
||||
colorExtraLight=#5E5E5E
|
||||
colorLight=#545454
|
||||
colorMid=#474747
|
||||
colorDark=#3A3A3A
|
||||
colorUltraDark=#333333
|
||||
colorForeground=#CCCCCC
|
||||
}
|
||||
|
||||
Graphite Highlight {
|
||||
kind=Dark
|
||||
colorUltraLight=#373737
|
||||
colorExtraLight=#373737
|
||||
colorLight=#373737
|
||||
colorMid=#373737
|
||||
colorDark=#373737
|
||||
colorUltraDark=#373737
|
||||
colorForeground=#CCCCCC
|
||||
}
|
||||
|
||||
Graphite Tab Highlight {
|
||||
kind=Light
|
||||
colorUltraLight=#FBFCFF
|
||||
colorExtraLight=#F2F6FB
|
||||
colorLight=#CED7E0
|
||||
colorMid=#BCC0C5
|
||||
colorDark=#62666B
|
||||
colorUltraDark=#363B3F
|
||||
colorForeground=#EDEDED
|
||||
}
|
||||
|
||||
Graphite Highlight Mark {
|
||||
kind=Dark
|
||||
colorUltraLight=#616161
|
||||
colorExtraLight=#5A5A5A
|
||||
colorLight=#4F4F4F
|
||||
colorMid=#414141
|
||||
colorDark=#323232
|
||||
colorUltraDark=#2B2B2B
|
||||
colorForeground=#2B2B2B
|
||||
}
|
||||
|
||||
Graphite Text Highlight {
|
||||
kind=Light
|
||||
colorUltraLight=#BDBEC0
|
||||
colorExtraLight=#B8BBBD
|
||||
colorLight=#A4A9AE
|
||||
colorMid=#9A9D9F
|
||||
colorDark=#686B6D
|
||||
colorUltraDark=#505355
|
||||
colorForeground=#2B2F33
|
||||
}
|
||||
|
||||
Graphite Separator {
|
||||
kind=Dark
|
||||
colorUltraLight=#565656
|
||||
colorExtraLight=#525252
|
||||
colorLight=#4F4F4F
|
||||
colorMid=#383838
|
||||
colorDark=#353535
|
||||
colorUltraDark=#333333
|
||||
colorForeground=#B4B4B4
|
||||
}
|
||||
|
||||
Graphite Aqua {
|
||||
kind=Light
|
||||
colorUltraLight=#6383FF
|
||||
colorExtraLight=#577EFF
|
||||
colorLight=#4A6FFF
|
||||
colorMid=#355FFB
|
||||
colorDark=#1A3DE6
|
||||
colorUltraDark=#153BE1
|
||||
colorForeground=#FFFFFF
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue