Author: remi
Date: 2008-08-16 12:32:25 +0200 (Sat, 16 Aug 2008)
New Revision: 1515

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/messages.properties
   
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/messages_fr.properties
   
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/visual/ATTBlockViewer.java
Log:
* update

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-16 10:04:45 UTC (rev 1514)
+++ 
software_suite_v2/software/tools/attitunesStudio/trunk/src/GUI/AttituneCmdConf.java
 2008-08-16 10:32:25 UTC (rev 1515)
@@ -76,9 +76,16 @@
         */
        public static void showBlockConf(ATTBlockViewer attBlockViewer, JPanel 
myPanel, String cmd)
        {
-               if 
(cmd.equals((String)attBlockViewer.getFocusedBlock().getFunctionParams().get("cmd")))
+               if (attBlockViewer.getFocusedBlock() != null)
                {
-                       selectedStruct = 
ATTBlockParams.copyBlockStruct(attBlockViewer.getFocusedBlock().getFunctionParams());
+                       if 
(cmd.equals((String)attBlockViewer.getFocusedBlock().getFunctionParams().get("cmd")))
+                       {
+                               selectedStruct = 
ATTBlockParams.copyBlockStruct(attBlockViewer.getFocusedBlock().getFunctionParams());
+                       }
+                       else
+                       {
+                               selectedStruct = null;
+                       }
                }
                else
                {
@@ -525,6 +532,7 @@
                attBlockViewer.updateBlock(attBlockViewer.getFocusedBlock(), 
selectedStruct);
                attBlockViewer.getFocusedBlock().setLength(length);
                attBlockViewer.getFocusedBlock().setPosition(position);
+               attBlockViewer.recalcFullTime();
                attBlockViewer.repaint();
                attBlockViewer.playBlock(attBlockViewer.getFocusedBlock());
        }
@@ -554,11 +562,16 @@
                
                selectedStruct.put("count", 
((Integer)jSpinnerCount.getValue()));
                attBlockViewer.updateBlock(attBlockViewer.getFocusedBlock(), 
selectedStruct);
+               
+               
attBlockViewer.tux.access.acquire(TuxAPIConst.ACCESS_PRIORITY_CRITICAL);
                Double ct = new Date().getTime() / 1000.0;
                attBlockViewer.tux.mouth.on((Integer)jSpinnerCount.getValue(), 
TuxAPIConst.SSV_NDEF);
-               Double length = (new Date().getTime() / 1000.0) - ct;
+               Double length = (new Date().getTime() / 1000.0) - ct - 0.5;
+               attBlockViewer.tux.access.release();
+               
                attBlockViewer.getFocusedBlock().setLength(length);
                attBlockViewer.getFocusedBlock().setPosition(position);
+               attBlockViewer.recalcFullTime();
                attBlockViewer.repaint();
        }
        
@@ -587,11 +600,16 @@
                
                selectedStruct.put("count", 
((Integer)jSpinnerCount.getValue()));
                attBlockViewer.updateBlock(attBlockViewer.getFocusedBlock(), 
selectedStruct);
+               
+               
attBlockViewer.tux.access.acquire(TuxAPIConst.ACCESS_PRIORITY_CRITICAL);
                Double ct = new Date().getTime() / 1000.0;
                attBlockViewer.tux.eyes.on((Integer)jSpinnerCount.getValue(), 
TuxAPIConst.SSV_NDEF);
-               Double length = (new Date().getTime() / 1000.0) - ct;
+               Double length = (new Date().getTime() / 1000.0) - ct - 0.5;
+               attBlockViewer.tux.access.release();
+               
                attBlockViewer.getFocusedBlock().setLength(length);
                attBlockViewer.getFocusedBlock().setPosition(position);
+               attBlockViewer.recalcFullTime();
                attBlockViewer.repaint();
        }
        
@@ -620,11 +638,16 @@
                
                selectedStruct.put("count", 
((Integer)jSpinnerCount.getValue()));
                attBlockViewer.updateBlock(attBlockViewer.getFocusedBlock(), 
selectedStruct);
+               
+               
attBlockViewer.tux.access.acquire(TuxAPIConst.ACCESS_PRIORITY_CRITICAL);
                Double ct = new Date().getTime() / 1000.0;
                
attBlockViewer.tux.flippers.on((Integer)jSpinnerCount.getValue(), 
TuxAPIConst.SSV_NDEF);
-               Double length = (new Date().getTime() / 1000.0) - ct;
+               Double length = (new Date().getTime() / 1000.0) - ct - 0.5;
+               attBlockViewer.tux.access.release();
+               
                attBlockViewer.getFocusedBlock().setLength(length);
                attBlockViewer.getFocusedBlock().setPosition(position);
+               attBlockViewer.recalcFullTime();
                attBlockViewer.repaint();
        }
        
@@ -653,12 +676,17 @@
                
                selectedStruct.put("index", (Integer)jSpinnerCount.getValue());
                attBlockViewer.updateBlock(attBlockViewer.getFocusedBlock(), 
selectedStruct);
+               
+               
attBlockViewer.tux.access.acquire(TuxAPIConst.ACCESS_PRIORITY_CRITICAL);
                Double ct = new Date().getTime() / 1000.0;
                
attBlockViewer.tux.soundFlash.play((Integer)jSpinnerCount.getValue());
                Double length = (new Date().getTime() / 1000.0) - ct;
+               attBlockViewer.tux.access.release();
+               
                attBlockViewer.getFocusedBlock().closeWaveFile();
                attBlockViewer.getFocusedBlock().setLength(length);
                attBlockViewer.getFocusedBlock().setPosition(position);
+               attBlockViewer.recalcFullTime();
                attBlockViewer.repaint();
        }
        
@@ -677,12 +705,19 @@
                ComboBoxModel jComboBox1Model = new 
DefaultComboBoxModel(wavsList.toArray());
                jComboBoxWavs.setModel(jComboBox1Model);
                myPanel.add(jComboBoxWavs, new GridBagConstraints(3, 0, 1, 1, 
0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new 
Insets(0, 0, 0, 0), 0, 0));
+               myPanel.add(new JButton("Add a new wave file"), new 
GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, 
GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
+               myPanel.add(new JButton("Delete this wave file"), new 
GridBagConstraints(3, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, 
GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
        }
        
        private static void testBlockWavPlay(ATTBlockViewer attBlockViewer)
        {
                ATTBlock block = new ATTBlock(4);
 
+               if (jComboBoxWavs.getModel().getSize() == 0)
+               {
+                       return;
+               }
+               
                selectedStruct.put("wav_name", 
(String)jComboBoxWavs.getSelectedItem());
                block.setFunctionParams(selectedStruct);
                attBlockViewer.playBlock(block);
@@ -693,10 +728,16 @@
                Double position = 
attBlockViewer.getFocusedBlock().getPosition();
                String wavFile = 
attBlockViewer.attituneFile.getWaveFile((String)jComboBoxWavs.getSelectedItem());
                
+               if (jComboBoxWavs.getModel().getSize() == 0)
+               {
+                       return;
+               }
+               
                selectedStruct.put("wav_name", 
(String)jComboBoxWavs.getSelectedItem());
                attBlockViewer.updateBlock(attBlockViewer.getFocusedBlock(), 
selectedStruct);
                attBlockViewer.getFocusedBlock().loadWaveFile(wavFile);
                attBlockViewer.getFocusedBlock().setPosition(position);
+               attBlockViewer.recalcFullTime();
                attBlockViewer.repaint();
        }
        
@@ -733,13 +774,16 @@
                selectedStruct.put("speed", (Integer)jSliderSpeed.getValue());
                attBlockViewer.updateBlock(attBlockViewer.getFocusedBlock(), 
selectedStruct);
                
+               
attBlockViewer.tux.access.acquire(TuxAPIConst.ACCESS_PRIORITY_CRITICAL);
                Double ct = new Date().getTime() / 1000.0;
                Double turns = (Integer)jSpinnerCount.getValue() / 4.0;
                attBlockViewer.tux.spinning.leftOn(turns, 
(Integer)jSliderSpeed.getValue());
-               Double length = (new Date().getTime() / 1000.0) - ct;
+               Double length = (new Date().getTime() / 1000.0) - ct - 0.5;
+               attBlockViewer.tux.access.release();
                
                attBlockViewer.getFocusedBlock().setLength(length);
                attBlockViewer.getFocusedBlock().setPosition(position);
+               attBlockViewer.recalcFullTime();
                attBlockViewer.repaint();
        }
        
@@ -776,13 +820,16 @@
                selectedStruct.put("speed", (Integer)jSliderSpeed.getValue());
                attBlockViewer.updateBlock(attBlockViewer.getFocusedBlock(), 
selectedStruct);
                
+               
attBlockViewer.tux.access.acquire(TuxAPIConst.ACCESS_PRIORITY_CRITICAL);
                Double ct = new Date().getTime() / 1000.0;
                Double turns = (Integer)jSpinnerCount.getValue() / 4.0;
                attBlockViewer.tux.spinning.rightOn(turns, 
(Integer)jSliderSpeed.getValue());
-               Double length = (new Date().getTime() / 1000.0) - ct;
+               Double length = (new Date().getTime() / 1000.0) - ct - 0.5;
+               attBlockViewer.tux.access.release();
                
                attBlockViewer.getFocusedBlock().setLength(length);
                attBlockViewer.getFocusedBlock().setPosition(position);
+               attBlockViewer.recalcFullTime();
                attBlockViewer.repaint();
        }
        
@@ -813,6 +860,11 @@
        {
                ATTBlock block = new ATTBlock(4);
 
+               if (jComboBoxLocutors.getModel().getSize() == 0)
+               {
+                       return;
+               }
+               
                String spkName = (String)jComboBoxLocutors.getSelectedItem() + 
"8k";
                Integer speaker = 
Arrays.asList(ATTBlockParams.LOCUTOR_NAMES_LIST).indexOf(spkName) + 1;
                selectedStruct.put("speaker", speaker);
@@ -826,6 +878,11 @@
        {
                Double position = 
attBlockViewer.getFocusedBlock().getPosition();
                
+               if (jComboBoxLocutors.getModel().getSize() == 0)
+               {
+                       return;
+               }
+               
                String spkName = (String)jComboBoxLocutors.getSelectedItem() + 
"8k";
                Integer speaker = 
Arrays.asList(ATTBlockParams.LOCUTOR_NAMES_LIST).indexOf(spkName) + 1;
                selectedStruct.put("speaker", speaker);
@@ -833,16 +890,18 @@
                selectedStruct.put("text", jTextAreaTTS.getText());
                attBlockViewer.updateBlock(attBlockViewer.getFocusedBlock(), 
selectedStruct);
                
+               
attBlockViewer.tux.access.acquire(TuxAPIConst.ACCESS_PRIORITY_CRITICAL);
                Double ct = new Date().getTime() / 1000.0;
                attBlockViewer.tux.tts.speak(
                                jTextAreaTTS.getText(), 
                                (String)jComboBoxLocutors.getSelectedItem(), 
                                (Integer)jSpinnerPitch.getValue());
-               
attBlockViewer.tux.soundFlash.play((Integer)jSpinnerCount.getValue());
-               Double length = (new Date().getTime() / 1000.0) - ct;
+               Double length = (new Date().getTime() / 1000.0) - ct - 0.5;
+               attBlockViewer.tux.access.release();
                
                attBlockViewer.getFocusedBlock().setLength(length);
                attBlockViewer.getFocusedBlock().setPosition(position);
+               attBlockViewer.recalcFullTime();
                attBlockViewer.repaint();
        }
 }

Modified: 
software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java
===================================================================
--- software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java   
2008-08-16 10:04:45 UTC (rev 1514)
+++ software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java   
2008-08-16 10:32:25 UTC (rev 1515)
@@ -719,10 +719,7 @@
        {
                jPanelBlocConf.setVisible(false);
                jPanelBlocConf.removeAll();
-               if (attBlockViewer.getFocusedBlock() != null)
-               {
-                       AttituneCmdConf.showBlockConf(attBlockViewer, 
jPanelBlocConf, cmd);
-               }
+               AttituneCmdConf.showBlockConf(attBlockViewer, jPanelBlocConf, 
cmd);
                jPanelBlocConf.setVisible(true);
                this.pack();
        }
@@ -732,6 +729,22 @@
         */
        private void onTestBlockMouseClicked(MouseEvent evt)
        {       
+               if (!attBlockViewer.tux.dongle.getConnected())
+               {
+                       JOptionPane.showMessageDialog(this, 
+                                       ATTMessages.getString("MainFrame.103"), 
+                                       ATTMessages.getString("MainFrame.1"), 
+                                       JOptionPane.WARNING_MESSAGE);
+                       return;
+               }
+               if (!attBlockViewer.tux.radio.getConnected())
+               {
+                       JOptionPane.showMessageDialog(this, 
+                                       ATTMessages.getString("MainFrame.104"), 
+                                       ATTMessages.getString("MainFrame.1"), 
+                                       JOptionPane.WARNING_MESSAGE);
+                       return;
+               }
                AttituneCmdConf.testBlockConf(attBlockViewer);
        }
        
@@ -740,6 +753,22 @@
         */
        private void onValidateBlockMouseClicked(MouseEvent evt)
        {       
+               if (!attBlockViewer.tux.dongle.getConnected())
+               {
+                       JOptionPane.showMessageDialog(this, 
+                                       ATTMessages.getString("MainFrame.103"), 
+                                       ATTMessages.getString("MainFrame.1"), 
+                                       JOptionPane.WARNING_MESSAGE);
+                       return;
+               }
+               if (!attBlockViewer.tux.radio.getConnected())
+               {
+                       JOptionPane.showMessageDialog(this, 
+                                       ATTMessages.getString("MainFrame.104"), 
+                                       ATTMessages.getString("MainFrame.1"), 
+                                       JOptionPane.WARNING_MESSAGE);
+                       return;
+               }
                AttituneCmdConf.validateBlockConf(attBlockViewer);
        }
        
@@ -981,6 +1010,22 @@
         */
        public void onPlayButtonPressed(MouseEvent evt)
        {
+               if (!attBlockViewer.tux.dongle.getConnected())
+               {
+                       JOptionPane.showMessageDialog(this, 
+                                       ATTMessages.getString("MainFrame.103"), 
+                                       ATTMessages.getString("MainFrame.1"), 
+                                       JOptionPane.WARNING_MESSAGE);
+                       return;
+               }
+               if (!attBlockViewer.tux.radio.getConnected())
+               {
+                       JOptionPane.showMessageDialog(this, 
+                                       ATTMessages.getString("MainFrame.104"), 
+                                       ATTMessages.getString("MainFrame.1"), 
+                                       JOptionPane.WARNING_MESSAGE);
+                       return;
+               }
                attBlockViewer.playScene(attBlockViewer.getCurrentPosition());
        }
        

Modified: 
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/messages.properties
===================================================================
--- 
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/messages.properties
     2008-08-16 10:04:45 UTC (rev 1514)
+++ 
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/messages.properties
     2008-08-16 10:32:25 UTC (rev 1515)
@@ -22,6 +22,8 @@
 MainFrame.100=Command :
 MainFrame.101=Test
 MainFrame.102=Validate
+MainFrame.103=Your USB fish is disconnected, operation canceled
+MainFrame.104=Tuxdroid is disconnected, operation canceled
 BlockConf.0=Count :
 BlockConf.1=Speed :
 BlockConf.2=No parameter

Modified: 
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/messages_fr.properties
===================================================================
--- 
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/messages_fr.properties
  2008-08-16 10:04:45 UTC (rev 1514)
+++ 
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/messages_fr.properties
  2008-08-16 10:32:25 UTC (rev 1515)
@@ -22,6 +22,8 @@
 MainFrame.100=Commande :
 MainFrame.101=Tester
 MainFrame.102=Valider
+MainFrame.103=Le poisson USB n'est pas branch�, l'op�ration est annul�e
+MainFrame.104=Tuxdroid n'est pas allum�, l'op�ration est annul�e
 BlockConf.0=Nombre :
 BlockConf.1=Vitesse :
 BlockConf.2=Pas de param�tre

Modified: 
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/visual/ATTBlockViewer.java
===================================================================
--- 
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/visual/ATTBlockViewer.java
      2008-08-16 10:04:45 UTC (rev 1514)
+++ 
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/visual/ATTBlockViewer.java
      2008-08-16 10:32:25 UTC (rev 1515)
@@ -1045,10 +1045,10 @@
                return tlv.timePosition;
        }
        
-       /*
+       /**
         * 
         */
-       private void recalcFullTime()
+       public void recalcFullTime()
        {
                double newMaxTime, val;
                int i, j;


-------------------------------------------------------------------------
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

Reply via email to