summaryrefslogtreecommitdiff
path: root/obsolete/support/png2pdf/Java
diff options
context:
space:
mode:
Diffstat (limited to 'obsolete/support/png2pdf/Java')
-rw-r--r--obsolete/support/png2pdf/Java/Png2PdfGUI/Makefile.in13
-rwxr-xr-xobsolete/support/png2pdf/Java/Png2PdfGUI/bin/create-jar7
-rwxr-xr-xobsolete/support/png2pdf/Java/Png2PdfGUI/bin/manifest.in2
-rw-r--r--obsolete/support/png2pdf/Java/Png2PdfGUI/src/ChooseDirectory.pngbin310 -> 0 bytes
-rw-r--r--obsolete/support/png2pdf/Java/Png2PdfGUI/src/Exit.pngbin364 -> 0 bytes
-rw-r--r--obsolete/support/png2pdf/Java/Png2PdfGUI/src/Options.pngbin420 -> 0 bytes
-rw-r--r--obsolete/support/png2pdf/Java/Png2PdfGUI/src/Png2PdfController.java627
-rw-r--r--obsolete/support/png2pdf/Java/Png2PdfGUI/src/Png2PdfDialog.java550
-rw-r--r--obsolete/support/png2pdf/Java/Png2PdfGUI/src/Png2PdfFileFilter.java21
-rw-r--r--obsolete/support/png2pdf/Java/Png2PdfGUI/src/Png2PdfGUI.java42
-rw-r--r--obsolete/support/png2pdf/Java/Png2PdfGUI/src/Png2PdfWindow.java1155
-rw-r--r--obsolete/support/png2pdf/Java/Png2PdfGUI/src/Run.pngbin419 -> 0 bytes
-rwxr-xr-xobsolete/support/png2pdf/Java/Png2PdfGUI/src/compile-archive17
-rwxr-xr-xobsolete/support/png2pdf/Java/Png2PdfGUI/src/compile-archive.in16
-rw-r--r--obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg01.pngbin6689 -> 0 bytes
-rw-r--r--obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg02.pngbin7220 -> 0 bytes
-rw-r--r--obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg03.pngbin7590 -> 0 bytes
-rw-r--r--obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg04.pngbin30819 -> 0 bytes
-rw-r--r--obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg05.pngbin6938 -> 0 bytes
-rw-r--r--obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg06.pngbin7490 -> 0 bytes
-rw-r--r--obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg07.pngbin7819 -> 0 bytes
-rw-r--r--obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg08.pngbin15959 -> 0 bytes
-rw-r--r--obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg09.pngbin7457 -> 0 bytes
-rw-r--r--obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg10.pngbin7749 -> 0 bytes
-rw-r--r--obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg11.pngbin7536 -> 0 bytes
-rw-r--r--obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg12.pngbin7440 -> 0 bytes
-rw-r--r--obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg13.pngbin7554 -> 0 bytes
-rw-r--r--obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg14.pngbin22676 -> 0 bytes
-rw-r--r--obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppgui.html212
-rw-r--r--obsolete/support/png2pdf/Java/Png2PdfGUI/src/style.css241
30 files changed, 0 insertions, 2903 deletions
diff --git a/obsolete/support/png2pdf/Java/Png2PdfGUI/Makefile.in b/obsolete/support/png2pdf/Java/Png2PdfGUI/Makefile.in
deleted file mode 100644
index 4da8e0f2a8..0000000000
--- a/obsolete/support/png2pdf/Java/Png2PdfGUI/Makefile.in
+++ /dev/null
@@ -1,13 +0,0 @@
-
-abs_top_srcdir=@abs_top_srcdir@
-
-all:
- cd ./src && ./compile-archive $(abs_top_srcdir)
- cd ./bin && ./create-jar $(abs_top_srcdir)
-
-install: all
- -cp png2pdf.jar $(abs_top_srcdir)/png2pdf.jar
-
-clean:
- -(cd ./bin && rm -fr *.class)
- -rm *.jar
diff --git a/obsolete/support/png2pdf/Java/Png2PdfGUI/bin/create-jar b/obsolete/support/png2pdf/Java/Png2PdfGUI/bin/create-jar
deleted file mode 100755
index 4e6363f81c..0000000000
--- a/obsolete/support/png2pdf/Java/Png2PdfGUI/bin/create-jar
+++ /dev/null
@@ -1,7 +0,0 @@
-#! /bin/bash
-
-cd ./bin
-[ ! -f ../png2pdf.jar ] || rm ../png2pdf.jar
-echo Create jar file
-jar cvfm ../png2pdf.jar manifest.in *.class *.html *.css *.png
-
diff --git a/obsolete/support/png2pdf/Java/Png2PdfGUI/bin/manifest.in b/obsolete/support/png2pdf/Java/Png2PdfGUI/bin/manifest.in
deleted file mode 100755
index 4946b2bca9..0000000000
--- a/obsolete/support/png2pdf/Java/Png2PdfGUI/bin/manifest.in
+++ /dev/null
@@ -1,2 +0,0 @@
-Main-Class: Png2PdfGUI
-
diff --git a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ChooseDirectory.png b/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ChooseDirectory.png
deleted file mode 100644
index 5e4807c888..0000000000
--- a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ChooseDirectory.png
+++ /dev/null
Binary files differ
diff --git a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/Exit.png b/obsolete/support/png2pdf/Java/Png2PdfGUI/src/Exit.png
deleted file mode 100644
index 263cf525c2..0000000000
--- a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/Exit.png
+++ /dev/null
Binary files differ
diff --git a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/Options.png b/obsolete/support/png2pdf/Java/Png2PdfGUI/src/Options.png
deleted file mode 100644
index ab1a5082b2..0000000000
--- a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/Options.png
+++ /dev/null
Binary files differ
diff --git a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/Png2PdfController.java b/obsolete/support/png2pdf/Java/Png2PdfGUI/src/Png2PdfController.java
deleted file mode 100644
index 8312f24181..0000000000
--- a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/Png2PdfController.java
+++ /dev/null
@@ -1,627 +0,0 @@
-
-import java.awt.Color;
-import java.util.Properties;
-import java.util.Iterator;
-import java.util.StringTokenizer;
-import java.util.NoSuchElementException;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.File;
-
-
-import dirk_krause.jtools.LogContentsForCommand;
-import dirk_krause.jtools.StatusChanger;
-import dirk_krause.jtools.PropertyTool;
-import dirk_krause.jtools.StringTool;
-import dirk_krause.jtools.StatusChanger;
-
-public class Png2PdfController
-{
- /**
- * The application name (Png2PdfGUI), as found in the
- * constructor.
- */
- protected String appName = null;
-
- /**
- * PDF format version to produce.
- */
- protected int pdfVersion = PDF_VERSION_14;
-
- /**
- * Run in make mode
- */
- protected boolean makeMode = true;
-
- /**
- * Either set interpolation bit or not
- */
- protected boolean interpolate = true;
-
- /**
- * Alpha channel by default expresses opacity.
- * This flag can be used to change this to transparency.
- */
- protected boolean alphaTrans = false;
-
- /**
- * Mix alpha channel against a background color.
- */
- protected boolean mix = false;
-
- /**
- * The color to mix against.
- */
- protected Color mixColor = null;
-
- /**
- * Prefer specified color over background chunk contents.
- */
- protected boolean preferMyColor = true;
-
- /**
- * Create image mask or not.
- */
- protected boolean mask = false;
-
- /**
- * Use inverted mask levels or normal levels.
- */
- protected boolean maskInverted = false;
-
- /**
- * Write alpha channel to output.
- */
- protected boolean alpha = true;
-
- /**
- * Show file names while processing.
- */
- protected boolean showFilenames = false;
-
- /**
- * Status changer to show file names
- */
- protected StatusChanger sc = null;
-
- protected synchronized void internalSetPdfVersion(int i) { pdfVersion = i; }
-
- public void setPdfVersion(int i)
- {
- int v = i;
- if(v < PDF_VERSION_12) v = PDF_VERSION_12;
- if(v > PDF_VERSION_14) v = PDF_VERSION_14;
- internalSetPdfVersion(v);
- }
-
- public synchronized int getPdfVersion() { return pdfVersion; }
-
- public synchronized boolean getMakeMode() { return makeMode; }
-
- public synchronized void setMakeMode(boolean b) { makeMode = b; }
-
- public synchronized boolean getInterpolate() { return interpolate; }
-
- public synchronized void setInterpolate(boolean b) { interpolate = b; }
-
- public synchronized boolean getAlphaTrans() { return alphaTrans; }
-
- public synchronized void setAlphaTrans(boolean b) { alphaTrans = b; }
-
- public synchronized boolean getMix() { return mix; }
-
- public synchronized void setMix(boolean b) { mix = b; }
-
- public synchronized Color internalGetMixColor() { return mixColor; }
-
- public Color getMixColor()
- {
- Color back = mixColor;
- if(back == null) {
- back = new Color(255,255,255);
- } else {
- back = new Color(back.getRed(), back.getGreen(), back.getBlue());
- }
- return back;
- }
-
- public void internalSetMixColor(Color c) { mixColor = c; }
-
- public synchronized void setMixColor(Color c)
- {
- Color x;
- if(c != null) {
- x = new Color(c.getRed(), c.getGreen(), c.getBlue());
- } else {
- x = new Color(255,255,255);
- }
- internalSetMixColor(x);
- }
-
- public synchronized boolean getPreferMyColor() { return preferMyColor; }
-
- public synchronized void setPreferMyColor(boolean b) { preferMyColor = b; }
-
- public synchronized boolean getMask() { return mask; }
-
- public synchronized void setMask(boolean b) { mask = b; }
-
- public synchronized boolean getMaskInverted() { return maskInverted; }
-
- public synchronized void setMaskInverted(boolean b) { maskInverted = b; }
-
- public synchronized boolean getAlpha() { return alpha; }
-
- public synchronized void setAlpha(boolean b) { alpha = b; }
-
- public synchronized boolean getShowFilenames() { return showFilenames; }
-
- public synchronized void setShowFilenames(boolean b) { showFilenames = b; }
-
- public synchronized StatusChanger getStatusChanger() { return sc; }
-
- public synchronized void setStatusChanger(StatusChanger s) { sc = s; }
-
- public static final String[] pk = {
- "directory",
- ".",
- "png2pdf GUI settings",
- "show-filenames",
- };
-
- public static final int PDF_VERSION_12 = 0;
- public static final int PDF_VERSION_13 = 1;
- public static final int PDF_VERSION_14 = 2;
-
- public static final String[] allArgs = {
- /* 0 */ "png2pdf",
- /* 1 */ "--/ui/lang=en",
- /* 2 */ "--/ui/lang/env=no",
- /* 3 */ "--/log/stdout/level=warning",
- /* 4 */ "--/log/stderr/level=none",
- /* 5 */ "--/log/file/level=none",
- /* 6 */ "--/log/file/name=png2pdf-gui.log",
- /* 7 */ "-C",
- /* 8 */ "-r",
- /* 9 */ "-c",
- /* 10 */ "-p",
- /* 11 */ "1.2",
- /* 12 */ "1.3",
- /* 13 */ "1.4",
- /* 14 */ "-m",
- /* 15 */ "-m-",
- /* 16 */ "-s",
- /* 17 */ "-s-",
- /* 18 */ "-i",
- /* 19 */ "-i-",
- /* 20 */ "-a",
- /* 21 */ "-a-",
- /* 22 */ "-l",
- /* 23 */ "-l-",
- /* 24 */ "-t",
- /* 25 */ "-t-",
- /* 26 */ "-b",
- /* 27 */ "-b-",
- /* 28 */ "-n",
- /* 29 */ "-n-",
- /* 30 */ "-f",
- /* 31 */ "-f-",
- /* 32 */ ",",
- /* 33 */ ".",
- /* 34 */ ".pdf",
- /* 35 */ "Processing file: ",
- };
-
- public static final String[] options = {
- "-p", // 0
- "-m", // 1
- "-s", // 2
- "-i", // 3
- "-a", // 4
- "-l", // 5
- "-t", // 6
- "-b", // 7
- "-n", // 8
- "-f", // 9
- };
-
- public static final String[] versions = {
- "1.2", "1.3", "1.4"
- };
-
- protected String workingDirectory = "." ;
-
- protected synchronized void internalSetCwd(String s) { workingDirectory = s; }
- protected synchronized String internalGetCwd() { return workingDirectory; }
- public void setCwd(String newcwd)
- {
- internalSetCwd(new String(newcwd));
- }
- public String getCwd()
- {
- String back = new String(internalGetCwd());
- return back;
- }
-
- public Png2PdfController(String an)
- {
- appName = an;
- initialize();
- }
-
- public Png2PdfController()
- {
- this(Png2PdfGUI.appName);
- }
-
- protected void addProgramOptions(LogContentsForCommand l)
- {
- int pv = getPdfVersion();
- boolean al = getAlpha();
- boolean ma = getMask();
- boolean mi = getMaskInverted();
- boolean mx = getMix();
- Color co = getMixColor();
- boolean pc = getPreferMyColor();
- boolean in = getInterpolate();
- boolean mm = getMakeMode();
- boolean tr = getAlphaTrans();
- if(pv < PDF_VERSION_12) pv = PDF_VERSION_12;
- if(pv > PDF_VERSION_14) pv = PDF_VERSION_14;
- if(pv < PDF_VERSION_14) {
- al = false;
- }
- if(al) {
- mx = false;
- ma = false;
- }
- if(pv < PDF_VERSION_13) {
- ma = false;
- }
- l.addArgv(allArgs[10]);
- l.addArgv(allArgs[11+pv]);
- if(al) {
- l.addArgv(allArgs[20]);
- } else {
- l.addArgv(allArgs[21]);
- if(mx) {
- l.addArgv(allArgs[14]);
- StringBuilder sb = new StringBuilder();
- sb.append(Integer.toString(co.getRed()));
- sb.append(allArgs[32]);
- sb.append(Integer.toString(co.getGreen()));
- sb.append(allArgs[32]);
- sb.append(Integer.toString(co.getBlue()));
- l.addArgv(new String(sb));
- if(pc) {
- l.addArgv(allArgs[16]);
- } else {
- l.addArgv(allArgs[17]);
- }
- } else {
- l.addArgv(allArgs[15]);
- }
- if(ma) {
- l.addArgv(allArgs[18]);
- if(mi) {
- l.addArgv(allArgs[22]);
- } else {
- l.addArgv(allArgs[23]);
- }
- } else {
- l.addArgv(allArgs[19]);
- }
- }
- if(al || mx || ma) {
- if(tr) {
- l.addArgv(allArgs[24]);
- } else {
- l.addArgv(allArgs[25]);
- }
- }
- if(pv >= PDF_VERSION_13) {
- if(in) {
- l.addArgv(allArgs[28]);
- } else {
- l.addArgv(allArgs[29]);
- }
- }
- }
-
- public LogContentsForCommand restoreOptions()
- {
- int i;
- int pv = PDF_VERSION_14;
- boolean al = true;
- boolean ma = false;
- boolean mi = false;
- boolean mx = false;
- Color co = null;
- boolean pc = false;
- boolean in = true;
- boolean mm = true;
- boolean tr = true;
- LogContentsForCommand back = new LogContentsForCommand();
- for(i = 0; i <= 7; i++) {
- back.addArgv(allArgs[i]);
- }
- back.run();
- if(back.getSuccess()) {
- Iterator<String> it = back.getIterator();
- int state = 0;
- while(it.hasNext()) {
- String s = it.next();
- String t = s.trim();
- switch(state) {
- case 0: {
- if(t.startsWith(LogContentsForCommand.msgTexts[1])) {
- state = 1;
- }
- } break;
- case 1: {
- if(t.startsWith(LogContentsForCommand.msgTexts[2])) {
- state = 2;
- } else { // process line
- StringTokenizer st = new StringTokenizer(t);
- if(st.hasMoreTokens()) {
- try {
- String k = st.nextToken();
- if(st.hasMoreTokens()) {
- String v = st.nextToken();
- boolean b = StringTool.getBoolean(v, false);
- switch(StringTool.getArrayIndex(options, k)) {
- case 0: { // -p
- pv = StringTool.getArrayIndex(versions, v);
- } break;
- case 1: { // -m
- StringTokenizer st2 = new StringTokenizer(v, " \t,");
- try {
- if(st2.hasMoreTokens()) {
- String sr = st2.nextToken();
- if(st2.hasMoreTokens()) {
- String sg = st2.nextToken();
- if(st2.hasMoreTokens()) {
- String sb = st2.nextToken();
- try {
- int r = Integer.parseInt(sr);
- int g = Integer.parseInt(sg);
- int blue = Integer.parseInt(sb);
- co = new Color(r,g,blue);
- }
- catch(NumberFormatException e) {}
- }
- }
- }
- }
- catch(NoSuchElementException e) {}
- } break;
- case 2: { // -s
- pc = b;
- } break;
- case 3: { // -i
- ma = b;
- } break;
- case 4: { // -a
- al = b;
- } break;
- case 5: { // -l
- mi = b;
- } break;
- case 6: { // -t
- tr = b;
- } break;
- case 7: { // -b
- // nichts tun, ignorieren
- } break;
- case 8: { // -n
- in = b;
- } break;
- case 9: { // -f
- mm = b;
- } break;
- }
- }
- }
- catch(NoSuchElementException e) {}
- }
- }
- } break;
- }
- }
- }
- if(pv < PDF_VERSION_12) pv = PDF_VERSION_12;
- if(pv > PDF_VERSION_14) pv = PDF_VERSION_14;
- if(pv < PDF_VERSION_14) {
- al = false;
- }
- if(pv < PDF_VERSION_13) {
- in = false;
- }
- if(al) {
- mx = false; ma = false;
- }
- if(!ma) {
- mi = false;
- }
- if(!mx) {
- pc = false;
- }
- setPdfVersion(pv);
- setAlpha(al);
- setAlphaTrans(tr);
- setInterpolate(in);
- setMakeMode(mm);
- setMask(ma);
- setMaskInverted(mi);
- setMix(mx);
- setPreferMyColor(pc);
- setMixColor(co);
- return back;
- }
-
- public LogContentsForCommand saveOptions()
- {
- LogContentsForCommand back = new LogContentsForCommand();
- int i = 0;
- back.addArgv(allArgs[0]);
- for(i = 3; i <= 6 ; i++) {
- back.addArgv(allArgs[i]);
- }
- for(i = 8; i <= 9; i++) {
- back.addArgv(allArgs[i]);
- }
- addProgramOptions(back);
- if(getMakeMode()) {
- back.addArgv(allArgs[30]);
- } else {
- back.addArgv(allArgs[31]);
- }
- back.run();
-
- return back;
- }
-
- protected boolean mustConvert(String sname, String dname)
- {
- boolean back = true;
- File sfile = new File(sname);
- File dfile = new File(dname);
- if(dfile.exists()) {
- if(dfile.isFile()) {
- if(dfile.lastModified() > sfile.lastModified()) {
- back = false;
- }
- }
- }
- return back;
- }
-
- protected String changeSuffix(String fn)
- {
- String back = fn;
- StringBuilder sb;
- int ind = fn.lastIndexOf(allArgs[33]);
- if(ind > -1) {
- sb = new StringBuilder(fn.substring(0, ind));
- } else {
- sb = new StringBuilder(fn);
- }
- sb.append(allArgs[34]);
- back = new String(sb);
- return back;
- }
-
- protected void runShowingFilenames(LogContentsForCommand l)
- {
- boolean mm = getMakeMode();
- Png2PdfFileFilter ff = new Png2PdfFileFilter();
- File d = new File(getCwd());
- StatusChanger s = getStatusChanger();
- if(d.isDirectory()) {
- File[] inputNames = d.listFiles(ff);
- for(int k = 0; k < inputNames.length; k++) {
- String sname = inputNames[k].getAbsolutePath();
- String dname = changeSuffix(sname);
- boolean mustRun = true;
- if(mm) {
- mustRun = this.mustConvert(sname, dname);
- }
- if(mustRun) {
- if(s != null) {
- StringBuilder sb = new StringBuilder();
- sb.append(allArgs[35]);
- sb.append(inputNames[k].getName());
- s.setStatus(new String(sb));
- }
- l.newCommand();
- l.addArgv(allArgs[0]);
- for(int i = 3; i <= 6 ; i++) {
- l.addArgv(allArgs[i]);
- }
- addProgramOptions(l);
- if(getMakeMode()) {
- l.addArgv(allArgs[30]);
- } else {
- l.addArgv(allArgs[31]);
- }
- l.addArgv(sname);
- l.addArgv(dname);
- l.run();
- }
- }
- } else {
- // ERROR No directory
- }
- ff = null;
- }
-
- public LogContentsForCommand runTheProgram()
- {
- int i;
- LogContentsForCommand back = new LogContentsForCommand();
- if(getShowFilenames()) {
- runShowingFilenames(back);
- } else {
- back.addArgv(allArgs[0]);
- for(i = 3; i <= 6 ; i++) {
- back.addArgv(allArgs[i]);
- }
- addProgramOptions(back);
- if(getMakeMode()) {
- back.addArgv(allArgs[30]);
- } else {
- back.addArgv(allArgs[31]);
- }
- back.addArgv(this.getCwd());
- back.run();
- }
- return back;
- }
-
- /**
- * Write current working directory to preferences
- * after the directory was changed.
- *
- */
- public void writeCwd()
- {
- try {
- Properties p = new Properties();
- p.setProperty(pk[0], getCwd());
- p.setProperty(
- pk[3],
- ((showFilenames)
- ? (StringTool.theBooleanStrings[3])
- : (StringTool.theBooleanStrings[8]))
- );
- PropertyTool.writePropertiesForApp(Png2PdfGUI.appName, p, pk[2]);
- }
- catch(FileNotFoundException e) {
- }
- catch(IOException e) {
- }
- catch(SecurityException e) {
- }
- }
-
- /**
- * Initialize object, read working directory from
- * preferences.
- *
- */
- public void initialize()
- {
- try {
- Properties p = PropertyTool.readPropertiesForApp(Png2PdfGUI.appName);
- String newcwd = p.getProperty(pk[0], pk[1]);
- setCwd(newcwd);
- String s = p.getProperty(pk[3], StringTool.theBooleanStrings[8]);
- showFilenames = StringTool.getBoolean(s, false);
- }
- catch(FileNotFoundException e) {}
- catch(IOException e) {}
- catch(SecurityException e) {}
- }
-
-
-}
diff --git a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/Png2PdfDialog.java b/obsolete/support/png2pdf/Java/Png2PdfGUI/src/Png2PdfDialog.java
deleted file mode 100644
index 6faaee8d47..0000000000
--- a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/Png2PdfDialog.java
+++ /dev/null
@@ -1,550 +0,0 @@
-
-import java.awt.event.ActionListener;
-import java.awt.event.ActionEvent;
-import java.awt.event.ItemEvent;
-import java.awt.event.WindowListener;
-import java.awt.event.WindowEvent;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.awt.Container;
-import java.awt.Component;
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.GridBagLayout;
-import java.awt.GridBagConstraints;
-
-import javax.swing.Box;
-import javax.swing.BoxLayout;
-import javax.swing.JButton;
-import javax.swing.JFrame;
-import javax.swing.JPanel;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.BorderFactory;
-import javax.swing.JCheckBox;
-import javax.swing.JColorChooser;
-
-import dirk_krause.jtools.ComponentSizer;
-import dirk_krause.jtools.GuiController;
-import dirk_krause.jtools.SelfPositioningDialog;
-import dirk_krause.jtools.GbcMaker;
-import dirk_krause.jtools.StringTool;
-import dirk_krause.jtools.ColorShowArea;
-
-public class Png2PdfDialog extends SelfPositioningDialog
- implements ActionListener, WindowListener, ItemListener
-{
- protected int b = 5;
- protected Png2PdfController ppc = null;
- protected ActionListener a = null;
- protected ActionListener ccal = null;
- protected ItemListener mixl = null;
- protected ItemListener masl = null;
- protected ItemListener alpl = null;
- protected JButton bOK = null;
- protected JButton bCancel = null;
- protected JComboBox cbPdfVersion = null;
- protected JCheckBox cbMakeMode = null;
- protected JCheckBox cbInterpolation = null;
- protected JCheckBox cbMix = null;
- protected ColorShowArea csa = null;
- protected JCheckBox cbPrefer = null;
- protected JCheckBox cbMask = null;
- protected JCheckBox cbInverted = null;
- protected JCheckBox cbAlpha = null;
- protected JCheckBox cbTransparency = null;
- protected JButton bDefaults = null;
- protected JCheckBox cbShowFilenames = null;
-
- protected boolean isCorrecting = false;
-
- protected synchronized boolean startCorrection()
- {
- boolean back = false;
- if(!isCorrecting) {
- isCorrecting = true; back = true;
- }
- return back;
- }
-
- protected synchronized void finishCorrection()
- {
- isCorrecting = false;
- }
-
- class ColorChangerActionListener implements ActionListener
- {
- Component parent;
- public void actionPerformed(ActionEvent e)
- {
- Color newColor = JColorChooser.showDialog(
- parent, theTexts[15], csa.getColor()
- );
- if(newColor != null) {
- csa.setColor(newColor);
- }
- }
- public ColorChangerActionListener(Component jp)
- {
- parent = jp;
- }
- }
-
- class MixListener implements ItemListener
- {
- public void itemStateChanged(ItemEvent e)
- {
- if(startCorrection()) {
- if(cbMix.isSelected()) {
- if(cbAlpha.isSelected()) {
- cbAlpha.setSelected(false);
- cbMask.setSelected(true);
- }
- }
- finishCorrection();
- }
- }
- }
-
- class MaskListener implements ItemListener
- {
- public void itemStateChanged(ItemEvent e)
- {
- if(startCorrection()) {
- if(cbMask.isSelected()) {
- if(cbAlpha.isSelected()) {
- cbAlpha.setSelected(false);
- cbMix.setSelected(true);
- }
- }
- finishCorrection();
- }
- }
- }
-
- class AlphaListener implements ItemListener
- {
- public void itemStateChanged(ItemEvent e)
- {
- if(startCorrection()) {
- if(cbAlpha.isSelected()) {
- if(cbMix.isSelected()) {
- cbMix.setSelected(false);
- }
- if(cbMask.isSelected()) {
- cbMask.setSelected(false);
- }
- }
- finishCorrection();
- }
- }
- }
-
- public static final String[] theTexts = {
- /* 0 */ "Png2pdf Options",
- /* 1 */ "General options",
- /* 2 */ "Image interpolation",
- /* 3 */ "Alpha channel handling",
- /* 4 */ "PDF format version: ",
- /* 5 */ "Run in \"make\" mode (check modification timestamps)",
- /* 6 */ "Set interpolation flag",
- /* 7 */ "Mix against a background color",
- /* 8 */ "Choose default background color: ",
- /* 9 */ " ",
- /* 10 */ "Prefer specified default color over background color chunk",
- /* 11 */ "Create image mask",
- /* 12 */ "Use inverted mask levels",
- /* 13 */ "Write alpha channel to output",
- /* 14 */ "Input alpha channel expresses transparency",
- /* 15 */ "Choose default background color",
- /* 16 */ "Show file names while processing"
- };
- public static final String[] buttonTexts = {
- /* 0 */ "OK",
- /* 1 */ "Cancel",
- /* 2 */ "Defaults",
- };
- public static final String[] pdfVersions = {
- "1.2", "1.3", "1.4"
- };
-
- public Png2PdfDialog(JFrame p, GuiController gc, Png2PdfController pc, ActionListener al)
- {
- super(p);
- b = gc.getBorder();
- ppc = pc;
- a = al;
- setTitle(theTexts[0]);
- Container cp = getContentPane();
- GridBagLayout gbl = new GridBagLayout();
- cp.setLayout(gbl);
- GridBagConstraints gbc = null;
- JPanel jp = null;
- GbcMaker gbcm = new GbcMaker(4,1,b);
- // general options panel
- jp = new JPanel();
- setGeneralOptionsPanel(jp);
- gbc = gbcm.create(0,0,1,1);
- gbc.fill = GridBagConstraints.HORIZONTAL;
- gbl.setConstraints(jp, gbc);
- cp.add(jp);
- // interpolation panel
- jp = new JPanel();
- setInterpolationPanel(jp);
- gbc = gbcm.create(1,0,1,1);
- gbc.fill = GridBagConstraints.HORIZONTAL;
- gbl.setConstraints(jp, gbc);
- cp.add(jp);
- // alpha panel
- jp = new JPanel();
- setAlphaPanel(jp);
- gbc = gbcm.create(2,0,1,1);
- gbc.fill = GridBagConstraints.HORIZONTAL;
- gbl.setConstraints(jp, gbc);
- cp.add(jp);
- // button panel
- jp = new JPanel();
- setButtonPanel(jp);
- gbc = gbcm.create(3,0,1,1);
- gbl.setConstraints(jp, gbc);
- cp.add(jp);
- // and finish setup
- csa.setToolTipText(theTexts[15]);
- pack();
- addWindowListener(this);
- ccal = new ColorChangerActionListener(this);
- csa.addActionListener(ccal);
- mixl = new MixListener();
- cbMix.addItemListener(mixl);
- masl = new MaskListener();
- cbMask.addItemListener(masl);
- alpl = new AlphaListener();
- cbAlpha.addItemListener(alpl);
- cbPdfVersion.addItemListener(this);
- controller_to_dialog();
- }
-
- protected void setAlphaPanel(JPanel jp)
- {
- jp.setBorder(BorderFactory.createTitledBorder(theTexts[3]));
- GridBagLayout gbl = new GridBagLayout();
- jp.setLayout(gbl);
- GbcMaker gbcm = new GbcMaker(7, 4, b);
- GridBagConstraints gbc = null;
- cbTransparency = new JCheckBox(theTexts[14]);
- gbc = gbcm.create(0, 0, 1, 3);
- gbc.anchor = GridBagConstraints.WEST;
- gbl.setConstraints(cbTransparency, gbc);
- jp.add(cbTransparency);
- cbMix = new JCheckBox(theTexts[7]);
- gbc = gbcm.create(1, 0, 1, 3);
- gbc.anchor = GridBagConstraints.WEST;
- gbl.setConstraints(cbMix, gbc);
- jp.add(cbMix);
- JLabel l = new JLabel(theTexts[9]);
- gbc = gbcm.create(2,0,1,1);
- gbc.anchor = GridBagConstraints.WEST;
- gbl.setConstraints(l, gbc);
- jp.add(l);
- l = new JLabel(theTexts[8]);
- gbc = gbcm.create(2, 1, 1, 1);
- gbc.anchor = GridBagConstraints.WEST;
- gbl.setConstraints(l, gbc);
- jp.add(l);
- csa = new ColorShowArea();
- gbc = gbcm.create(2, 2, 1, 1);
- gbc.anchor = GridBagConstraints.WEST;
- gbl.setConstraints(csa, gbc);
- jp.add(csa);
- JPanel dp = gbcm.createDummyPanel();
- gbc = gbcm.createDummyGbc(2,3,1,1);
- gbl.setConstraints(dp, gbc);
- jp.add(dp);
- cbPrefer = new JCheckBox(theTexts[10]);
- gbc = gbcm.create(3,1,1,2);
- gbc.anchor = GridBagConstraints.WEST;
- gbl.setConstraints(cbPrefer, gbc);
- jp.add(cbPrefer);
- cbMask = new JCheckBox(theTexts[11]);
- gbc = gbcm.create(4,0,1,3);
- gbc.anchor = GridBagConstraints.WEST;
- gbl.setConstraints(cbMask, gbc);
- jp.add(cbMask);
- cbInverted = new JCheckBox(theTexts[12]);
- gbc = gbcm.create(5,1,1,2);
- gbc.anchor = GridBagConstraints.WEST;
- gbl.setConstraints(cbInverted, gbc);
- jp.add(cbInverted);
- cbAlpha = new JCheckBox(theTexts[13]);
- gbc = gbcm.create(6,0,1,3);
- gbc.anchor = GridBagConstraints.WEST;
- gbl.setConstraints(cbAlpha, gbc);
- jp.add(cbAlpha);
- }
-
- protected void setInterpolationPanel(JPanel jp)
- {
- jp.setBorder(BorderFactory.createTitledBorder(theTexts[2]));
- GridBagLayout gbl = new GridBagLayout();
- jp.setLayout(gbl);
- GbcMaker gbcm = new GbcMaker(1, 2, b);
- GridBagConstraints gbc = null;
- cbInterpolation = new JCheckBox(theTexts[6]);
- gbc = gbcm.create(0,0,1,1);
- gbl.setConstraints(cbInterpolation, gbc);
- jp.add(cbInterpolation);
- JPanel dp = gbcm.createDummyPanel();
- gbc = gbcm.createDummyGbc(0,1,1,1);
- gbl.setConstraints(dp, gbc);
- jp.add(dp);
- }
-
- protected void setGeneralOptionsPanel(JPanel jp)
- {
- jp.setBorder(BorderFactory.createTitledBorder(theTexts[1]));
- GridBagLayout gbl = new GridBagLayout();
- jp.setLayout(gbl);
- GbcMaker gbcm = new GbcMaker(3, 3, b);
- GridBagConstraints gbc = null;
- JLabel jl = new JLabel(theTexts[4]);
- gbc = gbcm.create(0,0,1,1);
- gbl.setConstraints(jl, gbc);
- jp.add(jl);
- cbPdfVersion = new JComboBox();
- for(int i = 0; i < pdfVersions.length; i++) {
- cbPdfVersion.addItem(pdfVersions[i]);
- }
- cbPdfVersion.setSelectedIndex(0);
- gbc = gbcm.create(0,1,1,1);
- gbc.anchor = GridBagConstraints.WEST;
- gbl.setConstraints(cbPdfVersion, gbc);
- jp.add(cbPdfVersion);
- JPanel dp = gbcm.createDummyPanel();
- gbc = gbcm.createDummyGbc(0, 2, 1, 1);
- gbl.setConstraints(dp, gbc);
- jp.add(dp);
- cbMakeMode = new JCheckBox(theTexts[5]);
- gbc = gbcm.create(1,0,1,2);
- gbc.anchor = GridBagConstraints.WEST;
- gbl.setConstraints(cbMakeMode, gbc);
- jp.add(cbMakeMode);
- cbShowFilenames = new JCheckBox(theTexts[16]);
- gbc = gbcm.create(2, 0, 1, 2);
- gbc.anchor = GridBagConstraints.WEST;
- gbl.setConstraints(cbShowFilenames, gbc);
- jp.add(cbShowFilenames);
- }
-
- protected void setButtonPanel(JPanel jp)
- {
- jp.setLayout(new BoxLayout(jp, BoxLayout.LINE_AXIS));
- bOK = new JButton(buttonTexts[0]);
- bOK.addActionListener(this);
- bCancel = new JButton(buttonTexts[1]);
- bCancel.addActionListener(this);
- bDefaults = new JButton(buttonTexts[2]);
- bDefaults.addActionListener(this);
- ComponentSizer cs = new ComponentSizer();
- cs.getComponentSize(bOK); cs.getComponentSize(bCancel);
- cs.getComponentSize(csa); cs.getComponentSize(bDefaults);
- cs.setComponentSize(bOK); cs.setComponentSize(bCancel);
- cs.setComponentSize(csa); cs.setComponentSize(bDefaults);
- jp.add(Box.createHorizontalGlue());
- jp.add(bOK);
- jp.add(Box.createRigidArea(new Dimension(b, b)));
- jp.add(bCancel);
- jp.add(Box.createRigidArea(new Dimension(b, b)));
- jp.add(bDefaults);
- jp.add(Box.createHorizontalGlue());
- }
-
- public void cleanup()
- {
- cbPdfVersion.removeItemListener(this);
- cbMix.removeItemListener(mixl);
- mixl = null;
- cbMask.removeItemListener(masl);
- masl = null;
- cbAlpha.removeItemListener(alpl);
- alpl = null;
- csa.removeActionListener(ccal);
- ccal = null;
- removeWindowListener(this);
- bOK.removeActionListener(this);
- bCancel.removeActionListener(this);
- }
-
- public void controller_to_dialog()
- {
- if(startCorrection()) {
- int i = ppc.getPdfVersion();
- if(i < 0) i = 0; if(i > 2) i = 2;
- cbPdfVersion.setSelectedIndex(i);
- cbMakeMode.setSelected(ppc.getMakeMode());
- cbInterpolation.setSelected(ppc.getInterpolate());
- cbTransparency.setSelected(ppc.getAlphaTrans());
- cbMix.setSelected(ppc.getMix());
- csa.setColor(ppc.getMixColor());
- cbPrefer.setSelected(ppc.getPreferMyColor());
- cbMask.setSelected(ppc.getMask());
- cbInverted.setSelected(ppc.getMaskInverted());
- cbAlpha.setSelected(ppc.getAlpha());
- cbShowFilenames.setSelected(ppc.getShowFilenames());
- finishCorrection();
- }
- correct_dialog();
- }
-
- public void dialog_to_controller()
- {
- int i = cbPdfVersion.getSelectedIndex();
- if(i < 0) i = 0; if(i > 2) i = 2;
- ppc.setPdfVersion(i);
- ppc.setMakeMode(cbMakeMode.isSelected());
- ppc.setInterpolate(cbInterpolation.isSelected());
- ppc.setAlphaTrans(cbTransparency.isSelected());
- ppc.setMix(cbMix.isSelected());
- ppc.setMixColor(csa.getColor());
- ppc.setPreferMyColor(cbPrefer.isSelected());
- ppc.setMask(cbMask.isSelected());
- ppc.setMaskInverted(cbInverted.isSelected());
- ppc.setAlpha(cbAlpha.isSelected());
- ppc.setShowFilenames(cbShowFilenames.isSelected());
- }
-
- protected void setDefaults()
- {
- if(startCorrection()) {
- cbMakeMode.setSelected(true);
- cbPdfVersion.setSelectedIndex(2);
- cbInterpolation.setSelected(true);
- cbMix.setSelected(false);
- cbTransparency.setSelected(false);
- csa.setColor(new Color(255,255,255));
- cbPrefer.setSelected(false);
- cbMask.setSelected(false);
- cbInverted.setSelected(false);
- cbAlpha.setSelected(true);
- cbMask.setEnabled(true);
- cbAlpha.setEnabled(true);
- cbInterpolation.setEnabled(true);
- cbShowFilenames.setSelected(false);
- finishCorrection();
- }
- }
-
- protected void disable_interpolation()
- {
- cbInterpolation.setSelected(false);
- cbInterpolation.setEnabled(false);
- }
-
- protected void enable_interpolation()
- {
- cbInterpolation.setEnabled(true);
- }
-
- protected void allow_alpha(boolean m, boolean i, boolean a)
- {
- if(a) {
- cbAlpha.setEnabled(true);
- if(cbAlpha.isSelected()) {
- if(cbMask.isSelected()) {
- cbMask.setSelected(false);
- }
- if(cbMix.isSelected()) {
- cbMix.setSelected(false);
- }
- }
- } else {
- if(cbAlpha.isSelected()) {
- cbAlpha.setSelected(false);
- if(i) {
- cbMask.setSelected(true);
- }
- }
- cbAlpha.setEnabled(false);
- }
- if(i) {
- cbMask.setEnabled(true);
- } else {
- if(cbMask.isSelected()) {
- cbMask.setSelected(false);
- cbMix.setSelected(true);
- }
- cbMask.setEnabled(false);
- }
- if(m) {
- cbMix.setEnabled(true);
- } else {
- if(cbMix.isSelected()) {
- cbMix.setSelected(false);
- }
- cbMix.setEnabled(false);
- }
- }
-
- public void correct_dialog()
- {
- if(startCorrection()) {
- switch(cbPdfVersion.getSelectedIndex()) {
- case Png2PdfController.PDF_VERSION_12: {
- disable_interpolation();
- allow_alpha(true, false, false);
- } break;
- case Png2PdfController.PDF_VERSION_13: {
- enable_interpolation();
- allow_alpha(true, true, false);
- } break;
- case Png2PdfController.PDF_VERSION_14: {
- enable_interpolation();
- allow_alpha(true, true, true);
- } break;
- }
- finishCorrection();
- }
- }
-
- public void actionPerformed(ActionEvent e)
- {
- switch(StringTool.getArrayIndex(buttonTexts, e.getActionCommand())) {
- case 0: { // OK
- setVisible(false);
- dialog_to_controller();
- controller_to_dialog();
- correct_dialog();
- if(a != null) {
- ActionEvent myEvent =
- new ActionEvent(this,ActionEvent.ACTION_PERFORMED, Png2PdfWindow.actionCmd[5]);
- a.actionPerformed(myEvent);
- }
- } break;
- case 1: { // Cancel
- setVisible(false);
- controller_to_dialog();
- correct_dialog();
- } break;
- case 2: {
- setDefaults();
- } break;
- }
- }
-
- public void itemStateChanged(ItemEvent e)
- {
- correct_dialog();
- repaint();
- }
-
- public void windowClosing(WindowEvent e)
- {
- setVisible(false);
- controller_to_dialog();
- }
- public void windowActivated(WindowEvent e) {}
- public void windowClosed(WindowEvent e) {}
- public void windowDeactivated(WindowEvent e) {}
- public void windowDeiconified(WindowEvent e) {}
- public void windowIconified(WindowEvent e) {}
- public void windowOpened(WindowEvent e) {}
-}
diff --git a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/Png2PdfFileFilter.java b/obsolete/support/png2pdf/Java/Png2PdfGUI/src/Png2PdfFileFilter.java
deleted file mode 100644
index b408e95b79..0000000000
--- a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/Png2PdfFileFilter.java
+++ /dev/null
@@ -1,21 +0,0 @@
-import java.io.File;
-import java.io.FileFilter;
-
-public class Png2PdfFileFilter extends Object
- implements FileFilter
-{
- public static final String[] suffixes = {
- ".png", ".PNG"
- };
- public boolean accept(File f)
- {
- boolean back = false;
- String fn = f.getAbsolutePath();
- for(int i = 0; ((i < suffixes.length) && (!back)); i++) {
- if(fn.endsWith(suffixes[i])) {
- back = true;
- }
- }
- return back;
- }
-}
diff --git a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/Png2PdfGUI.java b/obsolete/support/png2pdf/Java/Png2PdfGUI/src/Png2PdfGUI.java
deleted file mode 100644
index f6d0f73692..0000000000
--- a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/Png2PdfGUI.java
+++ /dev/null
@@ -1,42 +0,0 @@
-
-import dirk_krause.jtools.GuiController;
-import javax.swing.SwingUtilities;
-
-public class Png2PdfGUI {
- static public final String appName = "Png2PdfGUI";
-
- class GuiBuilder implements Runnable
- {
- protected GuiController g = null;
- protected Png2PdfController p = null;
-
- public GuiBuilder(GuiController gc, Png2PdfController pc)
- {
- g = gc; p = pc;
- }
- public void run()
- {
- g.initialize();
- Png2PdfWindow w = new Png2PdfWindow(g, p);
- w.setVisible(true);
- w.retrievePng2pdfSettings();
- }
- }
-
- /**
- * @param args
- */
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- Png2PdfGUI ppg = new Png2PdfGUI();
- ppg.run();
- }
-
- void run()
- {
- GuiController guic = new GuiController(appName);
- Png2PdfController ppc = new Png2PdfController(appName);
- SwingUtilities.invokeLater(new GuiBuilder(guic, ppc));
- }
-
-}
diff --git a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/Png2PdfWindow.java b/obsolete/support/png2pdf/Java/Png2PdfGUI/src/Png2PdfWindow.java
deleted file mode 100644
index e39278c4ca..0000000000
--- a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/Png2PdfWindow.java
+++ /dev/null
@@ -1,1155 +0,0 @@
-
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.Container;
-import java.awt.Dimension;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.WindowEvent;
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-
-import javax.swing.Box;
-import javax.swing.ImageIcon;
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JFileChooser;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JMenu;
-import javax.swing.JMenuBar;
-import javax.swing.JMenuItem;
-import javax.swing.JPanel;
-import javax.swing.JToolBar;
-import javax.swing.SwingUtilities;
-
-import dirk_krause.jtools.ApplicationFrame;
-import dirk_krause.jtools.DirectoryFilter;
-import dirk_krause.jtools.GbcMaker;
-import dirk_krause.jtools.GuiController;
-import dirk_krause.jtools.GuiDialog;
-import dirk_krause.jtools.HelpWindow;
-import dirk_krause.jtools.LogContents;
-import dirk_krause.jtools.LogContentsForCommand;
-import dirk_krause.jtools.LogWindow;
-import dirk_krause.jtools.OneDirectoryDropTransferHandler;
-import dirk_krause.jtools.SizeTracker;
-import dirk_krause.jtools.StringTool;
-import dirk_krause.jtools.StatusChanger;
-import java.awt.event.ActionListener;
-import java.awt.event.ActionEvent;
-
-public class Png2PdfWindow extends ApplicationFrame
- implements ActionListener
-{
- /**
- * Dialog to set up GUI.
- */
- protected GuiDialog guid = null;
-
- /**
- * Controller keeping options for png2pdf.
- */
- protected Png2PdfController tc = null;
-
- /**
- * Dialog to set up options to png2pdf.
- */
- protected Png2PdfDialog tod = null;
-
- /**
- * Window to show log text (command output).
- */
- protected LogWindow lw = null;
-
- /**
- * Window to show version information and help.
- */
- protected HelpWindow hw = null;
-
- /**
- * Flag to indicate whether or not a background
- * thread is running
- */
- protected boolean isRunning = false;
-
- /**
- * Menu item to choose directory.
- */
- protected JMenuItem miDir = null;
-
- /**
- * Menu item to set options.
- */
- protected JMenuItem miOpt = null;
-
- /**
- * Menu item to run the png2pdf command.
- */
- protected JMenuItem miRun = null;
-
- /**
- * Menu item to exit the application.
- */
- protected JMenuItem miExit = null;
-
- /**
- * Menu item to set up GUI.
- */
- protected JMenuItem miGui = null;
-
- /**
- * Menu item to pack window.
- */
- protected JMenuItem miPck = null;
-
- /**
- * Menu item to show version and license information.
- */
- protected JMenuItem miLic = null;
-
- /**
- * Menu item to show help text.
- */
- protected JMenuItem miHlp = null;
-
- /**
- * Button to change directory.
- */
- protected JButton bDir = null;
-
- /**
- * Button to change options to png2pdf.
- */
- protected JButton bOpt = null;
-
- /**
- * Button to run the png2pdf command.
- */
- protected JButton bRun = null;
-
- /**
- * Button to exit the application.
- */
- protected JButton bExit = null;
-
- /**
- * Label to show the current working directory.
- */
- protected JLabel lDir = null;
-
- /**
- * Label to show the program status.
- */
- protected JLabel lSta = null;
-
- /**
- * Color to show the program status in red while
- * the application is busy.
- */
- protected Color myR = null;
-
- /**
- * Color to show the program status in green
- * while the application is idle.
- */
- protected Color myG = null;
-
- /**
- * Size tracker for directory label.
- */
- protected SizeTracker stDir = null;
-
- /**
- * Size tracker for status messages.
- */
- protected SizeTracker stSta = null;
-
- /**
- * Allow the controller to print file names.
- */
- protected ControllerStatusChanger csc = null;
-
- /**
- * License terms.
- */
- public static final String licenseTerms =
- "<html>\n"
- + "<head>\n"
- + "</head>\n"
- + "<body>\n"
- + "<p>This is Png2PdfGUI, version 1.1.0</p>"
- + "<p>\n"
- + "Copyright (c) 2006, Dirk Krause<br>\n"
- + "All rights reserved.\n"
- + "</p>\n"
- + "<p>\n"
- + "Redistribution and use in source and binary forms,\n"
- + "with or without modification, are permitted provided\n"
- + "that the following conditions are met:\n"
- + "<ul>\n"
- + "<li>Redistributions of source code must retain the above\n"
- + "copyright notice, this list of conditions and the\n"
- + "following disclaimer.</li>\n"
- + "<li>Redistributions in binary form must reproduce the above \n"
- + "opyright notice, this list of conditions and the following\n"
- + "disclaimer in the documentation and/or other materials\n"
- + "provided with the distribution.</li>\n"
- + "<li>Neither the name of the Dirk Krause nor the names of\n"
- + "its contributors may be used to endorse or promote\n"
- + "products derived from this software without specific\n"
- + "prior written permission.</li>\n"
- + "</ul>\n"
- + "THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND\n"
- + "CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES,\n"
- + "INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n"
- + "MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n"
- + "DISCLAIMED.<br>\n"
- + "IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n"
- + "LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n"
- + "EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n"
- + "LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n"
- + "LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n"
- + "HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n"
- + "CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\n"
- + "OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n"
- + "SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH\n"
- + "DAMAGE.\n"
- + "</p>\n"
- + "</body>\n"
- + "</html>\n";
-
- /**
- * Keywords to set up GUI elements
- */
- public static final String[] theTexts = {
- "Png2pdf-GUI", // 0
- "Png2pdf", // 1
- "Setup", // 2
- "<html><body><b>Png2pdfGUI - a GUI to the png2pdf program</b></body></html>", // 3
- "Directory:", // 4
- "Status:", // 5
- "Ready", // 6
- "Running", // 7
- "Initializing", // 8
- "Saving Options", // 9
- "Exiting", // 10
- "Retrieving defaults", // 11
- "Saving defaults", // 12
- "Help", // 13
- };
-
- /**
- * Keyword to set up buttons and menu items
- */
- public static final String[] actionCmd = {
- "GUI", // 0
- "Directory", // 1
- "Options", // 2
- "Run", // 3
- "Exit", // 4
- "Save Options", // 5
- "About", // 6
- "Help", // 7
- "Pack window", // 8
- "Retrieve Options", // 9
- };
-
- /**
- * File names for icons in the button bar.
- */
- public static final String[] iconFileNames = {
- "ChooseDirectory.png",
- "Options.png",
- "Run.png",
- "Exit.png"
- };
-
- /**
- * Texts for tooltips.
- */
- public static final String[] toolTipTexts = {
- "<html><body>Choose <b>Directory</b></body></html>",
- "<html><body>Set <b>Options</b></body></html>",
- "<html><body><b>Run</b> png2pdf</body></html>",
- "<html><body><b>Exit</b> the GUI</body></html>",
- "<html><body><b>Setup</b> the <b>GUI</b></body></html>",
- "<html><body><b>Pack window</b> to optimized size</body></html>"
- };
-
- /**
- * File name for online help.
- */
- public static final String helpFileName = "ppgui.html";
-
- /**
- * Change status label.
- *
- */
- class PpStatusChanger implements Runnable
- {
- private int newText = 0;
- private Color newColor = Color.BLACK;
- public PpStatusChanger(int t, Color c)
- {
- newText = t; newColor = c;
- }
- public void run()
- {
- setStatus(newText, newColor, true);
- }
- }
-
- /**
- * Change directory label.
- *
- */
- class DirectoryChanger implements Runnable
- {
- String newDirectory;
- public DirectoryChanger(String s)
- {
- newDirectory = s;
- }
- public void run()
- {
- lDir.setText(newDirectory);
- if(stDir.mustPackAgain(lDir)) {
- pack();
- }
- lDir.repaint();
- }
- }
-
- /**
- * Transfer handler for drop operations.
- *
- */
- class DropHandler extends OneDirectoryDropTransferHandler
- {
- protected boolean processFilename(String s)
- {
- boolean back = false;
- File f = new File(s);
- if(f.isDirectory()) {
- getTc().setCwd(s);
- getTc().writeCwd();
- back = true;
- SwingUtilities.invokeLater(new DirectoryChanger(s));
- }
- return back;
- }
- }
-
- /**
- * Show the log window.
- *
- */
- class LogWindowShower implements Runnable
- {
- private LogContents lc = null;
- public void run()
- {
- getLogWindow().setVisible(false);
- // getLogWindow().chooseNonmodalPosition(this);
- positionLogWindow();
- getLogWindow().showTextIfNecessary(lc);
- }
- public LogWindowShower(LogContents l)
- {
- lc = l;
- }
- }
-
- /**
- * Retrieve options.
- *
- */
- class OptionRetriever implements Runnable
- {
- public void run()
- {
- setStatus(11, myR, false);
- LogContentsForCommand lcfc = getTc().restoreOptions();
- setRunning(false);
- setStatus(6, myG, false);
- if(!(lcfc.getSuccess())) {
- SwingUtilities.invokeLater(new LogWindowShower(lcfc));
- }
- }
- public OptionRetriever()
- {
- }
- }
-
- /**
- * Save options.
- *
- */
- class OptionSaver implements Runnable
- {
- public void run()
- {
- setStatus(12, myR, false);
- LogContentsForCommand lcfc = getTc().saveOptions();
- setRunning(false);
- setStatus(6, myG, false);
- if(!(lcfc.getSuccess())) {
- SwingUtilities.invokeLater(new LogWindowShower(lcfc));
- }
- }
- public OptionSaver()
- {
-
- }
- }
-
- /**
- * Run png2pdf.
- *
- */
- class ProgramRunner implements Runnable
- {
- public void run()
- {
- setStatus(7, myR, false);
- LogContentsForCommand lcfc = getTc().runTheProgram();
- setRunning(false);
- setStatus(6, myG, false);
- if(!(lcfc.getSuccess())) {
- SwingUtilities.invokeLater(new LogWindowShower(lcfc));
- }
- }
- public ProgramRunner()
- {
-
- }
- }
-
- class ControllerStatusChanger implements StatusChanger
- {
- class MyRunner implements Runnable
- {
- String myText = null;
- public void run()
- {
- lSta.setText(myText);
- if(stSta.mustPackAgain(lSta)) {
- pack();
- }
- lSta.repaint();
- }
- public MyRunner(String s)
- {
- myText = s;
- }
- }
- public void setStatus(String s)
- {
- SwingUtilities.invokeLater(new MyRunner(s));
- }
- }
-
- /**
- * DropHandler instance.
- */
- protected DropHandler dh = null;
-
- /**
- * Get the dialog to set png2pdf options. Create new dialog
- * if necessary.
- *
- * @param p
- * The parent frame.
- *
- * @param g
- * A GuiController providing the border settings.
- *
- * @param tc
- * The Png2PdfController to set up.
- *
- * @return
- * The png2pdf options dialog.
- */
- protected synchronized Png2PdfDialog internalGetTod()
- {
- return tod;
- }
-
- protected synchronized void internalSetTod(Png2PdfDialog d)
- {
- tod = d;
- }
-
- /**
- * Get the dialog to set png2pdf options. Create new dialog
- * if necessary.
- */
- protected Png2PdfDialog getTod()
- {
- Png2PdfController tc = getTc();
- Png2PdfDialog back = internalGetTod();
- if(back == null) {
- back = new Png2PdfDialog(this, getGuic(), tc, this);
- internalSetTod(back);
- // back.chooseNonmodalPosition(this);
- }
- return back;
- }
-
- /**
- * Mark existing png2pdf options dialog as not longer being used.
- *
- */
- protected synchronized void resetTod()
- {
- tod = null;
- }
-
- /**
- * Check whether or not there already is a png2pdf options dialog.
- *
- * @return
- * The test result.
- */
- protected synchronized boolean haveTod()
- {
- boolean back = false;
- if(tod != null) {
- back = true;
- }
- return back;
- }
-
- /**
- * Get the png2pdf controller.
- *
- * @return
- * The controller.
- */
- protected synchronized Png2PdfController getTc()
- {
- if(tc == null) {
- tc = new Png2PdfController();
- }
- return tc;
- }
-
- /**
- * Get the log window.
- *
- * @return
- * The log window.
- */
- protected synchronized LogWindow internalGetLogWindow() { return lw; }
-
- /**
- * Set the log window.
- *
- * @param l
- * The log window.
- */
- protected synchronized void internalSetLogWindow(LogWindow l) { lw = l; }
-
- /**
- * Get the log window.
- *
- * @return
- * The log window.
- */
- protected LogWindow getLogWindow()
- {
- LogWindow back = internalGetLogWindow();
- if(back == null) {
- back = new LogWindow(this, getGuic());
- internalSetLogWindow(back);
- // back.chooseNonmodalPosition(this);
- }
- return back;
- }
-
- /**
- * Mark the log window as not longer being used.
- *
- */
- protected synchronized void resetLogWindow()
- {
- lw = null;
- }
-
- /**
- * Check whether or not we already have a log window.
- *
- * @return
- * The test result.
- */
- protected synchronized boolean haveLogWindow()
- {
- boolean back = false;
- if(lw != null) back = true;
- return back;
- }
-
- /**
- * Get the help window.
- *
- * @return
- * The help window.
- */
- protected synchronized HelpWindow internalGetHelpWindow() { return hw; }
-
- /**
- * Set the help window.
- *
- * @param h
- * The help window.
- */
- protected synchronized void internalSetHelpWindow(HelpWindow h) { hw = h; }
-
- /**
- * Get the help window.
- *
- * @return
- * The help window.
- */
- protected HelpWindow getHelpWindow()
- {
- HelpWindow back = internalGetHelpWindow();
- if(back == null) {
- back = new HelpWindow(this, getGuic());
- // back.chooseNonmodalPosition(this);
- internalSetHelpWindow(back);
- }
- return back;
- }
-
- /**
- * Mark the help window as not longer being used.
- *
- */
- protected synchronized void resetHelpWindow()
- {
- hw = null;
- }
-
- /**
- * Check whether or not there already is a help window.
- *
- * @return
- * The test result.
- */
- protected synchronized boolean haveHelpWindow()
- {
- boolean back = false;
- if(hw != null) back = true;
- return back;
- }
-
- /**
- * Set a new status.
- *
- * @param t
- * The index of the text in the theTexts array.
- *
- * @param c
- * The color to use.
- *
- * @param fromAwtThread
- * Flag indicating whether or not we are in the
- * AWT/event thread.
- */
- protected void setStatus(int t, Color c, boolean fromAwtThread)
- {
- if(fromAwtThread) {
- lSta.setText(theTexts[t]);
- lSta.setForeground(c);
- lSta.repaint();
- } else {
- SwingUtilities.invokeLater(new PpStatusChanger(t, c));
- }
- }
-
- /**
- * Set up the menu bar.
- */
- protected void setupMenuBar()
- {
- JMenuBar mb = new JMenuBar();
- JMenu m1 = new JMenu(theTexts[1]);
- mb.add(m1);
- miDir = new JMenuItem(actionCmd[1]);
- miDir.addActionListener(this);
- miDir.setToolTipText(toolTipTexts[0]);
- m1.add(miDir);
- miOpt = new JMenuItem(actionCmd[2]);
- miOpt.addActionListener(this);
- miOpt.setToolTipText(toolTipTexts[1]);
- m1.add(miOpt);
- miRun = new JMenuItem(actionCmd[3]);
- miRun.addActionListener(this);
- miRun.setToolTipText(toolTipTexts[2]);
- m1.add(miRun);
- miExit = new JMenuItem(actionCmd[4]);
- miExit.addActionListener(this);
- miExit.setToolTipText(toolTipTexts[3]);
- m1.add(miExit);
-
- JMenu m2 = new JMenu(theTexts[2]);
- miGui = new JMenuItem(actionCmd[0]);
- miGui.addActionListener(this);
- miGui.setToolTipText(toolTipTexts[4]);
- m2.add(miGui);
- miPck = new JMenuItem(actionCmd[8]);
- miPck.addActionListener(this);
- miPck.setToolTipText(toolTipTexts[5]);
- m2.add(miPck);
- mb.add(m2);
- JMenu m3 = new JMenu(theTexts[13]);
- miHlp = new JMenuItem(actionCmd[7]);
- miHlp.addActionListener(this);
- m3.add(miHlp);
- miLic = new JMenuItem(actionCmd[6]);
- miLic.addActionListener(this);
- m3.add(miLic);
- mb.add(Box.createHorizontalGlue());
- mb.add(m3);
- setJMenuBar(mb);
- }
-
- /**
- * Set up the button bar.
- *
- * @return
- * The new button bar.
- */
- protected JToolBar setupButtonBar()
- {
- JToolBar back = new JToolBar();
- bDir = new JButton(findImageForName(iconFileNames[0]));
- bDir.setActionCommand(actionCmd[1]);
- bDir.addActionListener(this);
- bDir.setToolTipText(toolTipTexts[0]);
- bOpt = new JButton(findImageForName(iconFileNames[1]));
- bOpt.setActionCommand(actionCmd[2]);
- bOpt.addActionListener(this);
- bOpt.setToolTipText(toolTipTexts[1]);
- bRun = new JButton(findImageForName(iconFileNames[2]));
- bRun.setActionCommand(actionCmd[3]);
- bRun.addActionListener(this);
- bRun.setToolTipText(toolTipTexts[2]);
- bExit = new JButton(findImageForName(iconFileNames[3]));
- bExit.setActionCommand(actionCmd[4]);
- bExit.addActionListener(this);
- bExit.setToolTipText(toolTipTexts[3]);
- back.add(bDir);
- back.add(bOpt);
- back.add(bRun);
- back.add(bExit);
- return back;
- }
-
- /**
- * Create the inner panel (real window panel).
- *
- * @return
- * The new panel.
- */
- protected JPanel createInnerPanel()
- {
- JPanel back = new JPanel();
- int b = getGuic().getBorder();
- GridBagLayout gbl = new GridBagLayout();
- back.setLayout(gbl);
- GbcMaker gbcm = new GbcMaker(5, 4, b);
- GridBagConstraints gbc = null;
- JLabel l = null;
- JPanel d = null;
- d = gbcm.createDummyPanel();
- gbc = gbcm.createDummyGbc(0, 0, 1, 1);
- gbl.setConstraints(d, gbc);
- back.add(d);
- l = new JLabel(theTexts[3]);
- gbc = gbcm.create(1, 1, 1, 2);
- gbl.setConstraints(l, gbc);
- back.add(l);
- l = new JLabel(theTexts[4]);
- l.setHorizontalAlignment(JLabel.RIGHT);
- gbc = gbcm.create(2, 1, 1, 1);
- gbc.anchor = GridBagConstraints.EAST;
- gbl.setConstraints(l, gbc);
- back.add(l);
- lDir = new JLabel(tc.getCwd());
- gbc = gbcm.create(2, 2, 1, 1);
- gbc.anchor = GridBagConstraints.WEST;
- lDir.setHorizontalAlignment(JLabel.LEFT);
- gbl.setConstraints(lDir, gbc);
- back.add(lDir);
- l = new JLabel(theTexts[5]);
- l.setHorizontalAlignment(JLabel.RIGHT);
- gbc = gbcm.create(3, 1, 1, 1);
- gbc.anchor = GridBagConstraints.EAST;
- gbl.setConstraints(l, gbc);
- back.add(l);
- lSta = new JLabel(theTexts[6]);
- gbc = gbcm.create(3, 2, 1, 1);
- gbc.anchor = GridBagConstraints.WEST;
- lSta.setHorizontalAlignment(JLabel.LEFT);
- gbl.setConstraints(lSta, gbc);
- lSta.setForeground(myG);
- back.add(lSta);
- d = gbcm.createDummyPanel();
- gbc = gbcm.createDummyGbc(4, 3, 1, 1);
- gbl.setConstraints(d, gbc);
- back.add(d);
- return back;
- }
-
- /**
- * Constructor.
- *
- * @param c
- * A GuiController providing the border setting.
- *
- * @param t
- * A controller for png2pdf options.
- */
- public Png2PdfWindow(GuiController c, Png2PdfController t)
- {
- super(Png2PdfGUI.appName, c);
- setTitle(theTexts[0]);
- tc = t;
- myR = new Color(128, 0, 0);
- myG = new Color(0, 128, 0);
- Container cp = getContentPane();
- cp.setLayout(new BorderLayout());
- setupMenuBar();
- JPanel ip;
- cp.add(setupButtonBar(), BorderLayout.PAGE_START);
- ip = createInnerPanel();
- cp.add(ip, BorderLayout.CENTER);
- pack();
- restorePosition();
- // setResizable(false);
- dh = new DropHandler();
- ip.setTransferHandler(dh);
- stDir = new SizeTracker();
- stDir.mustPackAgain(lDir);
- stSta = new SizeTracker();
- stSta.mustPackAgain(lSta);
- csc = new ControllerStatusChanger();
- t.setStatusChanger(csc);
- }
-
- /**
- * Cleanup procedure.
- */
- public void cleanup(boolean isLast)
- {
- if(isLast) {
- // guic.writeProperties(false);
- if(haveGuid()) {
- GuiDialog g = getGuid();
- g.cleanup(); g.dispose(); g = null;
- }
- if(haveHelpWindow()) {
- HelpWindow h = getHelpWindow();
- h.cleanup(); h.dispose(); h = null;
- }
- if(haveLogWindow()) {
- LogWindow l = getLogWindow();
- l.cleanup(); l.dispose(); l = null;
- }
- if(haveTod()) {
- Png2PdfDialog t = getTod();
- t.cleanup(); t.dispose(); t = null;
- }
- }
- if(haveGuid()) {
- resetGuid();
- }
- if(haveHelpWindow()) {
- resetHelpWindow();
- }
- if(haveLogWindow()) {
- resetLogWindow();
- }
- if(haveTod()) {
- resetTod();
- }
- miDir.removeActionListener(this); miDir = null;
- miOpt.removeActionListener(this); miOpt = null;
- miRun.removeActionListener(this); miRun = null;
- miExit.removeActionListener(this); miExit = null;
- miGui.removeActionListener(this); miGui = null;
- miPck.removeActionListener(this); miPck = null;
- bDir.removeActionListener(this); bDir = null;
- bOpt.removeActionListener(this); bOpt = null;
- bRun.removeActionListener(this); bRun = null;
- bExit.removeActionListener(this); bExit = null;
- tc.setStatusChanger(null); csc = null;
- tc = null;
- }
-
- /**
- * Check whether or not there already is a GUI options dialog.
- *
- * @return
- * The test result.
- */
- protected synchronized boolean haveGuid()
- {
- boolean back = false;
- if(guid != null) { back = true; }
- return back;
- }
-
- /**
- * Synchronized request for GUI dialog.
- *
- * @return
- * Reference to current GUI dialog (may be null).
- */
- protected synchronized GuiDialog internalGetGuid() { return guid; }
-
- /**
- * Synchronized set GUI dialog.
- *
- * @param d
- * The new GUI dialog.
- */
- protected synchronized void internalSetGuid(GuiDialog d) { guid = d; }
-
- /**
- * Get the GUI options dialog.
- *
- * @return
- * The GUI options dialog.
- */
- protected GuiDialog getGuid()
- {
- GuiDialog back = internalGetGuid();
- if(back == null) {
- back = new GuiDialog(this, getGuic());
- internalSetGuid(back);
- // guid.chooseNonmodalPosition(this);
- }
- return back;
- }
-
- /**
- * Mark the current GUI options dialog as not longer being used.
- *
- */
- protected synchronized void resetGuid()
- {
- guid = null;
- }
-
- /**
- * Show the GUI options dialog.
- *
- */
- protected void showGuiSetupDialog()
- {
- getGuid().controller_to_dialog();
- getGuid().setVisible(true);
- }
-
- /**
- * Check whether or not a background task is running.
- *
- * @return
- * The test result.
- */
- protected synchronized boolean getRunning()
- {
- return isRunning;
- }
-
- /**
- * Set the flag to indicate whether or not a background
- * task is running.
- *
- * @param b
- * The new flag value.
- */
- protected synchronized void setRunning(boolean b)
- {
- isRunning = b;
- }
-
- /**
- * Search for an icon image.
- *
- * @param n
- * The file name.
- *
- * @return
- * The icon image or null.
- */
- protected ImageIcon findImageForName(String n)
- {
- ImageIcon back = null;
- try {
- back = new ImageIcon(getClass().getResource(n));
- }
- catch(NullPointerException e) {
- back = new ImageIcon(n);
- }
- return back;
- }
-
- /**
- * Choose a new directory for png2pdf.
- *
- */
- protected void chooseDirectory()
- {
- String workingDirectory;
- JFileChooser c = new JFileChooser(getTc().getCwd());
- c.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
- c.setFileFilter(new DirectoryFilter());
- int result = c.showOpenDialog(this);
- if(result == JFileChooser.APPROVE_OPTION) {
- workingDirectory = c.getSelectedFile().getAbsolutePath();
- lDir.setText(workingDirectory);
- if(stDir.mustPackAgain(lDir)) {
- pack();
- }
- repaint();
- getTc().setCwd(workingDirectory);
- getTc().writeCwd();
- }
- }
-
- /**
- * Retrieve default settings.
- *
- */
- public void retrieveDefaults()
- {
- Thread thr = new Thread(new OptionRetriever());
- setRunning(true);
- thr.start();
- }
-
- /**
- * Save default settings.
- *
- */
- public void saveDefaults()
- {
- Thread thr = new Thread(new OptionSaver());
- setRunning(true);
- thr.start();
- }
-
- /**
- * Run png2pdf.
- *
- */
- public void runProgram()
- {
- Thread thr = new Thread(new ProgramRunner());
- setRunning(true);
- thr.start();
- }
-
- public void positionLogWindow()
- {
- getLogWindow().chooseNonmodalPosition(this);
- }
-
-
- /**
- * Reaction on mouseclicks
- *
- */
- public void actionPerformed(ActionEvent e)
- {
- switch(StringTool.getArrayIndex(actionCmd, e.getActionCommand())) {
- case 0: {
- showGuiSetupDialog();
- } break;
- case 1: { // directory
- if(!getRunning()) {
- chooseDirectory();
- }
- } break;
- case 2: { // options
- if(!getRunning()) {
- getTod().chooseNonmodalPosition(this);
- getTod().controller_to_dialog();
- getTod().correct_dialog();
- getTod().setVisible(true);
- }
- } break;
- case 3: { // run
- if(!getRunning()) {
- setRunning(true);
- runProgram();
- }
- } break;
- case 4: { // exit
- if(!getRunning()) {
- WindowEvent we = new WindowEvent(
- this,
- WindowEvent.WINDOW_CLOSING
- );
- processWindowEvent(we);
- }
- } break;
- case 5: { // save options
- getTc().writeCwd();
- if(!getRunning()) {
- setRunning(true);
- saveDefaults();
- }
- } break;
- case 6: { // license terms
- getHelpWindow().chooseNonmodalPosition(this);
- getHelpWindow().setVisible(false);
- getHelpWindow().setPurpose(2);
- getHelpWindow().setContentType(1);
- getHelpWindow().setText(licenseTerms);
- getHelpWindow().setVisible(true);
- } break;
- case 7: { // help
- URL helpUrl;
- getHelpWindow().chooseNonmodalPosition(this);
- getHelpWindow().setVisible(false);
- getHelpWindow().setPurpose(1);
- getHelpWindow().setContentType(0);
- getHelpWindow().setText(LogWindow.theTexts[1]);
-
- getHelpWindow().setContentType(1);
- helpUrl = Png2PdfGUI.class.getResource(helpFileName);
- if(helpUrl != null) {
- try {
- getHelpWindow().setPage(helpUrl);
- }
- catch(IOException ioe) {
- getHelpWindow().setText(LogWindow.theTexts[1]);
- }
- } else {
- }
- getHelpWindow().setVisible(true);
- } break;
- case 8: {
- pack(); repaint();
- } break;
- }
- }
-
- /**
- * Let the controller retrieve the settings from
- * png2pdf -C
- *
- */
- public void retrievePng2pdfSettings()
- {
- retrieveDefaults();
- }
-}
diff --git a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/Run.png b/obsolete/support/png2pdf/Java/Png2PdfGUI/src/Run.png
deleted file mode 100644
index 791a8fc3a6..0000000000
--- a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/Run.png
+++ /dev/null
Binary files differ
diff --git a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/compile-archive b/obsolete/support/png2pdf/Java/Png2PdfGUI/src/compile-archive
deleted file mode 100755
index ab8c062aab..0000000000
--- a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/compile-archive
+++ /dev/null
@@ -1,17 +0,0 @@
-#! /bin/bash
-
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-bindir=@bindir@
-DKLIBSJ=@DKLIBSJ@
-PROJECT=..
-rm ../jar/*.class || echo No class files to delete
-
-for i in *.java
-do
-echo $i
-javac -classpath .:${DKLIBSJ} -d ../bin $i
-echo $i done
-done
-cp *.html *.css *.png ../bin
-
diff --git a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/compile-archive.in b/obsolete/support/png2pdf/Java/Png2PdfGUI/src/compile-archive.in
deleted file mode 100755
index f7882afa7d..0000000000
--- a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/compile-archive.in
+++ /dev/null
@@ -1,16 +0,0 @@
-#! /bin/bash
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-bindir=@bindir@
-DKLIBSJ=@DKLIBSJ@
-PROJECT=..
-rm ../jar/*.class || echo No class files to delete
-
-for i in *.java
-do
-echo $i
-javac -classpath .:${DKLIBSJ} -d ../bin $i
-echo $i done
-done
-cp *.html *.css *.png ../bin
-
diff --git a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg01.png b/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg01.png
deleted file mode 100644
index dfb23aa2d6..0000000000
--- a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg01.png
+++ /dev/null
Binary files differ
diff --git a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg02.png b/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg02.png
deleted file mode 100644
index bdd596152d..0000000000
--- a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg02.png
+++ /dev/null
Binary files differ
diff --git a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg03.png b/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg03.png
deleted file mode 100644
index 39176dc9ce..0000000000
--- a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg03.png
+++ /dev/null
Binary files differ
diff --git a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg04.png b/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg04.png
deleted file mode 100644
index 2b26a165f4..0000000000
--- a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg04.png
+++ /dev/null
Binary files differ
diff --git a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg05.png b/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg05.png
deleted file mode 100644
index c3bcb8109a..0000000000
--- a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg05.png
+++ /dev/null
Binary files differ
diff --git a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg06.png b/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg06.png
deleted file mode 100644
index f76607c19d..0000000000
--- a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg06.png
+++ /dev/null
Binary files differ
diff --git a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg07.png b/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg07.png
deleted file mode 100644
index 192701e461..0000000000
--- a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg07.png
+++ /dev/null
Binary files differ
diff --git a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg08.png b/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg08.png
deleted file mode 100644
index 1b58c65b05..0000000000
--- a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg08.png
+++ /dev/null
Binary files differ
diff --git a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg09.png b/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg09.png
deleted file mode 100644
index df430fd18d..0000000000
--- a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg09.png
+++ /dev/null
Binary files differ
diff --git a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg10.png b/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg10.png
deleted file mode 100644
index b5f00508e5..0000000000
--- a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg10.png
+++ /dev/null
Binary files differ
diff --git a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg11.png b/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg11.png
deleted file mode 100644
index 3a797a2534..0000000000
--- a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg11.png
+++ /dev/null
Binary files differ
diff --git a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg12.png b/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg12.png
deleted file mode 100644
index 8d4cdb44d8..0000000000
--- a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg12.png
+++ /dev/null
Binary files differ
diff --git a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg13.png b/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg13.png
deleted file mode 100644
index d31c0b10e6..0000000000
--- a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg13.png
+++ /dev/null
Binary files differ
diff --git a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg14.png b/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg14.png
deleted file mode 100644
index 7ecd406ddf..0000000000
--- a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppg14.png
+++ /dev/null
Binary files differ
diff --git a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppgui.html b/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppgui.html
deleted file mode 100644
index d4a25920df..0000000000
--- a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/ppgui.html
+++ /dev/null
@@ -1,212 +0,0 @@
-<html>
-<head>
-<title>Png2PdfGUI - A graphical user interface to png2pdf</title>
-</head>
-<body>
-<h1>Png2PdfGUI - A graphical user interface to png2pdf</h1>
-<hr>
-<h2>Overview</h2>
-<p>
-The Java application Png2PdfGUI provides a graphical user
-interface to the png2pdf program.
-To convert PNG files to PDF you have to perform the following tasks:
-<ul>
-<li>Choose the directory containing the PNG files.</li>
-<li>Set conversion options.</li>
-<li>Run png2pdf.</li>
-<li>Exit the application.</li>
-</ul>
-These main tasks can be performed using buttons in the button bar
-or using menu entries.
-</p>
-<hr>
-<h2>Requirements</h2>
-<p>
-To use the Png2PdfGUI you must have the png2pdf program installed.
-Normally this conditions is fullfilled because Png2PdfGUI and png2pdf
-are in the same package, so they are installed at the same time.
-</p>
-<p>
-A Java run-time environment (Java 5) must be installed. Previous
-versions are not sufficient to run Png2PdfGUI.
-</p>
-<hr>
-<h2>Starting the program</h2>
-<h3>On Windows systems</h3>
-<p>In a prompt box run
-<pre>
-java.exe -cp c:\programs\krause\lib\png2pdf.jar;c:\programs\krause\lib\dklibsj.jar Png2PdfGUI
-</pre>
-You possibly need to replace c:\programs\krause by another directory, depending
-on your decisions during installation process.
-</p>
-<p>Once you have verified the program starts correctly you can create
-shortcuts either on the desktop or in the start menu. For shortcuts you
-should use javaw.exe instead of java.exe.
-</p>
-<h3>On Unix/Linux systems</h3>
-<p>Run
-<pre>
-java -c /usr/local/lib/png2pdf.jar:/usr/local/lib/dklibsj.jar Png2PdfGUI
-</pre>
-to start the program.<br>
-</p>
-<hr>
-<h2>Program appearance at start</h2>
-<p>
-When running the program for the first time the main window looks like
-this:<br>&nbsp;<br>
-<table width="100%">
-<tr><td align="CENTER"><img src="./ppg01.png" width="341" height="171"></td></tr>
-</table>
-</p>
-<hr>
-<h2>Choosing a directory</h2>
-<p>
-Use either the "Choose&nbsp;directory" button or the menu entry
-"Png2pdf&nbsp;/&nbsp;Directory" to choose the directory.<br>&nbsp;<br>
-<table width="100%">
-<tr>
-<td align="CENTER"><img src="./ppg02.png" width="341" height="171"></td>
-<td align="CENTER"><img src="./ppg03.png" width="341" height="171"></td>
-</tr>
-</table><br>&nbsp;<br>
-The directory chooser dialog appears.
-<br>&nbsp;<br>
-<table width="100%">
-<tr><td align="CENTER"><img src="./ppg04.png" width="817" height="407"></td></tr>
-</table>
-<br>&nbsp;<br>
-Navigate to the directory
-containing your PNG files and confirm the selection.<br>
-The new working directory is shown in the main window.<br>&nbsp;<br>
-<table width="100%">
-<tr><td align="CENTER"><img src="./ppg05.png" width="341" height="171"></td></tr>
-</table>
-</p>
-<p>You can also attempt to use drag'n'drop to drag a directory
-from Windows explorer or Nautilus into the Png2PdfGUI main window.
-For other Unix/Linux desktops it is not known whether drag'n'drop works,
-just try it.
-</p>
-<hr>
-<h2>Set png2pdf options</h2>
-<p>Use either the "Set&nbsp;options" button in the button bar or the
-"Png2pdf&nbsp;/&nbsp;Options" menu entry to set conversion options.
-<br>&nbsp;<br>
-<table width="100%">
-<tr>
-<td align="CENTER"><img src="./ppg06.png" width="341" height="171"></td>
-<td align="CENTER"><img src="./ppg07.png" width="341" height="171"></td>
-</tr>
-</table><br>&nbsp;<br>
-<table width="100%">
-<tr>
-<td align="CENTER"><img src="./ppg08.png" width="460" height="543"></td>
-</tr>
-</table><br>&nbsp;<br>
-In the "Png2pdf Options" dialog you have the following choices:
-<ul>
-<li>PDF format version<br>
-You can either produce PDF version 1.2, 1.3 or 1.4. Smaller version
-numbers will be compatible to older PDF viewers, larger version
-numbers require a recent viewer but provide more PDF features.</li>
-<li>Run in make mode<br>
-If make mode is enabled the program checks the modification timestamps
-of source and destination files. A destination file is up to date
-if the file exists and was last modified after the last modification
-of the source file. A conversion is only run for those sources for
-which there is no up-to-date destination file.
-</li>
-<li>Show file names while processing<br>
-The status message can either simply show "running" while a conversion
-is running or show the file name for each file currently processed.
-When processing directories containing many files showing each file name
-will show you that the program is still alive.<br>
-When showing file names a new png2pdf process is started for each
-conversion. If you choose to see the simple "running" status message one
-process is running on the directory doing all the conversions, this
-is faster than starting a new process for each file to convert.
-</li>
-<li>Image interpolation<br>
-This check box sets the image interpolation flag in output files.
-Viewer programs are recommended to do image interpolation, this is
-usefull if small images are scaled up.
-</li>
-<li>Alpha channel handling<br>
-Here you can decide how to handle alpha channel data if such data
-is present in a PNG file.
-<ul>
-<li>Input alpha channel expresses transparency<br>
-Normally you should leave this checkbox turned off because the
-alpha channel expresses opacity.</li>
-<li>Mix against a background color<br>
-You can choose to mix foreground color (the PNG pixel RGB value) against
-the background color depending on the opacity/transparency value of the
-pixel. The background color is contained in the background chunk in
-the PNG file.<br>
-Some PNG files containing an alpha channel do not contain a background chunk,
-so it is up to the user to choose a background color. The
-"Choose&nbsp;background&nbsp;color" entry allows to choose a default
-background color to use if no background chunk is available in the PNG file.
-Just click on the color-view rectangle to select a color.<br>
-If you always want to use the specified background color (you want to
-ignore background chunks from the PNG file) enable the checkbox
-"Prefer&nbsp;specified&nbsp;default&nbsp;color...".
-</li>
-<li>Create image mask<br>
-In addition to mixing -- or instead of mixing -- you can convert
-the alpha channel into an image mask. The normal mask level is
-to paint all opacity&gt;0 pixels and to mask out all opacity=0 pixels.<br>
-Enable "Use&nbsp;inverted&nbsp;mask&nbsp;levels" to paint
-only opacity=full pixels and to mask out all opacity&lt;full pixels.
-</li>
-<li>Write alpha channel to output<br>
-You can also write alpha channel data to PDF output (for PDF version &gt;= 1.4).
-</li>
-</ul>
-Note: Some of these options are not available for all PDF versions.<br>
-Some of the options are exclusive, i.e. you can not use mixing and
-alpha channel writing together (the opacity factors from the alpha
-channel would be applied twice: once in mixing and once by the PDF
-viewer when showing the file).
-</li>
-</ul>
-</p>
-<hr>
-<h2>Running a conversion</h2>
-<p>Use the "Run&nbsp;png2pdf" button from the button bar or the
-"Png2pdf&nbsp;/&nbsp;Run" menu entry to start a conversion.
-<br>&nbsp;<br>
-<table width="100%">
-<tr>
-<td align="CENTER"><img src="./ppg09.png" width="341" height="171"></td>
-<td align="CENTER"><img src="./ppg10.png" width="341" height="171"></td>
-</tr>
-</table><br>&nbsp;<br>
-While the conversion is running the status text color changes to red
-and the text changes to "Running". If you decided to see file names
-the text changes to "Processing&nbsp;...".
-<br>&nbsp;<br>
-<table width="100%">
-<tr>
-<td align="CENTER"><img src="./ppg11.png" width="341" height="171"></td>
-</tr>
-</table><br>&nbsp;<br>
-After all conversions are done the color changes back to green and the
-text changes back to "Ready".
-</p>
-<hr>
-<h2>Exiting the program</h2>
-<p>Use either the "Exit&nbsp;the&nbsp;GUI" button in the button bar or the
-"Png2pdf&nbsp;/&nbsp;Exit" menu entry to exit the program.
-<br>&nbsp;<br>
-<table width="100%">
-<tr>
-<td align="CENTER"><img src="./ppg12.png" width="341" height="171"></td>
-<td align="CENTER"><img src="./ppg13.png" width="341" height="171"></td>
-</tr>
-</table><br>&nbsp;<br>
-</p>
-</body>
-</html>
diff --git a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/style.css b/obsolete/support/png2pdf/Java/Png2PdfGUI/src/style.css
deleted file mode 100644
index 05278836a6..0000000000
--- a/obsolete/support/png2pdf/Java/Png2PdfGUI/src/style.css
+++ /dev/null
@@ -1,241 +0,0 @@
-
-@media screen
-{
- body {
- font-family: serif;
- background-color: white;
- }
- .headertable {
- width:100%;
- }
- .headertdleft {
- text-align:left;
- }
- .headertdright {
- text-align:right;
- }
- .navimenutable {
- text-align: center;
- background-color: yellow;
- }
- .navimenutd {
- }
- a.navimenulink {
- color: red;
- font-family: sans-serif;
- text-decoration: none;
- }
- a.navimenulink:hover {
- color: red;
- font-family: sans-serif;
- text-decoration: underline;
- }
- .navimenucurrent {
- color: red;
- font-family: sans-serif;
- font-weight: bold;
- }
- .footertable {
- background-color: yellow;
- }
- .footertr {
- }
- .footertdleft {
- text-align: left;
- }
- .footertdcenter {
- text-align: center;
- }
- .footertdright {
- text-align: right;
- }
- .h2tdleft {
- text-align: left;
- }
- .h2tdcenter {
- text-align: right;
- }
- .h2tdright {
- text-align: right;
- }
- a.smallotherlink {
- color: blue;
- font-family: sans-serif;
- font-size: small;
- text-decoration: none;
- }
- a.smallotherlink:hover {
- color: blue;
- font-family: sans-serif;
- font-size: small;
- text-decoration: underline;
- }
- .toctable {
- }
- .tocrow {
- }
- .toctd {
- }
- a.toclink {
- color: green;
- font-family: sans-serif;
- font-size: small;
- text-decoration: none;
- }
- a.linkoutside {
- color: blue;
- text-decoration: none;
- }
- a.linkinternal {
- color: green;
- text-decoration: none;
- }
- a.toclink:hover {
- color: green;
- font-family: sans-serif;
- font-size: small;
- text-decoration: underline;
- }
- a.linkoutside:hover {
- color: blue;
- text-decoration: underline;
- }
- a.linkinternal:hover {
- color: green;
- text-decoration: underline;
- }
- .subtitle {
- font-family: sans-serif;
- font-size: small;
- }
- .cmdarg {
- font-style: italic;
- }
- it {
- font-style: italic;
- }
- b {
- font-style: bold;
- }
- h6 {
- font-size: 100%;
- font-weight: bold;
- }
- h5 {
- font-size: 120%;
- font-weight: bold;
- }
- h4 {
- font-size: 144%;
- font-weight: bold;
- }
- h3 {
- font-size: 172%;
- font-weight: bold;
- }
- h2 {
- font-size: 206%
- font-weight: bold;
- }
- h1 {
- font-size: 250%;
- font-weight: bold;
- }
-}
-
-@media print
-{
- @page {
- margin-top: 1.5cm;
- margin-bottom: 1.5cm;
- }
- @page :left {
- margin-left: 1.5cm;
- margin-right: 2.5cm;
- }
- @page :right {
- margin-left: 2.5cm;
- margin-right: 1.5cm;
- }
-
- /* Choose a font suitable for larger texts. */
- body {
- font-family: Garamond, "Times New Roman", Times, serif;
- }
-
- .headertable {
- width:100%;
- }
- .headertdleft {
- text-align:left;
- }
- .headertdright {
- text-align:right;
- }
- .navimenutable {
- text-align: center;
- border-style: double;
- }
- .navimenutd {
- }
- .navimenulink {
- color: red;
- }
- .navimenucurrent {
- font-weight: bold;
- }
- .footertable {
- border-style: double;
- }
- .footertr {
- }
- .footertdleft {
- text-align: left;
- }
- .footertdcenter {
- text-align: center;
- }
- .footertdright {
- text-align: right;
- }
- .h2tdleft {
- text-align: left;
- }
- .h2tdright {
- text-align: right;
- }
- .smallotherlink {
- color: blue;
- font-size: small;
- }
- .toctable {
- }
- .tocrow {
- }
- .toctd {
- }
- .toclink {
- color: green;
- font-size: small;
- text-decoration: none;
- }
- .linkoutside {
- color: blue;
- }
- .linkinternal {
- color: green;
- }
- .subtitle {
- font-size: small;
- }
- .cmdarg {
- font-style: italic;
- }
- it {
- font-style: italic;
- }
- b {
- font-style: bold;
- }
-}
-