Skip to content

Commit

Permalink
small improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
lbalazscs committed Sep 6, 2023
1 parent aa144f0 commit 86552ad
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 30 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
<dependency>
<groupId>com.formdev</groupId>
<artifactId>flatlaf</artifactId>
<version>3.2</version>
<version>3.2.1</version>
</dependency>

<!--from here test dependencies-->
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/pixelitor/filters/gui/DialogMenuBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public DialogMenuBar(DialogMenuOwner owner, boolean addPresets) {
addPresetsMenu();
}

if (owner.hasHelp()) {
if (OpenInBrowserAction.CAN_BROWSE && owner.hasHelp()) {
JMenu helpMenu = new JMenu(GUIText.HELP);
helpMenu.add(new OpenInBrowserAction("Wikipedia", owner.getHelpURL()));
add(helpMenu);
Expand Down
14 changes: 8 additions & 6 deletions src/main/java/pixelitor/gui/PreferencesPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@
import javax.swing.border.Border;
import javax.swing.plaf.FontUIResource;
import javax.swing.plaf.nimbus.NimbusLookAndFeel;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.GridBagLayout;
import java.io.File;
import java.util.function.Consumer;

import static java.lang.Integer.parseInt;
import static pixelitor.gui.GUIText.CLOSE_DIALOG;
Expand Down Expand Up @@ -127,7 +129,7 @@ private void addThemeChooser(GridBagHelper gbh) {
themeChooser.setName("themeChooser");
gbh.addLabelAndControlNoStretch("Theme: ", themeChooser);

JLabel accentColorLabel = new JLabel("Accent Color (Flat Themes)");
/* JLabel accentColorLabel = new JLabel("Accent Color (Flat Themes)");
EnumComboBoxModel<AccentColor> accentColors = new EnumComboBoxModel<>(AccentColor.class);
@SuppressWarnings("unchecked")
JComboBox<Theme> accentColorChooser = new JComboBox<>(accentColors);
Expand All @@ -139,20 +141,20 @@ private void addThemeChooser(GridBagHelper gbh) {
accentColorEnabler.accept(currentTheme.isFlat());
gbh.addTwoControlsNoStretch(accentColorLabel, accentColorChooser);

*/
themeChooser.addActionListener(e -> {
Theme theme = themes.getSelectedItem();
setCursor(Cursors.BUSY);

EventQueue.invokeLater(() -> {
Themes.install(theme, true, false);
accentColorEnabler.accept(theme.isFlat());
// accentColorEnabler.accept(theme.isFlat());
SwingUtilities.getWindowAncestor(this).pack();
setCursor(Cursors.DEFAULT);
});
});

accentColorChooser.addActionListener(e -> Themes.changeAccentColor(accentColors.getSelectedItem()));
// accentColorChooser.addActionListener(e -> Themes.changeAccentColor(accentColors.getSelectedItem()));
}

private void addFontChoosers(GridBagHelper gbh) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/pixelitor/layers/LayerGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ public PixelitorEdit endMovement() {

@Override
PixelitorEdit createMovementEdit(int oldTx, int oldTy) {
return null; // the group has no content on its own
return null; // the group has no content of its own
}

@Override
Expand Down
17 changes: 8 additions & 9 deletions src/main/java/pixelitor/tools/pen/PathBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ public void mousePressed(PMouseEvent e) {

if (state == NO_INTERACTION) {
if (controlDown) {
if (handleCtrlPressHitBeforeSubpath(altDown, x, y)) {
if (handleCtrlPressBeforeSubpath(altDown, x, y)) {
return;
}
} else if (altDown) {
if (handleAltPressHitBeforeSubpath(x, y)) {
if (handleAltPressBeforeSubpath(x, y)) {
return;
}
}
Expand Down Expand Up @@ -144,8 +144,8 @@ public void mousePressed(PMouseEvent e) {
assert path.checkConsistency();
}

private static boolean handleCtrlPressHitBeforeSubpath(boolean altDown,
double x, double y) {
private static boolean handleCtrlPressBeforeSubpath(boolean altDown,
double x, double y) {
// if we are over an old point, just move it
DraggablePoint hit = path.handleWasHit(x, y, altDown);
if (hit != null) {
Expand All @@ -155,8 +155,8 @@ private static boolean handleCtrlPressHitBeforeSubpath(boolean altDown,
return false;
}

private static boolean handleAltPressHitBeforeSubpath(double x, double y) {
// if only alt is down, then break control points
private static boolean handleAltPressBeforeSubpath(double x, double y) {
// if only alt is down, then break the control points
DraggablePoint hit = path.handleWasHit(x, y, true);
if (hit != null) {
if (hit instanceof ControlPoint cp) {
Expand Down Expand Up @@ -190,10 +190,10 @@ private static void startDraggingOutNewHandles(AnchorPoint ap, double x, double

private static void breakAndStartMoving(ControlPoint cp, double x, double y) {
if (!cp.isRetracted()) {
// alt-press on an anchor point should break the handle
// alt-press on an anchor point should break the handle...
cp.getAnchor().setType(CUSP);
} else {
// except when it is retracted: then drag out symmetrically
// ...except when it is retracted: then drag out symmetrically
cp.getAnchor().setType(SYMMETRIC);
}
// after breaking, move it as usual
Expand Down Expand Up @@ -318,7 +318,6 @@ public boolean mouseMoved(MouseEvent e, View view) {
return false;
}
BuildState state = path.getBuildState();
// assert state.isMoving() : "state = " + state;
if (state == DRAGGING_THE_CONTROL_OF_LAST) {
state = recoverFromUnexpectedDragState("mouseMoved", view);
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/pixelitor/tools/pen/PathTransformer.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ public void mousePressed(PMouseEvent e) {
double x = e.getOrigCoX();
double y = e.getOrigCoY();

// first look for a handle hit in all the boxes so that
// handles can be manipulated even when the boxes are overlapping
// First, check all boxes for a handle hit so that handles
// can be manipulated even when the boxes overlap.
boolean handleWasHit = false;
for (TransformBox box : boxes) {
DraggablePoint hit = box.findHandleAt(x, y);
Expand All @@ -115,7 +115,7 @@ public void mousePressed(PMouseEvent e) {
}
activePoint = null;

// if no handle was hit, then look for whole-box movements
// if no handle was hit, then check for whole-box movements
for (TransformBox box : boxes) {
if (box.contains(x, y)) {
box.startWholeBoxDrag(x, y);
Expand Down
21 changes: 13 additions & 8 deletions src/main/java/pixelitor/utils/OpenInBrowserAction.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 Laszlo Balazs-Csiki and Contributors
* Copyright 2023 Laszlo Balazs-Csiki and Contributors
*
* This file is part of Pixelitor. Pixelitor is free software: you
* can redistribute it and/or modify it under the terms of the GNU
Expand All @@ -23,10 +23,15 @@
import java.net.URI;
import java.net.URISyntaxException;

import static java.awt.Desktop.Action.BROWSE;

/**
* An action that opens a URL in an external browser
*/
public class OpenInBrowserAction extends AbstractAction {
public static final boolean CAN_BROWSE = Desktop.isDesktopSupported()
&& Desktop.getDesktop().isSupported(BROWSE);

private URI uri;

public OpenInBrowserAction(String name, String url) {
Expand All @@ -44,13 +49,13 @@ public void actionPerformed(ActionEvent e) {
}

private static void openURI(URI uri) {
if (Desktop.isDesktopSupported()) {
Desktop desktop = Desktop.getDesktop();
try {
desktop.browse(uri);
} catch (IOException e) {
Messages.showException(e);
}
if (!CAN_BROWSE) {
return;
}
try {
Desktop.getDesktop().browse(uri);
} catch (IOException e) {
Messages.showException(e);
}
}
}
3 changes: 2 additions & 1 deletion website/release_notes.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@
<h1>Pixelitor release notes</h1>

<div class="card">
<h2>4.3.1 - released on 2023-02-</h2>
<h2>4.3.1 - released on 2023-09-06</h2>
<ul>
<li>New themes: flat dark, flat light, system</li>
<li>UI font type and size in Preferences</li>
<li>Support reading WebP files (without ImageMagick)</li>
<li>New filters: Abstract Lights, Tile Seamless, Rose, Concentric Shapes, Border Mask</li>
<li>Blinds, Checkerboard, Goo and Shapes Grid as separate transition filters</li>
<li>Improved filters: Photo Collage, Spheres</li>
<li>Snapping to pixel boundaries</li>
<li>Layer isolation</li>
<li>Crop to content</li>
<li>Adjustment layers, layer groups (experimental)</li>
Expand Down

0 comments on commit 86552ad

Please sign in to comment.