changeset 50:fb407182ba76

Add help menu item, UNTESTED.
author David Barts <davidb@stashtea.com>
date Thu, 07 May 2020 08:29:58 -0700
parents 35fb8de77c7d
children d4ccc5ccdc6d
files Building.html build.xml src/name/blackcap/exifwasher/HelpDialog.kt src/name/blackcap/exifwasher/Main.kt src/name/blackcap/exifwasher/Menus.kt src/name/blackcap/exifwasher/help.html
diffstat 6 files changed, 109 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/Building.html	Mon May 04 18:12:59 2020 -0700
+++ b/Building.html	Thu May 07 08:29:58 2020 -0700
@@ -53,8 +53,7 @@
       net win, as it is portable, and would spell the death of the only bit of
       OS-dependent Kotlin code in this application.</p>
     <p>In another year or two, I will probably make OpenJDK 11 or greater the
-      preferred version. It’s a little too early to do that right now, however,
-      as not many systems have Java 11 present.</p>
+      preferred version.</p>
     <h2>Build Procedure</h2>
     <h3>Install Prerequisites</h3>
     <p>See the “Prerequisites” section above for the details of what you will
@@ -80,7 +79,7 @@
       tools in its PATH).</p>
     <h3>Compile Kotlin Source and Bundle an App</h3>
     <p>Just type <code>ant macapp</code>, <code>ant winapp</code>, or <code>ant
-      deb</code> depending on whether you are building on a Mac, Windows, or
+        deb</code> depending on whether you are building on a Mac, Windows, or
       Debian Linux (note that Ubuntu is a Debian variant).</p>
     <h3>That’s It!</h3>
     <p>If all went well, a system-specific bundle should be found in the <code>dist</code>
--- a/build.xml	Mon May 04 18:12:59 2020 -0700
+++ b/build.xml	Thu May 07 08:29:58 2020 -0700
@@ -78,7 +78,7 @@
 
   <!-- Define the properties used by the build -->
   <property name="app.name"      value="${ant.project.name}"/>
-  <property name="app.version"   value="1.03"/>
+  <property name="app.version"   value="1.04"/>
   <property name="app.domain"    value="name.blackcap.exifwasher"/>
   <property name="app.entry"     value="${app.domain}.MainKt"/>
   <property name="app.copyright" value="Copyright © 2020, David W. Barts."/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/name/blackcap/exifwasher/HelpDialog.kt	Thu May 07 08:29:58 2020 -0700
@@ -0,0 +1,62 @@
+/*
+ * The dialog that displays the Exif data in a single file (display only,
+ * no changing). We do this after washing.
+ */
+package name.blackcap.exifwasher
+
+import java.awt.Color
+import java.awt.Dimension
+import java.awt.event.ActionEvent
+import java.awt.event.ActionListener
+import java.io.File
+import java.io.IOException
+import java.io.BufferedReader
+import java.io.InputStream
+import java.io.InputStreamReader
+import java.util.logging.Level
+import java.util.logging.Logger
+import javax.swing.*
+import javax.swing.table.DefaultTableModel
+import javax.swing.table.TableColumn
+import javax.swing.table.TableColumnModel
+
+import name.blackcap.exifwasher.exiv2.*
+
+class HelpDialog : JDialog(Application.mainFrame) {
+    private val BW = 9
+    private val BW2 = BW * 2
+    private val WIDTH = 640
+    private val HEIGHT = 480
+
+    private val dismissButton = JButton("Dismiss").also {
+        it.addActionListener(ActionListener { setVisible(false) })
+    }
+
+    private val helpPane = JTextPane().also {
+        it.contentType = "text/html";
+        it.text = ::class.java.getResourceAsStream("help.html").bufferedReader().use { it.readText() }
+    }
+
+    init {
+        setVisible(false)
+        title = "Help"
+        contentPane.apply {
+            layout = BoxLayout(this, BoxLayout.Y_AXIS)
+            add(JScrollPane(helpPane).apply {
+                alignmentX = JScrollPane.CENTER_ALIGNMENT
+                border = BorderFactory.createEmptyBorder(BW2, BW2, BW, BW2)
+                verticalScrollBarPolicy = ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS
+                horizontalScrollBarPolicy = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER
+                preferredSize = Dimension(WIDTH, HEIGHT)
+                background = Application.mainFrame.background
+            })
+            add(Box(BoxLayout.X_AXIS).apply {
+                alignmentX = Box.CENTER_ALIGNMENT
+                border = BorderFactory.createEmptyBorder(BW, BW2, BW2, BW2)
+                add(Box.createHorizontalGlue())
+                add(dismissButton)
+            })
+        }
+        pack()
+    }
+}
--- a/src/name/blackcap/exifwasher/Main.kt	Mon May 04 18:12:59 2020 -0700
+++ b/src/name/blackcap/exifwasher/Main.kt	Thu May 07 08:29:58 2020 -0700
@@ -14,6 +14,7 @@
     /* global UI objects */
     var mainFrame: MainFrame by setOnce()
     var settingsDialog: SettingsDialog by setOnce()
