[Pixelle-commit] SF.net SVN: pixelle:[186] trunk/pixelle/src/com/mebigfatguy/pixelle
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2008-11-14 22:00:14
|
Revision: 186
http://pixelle.svn.sourceforge.net/pixelle/?rev=186&view=rev
Author: dbrosius
Date: 2008-11-14 22:00:09 +0000 (Fri, 14 Nov 2008)
Log Message:
-----------
stub in the Pixel inspector - not hooked up yet
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java
Added Paths:
-----------
trunk/pixelle/src/com/mebigfatguy/pixelle/actions/InspectorAction.java
trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelInspector.java
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java 2008-11-14 21:44:47 UTC (rev 185)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleBundle.java 2008-11-14 22:00:09 UTC (rev 186)
@@ -52,6 +52,8 @@
public static final String OPTIONS_ITEM = "menu.transform.options";
public static final String TRANSFORM_NEW_ITEM = "menu.transform.newwindow";
public static final String TRANSFORM_ITEM = "menu.transform.transform";
+ public static final String GOODIES_MENU = "menu.goodies.title";
+ public static final String INSPECTOR_ITEM = "menu.goodies.inspector";
public static final String GRAPHIC_FILES = "label.graphic_files";
public static final String SAVE_ALGORITHM = "save.algorithm";
public static final String DELETE_ALGORITHM = "delete.algorithm";
@@ -79,6 +81,9 @@
public static final String ROLL_COLOR = "label.roll_color";
public static final String WAVE_COLOR = "label.wave_color";
public static final String SAVE_OVERWRITE = "label.save_overwrite";
+ public static final String X = "label.x";
+ public static final String Y = "label.y";
+ public static final String COLOR = "label.color";
private static ResourceBundle rb = ResourceBundle.getBundle("com/mebigfatguy/pixelle/resources/pixelle");
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java 2008-11-14 21:44:47 UTC (rev 185)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java 2008-11-14 22:00:09 UTC (rev 186)
@@ -41,6 +41,7 @@
import javax.swing.JScrollPane;
import com.mebigfatguy.pixelle.actions.CloseFileAction;
+import com.mebigfatguy.pixelle.actions.InspectorAction;
import com.mebigfatguy.pixelle.actions.NewFileAction;
import com.mebigfatguy.pixelle.actions.OpenFileAction;
import com.mebigfatguy.pixelle.actions.OptionsAction;
@@ -52,6 +53,7 @@
import com.mebigfatguy.pixelle.actions.TransformAction;
import com.mebigfatguy.pixelle.actions.TransformNewWindowAction;
import com.mebigfatguy.pixelle.actions.ZoomAction;
+import com.mebigfatguy.pixelle.dialogs.PixelInspector;
import com.mebigfatguy.pixelle.utils.GuiUtils;
import com.mebigfatguy.pixelle.utils.ZoomLevel;
@@ -84,10 +86,14 @@
JMenuItem optionsItem;
JMenuItem transformItem;
+ JMenu goodiesMenu;
+ JCheckBoxMenuItem inspectorItem;
+
File imageFile;
JScrollPane scroll;
ImagePanel panel;
transient PixelleImage image;
+ PixelInspector inspector;
boolean doNewWindow;
public PixelleFrame() throws PixelleTransformException {
@@ -180,6 +186,12 @@
mb.add(transformMenu);
+ goodiesMenu = new JMenu(PixelleBundle.getString(PixelleBundle.GOODIES_MENU));
+ inspectorItem = new JCheckBoxMenuItem(new InspectorAction(this));
+ goodiesMenu.add(inspectorItem);
+
+ mb.add(goodiesMenu);
+
setJMenuBar(mb);
Container cp = getContentPane();
@@ -262,6 +274,18 @@
panel.repaint();
}
+ public final void toggleInspector() {
+ if (inspector == null) {
+ inspector = new PixelInspector();
+ inspector.setAlwaysOnTop(true);
+ inspector.setLocationRelativeTo(this);
+ inspector.setVisible(true);
+ } else {
+ inspector.dispose();
+ inspector = null;
+ }
+ }
+
public class ImagePanel extends JPanel {
private static final long serialVersionUID = -1572146409734928935L;
Added: trunk/pixelle/src/com/mebigfatguy/pixelle/actions/InspectorAction.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/actions/InspectorAction.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/actions/InspectorAction.java 2008-11-14 22:00:09 UTC (rev 186)
@@ -0,0 +1,43 @@
+/*
+ * pixelle - Graphics algorithmic editor
+ * Copyright (C) 2008 Dave Brosius
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package com.mebigfatguy.pixelle.actions;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.KeyStroke;
+
+import com.mebigfatguy.pixelle.PixelleBundle;
+import com.mebigfatguy.pixelle.PixelleFrame;
+
+public class InspectorAction extends AbstractAction {
+
+ private static final long serialVersionUID = 2938266078773417057L;
+ private final PixelleFrame frame;
+
+ public InspectorAction(PixelleFrame pf) {
+ super(PixelleBundle.getString(PixelleBundle.INSPECTOR_ITEM));
+ putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke('I', ActionEvent.CTRL_MASK));
+ frame = pf;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ frame.toggleInspector();
+ }
+}
Property changes on: trunk/pixelle/src/com/mebigfatguy/pixelle/actions/InspectorAction.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Added: trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelInspector.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelInspector.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelInspector.java 2008-11-14 22:00:09 UTC (rev 186)
@@ -0,0 +1,105 @@
+/*
+ * pixelle - Graphics algorithmic editor
+ * Copyright (C) 2008 Dave Brosius
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package com.mebigfatguy.pixelle.dialogs;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Container;
+import java.awt.EventQueue;
+
+import javax.swing.BoxLayout;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+
+import com.mebigfatguy.pixelle.PixelleBundle;
+import com.mebigfatguy.pixelle.utils.GuiUtils;
+import com.mebigfatguy.pixelle.utils.GuiUtils.Sizing;
+
+public class PixelInspector extends JFrame {
+
+ private static final long serialVersionUID = 713537909520529431L;
+
+ private JPanel swatchPanel;
+ private JTextField xField;
+ private JTextField yField;
+ private JTextField colorField;
+
+ public PixelInspector() {
+ initComponents();
+ }
+
+ public void setInspectorColor(final Color c) {
+ EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ swatchPanel.setBackground(c);
+ swatchPanel.repaint();
+ }
+ });
+ }
+ private void initComponents() {
+ Container cp = getContentPane();
+ cp.setLayout(new BorderLayout(4, 4));
+
+ swatchPanel = new JPanel();
+ cp.add(swatchPanel, BorderLayout.WEST);
+
+ JPanel infoPanel = new JPanel();
+ infoPanel.setLayout(new BoxLayout(infoPanel, BoxLayout.Y_AXIS));
+
+ JLabel xLabel = new JLabel(PixelleBundle.getString(PixelleBundle.X));
+ JLabel yLabel = new JLabel(PixelleBundle.getString(PixelleBundle.Y));
+ JLabel colorLabel = new JLabel(PixelleBundle.getString(PixelleBundle.COLOR));
+ GuiUtils.sizeUniformly(Sizing.Both, xLabel, yLabel, colorLabel);
+
+ xField = new JTextField(6);
+ yField = new JTextField(6);
+ colorField = new JTextField(6);
+ GuiUtils.sizeUniformly(Sizing.Both, xField, yField, colorField);
+
+ xField.setEnabled(false);
+ yField.setEnabled(false);
+ colorField.setEnabled(false);
+
+ xLabel.setLabelFor(xField);
+ yLabel.setLabelFor(yField);
+ colorLabel.setLabelFor(colorField);
+
+ JPanel xPanel = new JPanel();
+ xPanel.setLayout(new BoxLayout(xPanel, BoxLayout.X_AXIS));
+ xPanel.add(xLabel);
+ xPanel.add(xField);
+ JPanel yPanel = new JPanel();
+ yPanel.setLayout(new BoxLayout(yPanel, BoxLayout.X_AXIS));
+ yPanel.add(yLabel);
+ yPanel.add(yField);
+ JPanel colorPanel = new JPanel();
+ colorPanel.setLayout(new BoxLayout(colorPanel, BoxLayout.X_AXIS));
+ colorPanel.add(colorLabel);
+ colorPanel.add(colorField);
+
+ infoPanel.add(xPanel);
+ infoPanel.add(yPanel);
+ infoPanel.add(colorPanel);
+
+ cp.add(infoPanel, BorderLayout.CENTER);
+ pack();
+ }
+}
Property changes on: trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelInspector.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|