[Patchanim-commit] SF.net SVN: patchanim:[280] trunk/patchanim/src/com/mebigfatguy/patchanim
Brought to you by:
dbrosius
From: <dbr...@us...> - 2009-01-04 22:27:22
|
Revision: 280 http://patchanim.svn.sourceforge.net/patchanim/?rev=280&view=rev Author: dbrosius Date: 2009-01-04 22:27:17 +0000 (Sun, 04 Jan 2009) Log Message: ----------- add set all border points menu option Modified Paths: -------------- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchSamplePanel.java trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchSamplePanel.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchSamplePanel.java 2009-01-02 06:02:58 UTC (rev 279) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchSamplePanel.java 2009-01-04 22:27:17 UTC (rev 280) @@ -68,7 +68,7 @@ private transient Thread redrawThread = null; private final Object redrawLock = new Object(); private boolean redrawing = false; - private boolean dragging = false; + private boolean dragging = false; public JPatchSamplePanel(PatchColor c) { color = c; @@ -108,16 +108,16 @@ public void mousePressed(MouseEvent me) { if ((color != PatchColor.Combined) && me.isPopupTrigger()) showPatchContentMenu(me); - else if (decorator != null) { - dragging = decorator.press(me.getPoint(), JPatchSamplePanel.this.getBounds()); - } + else if (decorator != null) { + dragging = decorator.press(me.getPoint(), JPatchSamplePanel.this.getBounds()); + } } @Override public void mouseReleased(MouseEvent me) { if ((color != PatchColor.Combined) && me.isPopupTrigger()) showPatchContentMenu(me); - dragging = false; + dragging = false; } }); @@ -214,34 +214,70 @@ JPopupMenu menu = new JPopupMenu(); JMenu setAllItem = new JMenu(rb.getString(PatchAnimBundle.SETALLPOINTS)); menu.add(setAllItem); - JMenuItem blackItem = new JMenuItem(rb.getString(PatchAnimBundle.BLACK)); - blackItem.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent ae) { - setAllPts(0.0); - } - }); - setAllItem.add(blackItem); - JMenuItem fullColorItem = new JMenuItem(rb.getString(PatchAnimBundle.FULLCOLOR)); - fullColorItem.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent ae) { - setAllPts(255.0); - } - }); + { + JMenuItem blackItem = new JMenuItem(rb.getString(PatchAnimBundle.BLACK)); + blackItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent ae) { + setAllPts(0.0); + } + }); + setAllItem.add(blackItem); + + JMenuItem fullColorItem = new JMenuItem(rb.getString(PatchAnimBundle.FULLCOLOR)); + fullColorItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent ae) { + setAllPts(255.0); + } + }); + setAllItem.add(fullColorItem); + + JMenuItem valueItem = new JMenuItem(rb.getString(PatchAnimBundle.VALUE)); + valueItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent ae) { + String value = JOptionPane.showInputDialog(JPatchSamplePanel.this, rb.getString(PatchAnimBundle.VALUE), "128"); + try { + if (value != null) + setAllPts(Double.parseDouble(value)); + } catch (NumberFormatException nfe) { + } + } + }); + setAllItem.add(valueItem); + } - setAllItem.add(fullColorItem); - JMenuItem valueItem = new JMenuItem(rb.getString(PatchAnimBundle.VALUE)); - valueItem.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent ae) { - String value = JOptionPane.showInputDialog(JPatchSamplePanel.this, rb.getString(PatchAnimBundle.VALUE), "128"); - try { - if (value != null) - setAllPts(Double.parseDouble(value)); - } catch (NumberFormatException nfe) { + JMenu borderItem = new JMenu(rb.getString(PatchAnimBundle.SETBORDERPOINTS)); + menu.add(borderItem); + { + JMenuItem blackItem = new JMenuItem(rb.getString(PatchAnimBundle.BLACK)); + blackItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent ae) { + setAllBorderPts(0.0); } - } - }); + }); + borderItem.add(blackItem); + + JMenuItem fullColorItem = new JMenuItem(rb.getString(PatchAnimBundle.FULLCOLOR)); + fullColorItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent ae) { + setAllBorderPts(255.0); + } + }); + borderItem.add(fullColorItem); + + JMenuItem valueItem = new JMenuItem(rb.getString(PatchAnimBundle.VALUE)); + valueItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent ae) { + String value = JOptionPane.showInputDialog(JPatchSamplePanel.this, rb.getString(PatchAnimBundle.VALUE), "128"); + try { + if (value != null) + setAllBorderPts(Double.parseDouble(value)); + } catch (NumberFormatException nfe) { + } + } + }); + borderItem.add(valueItem); + } - setAllItem.add(valueItem); JMenuItem lightenPatch = new JMenuItem(rb.getString(PatchAnimBundle.LIGHTENPATCH)); lightenPatch.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { @@ -471,6 +507,28 @@ mediator.setNewActivePatch(patch); } + private void setAllBorderPts(double d) { + PatchPanelMediator mediator = PatchPanelMediator.getMediator(); + CombinedPatch patch = mediator.getActivePatch(); + PatchCoords coords = patch.getPatch(color); + int order = coords.getOrder(); + for (int k = 0; k < order; k++) { + Coordinate c = coords.getCoordinate(k, 0); + c.setColor(d); + coords.setCoordinate(k, 0, c); + c = coords.getCoordinate(0, k); + c.setColor(d); + coords.setCoordinate(0, k, c); + c = coords.getCoordinate(k, order-1); + c.setColor(d); + coords.setCoordinate(k, order-1, c); + c = coords.getCoordinate(order-1, k); + c.setColor(d); + coords.setCoordinate(order-1, k, c); + } + mediator.setNewActivePatch(patch); + } + private void linearGradient(BlendDirection direction) { PatchPanelMediator mediator = PatchPanelMediator.getMediator(); CombinedPatch patch = mediator.getActivePatch(); Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2009-01-02 06:02:58 UTC (rev 279) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/main/PatchAnimBundle.java 2009-01-04 22:27:17 UTC (rev 280) @@ -83,6 +83,7 @@ public static final String CLONE = "patchanim.clone"; public static final String COLOR = "patchanim.color"; public static final String SETALLPOINTS = "patchanim.setallpoints"; + public static final String SETBORDERPOINTS = "patchanim.setborderpoints"; public static final String BLACK = "patchanim.black"; public static final String FULLCOLOR="patchanim.fullcolor"; public static final String VALUE="patchanim.value"; Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties 2009-01-02 06:02:58 UTC (rev 279) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/resources.properties 2009-01-04 22:27:17 UTC (rev 280) @@ -82,6 +82,7 @@ patchanim.clone = Clone patchanim.color = Color patchanim.setallpoints = Set all control points to... +patchanim.setborderpoints = Set border points to... patchanim.black = Black patchanim.fullcolor = Full Color patchanim.value = Value... This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |