Author: remi
Date: 2008-08-15 21:39:25 +0200 (Fri, 15 Aug 2008)
New Revision: 1506
Modified:
software_suite_v2/software/tools/attitunesStudio/trunk/src/GUI/AttituneCmdConf.java
software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/format/ATTBlockParams.java
Log:
* work in progress ...
Modified:
software_suite_v2/software/tools/attitunesStudio/trunk/src/GUI/AttituneCmdConf.java
===================================================================
---
software_suite_v2/software/tools/attitunesStudio/trunk/src/GUI/AttituneCmdConf.java
2008-08-15 17:45:31 UTC (rev 1505)
+++
software_suite_v2/software/tools/attitunesStudio/trunk/src/GUI/AttituneCmdConf.java
2008-08-15 19:39:25 UTC (rev 1506)
@@ -2,6 +2,7 @@
import java.awt.GridBagConstraints;
import java.awt.Insets;
+import java.util.Arrays;
import java.util.Hashtable;
import javax.swing.*;
@@ -27,6 +28,14 @@
private static JLabel labelPitch;
private static JLabel labelLocutor;
+ private static JSlider jSliderCount;
+ private static JSpinner jSpinnerCount;
+ private static JSlider jSliderSpeed;
+ private static JComboBox jComboBoxLocutors;
+
+ private static Hashtable<String,Object> selectedStruct;
+ private static Hashtable<String,Object> newStruct;
+
static
{
labelCount = new JLabel(ATTMessages.getString("BlockConf.0"));
@@ -37,127 +46,385 @@
labelText = new JLabel(ATTMessages.getString("BlockConf.5"));
labelPitch = new JLabel(ATTMessages.getString("BlockConf.6"));
labelLocutor = new JLabel(ATTMessages.getString("BlockConf.7"));
+
+ jSliderCount = new JSlider();
+ jSliderSpeed = new JSlider();
+ SpinnerModel model = new SpinnerNumberModel(2, 1, 255, 1);
+ jSpinnerCount = new JSpinner(model);
+
+ jComboBoxLocutors = new JComboBox();
}
public static void showBlockConf(ATTBlockViewer attBlockViewer, JPanel
myPanel, String cmd)
{
+ if
(cmd.equals((String)attBlockViewer.getFocusedBlock().getFunctionParams().get("cmd")))
+ {
+ selectedStruct =
ATTBlockParams.copyBlockStruct(attBlockViewer.getFocusedBlock().getFunctionParams());
+ }
+ else
+ {
+ selectedStruct = null;
+ }
+
if (cmd.equals("leds_on"))
{
+ if (selectedStruct == null)
+ {
+ selectedStruct =
ATTBlockParams.copyBlockStruct(ATTBlockParams.LEDS_ON_CANVAS);
+ }
showBlockNoParam(attBlockViewer, myPanel);
}
else if (cmd.equals("ledl_on"))
{
+ if (selectedStruct == null)
+ {
+ selectedStruct =
ATTBlockParams.copyBlockStruct(ATTBlockParams.LEDL_ON_CANVAS);
+ }
showBlockNoParam(attBlockViewer, myPanel);
}
else if (cmd.equals("ledr_on"))
{
+ if (selectedStruct == null)
+ {
+ selectedStruct =
ATTBlockParams.copyBlockStruct(ATTBlockParams.LEDR_ON_CANVAS);
+ }
showBlockNoParam(attBlockViewer, myPanel);
}
else if (cmd.equals("leds_off"))
{
+ if (selectedStruct == null)
+ {
+ selectedStruct =
ATTBlockParams.copyBlockStruct(ATTBlockParams.LEDS_OFF_CANVAS);
+ }
showBlockNoParam(attBlockViewer, myPanel);
}
else if (cmd.equals("ledl_off"))
{
+ if (selectedStruct == null)
+ {
+ selectedStruct =
ATTBlockParams.copyBlockStruct(ATTBlockParams.LEDL_OFF_CANVAS);
+ }
showBlockNoParam(attBlockViewer, myPanel);
}
else if (cmd.equals("ledr_off"))
{
+ if (selectedStruct == null)
+ {
+ selectedStruct =
ATTBlockParams.copyBlockStruct(ATTBlockParams.LEDR_OFF_CANVAS);
+ }
showBlockNoParam(attBlockViewer, myPanel);
}
else if (cmd.equals("leds_blink"))
{
+ if (selectedStruct == null)
+ {
+ selectedStruct =
ATTBlockParams.copyBlockStruct(ATTBlockParams.LEDS_BLINK_CANVAS);
+ }
showBlockLedBlink(attBlockViewer, myPanel);
}
else if (cmd.equals("mouth_on"))
{
+ if (selectedStruct == null)
+ {
+ selectedStruct =
ATTBlockParams.copyBlockStruct(ATTBlockParams.MOUTH_ON_CANVAS);
+ }
showBlockMouthOn(attBlockViewer, myPanel);
}
else if (cmd.equals("mouth_open"))
{
+ if (selectedStruct == null)
+ {
+ selectedStruct =
ATTBlockParams.copyBlockStruct(ATTBlockParams.MOUTH_OPEN_CANVAS);
+ }
showBlockNoParam(attBlockViewer, myPanel);
}
else if (cmd.equals("mouth_close"))
{
+ if (selectedStruct == null)
+ {
+ selectedStruct =
ATTBlockParams.copyBlockStruct(ATTBlockParams.MOUTH_CLOSE_CANVAS);
+ }
showBlockNoParam(attBlockViewer, myPanel);
}
else if (cmd.equals("eyes_on"))
{
+ if (selectedStruct == null)
+ {
+ selectedStruct =
ATTBlockParams.copyBlockStruct(ATTBlockParams.EYES_ON_CANVAS);
+ }
showBlockEyesOn(attBlockViewer, myPanel);
}
else if (cmd.equals("eyes_open"))
{
+ if (selectedStruct == null)
+ {
+ selectedStruct =
ATTBlockParams.copyBlockStruct(ATTBlockParams.EYES_OPEN_CANVAS);
+ }
showBlockNoParam(attBlockViewer, myPanel);
}
else if (cmd.equals("eyes_close"))
{
+ if (selectedStruct == null)
+ {
+ selectedStruct =
ATTBlockParams.copyBlockStruct(ATTBlockParams.EYES_CLOSE_CANVAS);
+ }
showBlockNoParam(attBlockViewer, myPanel);
}
else if (cmd.equals("sound_play"))
{
+ if (selectedStruct == null)
+ {
+ selectedStruct =
ATTBlockParams.copyBlockStruct(ATTBlockParams.PLAY_FLASH_CANVAS);
+ }
showBlockSoundPlay(attBlockViewer, myPanel);
}
else if (cmd.equals("wav_play"))
{
+ if (selectedStruct == null)
+ {
+ selectedStruct =
ATTBlockParams.copyBlockStruct(ATTBlockParams.PLAY_WAVE_CANVAS);
+ }
showBlockWavPlay(attBlockViewer, myPanel);
}
else if (cmd.equals("spinl_on"))
{
+ if (selectedStruct == null)
+ {
+ selectedStruct =
ATTBlockParams.copyBlockStruct(ATTBlockParams.SPINNING_LEFT_CANVAS);
+ }
showBlockSpinLOn(attBlockViewer, myPanel);
}
else if (cmd.equals("spinr_on"))
{
+ if (selectedStruct == null)
+ {
+ selectedStruct =
ATTBlockParams.copyBlockStruct(ATTBlockParams.SPINNING_RIGHT_CANVAS);
+ }
showBlockSpinROn(attBlockViewer, myPanel);
}
else if (cmd.equals("tts_play"))
{
+ if (selectedStruct == null)
+ {
+ selectedStruct =
ATTBlockParams.copyBlockStruct(ATTBlockParams.PLAY_TTS_CANVAS);
+ }
showBlockTTS(attBlockViewer, myPanel);
}
else if (cmd.equals("wings_on"))
{
+ if (selectedStruct == null)
+ {
+ selectedStruct =
ATTBlockParams.copyBlockStruct(ATTBlockParams.FLIPPERS_ON_CANVAS);
+ }
showBlockWingsOn(attBlockViewer, myPanel);
}
else if (cmd.equals("wings_up"))
{
+ if (selectedStruct == null)
+ {
+ selectedStruct =
ATTBlockParams.copyBlockStruct(ATTBlockParams.FLIPPERS_UP_CANVAS);
+ }
showBlockNoParam(attBlockViewer, myPanel);
}
else if (cmd.equals("wings_down"))
{
+ if (selectedStruct == null)
+ {
+ selectedStruct =
ATTBlockParams.copyBlockStruct(ATTBlockParams.FLIPPERS_DOWN_CANVAS);
+ }
showBlockNoParam(attBlockViewer, myPanel);
}
else
{
+ selectedStruct = null;
+ newStruct = null;
showBlockNoParam(attBlockViewer, myPanel);
}
}
+ public static void testBlockConf(ATTBlockViewer attBlockViewer)
+ {
+ if (selectedStruct == null)
+ {
+ return;
+ }
+
+ String cmd = (String)selectedStruct.get("cmd");
+
+ if (cmd.equals("leds_on"))
+ {
+ testBlockNoParam(attBlockViewer);
+ }
+ else if (cmd.equals("ledl_on"))
+ {
+ testBlockNoParam(attBlockViewer);
+ }
+ else if (cmd.equals("ledr_on"))
+ {
+ testBlockNoParam(attBlockViewer);
+ }
+ else if (cmd.equals("leds_off"))
+ {
+ testBlockNoParam(attBlockViewer);
+ }
+ else if (cmd.equals("ledl_off"))
+ {
+ testBlockNoParam(attBlockViewer);
+ }
+ else if (cmd.equals("ledr_off"))
+ {
+ testBlockNoParam(attBlockViewer);
+ }
+ else if (cmd.equals("leds_blink"))
+ {
+ testBlockLedBlink(attBlockViewer);
+ }
+ else if (cmd.equals("mouth_on"))
+ {
+ testBlockMouthOn(attBlockViewer);
+ }
+ else if (cmd.equals("mouth_open"))
+ {
+ System.out.println("Test mouth open");
+ testBlockNoParam(attBlockViewer);
+ }
+ else if (cmd.equals("mouth_close"))
+ {
+ testBlockNoParam(attBlockViewer);
+ }
+ else if (cmd.equals("eyes_on"))
+ {
+ testBlockEyesOn(attBlockViewer);
+ }
+ else if (cmd.equals("eyes_open"))
+ {
+ testBlockNoParam(attBlockViewer);
+ }
+ else if (cmd.equals("eyes_close"))
+ {
+ testBlockNoParam(attBlockViewer);
+ }
+ else if (cmd.equals("sound_play"))
+ {
+ //testBlockSoundPlay(attBlockViewer);
+ }
+ else if (cmd.equals("wav_play"))
+ {
+ //testBlockWavPlay(attBlockViewer);
+ }
+ else if (cmd.equals("spinl_on"))
+ {
+ //testBlockSpinLOn(attBlockViewer);
+ }
+ else if (cmd.equals("spinr_on"))
+ {
+ //testBlockSpinROn(attBlockViewer);
+ }
+ else if (cmd.equals("tts_play"))
+ {
+ //testBlockTTS(attBlockViewer);
+ }
+ else if (cmd.equals("wings_on"))
+ {
+ testBlockWingsOn(attBlockViewer);
+ }
+ else if (cmd.equals("wings_up"))
+ {
+ testBlockNoParam(attBlockViewer);
+ }
+ else if (cmd.equals("wings_down"))
+ {
+ testBlockNoParam(attBlockViewer);
+ }
+ else
+ {
+ return;
+ }
+ }
+
private static void showBlockLedBlink(ATTBlockViewer attBlockViewer,
JPanel myPanel)
{
myPanel.add(labelCount, new GridBagConstraints(1, 0, 1, 1, 0.0,
0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0,
0, 0), 0, 0));
myPanel.add(labelSpeed, new GridBagConstraints(1, 1, 1, 1, 0.0,
0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0,
0, 0), 0, 0));
+
jSpinnerCount.getModel().setValue(((Double)selectedStruct.get("count")).intValue());
+ myPanel.add(jSpinnerCount, new GridBagConstraints(3, 0, 1, 1,
0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new
Insets(0, 0, 0, 0), 0, 0));
+ jSliderSpeed.setMinimum(10);
+ jSliderSpeed.setMaximum(100);
+
jSliderSpeed.setValue(((Double)selectedStruct.get("speed")).intValue());
+ myPanel.add(jSliderSpeed, new GridBagConstraints(3, 1, 1, 1,
0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new
Insets(0, 0, 0, 0), 0, 0));
}
+ private static void testBlockLedBlink(ATTBlockViewer attBlockViewer)
+ {
+ ATTBlock block = new ATTBlock(0);
+
+ selectedStruct.put("count",
((Integer)jSpinnerCount.getValue()).doubleValue());
+ selectedStruct.put("speed",
((Integer)jSliderSpeed.getValue()).doubleValue());
+ block.setFunctionParams(selectedStruct);
+ attBlockViewer.playBlock(block);
+ }
+
private static void showBlockNoParam(ATTBlockViewer attBlockViewer,
JPanel myPanel)
{
myPanel.add(labelNoParameters, new GridBagConstraints(1, 0, 1,
1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new
Insets(0, 0, 0, 0), 0, 0));
}
+ private static void testBlockNoParam(ATTBlockViewer attBlockViewer)
+ {
+ ATTBlock block = new ATTBlock(0);
+ block.setFunctionParams(selectedStruct);
+ attBlockViewer.playBlock(block);
+ }
+
private static void showBlockMouthOn(ATTBlockViewer attBlockViewer,
JPanel myPanel)
{
myPanel.add(labelCount, new GridBagConstraints(1, 0, 1, 1, 0.0,
0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0,
0, 0), 0, 0));
+
jSpinnerCount.getModel().setValue(((Integer)selectedStruct.get("count")));
+ myPanel.add(jSpinnerCount, new GridBagConstraints(3, 0, 1, 1,
0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new
Insets(0, 0, 0, 0), 0, 0));
}
+ private static void testBlockMouthOn(ATTBlockViewer attBlockViewer)
+ {
+ ATTBlock block = new ATTBlock(0);
+
+ selectedStruct.put("count",
((Integer)jSpinnerCount.getValue()));
+ block.setFunctionParams(selectedStruct);
+ attBlockViewer.playBlock(block);
+ }
+
private static void showBlockEyesOn(ATTBlockViewer attBlockViewer,
JPanel myPanel)
{
myPanel.add(labelCount, new GridBagConstraints(1, 0, 1, 1, 0.0,
0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0,
0, 0), 0, 0));
+
jSpinnerCount.getModel().setValue(((Integer)selectedStruct.get("count")));
+ myPanel.add(jSpinnerCount, new GridBagConstraints(3, 0, 1, 1,
0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new
Insets(0, 0, 0, 0), 0, 0));
}
+ private static void testBlockEyesOn(ATTBlockViewer attBlockViewer)
+ {
+ ATTBlock block = new ATTBlock(0);
+
+ selectedStruct.put("count",
((Integer)jSpinnerCount.getValue()));
+ block.setFunctionParams(selectedStruct);
+ attBlockViewer.playBlock(block);
+ }
+
private static void showBlockWingsOn(ATTBlockViewer attBlockViewer,
JPanel myPanel)
{
myPanel.add(labelCount, new GridBagConstraints(1, 0, 1, 1, 0.0,
0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0,
0, 0), 0, 0));
+
jSpinnerCount.getModel().setValue(((Integer)selectedStruct.get("count")));
+ myPanel.add(jSpinnerCount, new GridBagConstraints(3, 0, 1, 1,
0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new
Insets(0, 0, 0, 0), 0, 0));
}
+ private static void testBlockWingsOn(ATTBlockViewer attBlockViewer)
+ {
+ ATTBlock block = new ATTBlock(0);
+
+ selectedStruct.put("count",
((Integer)jSpinnerCount.getValue()));
+ block.setFunctionParams(selectedStruct);
+ attBlockViewer.playBlock(block);
+ }
+
private static void showBlockSoundPlay(ATTBlockViewer attBlockViewer,
JPanel myPanel)
{
myPanel.add(labelSoundIndex, new GridBagConstraints(1, 0, 1, 1,
0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new
Insets(0, 0, 0, 0), 0, 0));
@@ -185,5 +452,8 @@
myPanel.add(labelLocutor, new GridBagConstraints(1, 0, 1, 1,
0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new
Insets(0, 0, 0, 0), 0, 0));
myPanel.add(labelPitch, new GridBagConstraints(1, 1, 1, 1, 0.0,
0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0,
0, 0), 0, 0));
myPanel.add(labelText, new GridBagConstraints(1, 2, 1, 1, 0.0,
0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0,
0, 0), 0, 0));
+ ComboBoxModel jComboBox1Model = new
DefaultComboBoxModel(attBlockViewer.tux.tts.getVoices().toArray());
+ jComboBoxLocutors.setModel(jComboBox1Model);
+ myPanel.add(jComboBoxLocutors, new GridBagConstraints(3, 0, 1,
1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new
Insets(0, 0, 0, 0), 0, 0));
}
}
Modified:
software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java
===================================================================
--- software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java
2008-08-15 17:45:31 UTC (rev 1505)
+++ software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java
2008-08-15 19:39:25 UTC (rev 1506)
@@ -355,6 +355,12 @@
jButtonTestBlock = new
JButton();
jPanelBlockAction.add(jButtonTestBlock, new GridBagConstraints(1, 0, 1, 1, 0.0,
0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0,
0, 0), 0, 0));
jButtonTestBlock.setText(ATTMessages.getString("MainFrame.101"));
+
jButtonTestBlock.addMouseListener(new MouseAdapter() {
+ public void
mousePressed(MouseEvent evt)
+ {
+
onTestBlockMouseClicked(evt);
+ }
+ });
}
{
jButtonValidateBlock = new
JButton();
@@ -715,6 +721,14 @@
this.pack();
}
+ /*
+ * Event on test block button
+ */
+ private void onTestBlockMouseClicked(MouseEvent evt)
+ {
+ AttituneCmdConf.testBlockConf(attBlockViewer);
+ }
+
/*
------------------------------------------------------------------------
* Blocks viewer events
*
--------------------------------------------------------------------- */
Modified:
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/format/ATTBlockParams.java
===================================================================
---
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/format/ATTBlockParams.java
2008-08-15 17:45:31 UTC (rev 1505)
+++
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/format/ATTBlockParams.java
2008-08-15 19:39:25 UTC (rev 1506)
@@ -21,15 +21,15 @@
public static Hashtable<String,Object> LEDS_BLINK_CANVAS = new
Hashtable<String,Object>();
static {
LEDS_BLINK_CANVAS.put("cmd", "leds_blink");
- LEDS_BLINK_CANVAS.put("count", 1.0);
- LEDS_BLINK_CANVAS.put("speed", 1.0);
+ LEDS_BLINK_CANVAS.put("count", 10.0);
+ LEDS_BLINK_CANVAS.put("speed", 25.0);
LEDS_BLINK_CANVAS.put("duration", 0.0);
}
private static String[] ledsBlinkTmc(Hashtable<String,Object> struct)
{
String[] result = new String[1];
Double speed = (Double)struct.get("speed");
- Double duration = (Double)(speed * 0.008);
+ Double duration = (Double)(speed * 0.004);
String cmd = String.format("TUX_CMD:LED:BLINK:LED_BOTH,%g,%g",
(Double)struct.get("count"), duration);
result[0] = cmd;
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn