[Pixelle-commit] SF.net SVN: pixelle:[265] trunk/pixelle/src/com/mebigfatguy/pixelle
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2009-07-17 05:42:15
|
Revision: 265
http://pixelle.svn.sourceforge.net/pixelle/?rev=265&view=rev
Author: dbrosius
Date: 2009-07-17 05:42:12 +0000 (Fri, 17 Jul 2009)
Log Message:
-----------
use popup editors to give more room
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java
trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/AlgorithmEditor.java
trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java
trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle.properties
trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle_de.properties
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java 2009-07-17 05:00:52 UTC (rev 264)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java 2009-07-17 05:42:12 UTC (rev 265)
@@ -75,6 +75,7 @@
public static final String RED_ALGORITHM = "title.red";
public static final String GREEN_ALGORITHM = "title.green";
public static final String BLUE_ALGORITHM = "title.blue";
+ public static final String BLACK_ALGORITHM = "title.black";
public static final String TRANSPARENCY_ALGORITHM = "title.transparency";
public static final String SELECTION_ALGORITHM = "title.selection"; public static final String PIXEL_OPTIONS = "title.pixel_options";
public static final String INDEX_OUT_OF_BOUNDS_PIXELS = "title.index_out_of_bounds_pixels";
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/AlgorithmEditor.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/AlgorithmEditor.java 2009-07-17 05:00:52 UTC (rev 264)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/AlgorithmEditor.java 2009-07-17 05:42:12 UTC (rev 265)
@@ -22,6 +22,8 @@
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Point;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
import javax.swing.Box;
import javax.swing.BoxLayout;
@@ -45,19 +47,27 @@
private JEditorPane algo;
private JButton ok;
private JButton cancel;
+ private String origValue;
+ private boolean isOK = false;
- public AlgorithmEditor(PixelleComponent component, Point pt, Dimension dim) {
-
+ public AlgorithmEditor(PixelleComponent component, Point pt, Dimension dim, String value) {
+ origValue = value;
initComponents();
initListeners();
setTitle(component.toString());
+ pt.y -= dim.height;
setLocation(pt);
+ dim.height *= 8;
setSize(dim);
+ algo.setText(value);
+ }
+
+ public String getValue() {
+ if (isOK)
+ return algo.getText();
-
-
-
+ return origValue;
}
private void initComponents() {
@@ -83,8 +93,22 @@
}
private void initListeners() {
+ setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
+ ok.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent ae) {
+ isOK = true;
+ dispose();
+ }
+ });
+
+ cancel.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent ae) {
+ dispose();
+ }
+ });
}
+
public String getText() {
return algo.getText();
}
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java 2009-07-17 05:00:52 UTC (rev 264)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java 2009-07-17 05:42:12 UTC (rev 265)
@@ -25,9 +25,12 @@
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.EnumMap;
+import java.util.EnumSet;
import java.util.Map;
import java.util.Set;
@@ -50,6 +53,7 @@
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.ListSelectionModel;
+import javax.swing.SwingUtilities;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
@@ -409,6 +413,16 @@
}
});
+ for (final PixelleComponent comp : PixelleComponent.gsValues()) {
+ final JTextField tf = gsEditor.get(comp);
+ tf.addKeyListener(new KeyExpansionListener(tf, comp));
+ }
+
+ for (final PixelleComponent comp : PixelleComponent.rgbValues()) {
+ final JTextField tf = rgbEditor.get(comp);
+ tf.addKeyListener(new KeyExpansionListener(tf, comp));
+ }
+
save.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
ImageType imageType = getImageType();
@@ -457,8 +471,31 @@
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
+ class KeyExpansionListener extends KeyAdapter
+ {
+ private JTextField textField;
+ private PixelleComponent component;
+
+ public KeyExpansionListener(JTextField tf, PixelleComponent comp) {
+ textField = tf;
+ component = comp;
+ }
+
+ @Override
+ public void keyPressed(KeyEvent e) {
+ Point pt = textField.getLocation();
+ SwingUtilities.convertPointToScreen(pt, textField.getParent());
+ Dimension dim = textField.getSize();
+ AlgorithmEditor editor = new AlgorithmEditor(component, pt, dim, textField.getText());
+ editor.setModal(true);
+ editor.setVisible(true);
+ textField.setText(editor.getValue());
+ }
+ }
+
class SourcePanel extends JPanel
{
+ private static final long serialVersionUID = -8696503930565383721L;
private static final String PLUS_ICON = "/com/mebigfatguy/pixelle/resources/plus.png";
private static final String MINUS_ICON = "/com/mebigfatguy/pixelle/resources/minus.png";
JTable sourceTable;
@@ -489,6 +526,8 @@
sourceModel.addColumn(PixelleBundle.getString(PixelleBundle.SOURCES_NAME));
sourceModel.addRow(new Object[] { Integer.valueOf(0), frame });
sourceTable = new JTable(sourceModel) {
+ private static final long serialVersionUID = 2415580946606915612L;
+
@Override
public boolean isCellEditable(int row, int column) {
return false;
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle.properties
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle.properties 2009-07-17 05:00:52 UTC (rev 264)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle.properties 2009-07-17 05:42:12 UTC (rev 265)
@@ -74,6 +74,7 @@
title.red = Red Algorithm
title.green = Green Algorithm
title.blue = Blue Algorithm
+title.black = Black Algorithm
title.transparency = Transparency Algorithm
title.selection = Selection Algorithm
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle_de.properties
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle_de.properties 2009-07-17 05:00:52 UTC (rev 264)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/resources/pixelle_de.properties 2009-07-17 05:42:12 UTC (rev 265)
@@ -71,6 +71,13 @@
label.transparency = (Transparenz)
label.selection = (Auswahl)
+title.red = Rot Algorithmus
+title.green = Gr\xFCn Algorithmus
+title.blue = Blau Algorithmus
+title.black = Schwarz Algorithmus
+title.transparency = Transparenz Algorithmus
+title.selection = Auswahl Algorithmus
+
title.pixel_options = Pixel-Optionen
title.index_out_of_bounds_pixels = F\xFCr Index-out-of-bounds Pixel Nutzung\:
label.color = Farbe
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|