# HG changeset patch # User David Barts # Date 1606265137 28800 # Node ID 92afaa27f40a93b047f56441f5948e5260f6ba22 # Parent d3979a2155a8c2c8a5f1036cb726545f66812fda Mac app support. diff -r d3979a2155a8 -r 92afaa27f40a ImagePrep.icns Binary file ImagePrep.icns has changed diff -r d3979a2155a8 -r 92afaa27f40a ImagePrep.iconset/icon_128x128.png Binary file ImagePrep.iconset/icon_128x128.png has changed diff -r d3979a2155a8 -r 92afaa27f40a ImagePrep.iconset/icon_128x128@2x.png Binary file ImagePrep.iconset/icon_128x128@2x.png has changed diff -r d3979a2155a8 -r 92afaa27f40a ImagePrep.iconset/icon_16x16.png Binary file ImagePrep.iconset/icon_16x16.png has changed diff -r d3979a2155a8 -r 92afaa27f40a ImagePrep.iconset/icon_16x16@2x.png Binary file ImagePrep.iconset/icon_16x16@2x.png has changed diff -r d3979a2155a8 -r 92afaa27f40a ImagePrep.iconset/icon_256x256.png Binary file ImagePrep.iconset/icon_256x256.png has changed diff -r d3979a2155a8 -r 92afaa27f40a ImagePrep.iconset/icon_256x256@2x.png Binary file ImagePrep.iconset/icon_256x256@2x.png has changed diff -r d3979a2155a8 -r 92afaa27f40a ImagePrep.iconset/icon_32x32.png Binary file ImagePrep.iconset/icon_32x32.png has changed diff -r d3979a2155a8 -r 92afaa27f40a ImagePrep.iconset/icon_32x32@2x.png Binary file ImagePrep.iconset/icon_32x32@2x.png has changed diff -r d3979a2155a8 -r 92afaa27f40a ImagePrep.iconset/icon_512x512.png Binary file ImagePrep.iconset/icon_512x512.png has changed diff -r d3979a2155a8 -r 92afaa27f40a ImagePrep.iconset/icon_512x512@2x.png Binary file ImagePrep.iconset/icon_512x512@2x.png has changed diff -r d3979a2155a8 -r 92afaa27f40a build.xml --- a/build.xml Mon Nov 23 15:45:04 2020 -0800 +++ b/build.xml Tue Nov 24 16:45:37 2020 -0800 @@ -41,6 +41,7 @@ + @@ -119,4 +120,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r d3979a2155a8 -r 92afaa27f40a package-files/osx/Info.plist --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package-files/osx/Info.plist Tue Nov 24 16:45:37 2020 -0800 @@ -0,0 +1,47 @@ + + + + + + CFBundleDevelopmentRegion + English + CFBundleDisplayName + @app.name@ + CFBundleExecutable + JavaApplicationStub + CFBundleIconFile + @app.name@.icns + CFBundleIdentifier + @app.domain@ + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + @app.name@ + CFBundlePackageType + APPL + CFBundleShortVersionString + @app.version@ + CFBundleVersion + @app.version@ + NSHumanReadableCopyright + @app.copyright@ + + CFBundleAllowMixedLocalizations + false + LSApplicationCategoryType + public.app-category.photography + + JVMMainClassName + @app.entry@ + JVMClassPath + Contents/Java/@lc.app.name@.jar + JVMVersion + @jvm.version@+ + JVMOptions + + -Dapple.awt.textantialiasing=true + -Dapple.laf.useScreenMenuBar=true + -Dapple.awt.antialiasing=true + + + diff -r d3979a2155a8 -r 92afaa27f40a package-files/osx/JavaApplicationStub --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package-files/osx/JavaApplicationStub Tue Nov 24 16:45:37 2020 -0800 @@ -0,0 +1,159 @@ +#!/bin/bash + +# This is based on Tobias Fischer's universalJavaApplicationStub: +# https://github.com/tofi86/universalJavaApplicationStub +# +# Therefore this part of JpegWasher is covered by the same MIT license +# that his code is: +# +# The MIT License (MIT) +# +# Copyright (c) 2014-2020 Tobias Fischer +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +# Establish our application names +appname="@app.name@" +appdom="@app.domain@" + +# Make a place for our logs to go +appsupp="$HOME/Library/Application Support/$appdom" +logfile="$appsupp/launcher.log" + +function die { + osascript -e "tell application \"System Events\" to display dialog \"${1}\" with title \"Fatal Error\" buttons {\" OK \"} default button 1" + exit ${2:-1} +} + +# Initialize files and dirs, bail if we can't. +if [ ! -d "$appsupp" ] +then + if ! mkdir -p "$appsupp" + then + die "Unable to create folder '$appsupp'" 2 + fi +fi +> "$logfile" +if [ $? -ne 0 ] +then + die "Unable to create file '$logfile'" 2 +fi + +function stub_logger { + echo "$(date +%c) - $1" >> "$logfile" +} + +# Was originally just for debugging, but I think this could be useful +# for later troubleshooting "in the wild." +stub_logger "execution begins" +{ + echo "****** BEGIN ARGUMENT AND ENVIRONMENT DUMP *******" + echo "Arguments:" "$0" "$@" + echo "Directory:" $(pwd) + env + echo "******* END ARGUMENT AND ENVIRONMENT DUMP ********" +} >> "$logfile" + +# Change to the application root directory, two up from where this script +# (which should contain an absolute path) is. +mydir="${0%/*}" +cd "$mydir/../.." || die "Unable to cd '$mydir/../..'" + +# Determine where Java is, bail if we can't. +if [ -n "$JAVA_HOME" ] +then + if [ ! -d "$JAVA_HOME" ] + then + die "'$JAVA_HOME' does not exist" + fi +else + export JAVA_HOME="$(/usr/libexec/java_home)" + if [ $? -ne 0 -o ! -d "$JAVA_HOME" ] + then + die "Unable to locate Java." + fi +fi + +java="$JAVA_HOME/bin/java" +if [ ! -x "$java" ] +then + die "'$java' not found or not executable" +fi + +function plist_get { + /usr/libexec/PlistBuddy -c "print $1" Contents/Info.plist 2> /dev/null +} +function must_get { + plist_get "$@" || die "Info.plist key '$1' not found." +} + +# Load some parameters from Contents/Info.plist +estat=0 +CFBundleName=$(must_get ':CFBundleName') +CFBundleIconFile=$(must_get ':CFBundleIconFile') +JVMMainClassName=$(must_get ':JVMMainClassName') +JVMClassPath=$(must_get ':JVMClassPath') +JVMVersion=$(must_get ':JVMVersion') + +# Sanity check our JVM version +if [[ "$JVMVersion" == *+ ]] +then + op='>' + JVMVersion="${JVMVersion%+}" +else + op='=' +fi +version=$("$java" -version 2>&1 | awk '/version/{print $3}' | sed -E -e 's/"//g' -e 's/-ea//g') +if [ ! "$version" "$op" "$JVMVersion" ] +then + die "'$java' too old" +fi + +# Load the JVMOptions array (if found) +JVMOptions=() +let i=0 +while true +do + j="$(plist_get :JVMOptions:$i)" + if [ -z "$j" ] + then + break + fi + JVMOptions+=("$j") + let i+=1 +done + +# Fatal error if we cannot change to HOME or HOME not defined +approot="$(pwd)" +if [ -z "$HOME" ] +then + die "HOME not defined!" +fi +cd "$HOME" || die "Unable to cd '$HOME'" + +# And off we go! +jcmd=( "$JAVA_HOME/bin/java" -cp "$approot/$JVMClassPath" + -Xdock:icon="$approot/Contents/Resources/$CFBundleIconFile" + -Xdock:name="$CFBundleName" "${JVMOptions[@]}" "$JVMMainClassName" ) + +stub_logger "Executing: ${jcmd[*]}" +exec "${jcmd[@]}" + +# This shouldn't happen... +die "Could not launch Java." diff -r d3979a2155a8 -r 92afaa27f40a src/name/blackcap/imageprep/Main.kt --- a/src/name/blackcap/imageprep/Main.kt Mon Nov 23 15:45:04 2020 -0800 +++ b/src/name/blackcap/imageprep/Main.kt Tue Nov 24 16:45:37 2020 -0800 @@ -7,13 +7,6 @@ import java.util.logging.Level import java.util.logging.Logger import javax.swing.UIManager -import name.blackcap.kcli.CommandLine -import name.blackcap.kcli.InvalidArgumentException -import name.blackcap.kcli.Option -import name.blackcap.kcli.PromptingParser -import org.apache.commons.cli.HelpFormatter -import org.apache.commons.cli.Options -import org.apache.commons.cli.ParseException object Application { /* name we call ourselves */ diff -r d3979a2155a8 -r 92afaa27f40a src/name/blackcap/imageprep/Menus.kt --- a/src/name/blackcap/imageprep/Menus.kt Mon Nov 23 15:45:04 2020 -0800 +++ b/src/name/blackcap/imageprep/Menus.kt Tue Nov 24 16:45:37 2020 -0800 @@ -89,7 +89,7 @@ val acc = JPanel().apply { layout = BoxLayout(this, BoxLayout.Y_AXIS) add(Box.createGlue()) - add(JLabel("Max. dimension:").apply { alignmentX = LEFT_ALIGNMENT }) + add(JLabel("Max. dim.:").apply { alignmentX = LEFT_ALIGNMENT }) add(maxDim) } val chooser = JFileChooser().apply {