diff --git a/ChangeLog b/ChangeLog index 34292ad..2c11d06 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2004-04-28 Pierre-Luc Paour (1.4-b6) + + * Added GeekLog support. + * Fixed updating the album tree after creating an album. + * Slideshow: better feedback when manually moving to another picture. + * Slideshow: fixed picture-switching delay being incorrect after manually + moving to another picture. + * New preference to override background color for slideshow and preview. + * Slideshow: new method for painting information on top of image, text no longer + moves. + * Slideshow: new controller display, similar to iPhoto, with help. + 2004-04-21 Pierre-Luc Paour (1.4-b5) * Added support for Gallery aliases, to use as a handle instead of the @@ -71,7 +83,7 @@ * Fixed a bug in the applet uploader, where added pictures were not shown. * From this version on, the applets are signed with a certificate - authneticated by Thawte. + authenticated by Thawte. This is considered a final candidate for GR 1.3.2. diff --git a/build.xml b/build.xml index fc10930..f51eb24 100644 --- a/build.xml +++ b/build.xml @@ -120,6 +120,9 @@ + + + diff --git a/com/gallery/GalleryRemote/AuthorizePopup.java b/com/gallery/GalleryRemote/AuthorizePopup.java index d213ecf..43d1c4f 100644 --- a/com/gallery/GalleryRemote/AuthorizePopup.java +++ b/com/gallery/GalleryRemote/AuthorizePopup.java @@ -139,7 +139,7 @@ private static class BasicAuthBox extends JDialog implements ActionListener { constr.weightx = 1.0; JButton b; - p.add(b = new JButton(GRI18n.getString(MODULE, "ok"))); + p.add(b = new JButton(GRI18n.getString("Common", "OK"))); b.addActionListener(this); b.setActionCommand("ok"); getRootPane().setDefaultButton(b); @@ -152,7 +152,7 @@ private static class BasicAuthBox extends JDialog implements ActionListener { constr.weightx = 2.0; gb.setConstraints(b, constr); - p.add(b = new JButton(GRI18n.getString(MODULE, "cancel"))); + p.add(b = new JButton(GRI18n.getString("Common", "Cancel"))); b.addActionListener(this); b.setActionCommand("cancel"); constr.weightx = 1.0; diff --git a/com/gallery/GalleryRemote/MainFrame.java b/com/gallery/GalleryRemote/MainFrame.java index b39e4a0..8657239 100644 --- a/com/gallery/GalleryRemote/MainFrame.java +++ b/com/gallery/GalleryRemote/MainFrame.java @@ -69,7 +69,7 @@ public class MainFrame extends JFrame public static final String MODULE = "MainFrame"; public static final String FILE_TYPE = ".grg"; - PreviewFrame previewFrame = null; + public PreviewFrame previewFrame = null; private static final String DIALOGTITLE = "Gallery Remote -- "; @@ -753,6 +753,9 @@ public void newAlbum() { newAlbum.setName(newAlbumName); } + // todo: this is too drastic... + getCurrentGallery().reload(); + Log.log(Log.LEVEL_TRACE, MODULE, "Album '" + newAlbum + "' created."); // there is probably a better way... this is needed to give the UI time to catch up // and load the combo up with the reloaded album list @@ -1844,6 +1847,12 @@ public void movePicturesDown() { public void flushMemory() { thumbnailCache.flushMemory(); previewFrame.flushMemory(); + + for (int i = 0; i < galleries.getSize(); i++) { + Gallery g = (Gallery) galleries.getElementAt(i); + + preloadThumbnails(g.getAllPictures().iterator()); + } } public void preloadThumbnails(Iterator pictures) { diff --git a/com/gallery/GalleryRemote/MoveAlbumDialog.java b/com/gallery/GalleryRemote/MoveAlbumDialog.java index d2af11c..b6d22fb 100644 --- a/com/gallery/GalleryRemote/MoveAlbumDialog.java +++ b/com/gallery/GalleryRemote/MoveAlbumDialog.java @@ -101,9 +101,9 @@ private void jbInit() { jAlbum = new JComboBox(albums); jAlbum.setFont(UIManager.getFont("Label.font")); - jCancel.setText(GRI18n.getString(MODULE, "cancel")); + jCancel.setText(GRI18n.getString("Common", "cancel")); jCancel.setActionCommand("Cancel"); - jOk.setText(GRI18n.getString(MODULE, "OK")); + jOk.setText(GRI18n.getString("Common", "OK")); jOk.setActionCommand("OK"); jAlbumName.setText(GRI18n.getString(MODULE, "moveAlbm", new String[] {album.getName()})); diff --git a/com/gallery/GalleryRemote/NewAlbumDialog.java b/com/gallery/GalleryRemote/NewAlbumDialog.java index 517475e..306b126 100644 --- a/com/gallery/GalleryRemote/NewAlbumDialog.java +++ b/com/gallery/GalleryRemote/NewAlbumDialog.java @@ -106,7 +106,7 @@ private void jbInit() { jAlbum.setSelectedItem(defaultAlbum); } - jCancel.setText(GRI18n.getString(MODULE, "cancel")); + jCancel.setText(GRI18n.getString("Common", "cancel")); jCancel.setActionCommand("Cancel"); jDescription.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED, Color.white, Color.lightGray, Color.darkGray, Color.gray)); jDescription.setLineWrap(true); @@ -115,7 +115,7 @@ private void jbInit() { jGalleryName.setText(GRI18n.getString(MODULE, "createAlbm", new String[] { gallery.toString() })); jName.setFont(UIManager.getFont("Label.font")); jName.setToolTipText(GRI18n.getString(MODULE, "albmNameTip")); - jOk.setText(GRI18n.getString(MODULE, "OK")); + jOk.setText(GRI18n.getString("Common", "OK")); jOk.setActionCommand("OK"); jTitle.setFont(UIManager.getFont("Label.font")); diff --git a/com/gallery/GalleryRemote/PreviewFrame.java b/com/gallery/GalleryRemote/PreviewFrame.java index 3dc689a..77810ab 100755 --- a/com/gallery/GalleryRemote/PreviewFrame.java +++ b/com/gallery/GalleryRemote/PreviewFrame.java @@ -24,6 +24,7 @@ import com.gallery.GalleryRemote.model.Picture; import com.gallery.GalleryRemote.util.GRI18n; import com.gallery.GalleryRemote.util.ImageUtils; +import com.gallery.GalleryRemote.prefs.PreferenceNames; import javax.swing.*; import java.awt.*; @@ -36,7 +37,7 @@ import HTTPClient.TransferListener; -public class PreviewFrame extends javax.swing.JFrame { +public class PreviewFrame extends JFrame implements PreferenceNames { public static final String MODULE = "PreviewFrame"; SmartHashtable imageIcons = new SmartHashtable(); @@ -50,7 +51,6 @@ public class PreviewFrame extends javax.swing.JFrame { public void initComponents() { setTitle(GRI18n.getString(MODULE, "title")); - setIconImage(GalleryRemote._().getMainFrame().getIconImage()); setBounds(GalleryRemote._().properties.getPreviewBounds()); @@ -83,7 +83,7 @@ public void displayPicture(Picture picture, boolean async) { loadPicture = null; //currentPicture = null; - imageLoaded(null, null); + pictureReady(null, null); } else { //String filename = picture.getSource().getPath(); @@ -96,7 +96,7 @@ public void displayPicture(Picture picture, boolean async) { Log.log(Log.LEVEL_TRACE, MODULE, "Cache hit: " + picture); //currentImage = r; //currentPicture = picture; - imageLoaded(r, picture); + pictureReady(r, picture); } else { Log.log(Log.LEVEL_TRACE, MODULE, "Cache miss: " + picture); if (async) { @@ -106,7 +106,7 @@ public void displayPicture(Picture picture, boolean async) { //currentPicture = picture; ImageIcon sizedIcon = getSizedIconForce(picture); if (sizedIcon != null) { - imageLoaded(sizedIcon, picture); + pictureReady(sizedIcon, picture); } } } @@ -120,8 +120,12 @@ public ImageIcon getSizedIconForce(Picture picture) { if (r == null) { synchronized(picture) { if (picture.isOnline()) { + pictureStartDownload(picture); + File f = ImageUtils.download(picture, getRootPane().getSize(), GalleryRemote._().getCore().getMainStatusUpdate(), listener); + pictureStartProcessing(picture); + if (f != null) { r = ImageUtils.load( f.getPath(), @@ -131,6 +135,8 @@ public ImageIcon getSizedIconForce(Picture picture) { return null; } } else { + pictureStartProcessing(picture); + r = ImageUtils.load( picture.getSource().getPath(), getRootPane().getSize(), @@ -150,7 +156,12 @@ public void paintComponent(Graphics g) { //Log.log(Log.LEVEL_TRACE, MODULE, "Painting ImageContentPane..."); //Log.logStack(Log.LEVEL_TRACE, MODULE); - g.setColor(getBackground()); + Color c = GalleryRemote._().properties.getColorProperty(SLIDESHOW_COLOR); + if (c != null) { + g.setColor(c); + } else { + g.setColor(getBackground()); + } g.fillRect(0, 0, getSize().width, getSize().height); //g.clearRect(0, 0, getSize().width, getSize().height); @@ -189,7 +200,7 @@ public void run() { stillRunning = false; if (notify) { - imageLoaded(tmpImage, tmpPicture); + pictureReady(tmpImage, tmpPicture); notify = false; } @@ -304,9 +315,13 @@ public void shrink() { } } - public void imageLoaded(ImageIcon image, Picture picture) { + public void pictureReady(ImageIcon image, Picture picture) { currentImage = image; currentPicture = picture; repaint(); } + + public void pictureStartDownload(Picture picture) {} + + public void pictureStartProcessing(Picture picture) {} } diff --git a/com/gallery/GalleryRemote/SlideshowFrame.java b/com/gallery/GalleryRemote/SlideshowFrame.java index 854d4f8..2fdb01e 100644 --- a/com/gallery/GalleryRemote/SlideshowFrame.java +++ b/com/gallery/GalleryRemote/SlideshowFrame.java @@ -2,6 +2,7 @@ import com.gallery.GalleryRemote.model.Picture; import com.gallery.GalleryRemote.util.DialogUtil; +import com.gallery.GalleryRemote.util.GRI18n; import com.gallery.GalleryRemote.prefs.PreferenceNames; import com.gallery.GalleryRemote.prefs.PropertiesFile; @@ -10,6 +11,7 @@ import javax.swing.plaf.ComponentUI; import javax.swing.plaf.LabelUI; import java.awt.*; +import java.awt.geom.Rectangle2D; import java.awt.event.*; import java.util.List; import java.util.ArrayList; @@ -22,17 +24,42 @@ */ public class SlideshowFrame extends PreviewFrame implements Runnable, PreferenceNames, CancellableTransferListener { public static final String MODULE = "SlideFrame"; + List pictures = null; List wantDownloaded = Collections.synchronizedList(new ArrayList()); Picture userPicture = null; int sleepTime = 3000; boolean running = false; boolean shutdown = false; + long pictureShownTime = 0; + + //JLabel jCaption = new JLabel(); + //JLabel jProgress = new JLabel(); + //JLabel jExtra = new JLabel(); + //JLabel jURL = new JLabel(); + String caption = null; + String progress = null; + String extra = null; + String url = null; + + public static final int STATE_NONE = 0; + public static final int STATE_DOWNLOADING = 1; + public static final int STATE_PROCESSING = 2; + public static final int STATE_NEXTREADY = 3; + + public static final int FEEDBACK_NONE = 0; + public static final int FEEDBACK_HELP = 1; + public static final int FEEDBACK_PREV = 2; + public static final int FEEDBACK_NEXT = 4; + public static final int FEEDBACK_PAUSE_PLAY = 8; + + public int feedback = FEEDBACK_NONE; + + long controllerUntil = 0; + Thread controllerThread = null; + + public static ImageIcon iForward = new ImageIcon(GalleryRemote.class.getResource("/forward.png")); - JLabel jCaption = new JLabel(); - JLabel jProgress = new JLabel(); - JLabel jExtra = new JLabel(); - JLabel jURL = new JLabel(); public SlideshowFrame() { setUndecorated(true); @@ -42,6 +69,10 @@ public SlideshowFrame() { listener = this; ignoreIMFailure = true; + + FeedbackGlassPane glass = new FeedbackGlassPane(); + setGlassPane(glass); + glass.setVisible(true); } public void showSlideshow() { @@ -133,21 +164,29 @@ public void keyPressed(KeyEvent e) { case KeyEvent.VK_DOWN: nextAsync(); break; + case KeyEvent.VK_H: + updateFeedback(FEEDBACK_HELP); + break; case KeyEvent.VK_SPACE: if (running) { running = false; } else { new Thread(SlideshowFrame.this).start(); } + updateFeedback(FEEDBACK_PAUSE_PLAY); - updateProgress(currentPicture); + updateProgress(currentPicture, STATE_NONE); break; } } }); - jCaption.setUI((LabelUI) OutlineLabelUI.createUI(jCaption)); + PreviewFrame.ImageContentPane cp = new PreviewFrame.ImageContentPane(); + setContentPane(cp); + + PropertiesFile pf = GalleryRemote._().properties; + /*jCaption.setUI((LabelUI) OutlineLabelUI.createUI(jCaption)); jProgress.setUI((LabelUI) OutlineLabelUI.createUI(jProgress)); jExtra.setUI((LabelUI) OutlineLabelUI.createUI(jExtra)); jURL.setUI((LabelUI) OutlineLabelUI.createUI(jURL)); @@ -162,8 +201,6 @@ public void keyPressed(KeyEvent e) { jExtra.setFont(jCaption.getFont().deriveFont(Font.BOLD)); jURL.setFont(jCaption.getFont().deriveFont(Font.BOLD)); - PreviewFrame.ImageContentPane cp = new PreviewFrame.ImageContentPane(); - setContentPane(cp); cp.setLayout(new GridBagLayout()); cp.add(new JLabel(), new GridBagConstraints(0, 10, 1, 1, 1.0, 1.0 @@ -173,16 +210,15 @@ public void keyPressed(KeyEvent e) { cp.add(new JLabel(), new GridBagConstraints(2, 20, 1, 1, 1.0, 1.0 , GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); - PropertiesFile pf = GalleryRemote._().properties; addComponent(cp, jProgress, 1, pf.getIntProperty(SLIDESHOW_PROGRESS)); addComponent(cp, jCaption, 2, pf.getIntProperty(SLIDESHOW_CAPTION)); addComponent(cp, jExtra, 3, pf.getIntProperty(SLIDESHOW_EXTRA)); - addComponent(cp, jURL, 4, pf.getIntProperty(SLIDESHOW_URL)); + addComponent(cp, jURL, 4, pf.getIntProperty(SLIDESHOW_URL));*/ sleepTime = pf.getIntProperty(SLIDESHOW_DELAY) * 1000; } - private void addComponent(PreviewFrame.ImageContentPane cp, JLabel c, int mod, int value) { + /*private void addComponent(PreviewFrame.ImageContentPane cp, JLabel c, int mod, int value) { if (value == 0) { return; } @@ -211,7 +247,7 @@ private void addComponent(PreviewFrame.ImageContentPane cp, JLabel c, int mod, i , cons, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); c.setHorizontalAlignment(value % 10); - } + }*/ public void start(ArrayList pictures) { if (GalleryRemote._().properties.getBooleanProperty(SLIDESHOW_RANDOM)) { @@ -227,7 +263,6 @@ public void start(ArrayList pictures) { public void run() { running = true; while (running) { - long time = System.currentTimeMillis(); if (!next(false)) { // the slideshow is over @@ -236,9 +271,9 @@ public void run() { } try { - long sleep = sleepTime - (System.currentTimeMillis() - time); + long sleep; - if (sleep > 0) { + while ((sleep = sleepTime - (System.currentTimeMillis() - pictureShownTime)) > 0) { Thread.sleep(sleep); } } catch (InterruptedException e) { @@ -250,6 +285,7 @@ public void run() { private void previousAsync() { new Thread() { public void run() { + updateFeedback(FEEDBACK_PREV); previous(true); } }.start(); @@ -258,6 +294,7 @@ public void run() { private void nextAsync() { new Thread() { public void run() { + updateFeedback(FEEDBACK_NEXT); next(true); } }.start(); @@ -288,18 +325,18 @@ public boolean next(boolean user) { if (user) { userPicture = picture; } else if (userPicture != null && userPicture != picture) { - // automatic move tying to move away from user-chosen picture + // automatic move trying to move away from user-chosen picture return true; } wantDownloaded.add(picture); - updateProgress(picture); + updateProgress(picture, STATE_NONE); displayPicture(picture, false); // and cache the one after it if (++index < pictures.size() && (imageIcons.get(picture = (Picture) pictures.get(index))) == null) { wantDownloaded.add(picture); - previewLoader.loadPreview(picture, false); + previewLoader.loadPreview(picture, true); } return true; @@ -335,20 +372,20 @@ public boolean previous(boolean user) { } wantDownloaded.add(picture); - updateProgress(picture); + updateProgress(picture, STATE_NONE); displayPicture(picture, false); // and cache the one after it if (--index > 0 && (imageIcons.get(picture = (Picture) pictures.get(index))) == null) { wantDownloaded.add(picture); - previewLoader.loadPreview(picture, false); + previewLoader.loadPreview(picture, true); } return true; } - public void imageLoaded(ImageIcon image, Picture picture) { - Log.log(Log.LEVEL_TRACE, MODULE, "Picture " + picture + " finished loading"); + public void pictureReady(ImageIcon image, Picture picture) { + Log.log(Log.LEVEL_TRACE, MODULE, "Picture " + picture + " ready"); if (picture == userPicture) { userPicture = null; @@ -356,40 +393,80 @@ public void imageLoaded(ImageIcon image, Picture picture) { if (picture != loadPicture) { Log.log(Log.LEVEL_TRACE, MODULE, "We wanted " + loadPicture + ": ignoring"); + updateProgress(loadPicture, STATE_NEXTREADY); return; } if (picture != null) { // todo: captions are not printed outline because they are HTML and that's a fucking mess //jCaption.setText("" + picture.getCaption() + ""); - jCaption.setText(picture.getCaption()); - updateProgress(picture); - String extraFields = picture.getExtraFieldsString(); - if (extraFields != null) { - jExtra.setText(extraFields); - } + //jCaption.setText(picture.getCaption()); + caption = picture.getCaption(); + updateProgress(picture, STATE_NONE); + extra = picture.getExtraFieldsString(); + //if (extraFields != null) { + //jExtra.setText(extraFields); + //} if (picture.isOnline()) { - jURL.setText(picture.safeGetUrlFull().toString()); + //jURL.setText(picture.safeGetUrlFull().toString()); + url = picture.safeGetUrlFull().toString(); } else { - jURL.setText(picture.getSource().toString()); + //jURL.setText(picture.getSource().toString()); + url = picture.getSource().toString(); } } - super.imageLoaded(image, picture); + pictureShownTime = System.currentTimeMillis(); + + super.pictureReady(image, picture); } - private void updateProgress(Picture picture) { - StringBuffer sb = new StringBuffer(); + public void pictureStartDownload(Picture picture) { + if (picture == loadPicture || picture == userPicture) { + updateProgress(picture, STATE_DOWNLOADING); + } + } + + public void pictureStartProcessing(Picture picture) { + if (picture == loadPicture || picture == userPicture) { + updateProgress(picture, STATE_PROCESSING); + } + } + + private void updateProgress(Picture picture, int state) { + if (picture == null) { + return; + } + //StringBuffer sb = new StringBuffer(); + + //sb.append(pictures.indexOf(picture) + 1).append("/").append(pictures.size()); + Object[] params = new Object[] {picture.getName(), + new Integer(pictures.indexOf(picture) + 1), + new Integer(pictures.size())}; + + switch (state) { + case STATE_NONE: + if (! running) { + progress = GRI18n.getString(MODULE, "paused", params); + } else { + progress = GRI18n.getString(MODULE, "showing", params); + } + break; - sb.append(pictures.indexOf(picture) + 1).append("/").append(pictures.size()); + case STATE_DOWNLOADING: + progress = GRI18n.getString(MODULE, "downloading", params); + break; + + case STATE_PROCESSING: + progress = GRI18n.getString(MODULE, "processing", params); + break; - if (imageIcons.get(picture) == null) { - sb.append(" ").append("(downloading)"); - } else if (! running) { - sb.append(" ").append("(paused)"); + case STATE_NEXTREADY: + progress = GRI18n.getString(MODULE, "nextReady", params); + break; } - jProgress.setText(sb.toString()); + repaint(); } public boolean dataTransferred(int transferred, int overall, double kbPerSecond, Picture p) { @@ -410,26 +487,26 @@ public boolean dataTransferred(int transferred, int overall, double kbPerSecond, return true; } - public static class OutlineLabelUI extends BasicLabelUI { - protected static OutlineLabelUI labelUI = new OutlineLabelUI(); + //public static class OutlineLabelUI extends BasicLabelUI { + // protected static OutlineLabelUI labelUI = new OutlineLabelUI(); /*private static Rectangle paintIconR = new Rectangle(); private static Rectangle paintTextR = new Rectangle(); private static Rectangle paintViewR = new Rectangle(); private static Insets paintViewInsets = new Insets(0, 0, 0, 0);*/ - public static ComponentUI createUI(JComponent c) { - return labelUI; - } + // public static ComponentUI createUI(JComponent c) { + // return labelUI; + // } - protected void paintEnabledText(JLabel l, Graphics g, String s, int textX, int textY) { - g.setColor(Color.darkGray); - g.drawString(s,textX + 1, textY + 1); - g.drawString(s,textX - 1, textY + 1); - g.drawString(s,textX + 1, textY - 1); - g.drawString(s,textX - 1, textY - 1); - g.setColor(l.getForeground()); - g.drawString(s, textX, textY); - } + // protected void paintEnabledText(JLabel l, Graphics g, String s, int textX, int textY) { + // g.setColor(Color.darkGray); + // g.drawString(s,textX + 1, textY + 1); + // g.drawString(s,textX - 1, textY + 1); + // g.drawString(s,textX + 1, textY - 1); + // g.drawString(s,textX - 1, textY - 1); + // g.setColor(l.getForeground()); + // g.drawString(s, textX, textY); + // } // todo: captions are not printed outline because they are HTML and that's a fucking mess /*public void paint(Graphics g, JComponent c) { @@ -493,5 +570,194 @@ protected void paintEnabledText(JLabel l, Graphics g, String s, int textX, int t } } }*/ + //} + + public void updateFeedback(int feedback) { + if (feedback != FEEDBACK_NONE) { + controllerUntil = System.currentTimeMillis() + + (feedback == FEEDBACK_HELP?6000: 1500); + + synchronized(this) { + if (controllerThread == null) { + controllerThread = new Thread() { + public void run() { + boolean running = true; + + while (running) { + try { + Thread.sleep(controllerUntil - System.currentTimeMillis()); + synchronized(this) { + if (System.currentTimeMillis() >= controllerUntil) { + running = false; + controllerThread = null; + SlideshowFrame.this.feedback = FEEDBACK_NONE; + repaint(); + } + } + } catch (InterruptedException e) {} + } + } + }; + controllerThread.start(); + } + } + } + + if ((this.feedback & FEEDBACK_HELP) == FEEDBACK_HELP) { + this.feedback = feedback | FEEDBACK_HELP; + } else if (feedback == FEEDBACK_HELP) { + this.feedback |= FEEDBACK_HELP; + } else { + this.feedback = feedback; + } + + repaint(); + } + + public class FeedbackGlassPane extends JComponent { + public void paint(Graphics g) { + if (feedback != FEEDBACK_NONE || controllerUntil > System.currentTimeMillis()) { + paintController(g); + } + + paintInfo(g); + } + + private void paintController(Graphics g) { + Color background = new Color(100, 100, 100, 150); + Color normal = new Color(180, 180, 180, 180); + Color hilight = new Color(255, 255, 255, 180); + + Dimension d = getSize(); + int width = 475; + int height = 150; + int x = d.width / 2 - width / 2; + int y = d.height / 3 * 2 - height / 2; + g.setFont(g.getFont().deriveFont(18.0F)); + FontMetrics fm = g.getFontMetrics(); + + // background + g.setColor(background); + g.fillRoundRect(x - 30, y - 20, width + 60, height + ((feedback & FEEDBACK_HELP) == FEEDBACK_HELP?70:40), 30, 30); + g.setColor(normal); + g.drawRoundRect(x - 30, y - 20, width + 60, height + ((feedback & FEEDBACK_HELP) == FEEDBACK_HELP?70:40), 30, 30); + + // left arrow + g.setColor((feedback & FEEDBACK_PREV) == FEEDBACK_PREV?hilight:normal); + g.fillPolygon(new int[] {x + 100, x + 100, x + 50, x + 50, x, x + 50, x + 50}, + new int[] {y + 60, y + 90, y + 90, y + 125, y + 75, y + 25, y + 60}, 7); + drawText(g, hilight, fm, x + 50, y + 160, GRI18n.getString(MODULE, "controller.left")); + drawText(g, hilight, fm, x + 107, y + 180, GRI18n.getString(MODULE, "controller.mousewheel")); + + x += 115; + + // right arrow + g.setColor((feedback & FEEDBACK_NEXT) == FEEDBACK_NEXT?hilight:normal); + g.fillPolygon(new int[] {x, x, x + 50, x + 50, x + 100, x + 50, x + 50}, + new int[] {y + 60, y + 90, y + 90, y + 125, y + 75, y + 25, y + 60}, 7); + drawText(g, hilight, fm, x + 50, y + 160, GRI18n.getString(MODULE, "controller.right")); + + x += 130; + + // play/pause + g.setColor((feedback & FEEDBACK_PAUSE_PLAY) == FEEDBACK_PAUSE_PLAY?hilight:normal); + if (running) { + g.fillPolygon(new int[] {x, x, x + 100}, + new int[] {y + 10, y + 140, y + 75}, 3); + } else { + g.fillPolygon(new int[] {x, x, x + 30, x + 30}, + new int[] {y + 10, y + 140, y + 140, y + 10}, 4); + g.fillPolygon(new int[] {x + 70, x + 70, x + 100, x + 100}, + new int[] {y + 10, y + 140, y + 140, y + 10}, 4); + } + drawText(g, hilight, fm, x + 50, y + 160, GRI18n.getString(MODULE, "controller.space")); + + x += 130; + + // stop + g.setColor(normal); + g.fillPolygon(new int[] {x, x, x + 30, x + 70, x + 100, x + 100, x + 70, x + 30}, + new int[] {y + 55, y + 95, y + 125, y + 125, y + 95, y + 55, y + 25, y + 25}, 8); + drawText(g, hilight, fm, x + 50, y + 160, GRI18n.getString(MODULE, "controller.escape")); + } + + public void paintInfo(Graphics g) { + PropertiesFile pf = GalleryRemote._().properties; + + paintInfo(g, caption, pf.getIntProperty(SLIDESHOW_CAPTION)); + paintInfo(g, progress, pf.getIntProperty(SLIDESHOW_PROGRESS)); + paintInfo(g, extra, pf.getIntProperty(SLIDESHOW_EXTRA)); + paintInfo(g, url, pf.getIntProperty(SLIDESHOW_URL)); + } + + public void paintInfo(Graphics g, String text, int position) { + if (position == 0) return; + + Dimension d = getSize(); + g.setFont(getFont()); + FontMetrics fm = g.getFontMetrics(); + Rectangle2D bounds = fm.getStringBounds(text, g); + int x; + int y; + int inset = 5; + + switch (position % 10) { + case 2: + default: + x = inset; + break; + + case 0: + x = (int) ((d.width - bounds.getWidth()) / 2); + break; + + case 4: + x = (int) (d.width - bounds.getWidth() - inset); + break; + } + + switch (position / 10) { + case 1: + default: + y = inset; + break; + + case 2: + y = (int) (d.height / 2); + break; + + case 3: + y = d.height - inset; + break; + } + + y += bounds.getHeight(); + + paintOutline(g, text, x, y); + } + + public final Color darkGray = new Color(64, 64, 64, 128); + protected void paintOutline(Graphics g, String s, int textX, int textY) { + g.setColor(darkGray); + g.drawString(s, textX + 1, textY + 1); + g.drawString(s, textX, textY + 1); + g.drawString(s, textX - 1, textY + 1); + g.drawString(s, textX + 1, textY); + g.drawString(s, textX, textY); + g.drawString(s, textX - 1, textY); + g.drawString(s, textX + 1, textY - 1); + g.drawString(s, textX, textY - 1); + g.drawString(s, textX - 1, textY - 1); + g.setColor(Color.white); + g.drawString(s, textX, textY); + } + + private void drawText(Graphics g, Color hilight, FontMetrics fm, int x, int y, String text) { + if ((feedback & FEEDBACK_HELP) != FEEDBACK_HELP) return; + + g.setColor(hilight); + Rectangle2D bounds = fm.getStringBounds(text, g); + g.drawString(text, (int) (x - bounds.getWidth() / 2), y); + } } } diff --git a/com/gallery/GalleryRemote/ThumbnailCache.java b/com/gallery/GalleryRemote/ThumbnailCache.java index a2f8fd1..69500be 100644 --- a/com/gallery/GalleryRemote/ThumbnailCache.java +++ b/com/gallery/GalleryRemote/ThumbnailCache.java @@ -65,10 +65,11 @@ public void run() { Dimension newD = ImageUtils.getSizeKeepRatio( new Dimension(i.getIconWidth(), i.getIconHeight()), GalleryRemote._().properties.getThumbnailSize(), true); - scaled = i.getImage().getScaledInstance(newD.width, newD.height, Image.SCALE_FAST); - - i.getImage().flush(); - i.setImage(scaled); + if (newD != null) { + scaled = i.getImage().getScaledInstance(newD.width, newD.height, Image.SCALE_FAST); + i.getImage().flush(); + i.setImage(scaled); + } } else { i = ImageUtils.load( p.getSource().getPath(), diff --git a/com/gallery/GalleryRemote/model/Gallery.java b/com/gallery/GalleryRemote/model/Gallery.java index d80bf2e..1c0c5ca 100644 --- a/com/gallery/GalleryRemote/model/Gallery.java +++ b/com/gallery/GalleryRemote/model/Gallery.java @@ -53,6 +53,8 @@ public class Gallery extends DefaultTreeModel implements Serializable, Preferenc String pnGalleryUrlString = null; String phpnLoginUrlString = null; String phpnGalleryUrlString = null; + String glLoginUrlString = null; + String glGalleryUrlString = null; String username; String password; String alias; @@ -70,10 +72,11 @@ public class Gallery extends DefaultTreeModel implements Serializable, Preferenc transient private boolean blockWrites = false; transient public boolean cookieLogin = false; - public static String types[] = new String[]{STANDALONE, POSTNUKE, PHPNUKE}; + public static String types[] = new String[]{STANDALONE, POSTNUKE, PHPNUKE, GEEKLOG}; public static final int TYPE_STANDALONE = 0; public static final int TYPE_POSTNUKE = 1; public static final int TYPE_PHPNUKE = 2; + public static final int TYPE_GEEKLOG = 3; public static final int TOSTRING_MAXLEN = 40; @@ -418,7 +421,7 @@ public String getStUrlString() { if (stUrlString != null) { return stUrlString; } else { - return "http://your.host.com/gallery"; + return "http://example.com/gallery"; } } @@ -441,7 +444,7 @@ public String getPnGalleryUrlString() { if (pnGalleryUrlString != null) { return pnGalleryUrlString.toString(); } else { - return "http://your.host.com/modules.php?op=modload&name=gallery&file=index&include=$GALLERYFILE$"; + return "http://example.com/modules.php?op=modload&name=gallery&file=index&include=$GALLERYFILE$"; } } @@ -464,7 +467,7 @@ public String getPnLoginUrlString() { if (pnLoginUrlString != null) { return pnLoginUrlString.toString(); } else { - return "http://your.host.com/user.php?uname=$USERNAME$&pass=$PASSWORD$&module=NS-User&op=login"; + return "http://example.com/user.php?uname=$USERNAME$&pass=$PASSWORD$&module=NS-User&op=login"; } } @@ -487,7 +490,7 @@ public String getPhpnGalleryUrlString() { if (phpnGalleryUrlString != null) { return phpnGalleryUrlString.toString(); } else { - return "http://your.host.com/modules.php?name=gallery&include=$GALLERYFILE$"; + return "http://example.com/modules.php?name=gallery&include=$GALLERYFILE$"; } } @@ -510,7 +513,53 @@ public String getPhpnLoginUrlString() { if (phpnLoginUrlString != null) { return phpnLoginUrlString.toString(); } else { - return "http://your.host.com/modules.php?name=Your_Account&op=login&username=$USERNAME$&user_password=$PASSWORD$"; + return "http://example.com/modules.php?name=Your_Account&op=login&username=$USERNAME$&user_password=$PASSWORD$"; + } + } + + /* GeekLog Gallery URL */ + + public void setGlGalleryUrlString(String urlString) { + if (urlString == null) { + glGalleryUrlString = null; + return; + } + + glGalleryUrlString = reformatUrlString(urlString, false); + + if (!blockWrites && glGalleryUrlString != null) { + GalleryRemote._().properties.setProperty(GL_GALLERY_URL + prefsIndex, glGalleryUrlString); + } + } + + public String getGlGalleryUrlString() { + if (glGalleryUrlString != null) { + return glGalleryUrlString.toString(); + } else { + return "http://example.com/path/to/gallery/$GALLERYFILE$"; + } + } + + /* PostNuke Login URL */ + + public void setGlLoginUrlString(String urlString) { + if (urlString == null) { + glLoginUrlString = null; + return; + } + + glLoginUrlString = reformatUrlString(urlString, false); + + if (!blockWrites && glLoginUrlString != null) { + GalleryRemote._().properties.setProperty(GL_LOGIN_URL + prefsIndex, glLoginUrlString); + } + } + + public String getGlLoginUrlString() { + if (glLoginUrlString != null) { + return glLoginUrlString.toString(); + } else { + return "http://example.com/path/to/geeklog/public_html/users.php?loginname=$USERNAME$&passwd=$PASSWORD$"; } } @@ -528,6 +577,9 @@ public URL getLoginUrl(String galleryFile) { case TYPE_PHPNUKE: return new URL(replace(phpnLoginUrlString, galleryFile)); + case TYPE_GEEKLOG: + return new URL(replace(glLoginUrlString, galleryFile)); + default: throw new RuntimeException("Unknown type: " + type); } @@ -552,6 +604,9 @@ public URL getGalleryUrl(String galleryFile) { case TYPE_PHPNUKE: return new URL(replace(phpnGalleryUrlString, galleryFile)); + case TYPE_GEEKLOG: + return new URL(replace(glGalleryUrlString, galleryFile)); + default: throw new RuntimeException("Unknown type: " + type); } @@ -736,6 +791,13 @@ public void writeToProperties(PropertiesFile p) { if (phpnGalleryUrlString != null) { p.setProperty(PHPN_GALLERY_URL + prefsIndex, phpnGalleryUrlString); } + + if (glLoginUrlString != null) { + p.setProperty(GL_LOGIN_URL + prefsIndex, glLoginUrlString); + } + if (glGalleryUrlString != null) { + p.setProperty(GL_GALLERY_URL + prefsIndex, glGalleryUrlString); + } } public static void removeFromProperties(PropertiesFile p, int n) { @@ -784,6 +846,10 @@ public String toString(boolean disambiguate) { tmp = phpnGalleryUrlString; break; + case TYPE_GEEKLOG: + tmp = glGalleryUrlString; + break; + default: throw new RuntimeException("Unknown type: " + type); } diff --git a/com/gallery/GalleryRemote/prefs/GalleryEditorDialog.java b/com/gallery/GalleryRemote/prefs/GalleryEditorDialog.java index f65a349..7250fb2 100644 --- a/com/gallery/GalleryRemote/prefs/GalleryEditorDialog.java +++ b/com/gallery/GalleryRemote/prefs/GalleryEditorDialog.java @@ -18,22 +18,24 @@ public class GalleryEditorDialog extends JDialog implements ActionListener { public static final String MODULE = "GEdiDlog"; - Gallery gallery; boolean isOK = false; JPanel jMainPanel = new JPanel(); - JLabel jPnGalleryUrlLabel = new JLabel(); JLabel jUsernameLabel = new JLabel(); JLabel jPasswordLabel = new JLabel(); JLabel jTypeLabel = new JLabel(); JLabel jPnLoginUrlLabel = new JLabel(); - JLabel jStandaloneUrlLabel = new JLabel(); + JLabel jPnGalleryUrlLabel = new JLabel(); JLabel jPnHelpLabel = new JLabel(); + JLabel jStandaloneUrlLabel = new JLabel(); JLabel jStandaloneHelpLabel = new JLabel(); JLabel jPhpnLoginUrlLabel = new JLabel(); JLabel jPhpnGalleryUrlLabel = new JLabel(); JLabel jPhpnHelpLabel = new JLabel(); + JLabel jGlLoginUrlLabel = new JLabel(); + JLabel jGlGalleryUrlLabel = new JLabel(); + JLabel jGlHelpLabel = new JLabel(); JLabel jAliasLabel = new JLabel(); JComboBox jType = new JComboBox(); @@ -52,6 +54,10 @@ public class GalleryEditorDialog extends JDialog implements ActionListener { JTextField jPhpnLoginUrl = new JTextField(); JTextField jPhpnGalleryUrl = new JTextField(); + JPanel jGeekLog = new JPanel(); + JTextField jGlLoginUrl = new JTextField(); + JTextField jGlGalleryUrl = new JTextField(); + JPanel jStandalone = new JPanel(); JTextField jStandaloneUrl = new JTextField(); @@ -94,9 +100,9 @@ private void jbInit() { jType.setEditable(false); jType.setModel(new DefaultComboBoxModel(Gallery.types)); - jOk.setText(GRI18n.getString(MODULE, "OK")); + jOk.setText(GRI18n.getString("Common", "OK")); jOk.setActionCommand("OK"); - jCancel.setText(GRI18n.getString(MODULE, "cancel")); + jCancel.setText(GRI18n.getString("Common", "Cancel")); jCancel.setActionCommand("Cancel"); jButtonPanel.setLayout(gridLayout1); gridLayout1.setHgap(5); @@ -125,6 +131,15 @@ private void jbInit() { jPhpnHelpLabel.setText(GRI18n.getString(MODULE, "phpNukeHelp")); jPhpnHelpLabel.setVerticalAlignment(SwingConstants.TOP); + jGeekLog.setLayout(new GridBagLayout()); + jGlLoginUrlLabel.setText(GRI18n.getString(MODULE, "glLogin")); + jGlLoginUrlLabel.setVerticalAlignment(SwingConstants.TOP); + jGlLoginUrlLabel.setVerticalTextPosition(SwingConstants.CENTER); + jGlGalleryUrlLabel.setText(GRI18n.getString(MODULE, "gllryUrl")); + jGlHelpLabel.setPreferredSize(new Dimension(300, 80)); + jGlHelpLabel.setText(GRI18n.getString(MODULE, "glHelp")); + jGlHelpLabel.setVerticalAlignment(SwingConstants.TOP); + this.getContentPane().add(jMainPanel, BorderLayout.CENTER); jMainPanel.add(jStylePanel, new GridBagConstraints(0, 4, 4, 1, 1.0, 1.0 , GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0)); @@ -173,6 +188,18 @@ private void jbInit() { jPHPNuke.add(jPhpnHelpLabel, new GridBagConstraints(0, 2, 2, 1, 1.0, 1.0 , GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 20, 0, 0), 0, 0)); + jStylePanel.add(jGeekLog, Gallery.types[Gallery.TYPE_GEEKLOG]); + jGeekLog.add(jGlLoginUrlLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0 + , GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 20, 0, 5), 0, 0)); + jGeekLog.add(jGlLoginUrl, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0 + , GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 0), 0, 0)); + jGeekLog.add(jGlGalleryUrlLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0 + , GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 20, 0, 5), 0, 0)); + jGeekLog.add(jGlGalleryUrl, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0 + , GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 0), 0, 0)); + jGeekLog.add(jGlHelpLabel, new GridBagConstraints(0, 2, 2, 1, 1.0, 1.0 + , GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 20, 0, 0), 0, 0)); + jStylePanel.add(jStandalone, Gallery.types[Gallery.TYPE_STANDALONE]); jStandalone.add(jStandaloneUrlLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0 , GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 20, 5, 5), 0, 0)); @@ -204,6 +231,9 @@ public void resetUIState() { jPhpnGalleryUrl.setText(gallery.getPhpnGalleryUrlString()); jPhpnLoginUrl.setText(gallery.getPhpnLoginUrlString()); + + jGlGalleryUrl.setText(gallery.getGlGalleryUrlString()); + jGlLoginUrl.setText(gallery.getGlLoginUrlString()); } public void readUIState() { @@ -220,6 +250,9 @@ public void readUIState() { gallery.setPhpnLoginUrlString(jPhpnLoginUrl.getText()); gallery.setPhpnGalleryUrlString(jPhpnGalleryUrl.getText()); + + gallery.setGlLoginUrlString(jGlLoginUrl.getText()); + gallery.setGlGalleryUrlString(jGlGalleryUrl.getText()); } public void actionPerformed(ActionEvent e) { diff --git a/com/gallery/GalleryRemote/prefs/GalleryProperties.java b/com/gallery/GalleryRemote/prefs/GalleryProperties.java index 372a42e..da87ea7 100644 --- a/com/gallery/GalleryRemote/prefs/GalleryProperties.java +++ b/com/gallery/GalleryRemote/prefs/GalleryProperties.java @@ -170,6 +170,25 @@ public void setDimensionProperty(String key, Dimension d) { setProperty(key, ((int) d.getWidth()) + "," + ((int) d.getHeight())); } + public Color getColorProperty(String key) { + String value = getProperty(key); + if (value == null) return null; + + StringTokenizer st; + if (value != null && (st = new StringTokenizer(value, ",")).countTokens() == 3) { + return new Color(Integer.parseInt(st.nextToken()), + Integer.parseInt(st.nextToken()), + Integer.parseInt(st.nextToken())); + } else { + Log.log(Log.LEVEL_ERROR, MODULE, "Parameter " + key + " is missing or malformed (should be red,green,blue)"); + return null; + } + } + + public void setColorProperty(String key, Color c) { + setProperty(key, ((int) c.getRed()) + "," + ((int) c.getGreen()) + "," + ((int) c.getBlue())); + } + /** * getLoadLastMRU returns whether we should automatically load the * last MRU file when GR starts. If this is true then we should try diff --git a/com/gallery/GalleryRemote/prefs/PreferenceNames.java b/com/gallery/GalleryRemote/prefs/PreferenceNames.java index 5ddc975..1ae96aa 100644 --- a/com/gallery/GalleryRemote/prefs/PreferenceNames.java +++ b/com/gallery/GalleryRemote/prefs/PreferenceNames.java @@ -39,10 +39,13 @@ public interface PreferenceNames { public static final String STANDALONE = "Standalone"; public static final String POSTNUKE = "PostNuke"; public static final String PHPNUKE = "PHPNuke"; + public static final String GEEKLOG = "GeekLog"; public static final String PN_GALLERY_URL = "pnGalleryUrl."; public static final String PN_LOGIN_URL = "pnLoginUrl."; public static final String PHPN_GALLERY_URL = "phpnGalleryUrl."; public static final String PHPN_LOGIN_URL = "phpnLoginUrl."; + public static final String GL_GALLERY_URL = "glGalleryUrl."; + public static final String GL_LOGIN_URL = "glLoginUrl."; public static final String ALIAS = "alias."; // Proxy panel @@ -63,6 +66,7 @@ public interface PreferenceNames { public static final String SLIDESHOW_MAX_PICTURES = "slideshowMaxPictures"; public static final String SLIDESHOW_RECURSIVE = "slideshowRecursive"; public static final String SLIDESHOW_NOSTRETCH = "slideshowNoStretch"; + public static final String SLIDESHOW_COLOR = "slideshowColor"; // Other public static final String SUPPRESS_WARNING_IM = "suppressWarningIM"; diff --git a/com/gallery/GalleryRemote/prefs/PreferencesDialog.java b/com/gallery/GalleryRemote/prefs/PreferencesDialog.java index 3d662b3..c37b1f0 100644 --- a/com/gallery/GalleryRemote/prefs/PreferencesDialog.java +++ b/com/gallery/GalleryRemote/prefs/PreferencesDialog.java @@ -103,13 +103,13 @@ private void jbInit() throws Exception { jPanels.setLayout(jPanelsLayout); this.setTitle(GRI18n.getString(MODULE, "title")); jOK.setMnemonic('0'); - jOK.setText(GRI18n.getString(MODULE, "OK")); + jOK.setText(GRI18n.getString("Common", "OK")); jOK.setActionCommand("OK"); jPanel2.setLayout(gridLayout1); jRevert.setToolTipText(GRI18n.getString(MODULE, "revertTip")); jRevert.setText(GRI18n.getString(MODULE, "revert")); jRevert.setActionCommand("revert"); - jCancel.setText(GRI18n.getString(MODULE, "cancel")); + jCancel.setText(GRI18n.getString("Common", "Cancel")); jCancel.setActionCommand("cancel"); gridLayout1.setHgap(5); this.getContentPane().add(jPanel1, BorderLayout.CENTER); diff --git a/com/gallery/GalleryRemote/prefs/SlideshowPanel.java b/com/gallery/GalleryRemote/prefs/SlideshowPanel.java index 6290edc..07d4584 100644 --- a/com/gallery/GalleryRemote/prefs/SlideshowPanel.java +++ b/com/gallery/GalleryRemote/prefs/SlideshowPanel.java @@ -1,6 +1,10 @@ package com.gallery.GalleryRemote.prefs; import com.gallery.GalleryRemote.util.GRI18n; +import com.gallery.GalleryRemote.util.ColorWellButton; +import com.gallery.GalleryRemote.GalleryRemote; +import com.gallery.GalleryRemote.GalleryRemoteCore; +import com.gallery.GalleryRemote.MainFrame; import javax.swing.*; import java.awt.*; @@ -15,7 +19,6 @@ public class SlideshowPanel extends PreferencePanel implements PreferenceNames { public static final String MODULE = "SlidePa"; - JLabel icon = new JLabel(GRI18n.getString(MODULE, "icon")); JPanel progressionPanel = new JPanel(); @@ -28,7 +31,8 @@ public class SlideshowPanel extends PreferencePanel implements PreferenceNames { JLabel caption = new JLabel(); JLabel extra = new JLabel(); JLabel url = new JLabel(); - JPanel performancePanel = new JPanel(); + JCheckBox jOverride = new JCheckBox(); + JPanel apperancePanel = new JPanel(); JComboBox jProgress; JComboBox jCaption; JComboBox jExtra; @@ -37,6 +41,7 @@ public class SlideshowPanel extends PreferencePanel implements PreferenceNames { JCheckBox jRandom = new JCheckBox(); JCheckBox jNoStretch = new JCheckBox(); JPanel spacerPanel1 = new JPanel(); + ColorWellButton jBackgroundColor = new ColorWellButton(Color.red); public JLabel getIcon() { return icon; @@ -52,6 +57,9 @@ public void readProperties(PropertiesFile props) { jRandom.setSelected(props.getBooleanProperty(SLIDESHOW_RANDOM)); jNoStretch.setSelected(props.getBooleanProperty(SLIDESHOW_NOSTRETCH)); jDelay.setText("" + props.getIntProperty(SLIDESHOW_DELAY)); + Color color = props.getColorProperty(SLIDESHOW_COLOR); + jOverride.setSelected(color != null); + jBackgroundColor.setSelectedColor(color); jProgress.setEnabled(! props.isOverridden(SLIDESHOW_PROGRESS)); jCaption.setEnabled(! props.isOverridden(SLIDESHOW_CAPTION)); @@ -64,6 +72,10 @@ public void readProperties(PropertiesFile props) { } public void writeProperties(PropertiesFile props) { + if (jNoStretch.isSelected() != props.getBooleanProperty(SLIDESHOW_NOSTRETCH)) { + GalleryRemote._().getCore().flushMemory(); + } + props.setIntProperty(SLIDESHOW_PROGRESS, ((LocationItem) jProgress.getSelectedItem()).id); props.setIntProperty(SLIDESHOW_CAPTION, ((LocationItem) jCaption.getSelectedItem()).id); props.setIntProperty(SLIDESHOW_EXTRA, ((LocationItem) jExtra.getSelectedItem()).id); @@ -73,6 +85,16 @@ public void writeProperties(PropertiesFile props) { props.setBooleanProperty(SLIDESHOW_RANDOM, jRandom.isSelected()); props.setBooleanProperty(SLIDESHOW_NOSTRETCH, jNoStretch.isSelected()); props.setIntProperty(SLIDESHOW_DELAY, Integer.parseInt(jDelay.getText())); + + if (jOverride.isSelected()) { + props.setColorProperty(SLIDESHOW_COLOR, jBackgroundColor.getSelectedColor()); + } else { + props.remove(SLIDESHOW_COLOR); + } + GalleryRemoteCore core = GalleryRemote._().getCore(); + if (core instanceof MainFrame) { + ((MainFrame) core).previewFrame.repaint(); + } } public void buildUI() { @@ -107,10 +129,10 @@ private void jbInit() { locationPanel.setBorder( new TitledBorder(BorderFactory.createEtchedBorder(Color.white, new Color(148, 145, 140)), GRI18n.getString(MODULE, "locationTitle"))); - performancePanel.setLayout(new GridBagLayout()); - performancePanel.setBorder( + apperancePanel.setLayout(new GridBagLayout()); + apperancePanel.setBorder( new TitledBorder(BorderFactory.createEtchedBorder(Color.white, new Color(148, 145, 140)), - GRI18n.getString(MODULE, "performanceTitle"))); + GRI18n.getString(MODULE, "appearanceTitle"))); delay.setText(GRI18n.getString(MODULE, "delay")); delay.setLabelFor(jDelay); @@ -136,12 +158,13 @@ private void jbInit() { jLowRez.setText(GRI18n.getString(MODULE, "lowRez")); jLowRez.setToolTipText(GRI18n.getString(MODULE, "lowRezHelp")); + jOverride.setText(GRI18n.getString(MODULE, "backgroundColor")); this.add(progressionPanel, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0 ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); this.add(locationPanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0 ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); - this.add(performancePanel, new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0 + this.add(apperancePanel, new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0 ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); this.add(spacerPanel, new GridBagConstraints(0, 3, 1, 1, 1.0, 1.0 ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); @@ -151,19 +174,25 @@ private void jbInit() { progressionPanel.add(jDelay, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0 ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); progressionPanel.add(delayHelp, new GridBagConstraints(0, 1, 2, 1, 0.0, 0.0 - ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); - JPanel jRandomNoStretch = new JPanel(); - jRandomNoStretch.add(jRandom); - jRandomNoStretch.add(jNoStretch); - progressionPanel.add(jRandomNoStretch, new GridBagConstraints(0, 2, 2, 1, 0.0, 0.0 + ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 10, 0, 0), 0, 0)); + //JPanel jRandomNoStretch = new JPanel(); + //jRandomNoStretch.add(jRandom); + //jRandomNoStretch.add(jNoStretch); + progressionPanel.add(jRandom, new GridBagConstraints(0, 2, 2, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); //progressionPanel.add(jNoStretch, new GridBagConstraints(0, 3, 2, 1, 1.0, 0.0 // ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); - performancePanel.add(jLowRez, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0 - ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); - performancePanel.add(spacerPanel1, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0 - ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); + apperancePanel.add(jLowRez, new GridBagConstraints(0, 0, 2, 1, 1.0, 0.0 + ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); + apperancePanel.add(jNoStretch, new GridBagConstraints(0, 1, 2, 1, 0.0, 0.0 + ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); + apperancePanel.add(jOverride, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0 + ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); + apperancePanel.add(jBackgroundColor, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0 + ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 0), 0, 0)); + //apperancePanel.add(spacerPanel1, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0 + // ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); locationPanel.add(progress, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0 ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0)); diff --git a/com/gallery/GalleryRemote/prefs/URLPanel.java b/com/gallery/GalleryRemote/prefs/URLPanel.java index 9ac5571..afbf9a4 100644 --- a/com/gallery/GalleryRemote/prefs/URLPanel.java +++ b/com/gallery/GalleryRemote/prefs/URLPanel.java @@ -14,6 +14,8 @@ import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseAdapter; /** * Created by IntelliJ IDEA. @@ -86,6 +88,15 @@ private void jbInit() { jGalleries.setCellRenderer(new GalleryCellRenderer()); jGalleries.addListSelectionListener(this); + jGalleries.addMouseListener(new MouseAdapter() { + public void mouseClicked(MouseEvent e) { + if (e.getClickCount() == 2) { + int index = jGalleries.locationToIndex(e.getPoint()); + modifyGallery((Gallery) jGalleries.getModel().getElementAt(index)); + } + } + }); + if (GalleryRemote._().getCore().getGalleries().getSize() > 0) { jGalleries.setSelectedIndex(0); } @@ -106,16 +117,7 @@ public void actionPerformed(ActionEvent e) { Log.log(Log.LEVEL_INFO, MODULE, "Command selected " + cmd + " Gallery: " + g); if (cmd.equals("Modify")) { - GalleryEditorDialog ged = new GalleryEditorDialog(dialog, g); - - if (ged.isOK()) { - //jGalleries.repaint(); - int i = GalleryRemote._().getCore().getGalleries().getIndexOf(g); - GalleryRemote._().getCore().getGalleries().removeElementAt(i); - GalleryRemote._().getCore().getGalleries().insertElementAt(g, i); - - Gallery.uncacheAmbiguousUrl(); - } + modifyGallery(g); } else if (cmd.equals("New")) { Gallery newG = new Gallery(GalleryRemote._().getCore().getMainStatusUpdate()); if (GalleryRemote._().getCore() instanceof TreeModelListener) { @@ -159,6 +161,19 @@ public void actionPerformed(ActionEvent e) { } } + private void modifyGallery(Gallery g) { + GalleryEditorDialog ged = new GalleryEditorDialog(dialog, g); + + if (ged.isOK()) { + //jGalleries.repaint(); + int i = GalleryRemote._().getCore().getGalleries().getIndexOf(g); + GalleryRemote._().getCore().getGalleries().removeElementAt(i); + GalleryRemote._().getCore().getGalleries().insertElementAt(g, i); + + Gallery.uncacheAmbiguousUrl(); + } + } + public void resetUIState() { Gallery selectedGallery = (Gallery) jGalleries.getSelectedValue(); @@ -175,6 +190,9 @@ public void resetUIState() { } else if (selectedGallery.getType() == Gallery.TYPE_PHPNUKE) { sb.append(GRI18n.getString(MODULE, "phpnLoginURL")).append(selectedGallery.getPhpnLoginUrlString()).append("
"); sb.append(GRI18n.getString(MODULE, "phpnGllryURL")).append(selectedGallery.getPhpnGalleryUrlString()).append("
"); + } else if (selectedGallery.getType() == Gallery.TYPE_GEEKLOG) { + sb.append(GRI18n.getString(MODULE, "glLoginURL")).append(selectedGallery.getGlLoginUrlString()).append("
"); + sb.append(GRI18n.getString(MODULE, "glGllryURL")).append(selectedGallery.getGlGalleryUrlString()).append("
"); } String username = selectedGallery.getUsername(); @@ -188,8 +206,8 @@ public void resetUIState() { jModify.setEnabled(true); jDelete.setEnabled(true); } else { - jModify.setEnabled(true); - jDelete.setEnabled(true); + jModify.setEnabled(false); + jDelete.setEnabled(false); } jDetails.setText(sb.toString()); diff --git a/com/gallery/GalleryRemote/resources/GRResources.properties b/com/gallery/GalleryRemote/resources/GRResources.properties index d570574..933d5fc 100644 --- a/com/gallery/GalleryRemote/resources/GRResources.properties +++ b/com/gallery/GalleryRemote/resources/GRResources.properties @@ -67,12 +67,10 @@ GEdiDlog.type = Gallery Type GEdiDlog.typeTip = Use Standalone when your Gallery is not embedded inside a Content \ Management System (the default). If it is embedded, pick the CMS \ it's wrapped in. -GEdiDlog.OK = OK -GEdiDlog.cancel = Cancel GEdiDlog.stndAln = Gallery URL GEdiDlog.stndAlnHlp = The Gallery URL is the URL users would use to connect to your Gallery. -GEdiDlog.pnLogin = PostNuke Login URL GEdiDlog.gllryUrl = Gallery Module URL +GEdiDlog.pnLogin = PostNuke Login URL GEdiDlog.pnHelp = Where $USERNAME$ and $PASSWORD$ will be replaced when Gallery \ Remote tries to log in by the username and password you enter above \ and $GALLERYFILE$ is replaced with the PHP file Gallery Remote uses \ @@ -88,6 +86,12 @@ GEdiDlog.phpNukeHelp = Where $USERNAME$ and $PASSWORD$ will The name parameter is the PHPNuke module name of your gallery; set it \ accordingly.
\ This functionality is only available with Gallery 1.3.5 (beta 10) and later. +GEdiDlog.glLogin = GeekLog Login URL +GEdiDlog.glHelp = Where $USERNAME$ and $PASSWORD$ will be replaced when Gallery \ + Remote tries to log in by the username and password you enter above \ + and $GALLERYFILE$ is replaced with the PHP file Gallery Remote uses \ + to communicate with Gallery (usually gallery_remote2.php).
\ + This functionality is only available with Gallery 1.3.5 (beta 10) and later. GEdiDlog.alias = Alias GEdiDlog.aliasTip = A short name to describe the Gallery.
It will be used in Gallery Remote to display a short \ name for the Gallery.
Leave empty to use the URL. @@ -121,7 +125,7 @@ GeneralPa.lang = Language GeneralPa.langTitle = Language #Slideshow panel -SlidePa.icon=Slideshow +SlidePa.icon=Slideshow/Preview SlidePa.locationItem.0=Don't show SlidePa.locationItem.12=Top left SlidePa.locationItem.10=Top center @@ -133,10 +137,9 @@ SlidePa.locationItem.32=Bottom left SlidePa.locationItem.30=Bottom center SlidePa.locationItem.34=Bottom right SlidePa.delay=Delay (sec) -SlidePa.delayHelp=Delay in seconds between pictures (if downloading takes longer, the wait will be longer) -SlidePa.delayDesc=Select 0 to disable automatic slideshow.
\ - Use the space bar to toggle between automatic and manual slideshow.
\ - Use arrow keys and the mouse wheel to control the slideshow and escape to exit. +SlidePa.delayHelp=Delay in seconds between pictures (if downloading takes longer, the wait will be longer)
\ + Select 0 to disable automatic slideshow. +SlidePa.delayDesc=Press the 'h' key during the slideshow for help SlidePa.progress=Progress SlidePa.progressHelp=Location of the progress meter SlidePa.caption=Caption @@ -153,15 +156,14 @@ SlidePa.noStretch=Don't stretch small pictures SlidePa.noStretchHelp=Don't resize small pictures to fit screen size, to avoid distorting them SlidePa.progressionTitle=Slideshow progression SlidePa.locationTitle=Location of text info -SlidePa.performanceTitle=Performance +SlidePa.appearanceTitle=Appearance +SlidePa.backgroundColor=Override background Color #PrefsDlog module PrefsDlog.title = Gallery Remote preferences -PrefsDlog.OK = OK PrefsDlog.revertTip = Revert this panel to its state before current changes. If the button is disabled, all or part of the changes in this panel cannot be reverted. PrefsDlog.revert = Revert -PrefsDlog.cancel = Cancel #ProxyPa module @@ -261,9 +263,7 @@ AuthorizePopup.authScheme = Authentication Scheme: {0} AuthorizePopup.authreq = Authorization Request AuthorizePopup.username = Username: AuthorizePopup.passwd = Password: -AuthorizePopup.ok = OK AuthorizePopup.clear = Clear -AuthorizePopup.cancel = Cancel #Droplist module @@ -354,11 +354,9 @@ GalComm2.fixCorruptedUrl = gallery_remote2.php?cmd=move-album&protocol_version=2 #NewAlbum module NewAlbum.title = New Album NewAlbum.rootAlbmTitle = Gallery main page -NewAlbum.cancel = Cancel NewAlbum.albmNameTip = What do you want to name this album? The name cannot contain any \ of the following characters: \\ / * ? " ' & \\u | . + # or spaces. \ Those characters will be ignored in your new album name. -NewAlbum.OK = OK NewAlbum.createAlbm = Creating a new album on Gallery {0} NewAlbum.parentAlbm = Parent album NewAlbum.albmTitle = Album title @@ -369,8 +367,6 @@ NewAlbum.albmDesc = Album description #MoveAlbum module MoveAlbum.title = Move Album MoveAlbum.rootAlbmTitle = Gallery main page -MoveAlbum.cancel = Cancel -MoveAlbum.OK = OK MoveAlbum.moveAlbm = Moving album {0} to inside another album MoveAlbum.parentAlbm = Move to @@ -433,6 +429,7 @@ PreviewFrame.title = Preview #StatusBar module StatusBar.Error = Error + #ThumbCache module ThumbCache.loadThmb = Loading thumbnails ThumbCache.thmbLoaded = Thumbnails loaded @@ -470,7 +467,6 @@ ImageUtils.down.end = Finished downloading {0} ImageUtils.down.fail = Downloading failed ImageUtils.down.progress = Downloading {0}: {1, number, integer} / {2, number, integer}kB ({3, number, integer}kB/s) ImageUtils.warningTitle=Warning -ImageUtils.warningOK=OK ImageUtils.warningDontShow=Don't display this warning again ImageUtils.warningTextIM=An optional part of Gallery Remote, ImageMagick, could not be found
\ or is malfunctioning. Gallery Remote will not be able to resize images before
\ @@ -497,4 +493,25 @@ AppletMini.pictures = List of pictures to upload (drag and drop or click Add Pic AppletSlideshow.Start = Start slideshow AppletSlideshow.Disabled = If some of the options above are greyed-out, the \ administrator of this gallery has forced the corresponding settings. -AppletSlideshow.emptyAlbum = There are no pictures to show in this album. Use the navigation menu at the top to go back to the album view. \ No newline at end of file +AppletSlideshow.emptyAlbum = There are no pictures to show in this album. Use the navigation menu at the top to go back to the album view. + + +# SlideFrame +SlideFrame.showing = Showing {0} ({1, number, integer} / {2, number, integer}) +SlideFrame.nextReady = Showing {0} ({1, number, integer} / {2, number, integer}), next picture ready +SlideFrame.paused = Showing {0} ({1, number, integer} / {2, number, integer}) (paused) +SlideFrame.downloading = Downloading picture {0} ({1, number, integer} / {2, number, integer}) +SlideFrame.processing = Processing picture {0} ({1, number, integer} / {2, number, integer}) +SlideFrame.controller.left = Left arrow +SlideFrame.controller.right = Right arrow +SlideFrame.controller.mousewheel = Mouse wheel +SlideFrame.controller.space = Space bar +SlideFrame.controller.escape = Escape + + +# ColorWell +ColorWell.colorChooserTitle = Pick color + +# Common +Common.OK = OK +Common.Cancel = Cancel \ No newline at end of file diff --git a/com/gallery/GalleryRemote/util/ColorWellButton.java b/com/gallery/GalleryRemote/util/ColorWellButton.java new file mode 100644 index 0000000..8553ab8 --- /dev/null +++ b/com/gallery/GalleryRemote/util/ColorWellButton.java @@ -0,0 +1,164 @@ +/* + * Gallery Remote - a File Upload Utility for Gallery + * + * Gallery - a web based photo album viewer and editor + * Copyright (C) 2000-2004 Bharat Mediratta + * + * ColorWellButton.java - Shows color chooser when clicked + * + * Copyright (C) 2002 Slava Pestov + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.gallery.GalleryRemote.util; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class ColorWellButton extends JButton { + public static final String MODULE = "ColorWell"; + + public ColorWellButton(Color color) { + setIcon(new ColorWell(color)); + setMargin(new Insets(2, 2, 2, 2)); + addActionListener(new ActionHandler()); + } + + public Color getSelectedColor() { + return ((ColorWell) getIcon()).color; + } + + public void setSelectedColor(Color color) { + ((ColorWell) getIcon()).color = color; + repaint(); + } + + static class ColorWell implements Icon { + Color color; + + ColorWell(Color color) { + this.color = color; + } + + public int getIconWidth() { + return 35; + } + + public int getIconHeight() { + return 10; + } + + public void paintIcon(Component c, Graphics g, int x, int y) { + if (color == null) + return; + + g.setColor(color); + g.fillRect(x, y, getIconWidth(), getIconHeight()); + g.setColor(color.darker()); + g.drawRect(x, y, getIconWidth() - 1, getIconHeight() - 1); + } + } + + class ActionHandler implements ActionListener { + public void actionPerformed(ActionEvent evt) { + Frame parent = DialogUtil.findParentWindow(ColorWellButton.this); + JDialog dialog; + if (parent != null) { + dialog = new ColorPickerDialog(parent, + GRI18n.getString(MODULE, "colorChooserTitle"), + true); + } else { + dialog = new ColorPickerDialog(JOptionPane.getFrameForComponent(ColorWellButton.this), + GRI18n.getString(MODULE, "colorChooserTitle"), + true); + } + dialog.pack(); + dialog.show(); + } + } + + /** + * Replacement for the color picker dialog provided with Swing. This version + * supports dialog as well as frame parents. + * + * @since jEdit 4.1pre7 + */ + private class ColorPickerDialog extends JDialog implements ActionListener { + public ColorPickerDialog(Frame parent, String title, boolean modal) { + super(parent, title, modal); + + init(); + } + + public ColorPickerDialog(Dialog parent, String title, boolean modal) { + super(parent, title, modal); + + getContentPane().setLayout(new BorderLayout()); + + init(); + } + + public void ok() { + Color c = chooser.getColor(); + if (c != null) + setSelectedColor(c); + setVisible(false); + } + + public void cancel() { + setVisible(false); + } + + public void actionPerformed(ActionEvent evt) { + if (evt.getSource() == ok) + ok(); + else + cancel(); + } + + private JColorChooser chooser; + private JButton ok; + private JButton cancel; + + private void init() { + Color c = getSelectedColor(); + if (c == null) + chooser = new JColorChooser(); + else + chooser = new JColorChooser(c); + + getContentPane().add(BorderLayout.CENTER, chooser); + + Box buttons = new Box(BoxLayout.X_AXIS); + buttons.add(Box.createGlue()); + + ok = new JButton(GRI18n.getString("Common", "OK")); + ok.addActionListener(this); + buttons.add(ok); + buttons.add(Box.createHorizontalStrut(6)); + getRootPane().setDefaultButton(ok); + cancel = new JButton(GRI18n.getString("Common", "Cancel")); + cancel.addActionListener(this); + buttons.add(cancel); + buttons.add(Box.createGlue()); + + getContentPane().add(BorderLayout.SOUTH, buttons); + pack(); + setLocationRelativeTo(getParent()); + } + } +} diff --git a/com/gallery/GalleryRemote/util/ImageUtils.java b/com/gallery/GalleryRemote/util/ImageUtils.java index 8391c63..19f4e9e 100644 --- a/com/gallery/GalleryRemote/util/ImageUtils.java +++ b/com/gallery/GalleryRemote/util/ImageUtils.java @@ -333,75 +333,79 @@ public static File resizeJava(String filename, Dimension d) { new Dimension(rim.getWidth(), rim.getHeight()), d, true); - Image scaled = rim.getScaledInstance(newD.width, newD.height, Image.SCALE_SMOOTH); - //ImageObserver imageObserver = GalleryRemote._().getMainFrame(); - ImageObserver imageObserver = null; - BufferedImage scaledB = new BufferedImage(scaled.getWidth(imageObserver), scaled.getHeight(imageObserver), rim.getType()); - scaledB.getGraphics().drawImage(scaled, 0, 0, imageObserver); - - /*System.out.println("*** Original"); - IIOMetadata metadata = image.getMetadata(); - String names[] = metadata.getMetadataFormatNames(); - for (int i = 0; i < names.length; i++) { + if (newD != null) { + Image scaled = rim.getScaledInstance(newD.width, newD.height, Image.SCALE_SMOOTH); + //ImageObserver imageObserver = GalleryRemote._().getMainFrame(); + ImageObserver imageObserver = null; + BufferedImage scaledB = new BufferedImage(scaled.getWidth(imageObserver), scaled.getHeight(imageObserver), rim.getType()); + scaledB.getGraphics().drawImage(scaled, 0, 0, imageObserver); + + /*System.out.println("*** Original"); + IIOMetadata metadata = image.getMetadata(); + String names[] = metadata.getMetadataFormatNames(); + for (int i = 0; i < names.length; i++) { displayMetadata(metadata.getAsTree(names[i])); - } + } - Node root = metadata.getAsTree(metadata.getNativeMetadataFormatName()); - Node markerSequence = root.getFirstChild().getNextSibling(); - markerSequence.removeChild(markerSequence.getFirstChild().getNextSibling().getNextSibling().getNextSibling()); - markerSequence.removeChild(markerSequence.getLastChild()); - markerSequence.removeChild(markerSequence.getLastChild()); - markerSequence.removeChild(markerSequence.getLastChild()); - markerSequence.removeChild(markerSequence.getLastChild()); - markerSequence.removeChild(markerSequence.getLastChild()); - markerSequence.removeChild(markerSequence.getLastChild()); - markerSequence.removeChild(markerSequence.getLastChild()); + Node root = metadata.getAsTree(metadata.getNativeMetadataFormatName()); + Node markerSequence = root.getFirstChild().getNextSibling(); + markerSequence.removeChild(markerSequence.getFirstChild().getNextSibling().getNextSibling().getNextSibling()); + markerSequence.removeChild(markerSequence.getLastChild()); + markerSequence.removeChild(markerSequence.getLastChild()); + markerSequence.removeChild(markerSequence.getLastChild()); + markerSequence.removeChild(markerSequence.getLastChild()); + markerSequence.removeChild(markerSequence.getLastChild()); + markerSequence.removeChild(markerSequence.getLastChild()); + markerSequence.removeChild(markerSequence.getLastChild()); - System.out.println("*** Modified root"); - displayMetadata(root);*/ + System.out.println("*** Modified root"); + displayMetadata(root);*/ - //metadata.setFromTree(metadata.getNativeMetadataFormatName(), root); + //metadata.setFromTree(metadata.getNativeMetadataFormatName(), root); - //System.out.println("*** Modified metadata"); - //displayMetadata(metadata.getAsTree(metadata.getNativeMetadataFormatName())); + //System.out.println("*** Modified metadata"); + //displayMetadata(metadata.getAsTree(metadata.getNativeMetadataFormatName())); - // todo: despite my best efforts, I can't get the ImageIO library to keep the metadata. - image = new IIOImage(scaledB, null, null); + // todo: despite my best efforts, I can't get the ImageIO library to keep the metadata. + image = new IIOImage(scaledB, null, null); - //image.getMetadata().mergeTree(metadata.getNativeMetadataFormatName(), root); + //image.getMetadata().mergeTree(metadata.getNativeMetadataFormatName(), root); - //image.setRaster(scaledB.getRaster()); + //image.setRaster(scaledB.getRaster()); - //write the image - r = deterministicTempFile("jres" - , "." + GalleryFileFilter.getExtension(filename), tmpDir, filename + d); - toDelete.add(r); + //write the image + r = deterministicTempFile("jres" + , "." + GalleryFileFilter.getExtension(filename), tmpDir, filename + d); + toDelete.add(r); - ImageWriter writer = ImageIO.getImageWriter(reader); - ImageOutputStream ios = null; - try { - r.delete(); - ios = ImageIO.createImageOutputStream(r); - } catch (IOException e) { - throw new IIOException("Can't create output stream!", e); - } + ImageWriter writer = ImageIO.getImageWriter(reader); + ImageOutputStream ios = null; + try { + r.delete(); + ios = ImageIO.createImageOutputStream(r); + } catch (IOException e) { + throw new IIOException("Can't create output stream!", e); + } - writer.setOutput(ios); - ImageWriteParam iwp = writer.getDefaultWriteParam(); - iwp.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); - iwp.setCompressionQuality(jpegQuality / 100.0F); - //metadata = writer.getDefaultStreamMetadata(null); - //System.out.println("*** Default metadata"); - //displayMetadata(metadata.getAsTree(metadata.getNativeMetadataFormatName())); - writer.write(null, image, iwp); + writer.setOutput(ios); + ImageWriteParam iwp = writer.getDefaultWriteParam(); + iwp.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); + iwp.setCompressionQuality(jpegQuality / 100.0F); + //metadata = writer.getDefaultStreamMetadata(null); + //System.out.println("*** Default metadata"); + //displayMetadata(metadata.getAsTree(metadata.getNativeMetadataFormatName())); + writer.write(null, image, iwp); - //image.getMetadata().mergeTree(metadata.getNativeMetadataFormatName(), root); + //image.getMetadata().mergeTree(metadata.getNativeMetadataFormatName(), root); - ios.flush(); - ios.close(); - writer.dispose(); + ios.flush(); + ios.close(); + writer.dispose(); - Log.log(Log.LEVEL_TRACE, MODULE, "Java resized " + filename + " to " + r.getPath()); + Log.log(Log.LEVEL_TRACE, MODULE, "Java resized " + filename + " to " + r.getPath()); + } else { + return new File(filename); + } } catch (IOException e) { Log.logException(Log.LEVEL_ERROR, MODULE, e); } diff --git a/defaults.properties b/defaults.properties index 079ea73..23f88b0 100644 --- a/defaults.properties +++ b/defaults.properties @@ -114,7 +114,7 @@ mruCount=4 loadLastMRU=false # -# --- Slideshow --- +# --- Slideshow and Preview --- # # Location of text elements during slideshow @@ -147,6 +147,9 @@ slideshowMaxPictures=0 # the display area to avoid distorting them slideshowNoStretch=false +# Color of the slideshow and preview backgrounds (R, G, B) +# slideshowColor=100,100,100 + # # --- Technical --- # @@ -182,6 +185,6 @@ updateUrlBeta=http://gallery.sourceforge.net/gallery_remote_version_check_beta.p # # --- Do not edit below this line --- # -version=1.4-b5 -releaseDate=2004/04/21 +version=1.4-b6 +releaseDate=2004/04/30 aboutText=Gallery Remote\n \n \nA part of the Gallery Open-Source Project\nhttp://gallery.sourceforge.net\n \n \nMaintained by:\n \nPierre-Luc Paour\n \n \nInitial version by Chris Smith\n \n \nContributors:\n \nTim Miller\nDolan Halbrook\nMarkus Cozowicz\nScott Gartner\nAmedeo Paglione\nChris Schwerdt\n \n \nArtwork by Ross A. Reyman\n \n \nBundled software:\n \nImageMagick\nJSX\nJava look and feel Graphics Repository icons\njpegtran, Guido Vollbeding's version\nMetadataExtractor