+    var helpDialog: HelpDialog by setOnce()
 
     fun initialize() {
         UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
@@ -21,6 +22,7 @@
         mainFrame.jMenuBar = MyMenuBar()
         setMacMenus() /* always safe to call; no-op if not a Mac */
         settingsDialog = SettingsDialog()
+        helpDialog = HelpDialog()
         mainFrame.setVisible(true)
     }
 }
--- a/src/name/blackcap/exifwasher/Menus.kt	Mon May 04 18:12:59 2020 -0700
+++ b/src/name/blackcap/exifwasher/Menus.kt	Thu May 07 08:29:58 2020 -0700
@@ -37,11 +37,14 @@
                 })
             }
         })
-        if (OS.type != OS.MAC) {
-            add(JMenu("Help").apply {
+        add(JMenu("Help").apply {
+            if (OS.type != OS.MAC) {
                 add(JMenuItem("About ${Application.MYNAME}…").apply {
                     addActionListener(ActionListener { showAboutDialog() })
                 })
+            }
+            add(JMenuItem("${Application.MYNAME} Help…").apply {
+                addActionListener(ActionListener { Application.helpDialog.setVisible(true) })
             })
         }
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/name/blackcap/exifwasher/help.html	Thu May 07 08:29:58 2020 -0700
@@ -0,0 +1,37 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+  <head>
+    <meta http-equiv="content-type" content="text/html; charset=utf-8">
+    <title>JpegWasher Help</title>
+  </head>
+  <body>
+    <h1>JpegWasher Help</h1>
+    <h2>Using This Program</h2>
+    <p>To remove sensitive metadata from your digital photos, just drag the JPEG
+      file(s) containing them onto the main window of this application, or
+      choose <em>File… Wash</em> from the menu bar.</p>
+    <p>A dialog will pop up displaying the metadata in the file, with check
+      boxes in the leftmost column marking the data to be deleted. If you
+      disagree with JpegWasher’s choices, check or uncheck boxes until you are
+      satisfied, then click on the Wash button below. The file will then be
+      washed, and a new dialog will pop up displaying any remaining metadata in
+      the washed file.</p>
+    <p>The newly-washed file will have the same name as the original one, with
+      “_washed” appended to it; e.g. washing <code>cat.jpg</code> will result
+      in <code>cat_washed.jpg</code>. (Whether or not the cat enjoys being
+      washed is an entirely different matter.)</p>
+    <h2>Configuring JpegWasher</h2>
+    <p>This is a configurable program, whose operation may be adjusted by the
+      preferences dialog (accessed under the <em>JpegWasher</em> menu on the
+      Mac and the <em>File</em> menu on Linux and Windows).</p>
+    <p>The whitelist that determines which metadata keys will <em>not</em> be
+      deleted can be changed, via the <em>Whitelist</em> pane of the
+      preferences dialog. Note that there are two kinds of whitelist entries:
+      ones that match entire keys, and ones that match the prefixes of keys (the
+      latter entries end with an asterisk “*”). Whitelist entries are case
+      sensitive; “exif.image.white*” will not match “Exif.Image.WhitePoint.”</p>
+    <p>It is also possible to set the folder where output files are created, via
+      the <em>Folders</em> pane (by default, this is the same folder the input
+      file was in).</p>
+  </body>
+</html>