Skip to content

Commit

Permalink
last changes before 4.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
lbalazscs committed Oct 3, 2018
1 parent 9f821d2 commit 5bfce0c
Show file tree
Hide file tree
Showing 37 changed files with 412 additions and 453 deletions.
17 changes: 0 additions & 17 deletions src/main/java/com/bric/image/ImageContextFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,13 @@
*/
public abstract class ImageContextFactory {
private static ImageContextFactory factory = new ImageContextFactory() {
boolean isJFXInstalled = isJFXInstalled();

public ImageContext create(BufferedImage bi) {
try {
if(isJFXInstalled)
return new JFXImageContext(bi);
return new BasicImageContext(bi);
} catch(Error e) {
return new BasicImageContext(bi);
}
}

private boolean isJFXInstalled() {
try {
Class<?> k = Class.forName("javafx.embed.swing.JFXPanel");
k.newInstance();
return true;
} catch(Throwable t) {
System.err.println("ImageContextFactory: JFX is not available.");
if(!(t instanceof ClassNotFoundException))
t.printStackTrace();
return false;
}
}
};

/** Return the ImageContextFactory in use.
Expand Down
264 changes: 0 additions & 264 deletions src/main/java/com/bric/image/JFXImageContext.java

This file was deleted.

17 changes: 6 additions & 11 deletions src/main/java/pixelitor/Build.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,12 @@
* menus and runtime checks.
*/
public enum Build {
DEVELOPMENT(true) {
}, FINAL(false) {
DEVELOPMENT() {
}, FINAL() {
};

private final boolean development;
private static boolean testing = false;

Build(boolean development) {
this.development = development;
}

public static final boolean enableAdjLayers = false;

public static Build CURRENT = FINAL;
Expand All @@ -47,12 +42,12 @@ public enum Build {
// Lazy because it should be calculated after the CURRENT is set.
private static final Lazy<String> fixTitle = Lazy.of(Build::calcFixTitle);

public boolean isDevelopment() {
return development;
public static boolean isDevelopment() {
return CURRENT == DEVELOPMENT;
}

public boolean isFinal() {
return !development;
public static boolean isFinal() {
return !isDevelopment();
}

private static String calcFixTitle() {
Expand Down
10 changes: 7 additions & 3 deletions src/main/java/pixelitor/Composition.java
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ public void deselect(boolean addToHistory) {
// we can get here from a DeselectEdit.redo on a non-active composition
}
}
if (Build.CURRENT.isDevelopment() && isActive()) {
if (Build.isDevelopment() && isActive()) {
ConsistencyChecks.selectionActionsEnabledCheck(this);
}
}
Expand Down Expand Up @@ -1119,7 +1119,9 @@ public CompletableFuture<Void> saveAsync(SaveSettings saveSettings,
OutputFormat outputFormat = saveSettings.getOutputFormat();
File f = saveSettings.getFile();

System.out.println("Composition::saveAsync: CALLED, file = " + f.getAbsolutePath());
if (Build.isDevelopment()) {
System.out.println("Composition::saveAsync: saving " + f.getAbsolutePath());
}

Runnable saveTask = outputFormat.getSaveTask(this, saveSettings);
return saveAsync(saveTask, f, addToRecentMenus);
Expand Down Expand Up @@ -1165,7 +1167,9 @@ public Path getActivePath() {

public void setActivePath(Path path) {
if (path != null && path.getComp() != this) {
throw new IllegalArgumentException();
throw new IllegalArgumentException(
"path belongs to other comp, this = " + toPathDebugString() +
", path.comp = " + path.getComp().toPathDebugString());
}

if (paths == null) {
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/pixelitor/Pixelitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

import javax.swing.*;
import java.awt.EventQueue;
import java.awt.GraphicsEnvironment;
import java.awt.event.KeyEvent;
import java.awt.geom.Rectangle2D;
import java.io.File;
Expand Down Expand Up @@ -76,6 +77,11 @@ public static void main(String[] args) {
// doesn't seem to pick up good defaults
System.setProperty("awt.useSystemAAFontSettings", "lcd");
System.setProperty("swing.aatext", "true");

if (GraphicsEnvironment.isHeadless()) {
System.err.println("Pixelitor cannot be used in headless mode");
System.exit(1);
}
}

ExceptionHandler.INSTANCE.initialize();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/pixelitor/filters/ParamTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public ParamTest() {

@Override
public BufferedImage doTransform(BufferedImage src, BufferedImage dest) {
if ((Build.CURRENT.isDevelopment()) && (!RandomGUITest.isRunning())) {
if ((Build.isDevelopment()) && (!RandomGUITest.isRunning())) {
System.out.println("ParamTest.doTransform CALLED");
}

Expand Down
Loading

0 comments on commit 5bfce0c

Please sign in to comment.