tux-droid-svn Mailing List for Tux Droid CE (Page 184)
Status: Beta
Brought to you by:
ks156
You can subscribe to this list here.
2007 |
Jan
|
Feb
(32) |
Mar
(108) |
Apr
(71) |
May
(38) |
Jun
(128) |
Jul
(1) |
Aug
(14) |
Sep
(77) |
Oct
(104) |
Nov
(90) |
Dec
(71) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(81) |
Feb
(18) |
Mar
(40) |
Apr
(102) |
May
(151) |
Jun
(74) |
Jul
(151) |
Aug
(257) |
Sep
(447) |
Oct
(379) |
Nov
(404) |
Dec
(430) |
2009 |
Jan
(173) |
Feb
(236) |
Mar
(519) |
Apr
(300) |
May
(112) |
Jun
(232) |
Jul
(314) |
Aug
(58) |
Sep
(203) |
Oct
(293) |
Nov
(26) |
Dec
(109) |
2010 |
Jan
(19) |
Feb
(25) |
Mar
(33) |
Apr
(1) |
May
|
Jun
(3) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: remi <c2m...@c2...> - 2008-07-31 11:37:55
|
Author: remi Date: 2008-07-31 13:38:00 +0200 (Thu, 31 Jul 2008) New Revision: 1434 Modified: software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/visual/ATTBlockViewer.java Log: * fixed bug with the sound wave blocks copying. The waveform is now loaded. 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-07-31 10:51:29 UTC (rev 1433) +++ software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/visual/ATTBlockViewer.java 2008-07-31 11:38:00 UTC (rev 1434) @@ -1357,7 +1357,17 @@ return null; } - return createBlock(rowCopied, blockCopied.getFunctionParams(), + ATTBlock newBlock; + + newBlock = createBlock(rowCopied, blockCopied.getFunctionParams(), timeBegin, blockCopied.getLength()); + + if (rowCopied == ATTConfig.BLOCK_TYPE_WAV) + { + newBlock.loadWaveFile(attituneFile.getWaveFile((String)blockCopied. + getFunctionParams().get("wav_name"))); + } + + return newBlock; } } |
From: remi <c2m...@c2...> - 2008-07-31 10:51:24
|
Author: remi Date: 2008-07-31 12:51:29 +0200 (Thu, 31 Jul 2008) New Revision: 1433 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/visual/ATTBlockViewer.java Log: * added copy and past block functions 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-07-30 14:35:16 UTC (rev 1432) +++ software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/format/ATTBlockParams.java 2008-07-31 10:51:29 UTC (rev 1433) @@ -2,6 +2,7 @@ import java.net.URLEncoder; import java.util.Hashtable; +import java.util.Iterator; /** * @@ -22,6 +23,7 @@ LEDS_BLINK_CANVAS.put("cmd", "leds_blink"); LEDS_BLINK_CANVAS.put("count", 1.0); LEDS_BLINK_CANVAS.put("speed", 1); + LEDS_BLINK_CANVAS.put("duration", 0.0); } private static String[] ledsBlinkTmc(Hashtable<String,Object> struct) { @@ -568,4 +570,65 @@ return null; } } + + /** + * + * @param struct + * @return + */ + public static Hashtable<String,Object> copyBlockStruct(Hashtable<String,Object> struct) + { + Hashtable<String,Object> result = new Hashtable<String,Object>(); + String key; + Iterator<String> it = (Iterator<String>)struct.keys(); + + while (it.hasNext()) + { + key = (String)it.next(); + result.put(key, struct.get(key)); + } + + return result; + } + + /** + * + * @param rowIdx + * @return + */ + public static Hashtable<String,Object> getDefaultBlock(int rowIdx) + { + Hashtable<String,Object> result; + + if (rowIdx == 0) + { + result = copyBlockStruct(LEDS_BLINK_CANVAS); + } + else if (rowIdx == 1) + { + result = copyBlockStruct(EYES_ON_CANVAS); + } + else if (rowIdx == 2) + { + result = copyBlockStruct(FLIPPERS_ON_CANVAS); + } + else if (rowIdx == 3) + { + result = copyBlockStruct(SPINNING_LEFT_CANVAS); + } + else if (rowIdx == 4) + { + result = copyBlockStruct(PLAY_FLASH_CANVAS); + } + else if (rowIdx == 5) + { + result = copyBlockStruct(PLAY_TTS_CANVAS); + } + else + { + result = copyBlockStruct(LEDS_BLINK_CANVAS); + } + + return result; + } } 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-07-30 14:35:16 UTC (rev 1432) +++ software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/visual/ATTBlockViewer.java 2008-07-31 10:51:29 UTC (rev 1433) @@ -75,6 +75,8 @@ private ATTBlock focusedBlock; private int focusedRowIndex; private boolean draggingBlock; + private ATTBlock blockCopied; + private int rowCopied; private int zoomFactor; @@ -155,6 +157,9 @@ focusedRowIndex = -1; draggingBlock = false; blockContainer0.setFocused(true); + /* Block to copy */ + blockCopied = null; + rowCopied = -1; /* Zoom init */ zoomFactor = -1; /* Event handlers */ @@ -1076,6 +1081,7 @@ resBlock.setLength(timeLength); recalcFullTime(); setFocusedBlock(resBlock); + this.repaint(); return resBlock; } @@ -1102,6 +1108,7 @@ { blockContainers[i].deleteBlock(j); recalcFullTime(); + this.repaint(); } return; @@ -1319,4 +1326,38 @@ sendSimpleCmd(String.format("macro/play?macro=%s", macro)); } + + /** + * + */ + public void copyBlock() + { + blockCopied = focusedBlock; + rowCopied = focusedRowIndex; + } + + /** + * + * @param timeBegin + * @return + */ + public ATTBlock pastBlock(double timeBegin) + { + if (rowCopied == -1) + { + return null; + } + else if (rowCopied != focusedRowIndex) + { + return null; + } + + if (blockCopied == null) + { + return null; + } + + return createBlock(rowCopied, blockCopied.getFunctionParams(), + timeBegin, blockCopied.getLength()); + } } |
From: Paul_R <c2m...@c2...> - 2008-07-30 14:35:07
|
Author: Paul_R Date: 2008-07-30 16:35:16 +0200 (Wed, 30 Jul 2008) New Revision: 1432 Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/advancedViewPanel.java software_suite_v2/software/tools/tuxController/trunk/src/i18n/bundle.properties software_suite_v2/software/tools/tuxController/trunk/src/i18n/bundle_en.properties software_suite_v2/software/tools/tuxController/trunk/src/i18n/bundle_fr.properties Log: * Internationalized the RF state label Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/advancedViewPanel.java =================================================================== --- software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/advancedViewPanel.java 2008-07-30 14:31:17 UTC (rev 1431) +++ software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/advancedViewPanel.java 2008-07-30 14:35:16 UTC (rev 1432) @@ -86,7 +86,7 @@ new Insets(0, 0, 0, 0), 0, 0)); win.imgRFState.setIcon(win.iconRFOff); win.imgRFState.setBounds(205, 30, 205, 20); - win.imgRFState.setText("Wireless link"); + win.imgRFState.setText(bundle.getString("lblRFState")); win.imgRFState.setHorizontalTextPosition(SwingConstants.LEFT); win.imgRFState.setHorizontalAlignment(SwingConstants.RIGHT); } Modified: software_suite_v2/software/tools/tuxController/trunk/src/i18n/bundle.properties =================================================================== --- software_suite_v2/software/tools/tuxController/trunk/src/i18n/bundle.properties 2008-07-30 14:31:17 UTC (rev 1431) +++ software_suite_v2/software/tools/tuxController/trunk/src/i18n/bundle.properties 2008-07-30 14:35:16 UTC (rev 1432) @@ -24,6 +24,7 @@ # Check box : advanced view chkAdvancedView=Advanced view +lblRFState=Wireless link # Advanced control : eyes lblEyes=Eyes Modified: software_suite_v2/software/tools/tuxController/trunk/src/i18n/bundle_en.properties =================================================================== --- software_suite_v2/software/tools/tuxController/trunk/src/i18n/bundle_en.properties 2008-07-30 14:31:17 UTC (rev 1431) +++ software_suite_v2/software/tools/tuxController/trunk/src/i18n/bundle_en.properties 2008-07-30 14:35:16 UTC (rev 1432) @@ -24,6 +24,7 @@ # Check box : advanced view chkAdvancedView=Advanced view +lblRFState=Wireless link # Advanced control : eyes lblEyes=Eyes Modified: software_suite_v2/software/tools/tuxController/trunk/src/i18n/bundle_fr.properties =================================================================== --- software_suite_v2/software/tools/tuxController/trunk/src/i18n/bundle_fr.properties 2008-07-30 14:31:17 UTC (rev 1431) +++ software_suite_v2/software/tools/tuxController/trunk/src/i18n/bundle_fr.properties 2008-07-30 14:35:16 UTC (rev 1432) @@ -24,6 +24,7 @@ # Check box : advanced view chkAdvancedView=Panneau avanclblRFState=Liaison radio # Advanced control : eyes lblEyes=Yeux |
From: Paul_R <c2m...@c2...> - 2008-07-30 14:31:08
|
Author: Paul_R Date: 2008-07-30 16:31:17 +0200 (Wed, 30 Jul 2008) New Revision: 1431 Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/ttsPanel.java software_suite_v2/software/tools/tuxController/trunk/src/GUI/mainWindow.java Log: * Added a scrollbar on the TTS text entry Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/ttsPanel.java =================================================================== --- software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/ttsPanel.java 2008-07-30 14:08:21 UTC (rev 1430) +++ software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/ttsPanel.java 2008-07-30 14:31:17 UTC (rev 1431) @@ -36,6 +36,7 @@ import javax.swing.JPanel; import javax.swing.JSpinner; import javax.swing.JTextArea; +import javax.swing.JScrollPane; import GUI.mainWindow; @@ -116,14 +117,18 @@ * Create the text entry. */ private void createTextEntryPanel() { + win.TTSScroll = new JScrollPane(); + win.textTTS = new JTextArea(); - win.panTTS.add(win.textTTS, + win.panTTS.add(win.TTSScroll, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 20), 0, 0)); + win.TTSScroll.setViewportView(win.textTTS); + win.TTSScroll.setSize(new java.awt.Dimension(370, 60)); + win.textTTS.setText(bundle.getString("textTTS")); //$NON-NLS-1$ - win.textTTS.setSize(370, 60); } /** Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/mainWindow.java =================================================================== --- software_suite_v2/software/tools/tuxController/trunk/src/GUI/mainWindow.java 2008-07-30 14:08:21 UTC (rev 1430) +++ software_suite_v2/software/tools/tuxController/trunk/src/GUI/mainWindow.java 2008-07-30 14:31:17 UTC (rev 1431) @@ -42,6 +42,7 @@ import javax.swing.JPanel; import javax.swing.JProgressBar; import javax.swing.JRadioButton; +import javax.swing.JScrollPane; import javax.swing.JSeparator; import javax.swing.JSlider; import javax.swing.JSpinner; @@ -978,6 +979,8 @@ public java.awt.Dimension dimWin; public java.awt.Dimension dimProg; public java.awt.Dimension dimAdvancedView; + + public JScrollPane TTSScroll; } |
From: Paul_R <c2m...@c2...> - 2008-07-30 14:08:12
|
Author: Paul_R Date: 2008-07-30 16:08:21 +0200 (Wed, 30 Jul 2008) New Revision: 1430 Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/levelPanel.java software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/objects.java software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/tuxPanel.java software_suite_v2/software/tools/tuxController/trunk/src/GUI/mainWindow.java Log: * Cleanup Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/levelPanel.java =================================================================== --- software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/levelPanel.java 2008-07-30 14:04:46 UTC (rev 1429) +++ software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/levelPanel.java 2008-07-30 14:08:21 UTC (rev 1430) @@ -39,7 +39,6 @@ createPanel(); createLightSection(); createBatterySection(); - createMicroSection(); } private void createPanel() { @@ -125,37 +124,4 @@ win.lblBatteryLevel.setText("0.00 V"); win.lblBatteryLevel.setSize(60, 22); } - - private void createMicroSection() { - /* - win.imgRFState = new JLabel(); - win.panLevel.add(win.imgRFState, - new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, - GridBagConstraints.CENTER, - GridBagConstraints.NONE, - new Insets(0, 0, 0, 0), 0, 0)); - win.imgRFState.setIcon(win.iconRFOff); - */ - win.progMicroLevel = new JProgressBar(); - win.panLevel.add(win.progMicroLevel, - new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, - GridBagConstraints.CENTER, - GridBagConstraints.NONE, - new Insets(0, 0, 0, 0), 0, 0)); - win.progMicroLevel.setPreferredSize(win.dimProg); - win.progMicroLevel.setMinimumSize(win.dimProg); - win.progMicroLevel.setMaximumSize(win.dimProg); - win.progMicroLevel.setVisible(false); - - win.lblMicroLevel = new JLabel(); - win.panLevel.add(win.lblMicroLevel, - new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, - GridBagConstraints.CENTER, - GridBagConstraints.BOTH, - new Insets(0, 0, 0, 0), 0, 0)); - win.lblMicroLevel.setText("0.00 %"); - win.lblMicroLevel.setSize(60, 22); - win.lblMicroLevel.setVisible(false); - } - } Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/objects.java =================================================================== --- software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/objects.java 2008-07-30 14:04:46 UTC (rev 1429) +++ software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/objects.java 2008-07-30 14:08:21 UTC (rev 1430) @@ -93,8 +93,6 @@ "/GUI/images/iconLight.png")); win.iconBattery = new javax.swing.ImageIcon(getClass().getResource( "/GUI/images/iconBattery.png")); - win.iconMicro = new javax.swing.ImageIcon(getClass().getResource( - "/GUI/images/iconMicro.png")); /* RF Image */ win.iconRFOff = new javax.swing.ImageIcon(getClass().getResource( Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/tuxPanel.java =================================================================== --- software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/tuxPanel.java 2008-07-30 14:04:46 UTC (rev 1429) +++ software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/tuxPanel.java 2008-07-30 14:08:21 UTC (rev 1430) @@ -49,30 +49,7 @@ createMouthSection(); createFlippersSection(); createSpinSection(); - - - - win.chkLeftLed = new JCheckBox(); - win.panImages.add(win.chkLeftLed); - win.chkLeftLed.setBounds(120, 0, 25, 25); - - win.chkLeftLed.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent evt) { - win.chkLeftLedActionPerformed(evt); - } - }); - - win.chkRightLed = new JCheckBox(); - win.panImages.add(win.chkRightLed); - win.chkRightLed.setBounds(90, 0, 25, 25); - - win.chkRightLed.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent evt) { - win.chkRightLedActionPerformed(evt); - } - }); - - + createLEDCheckBox(); } private void createPanel() { @@ -280,5 +257,27 @@ } }); } + + private void createLEDCheckBox() { + win.chkLeftLed = new JCheckBox(); + win.panImages.add(win.chkLeftLed); + win.chkLeftLed.setBounds(120, 0, 25, 25); + + win.chkLeftLed.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent evt) { + win.chkLeftLedActionPerformed(evt); + } + }); + + win.chkRightLed = new JCheckBox(); + win.panImages.add(win.chkRightLed); + win.chkRightLed.setBounds(90, 0, 25, 25); + + win.chkRightLed.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent evt) { + win.chkRightLedActionPerformed(evt); + } + }); + } } Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/mainWindow.java =================================================================== --- software_suite_v2/software/tools/tuxController/trunk/src/GUI/mainWindow.java 2008-07-30 14:04:46 UTC (rev 1429) +++ software_suite_v2/software/tools/tuxController/trunk/src/GUI/mainWindow.java 2008-07-30 14:08:21 UTC (rev 1430) @@ -971,7 +971,6 @@ public javax.swing.ImageIcon iconStop; public javax.swing.ImageIcon iconLight; public javax.swing.ImageIcon iconBattery; - public javax.swing.ImageIcon iconMicro; public javax.swing.ImageIcon iconRFOff; public javax.swing.ImageIcon iconRFOn; |
From: Paul_R <c2m...@c2...> - 2008-07-30 14:04:39
|
Author: Paul_R Date: 2008-07-30 16:04:46 +0200 (Wed, 30 Jul 2008) New Revision: 1429 Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/advancedViewPanel.java software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/generalControlPanel.java software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/levelPanel.java software_suite_v2/software/tools/tuxController/trunk/src/GUI/mainWindow.java Log: * Moved the RF state to the advanced view panel * Align the level panel Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/advancedViewPanel.java =================================================================== --- software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/advancedViewPanel.java 2008-07-30 13:31:40 UTC (rev 1428) +++ software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/advancedViewPanel.java 2008-07-30 14:04:46 UTC (rev 1429) @@ -28,6 +28,9 @@ import java.awt.event.ActionListener; import javax.swing.JCheckBox; +import javax.swing.JPanel; +import javax.swing.JLabel; +import javax.swing.SwingConstants; import GUI.mainWindow; @@ -52,19 +55,39 @@ * Create the panel with the checkbox. */ private void createAdvancedViewSection() { + win.advancedView = new JPanel(); + win.getContentPane().add(win.advancedView, + new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, + GridBagConstraints.NORTH, + GridBagConstraints.BOTH, + new Insets(0, 0, 0, 0), 0, 0)); + win.advancedView.setLayout(null); + win.chkAdvancedView = new JCheckBox(); - win.getContentPane().add(win.chkAdvancedView, + win.advancedView.add(win.chkAdvancedView, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); + win.chkAdvancedView.setBounds(10, 30, 205, 20); win.chkAdvancedView.setText(bundle.getString("chkAdvancedView")); //$NON-NLS-1$ - win.chkAdvancedView.setMargin(new java.awt.Insets(2, 10, 2, 1)); win.chkAdvancedView.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { win.chkAdvancedViewActionPerformed(evt); } - }); + }); + + win.imgRFState = new JLabel(); + win.advancedView.add(win.imgRFState, + new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, + GridBagConstraints.CENTER, + GridBagConstraints.NONE, + new Insets(0, 0, 0, 0), 0, 0)); + win.imgRFState.setIcon(win.iconRFOff); + win.imgRFState.setBounds(205, 30, 205, 20); + win.imgRFState.setText("Wireless link"); + win.imgRFState.setHorizontalTextPosition(SwingConstants.LEFT); + win.imgRFState.setHorizontalAlignment(SwingConstants.RIGHT); } } Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/generalControlPanel.java =================================================================== --- software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/generalControlPanel.java 2008-07-30 13:31:40 UTC (rev 1428) +++ software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/generalControlPanel.java 2008-07-30 14:04:46 UTC (rev 1429) @@ -61,23 +61,23 @@ win.sepGeneralControl1 = new JSeparator(); win.panGeneralControl.add(win.sepGeneralControl1); - win.sepGeneralControl1.setBounds(2, 4, 2, 86); + win.sepGeneralControl1.setBounds(2, 4, 2, 66); win.sepGeneralControl1.setOrientation(SwingConstants.VERTICAL); win.sepGeneralControl2 = new JSeparator(); win.panGeneralControl.add(win.sepGeneralControl2); - win.sepGeneralControl2.setBounds(18, 4, 2, 86); + win.sepGeneralControl2.setBounds(18, 4, 2, 66); win.sepGeneralControl2.setOrientation(SwingConstants.VERTICAL); - win.lblGeneral = new JVerticalLabel(bundle.getString("lblGeneral"), 67); //$NON-NLS-1$ + win.lblGeneral = new JVerticalLabel(bundle.getString("lblGeneral"), 57); //$NON-NLS-1$ win.panGeneralControl.add(win.lblGeneral); - win.lblGeneral.setBounds(2, 0, 16, 90); + win.lblGeneral.setBounds(2, 0, 16, 70); } private void button() { win.btnGeneralStop = new JButton(); win.panGeneralControl.add(win.btnGeneralStop); - win.btnGeneralStop.setBounds(18, 32, 360, 25); + win.btnGeneralStop.setBounds(18, 22, 360, 25); win.btnGeneralStop.setContentAreaFilled(false); win.btnGeneralStop.setBorderPainted(false); win.btnGeneralStop.setIcon(win.iconStop); Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/levelPanel.java =================================================================== --- software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/levelPanel.java 2008-07-30 13:31:40 UTC (rev 1428) +++ software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/levelPanel.java 2008-07-30 14:04:46 UTC (rev 1429) @@ -54,14 +54,14 @@ /* Create the panel */ win.panLevel = new JPanel(); win.panLevelAbs.add(win.panLevel); - win.panLevel.setBounds(0, 0, 406, 79); - java.awt.Dimension panDim = new java.awt.Dimension(406, 90); + win.panLevel.setBounds(0, 0, 406, 60); + java.awt.Dimension panDim = new java.awt.Dimension(406, 60); GridBagLayout panLevelLayout = new GridBagLayout(); win.panLevel.setLayout(panLevelLayout); win.panLevel.setMaximumSize(panDim); win.panLevel.setMinimumSize(panDim); - panLevelLayout.rowWeights = new double[] {0.1, 0.1, 0.1}; - panLevelLayout.rowHeights = new int[] {30, 30, 30}; + panLevelLayout.rowWeights = new double[] {0.1, 0.1, 0.0}; + panLevelLayout.rowHeights = new int[] {30, 30, 1}; panLevelLayout.columnWeights = new double[] {0.0, 0.0, 0.0}; panLevelLayout.columnWidths = new int[] {55, 260, 70}; } @@ -127,6 +127,7 @@ } private void createMicroSection() { + /* win.imgRFState = new JLabel(); win.panLevel.add(win.imgRFState, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, @@ -134,7 +135,7 @@ GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); win.imgRFState.setIcon(win.iconRFOff); - + */ win.progMicroLevel = new JProgressBar(); win.panLevel.add(win.progMicroLevel, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/mainWindow.java =================================================================== --- software_suite_v2/software/tools/tuxController/trunk/src/GUI/mainWindow.java 2008-07-30 13:31:40 UTC (rev 1428) +++ software_suite_v2/software/tools/tuxController/trunk/src/GUI/mainWindow.java 2008-07-30 14:04:46 UTC (rev 1429) @@ -125,13 +125,13 @@ setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); - dimWin = new java.awt.Dimension(430, 600); // 396, 592 + dimWin = new java.awt.Dimension(430, 580); // 396, 592 this.setPreferredSize(new java.awt.Dimension(430, 600)); // 756, 591 this.setMinimumSize(dimWin); this.setSize(dimWin); this.setResizable(false); thisLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1}; - thisLayout.rowHeights = new int[] {80, 390, 90, 40}; + thisLayout.rowHeights = new int[] {80, 390, 70, 40}; thisLayout.columnWeights = new double[] {0.0, 0.0, 1.0}; thisLayout.columnWidths = new int[] {430, 1, 1}; getContentPane().setLayout(thisLayout); @@ -150,33 +150,33 @@ private void resizeWindow() { if (chkAdvancedView.isSelected() && chkTTS.isSelected()) { - dimWin.setSize(790, 700); + dimWin.setSize(790, 680); thisLayout.columnWidths = new int[] {430, 360, 1}; - thisLayout.rowHeights = new int[] {80, 390, 90, 140}; + thisLayout.rowHeights = new int[] {80, 390, 70, 140}; this.setSize(dimWin); this.setResizable(false); } else if (!chkAdvancedView.isSelected() && !chkTTS.isSelected()) { - dimWin.setSize(430, 600); + dimWin.setSize(430, 580); thisLayout.columnWidths = new int[] {430, 1, 1}; - thisLayout.rowHeights = new int[] {80, 390, 90, 40}; + thisLayout.rowHeights = new int[] {80, 390, 70, 40}; this.setSize(dimWin); this.setResizable(false); } - else if (chkAdvancedView.isSelected() && !chkTTS.isSelected()) + else if(chkAdvancedView.isSelected() && !chkTTS.isSelected()) { - dimWin.setSize(790, 600); + dimWin.setSize(790, 580); thisLayout.columnWidths = new int[] {430, 360, 1}; - thisLayout.rowHeights = new int[] {80, 390, 90, 40}; + thisLayout.rowHeights = new int[] {80, 390, 70, 40}; this.setSize(dimWin); this.setResizable(false); } else if (!chkAdvancedView.isSelected() && chkTTS.isSelected()) { - dimWin.setSize(430, 700); + dimWin.setSize(430, 680); thisLayout.columnWidths = new int[] {430, 1, 1}; - thisLayout.rowHeights = new int[] {80, 390, 90, 140}; + thisLayout.rowHeights = new int[] {80, 390, 70, 140}; this.setSize(dimWin); this.setResizable(false); } @@ -817,6 +817,7 @@ public JPanel panLedsCtl; public JPanel panDummyCtl; public JPanel panGeneralControl; + public JPanel advancedView; public JPanel panLevelAbs; public JPanel panLevel; |
From: Paul_R <c2m...@c2...> - 2008-07-30 13:31:37
|
Author: Paul_R Date: 2008-07-30 15:31:40 +0200 (Wed, 30 Jul 2008) New Revision: 1428 Added: software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/iconRadioOff.png software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/iconRadioOn.png Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/levelPanel.java software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/objects.java software_suite_v2/software/tools/tuxController/trunk/src/GUI/control/controlTux.java software_suite_v2/software/tools/tuxController/trunk/src/GUI/mainWindow.java Log: * Added the RF State icon instead of the micro icon. Also hide the micro progress bar and percent label * Aligned the TTS checkbox Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/levelPanel.java =================================================================== --- software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/levelPanel.java 2008-07-30 13:06:26 UTC (rev 1427) +++ software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/levelPanel.java 2008-07-30 13:31:40 UTC (rev 1428) @@ -127,14 +127,14 @@ } private void createMicroSection() { - win.imgMicroLevel = new JLabel(); - win.panLevel.add(win.imgMicroLevel, + win.imgRFState = new JLabel(); + win.panLevel.add(win.imgRFState, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); - win.imgMicroLevel.setIcon(win.iconMicro); - + win.imgRFState.setIcon(win.iconRFOff); + win.progMicroLevel = new JProgressBar(); win.panLevel.add(win.progMicroLevel, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, @@ -144,6 +144,7 @@ win.progMicroLevel.setPreferredSize(win.dimProg); win.progMicroLevel.setMinimumSize(win.dimProg); win.progMicroLevel.setMaximumSize(win.dimProg); + win.progMicroLevel.setVisible(false); win.lblMicroLevel = new JLabel(); win.panLevel.add(win.lblMicroLevel, @@ -153,6 +154,7 @@ new Insets(0, 0, 0, 0), 0, 0)); win.lblMicroLevel.setText("0.00 %"); win.lblMicroLevel.setSize(60, 22); + win.lblMicroLevel.setVisible(false); } } Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/objects.java =================================================================== --- software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/objects.java 2008-07-30 13:06:26 UTC (rev 1427) +++ software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/objects.java 2008-07-30 13:31:40 UTC (rev 1428) @@ -95,6 +95,12 @@ "/GUI/images/iconBattery.png")); win.iconMicro = new javax.swing.ImageIcon(getClass().getResource( "/GUI/images/iconMicro.png")); + + /* RF Image */ + win.iconRFOff = new javax.swing.ImageIcon(getClass().getResource( + "/GUI/images/iconRadioOff.png")); + win.iconRFOn = new javax.swing.ImageIcon(getClass().getResource( + "/GUI/images/iconRadioOn.png")); } private void createSpinnerModels() { Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/control/controlTux.java =================================================================== --- software_suite_v2/software/tools/tuxController/trunk/src/GUI/control/controlTux.java 2008-07-30 13:06:26 UTC (rev 1427) +++ software_suite_v2/software/tools/tuxController/trunk/src/GUI/control/controlTux.java 2008-07-30 13:31:40 UTC (rev 1428) @@ -69,6 +69,8 @@ onLightLevelEvent((String)tux.status.requestOne("light_level")[0], 0.0); onBatteryLevelEvent((String)tux.status.requestOne("battery_level")[0], 0.0); + win.refreshRFState(tux.radio.getConnected()); + onVoiceListChanged(); } @@ -113,7 +115,7 @@ "onSpinCounter"); tux.event.handler.register(TuxAPIConst.ST_NAME_RADIO_STATE, this, - "onRadioConnected", "True", null); + "onRadioConnected", null, null); } /* EYES CONTROL ----------------------------------------------------------*/ @@ -619,9 +621,14 @@ tux.spinning.rightOnAsync(0.25); } - // BUG : this function didn't work ! public void onRadioConnected(String value, Double delay) { - this.refreshGUI(); - win.refreshVoiceList(tux.tts.getVoices()); + if (value.equalsIgnoreCase("True")) { + this.refreshGUI(); + win.refreshRFState(true); + win.refreshVoiceList(tux.tts.getVoices()); + } + else { + win.refreshRFState(false); + } } } Added: software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/iconRadioOff.png =================================================================== (Binary files differ) Property changes on: software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/iconRadioOff.png ___________________________________________________________________ Name: svn:mime-type + image/png Added: software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/iconRadioOn.png =================================================================== (Binary files differ) Property changes on: software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/iconRadioOn.png ___________________________________________________________________ Name: svn:mime-type + image/png Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/mainWindow.java =================================================================== --- software_suite_v2/software/tools/tuxController/trunk/src/GUI/mainWindow.java 2008-07-30 13:06:26 UTC (rev 1427) +++ software_suite_v2/software/tools/tuxController/trunk/src/GUI/mainWindow.java 2008-07-30 13:31:40 UTC (rev 1428) @@ -125,13 +125,13 @@ setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); - dimWin = new java.awt.Dimension(430, 590); // 396, 592 + dimWin = new java.awt.Dimension(430, 600); // 396, 592 this.setPreferredSize(new java.awt.Dimension(430, 600)); // 756, 591 this.setMinimumSize(dimWin); this.setSize(dimWin); this.setResizable(false); thisLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1}; - thisLayout.rowHeights = new int[] {80, 390, 90, 30}; + thisLayout.rowHeights = new int[] {80, 390, 90, 40}; thisLayout.columnWeights = new double[] {0.0, 0.0, 1.0}; thisLayout.columnWidths = new int[] {430, 1, 1}; getContentPane().setLayout(thisLayout); @@ -158,17 +158,17 @@ } else if (!chkAdvancedView.isSelected() && !chkTTS.isSelected()) { - dimWin.setSize(430, 590); + dimWin.setSize(430, 600); thisLayout.columnWidths = new int[] {430, 1, 1}; - thisLayout.rowHeights = new int[] {80, 390, 90, 30}; + thisLayout.rowHeights = new int[] {80, 390, 90, 40}; this.setSize(dimWin); this.setResizable(false); } else if (chkAdvancedView.isSelected() && !chkTTS.isSelected()) { - dimWin.setSize(790, 590); + dimWin.setSize(790, 600); thisLayout.columnWidths = new int[] {430, 360, 1}; - thisLayout.rowHeights = new int[] {80, 390, 90, 30}; + thisLayout.rowHeights = new int[] {80, 390, 90, 40}; this.setSize(dimWin); this.setResizable(false); } @@ -731,6 +731,17 @@ this.lblBatteryLevel.setText(String.format("%.2f", //$NON-NLS-1$ Float.parseFloat(fvalue) / 1000) +" V"); //$NON-NLS-1$ } + + /** + * Refresh : Refresh the RF State + * @param state + */ + public void refreshRFState(Boolean state) { + if (state) + this.imgRFState.setIcon(iconRFOn); + else + this.imgRFState.setIcon(iconRFOff); + } /* MISC FUNCTIONS -----------------------------------------------------------*/ public ButtonGroup getRadLeds() { @@ -820,7 +831,7 @@ public JLabel imgMouth; public JLabel imgLeftEye; public JLabel imgRightEye; - public JLabel imgMicroLevel; + public JLabel imgRFState; public JLabel imgBatteryLevel; public JLabel imgLightLevel; public JLabel lblBatteryLevel; @@ -960,6 +971,8 @@ public javax.swing.ImageIcon iconLight; public javax.swing.ImageIcon iconBattery; public javax.swing.ImageIcon iconMicro; + public javax.swing.ImageIcon iconRFOff; + public javax.swing.ImageIcon iconRFOn; /* Misc objects */ public java.awt.Dimension dimWin; |
From: Paul_R <c2m...@c2...> - 2008-07-30 13:06:18
|
Author: Paul_R Date: 2008-07-30 15:06:26 +0200 (Wed, 30 Jul 2008) New Revision: 1427 Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/generalControlPanel.java Log: * Aligned the General stop button Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/generalControlPanel.java =================================================================== --- software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/generalControlPanel.java 2008-07-30 13:03:54 UTC (rev 1426) +++ software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/generalControlPanel.java 2008-07-30 13:06:26 UTC (rev 1427) @@ -77,7 +77,7 @@ private void button() { win.btnGeneralStop = new JButton(); win.panGeneralControl.add(win.btnGeneralStop); - win.btnGeneralStop.setBounds(8, 32, 352, 25); + win.btnGeneralStop.setBounds(18, 32, 360, 25); win.btnGeneralStop.setContentAreaFilled(false); win.btnGeneralStop.setBorderPainted(false); win.btnGeneralStop.setIcon(win.iconStop); |
From: Paul_R <c2m...@c2...> - 2008-07-30 13:03:47
|
Author: Paul_R Date: 2008-07-30 15:03:54 +0200 (Wed, 30 Jul 2008) New Revision: 1426 Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/tuxPanel.java software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/flippersDown.png software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/flippersUp.png software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/iconBattery.png software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/iconDown.png software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/iconLeft.png software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/iconMicro.png software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/iconRight.png software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/iconRun.png software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/iconStop.png software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/iconUp.png software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/leftEyeClosed.png software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/leftEyeOff.png software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/leftEyeOn.png software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/mouthClosed.png software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/mouthOpened.png software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/rightEyeClosed.png software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/rightEyeOff.png software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/rightEyeOn.png software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/spinCharging.png software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/spinLeft.png software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/spinOff.png software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/spinRight.png software_suite_v2/software/tools/tuxController/trunk/src/GUI/mainWindow.java Log: * Updated the pictures Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/tuxPanel.java =================================================================== --- software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/tuxPanel.java 2008-07-30 12:32:13 UTC (rev 1425) +++ software_suite_v2/software/tools/tuxController/trunk/src/GUI/components/tuxPanel.java 2008-07-30 13:03:54 UTC (rev 1426) @@ -101,14 +101,14 @@ private void createEyesImage() { win.imgRightEye = new JLabel(); win.panImages.add(win.imgRightEye); - win.imgRightEye.setBounds(30, 10, 180, 79); + win.imgRightEye.setBounds(30, 10, 196, 80); win.imgRightEye.setIcon(win.eyeRightOn); /* Left eye */ win.imgLeftEye = new JLabel(); win.panImages.add(win.imgLeftEye); - win.imgLeftEye.setBounds(210, 10, 189, 79); + win.imgLeftEye.setBounds(226, 10, 193, 80); win.imgLeftEye.setIcon(win.eyeLeftOn); win.imgLeftEye.setBackground(new java.awt.Color(82,82,82)); } @@ -157,7 +157,7 @@ private void createMouthImage() { win.imgMouth = new JLabel(); win.panImages.add(win.imgMouth); - win.imgMouth.setBounds(30, 89, 367, 62); + win.imgMouth.setBounds(30, 90, 389, 62); win.imgMouth.setIcon(win.mouthClose); } @@ -206,7 +206,7 @@ private void createFlippersImage() { win.imgFlippers = new JLabel(); win.panImages.add(win.imgFlippers); - win.imgFlippers.setBounds(30, 151, 367, 142); + win.imgFlippers.setBounds(30, 152, 389, 152); win.imgFlippers.setIcon(win.flippersDown); } @@ -249,7 +249,7 @@ private void createSpinImage() { win.imgSpin = new JLabel(); win.panImages.add(win.imgSpin); - win.imgSpin.setBounds(30, 293, 367, 83); + win.imgSpin.setBounds(30, 304, 389, 69); win.imgSpin.setIcon(win.spinOff); } Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/flippersDown.png =================================================================== (Binary files differ) Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/flippersUp.png =================================================================== (Binary files differ) Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/iconBattery.png =================================================================== (Binary files differ) Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/iconDown.png =================================================================== (Binary files differ) Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/iconLeft.png =================================================================== (Binary files differ) Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/iconMicro.png =================================================================== (Binary files differ) Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/iconRight.png =================================================================== (Binary files differ) Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/iconRun.png =================================================================== (Binary files differ) Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/iconStop.png =================================================================== (Binary files differ) Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/iconUp.png =================================================================== (Binary files differ) Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/leftEyeClosed.png =================================================================== (Binary files differ) Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/leftEyeOff.png =================================================================== (Binary files differ) Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/leftEyeOn.png =================================================================== (Binary files differ) Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/mouthClosed.png =================================================================== (Binary files differ) Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/mouthOpened.png =================================================================== (Binary files differ) Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/rightEyeClosed.png =================================================================== (Binary files differ) Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/rightEyeOff.png =================================================================== (Binary files differ) Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/rightEyeOn.png =================================================================== (Binary files differ) Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/spinCharging.png =================================================================== (Binary files differ) Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/spinLeft.png =================================================================== (Binary files differ) Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/spinOff.png =================================================================== (Binary files differ) Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/images/spinRight.png =================================================================== (Binary files differ) Modified: software_suite_v2/software/tools/tuxController/trunk/src/GUI/mainWindow.java =================================================================== --- software_suite_v2/software/tools/tuxController/trunk/src/GUI/mainWindow.java 2008-07-30 12:32:13 UTC (rev 1425) +++ software_suite_v2/software/tools/tuxController/trunk/src/GUI/mainWindow.java 2008-07-30 13:03:54 UTC (rev 1426) @@ -125,15 +125,15 @@ setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); - dimWin = new java.awt.Dimension(400, 590); // 396, 592 - this.setPreferredSize(new java.awt.Dimension(400, 600)); // 756, 591 + dimWin = new java.awt.Dimension(430, 590); // 396, 592 + this.setPreferredSize(new java.awt.Dimension(430, 600)); // 756, 591 this.setMinimumSize(dimWin); this.setSize(dimWin); this.setResizable(false); thisLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1}; thisLayout.rowHeights = new int[] {80, 390, 90, 30}; thisLayout.columnWeights = new double[] {0.0, 0.0, 1.0}; - thisLayout.columnWidths = new int[] {396, 1, 1}; + thisLayout.columnWidths = new int[] {430, 1, 1}; getContentPane().setLayout(thisLayout); this.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent evt) { @@ -150,32 +150,32 @@ private void resizeWindow() { if (chkAdvancedView.isSelected() && chkTTS.isSelected()) { - dimWin.setSize(760, 700); - thisLayout.columnWidths = new int[] {396, 360, 1}; + dimWin.setSize(790, 700); + thisLayout.columnWidths = new int[] {430, 360, 1}; thisLayout.rowHeights = new int[] {80, 390, 90, 140}; this.setSize(dimWin); this.setResizable(false); } else if (!chkAdvancedView.isSelected() && !chkTTS.isSelected()) { - dimWin.setSize(400, 590); - thisLayout.columnWidths = new int[] {396, 1, 1}; + dimWin.setSize(430, 590); + thisLayout.columnWidths = new int[] {430, 1, 1}; thisLayout.rowHeights = new int[] {80, 390, 90, 30}; this.setSize(dimWin); this.setResizable(false); } else if (chkAdvancedView.isSelected() && !chkTTS.isSelected()) { - dimWin.setSize(760, 590); - thisLayout.columnWidths = new int[] {396, 360, 1}; + dimWin.setSize(790, 590); + thisLayout.columnWidths = new int[] {430, 360, 1}; thisLayout.rowHeights = new int[] {80, 390, 90, 30}; this.setSize(dimWin); this.setResizable(false); } else if (!chkAdvancedView.isSelected() && chkTTS.isSelected()) { - dimWin.setSize(400, 700); - thisLayout.columnWidths = new int[] {396, 1, 1}; + dimWin.setSize(430, 700); + thisLayout.columnWidths = new int[] {430, 1, 1}; thisLayout.rowHeights = new int[] {80, 390, 90, 140}; this.setSize(dimWin); this.setResizable(false); |
From: remi <c2m...@c2...> - 2008-07-30 12:32:03
|
Author: remi Date: 2008-07-30 14:32:13 +0200 (Wed, 30 Jul 2008) New Revision: 1425 Modified: software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/lib/httpserver/AttituneToMacroDecl.py Log: * little fix Modified: software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/lib/httpserver/AttituneToMacroDecl.py =================================================================== --- software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/lib/httpserver/AttituneToMacroDecl.py 2008-07-30 12:30:47 UTC (rev 1424) +++ software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/lib/httpserver/AttituneToMacroDecl.py 2008-07-30 12:32:13 UTC (rev 1425) @@ -200,6 +200,7 @@ return [cmd,] ATT_CMD_TO_MACRO_CMD_FUNCTS = { + 'leds_on' : ledsOnTmc, 'ledl_on' : ledlOnTmc, 'ledr_on' : ledrOnTmc, 'leds_off' : ledsOffTmc, |
From: remi <c2m...@c2...> - 2008-07-30 12:30:45
|
Author: remi Date: 2008-07-30 14:30:47 +0200 (Wed, 30 Jul 2008) New Revision: 1424 Modified: software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java 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/visual/ATTBlockViewer.java Log: * added: play scene from index. play a block. stop the scene or the block. Modified: software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java =================================================================== --- software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java 2008-07-30 11:11:36 UTC (rev 1423) +++ software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java 2008-07-30 12:30:47 UTC (rev 1424) @@ -264,7 +264,6 @@ */ public void onBlockSelected(ATTBlock block) { - System.out.println(block.getFunctionParams()); } /* @@ -349,6 +348,7 @@ */ public void onPlayButtonPressed(MouseEvent evt) { + attBlockViewer.playScene(attBlockViewer.getCurrentPosition()); } /* @@ -356,5 +356,6 @@ */ public void onStopButtonPressed(MouseEvent evt) { + attBlockViewer.stop(); } } 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-07-30 11:11:36 UTC (rev 1423) +++ software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/format/ATTBlockParams.java 2008-07-30 12:30:47 UTC (rev 1424) @@ -1,5 +1,6 @@ package com.tuxisalive.attitunes.format; +import java.net.URLEncoder; import java.util.Hashtable; /** @@ -451,7 +452,13 @@ cmd = String.format("OSL_CMD:TTS:SET_PITCH:%d", struct.get("pitch")); result[1] = cmd; String text = (String)struct.get("text"); - text = text.replace("\n", " "); + // Remove ending lines + text = text.replace("\n", "."); + // Try to encode the string + try + { + text = URLEncoder.encode(text, "UTF-8"); + } catch (Exception e) {} cmd = String.format("OSL_CMD:TTS:SPEAK:%s", text); result[2] = cmd; return result; @@ -468,7 +475,7 @@ * ATT command to macro command * ---------------------------------------------------------------------- */ - public String[] attCmdToMacroCmd(Hashtable<String,Object> struct) + public static String[] attCmdToMacroCmd(Hashtable<String,Object> struct) { String cmd = (String)struct.get("cmd"); 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-07-30 11:11:36 UTC (rev 1423) +++ software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/visual/ATTBlockViewer.java 2008-07-30 12:30:47 UTC (rev 1424) @@ -12,10 +12,7 @@ import java.util.Iterator; import java.util.Hashtable; -import com.tuxisalive.api.SLock; -import com.tuxisalive.api.SThread; -import com.tuxisalive.api.TuxEventHandlers; -import com.tuxisalive.api.TuxAPIMisc; +import com.tuxisalive.api.*; import com.tuxisalive.attitunes.ATTConfig; import com.tuxisalive.attitunes.ATTMisc; import com.tuxisalive.attitunes.block.ATTBlock; @@ -85,6 +82,8 @@ public ATTFormatReadWrite attituneFile; + public TuxAPI tux = new TuxAPI("localhost", 270); + /** * Constructor of the class. * @param width width of the viewer @@ -178,6 +177,8 @@ recalcFullTime(); /* Set visible */ this.setVisible(true); + /* Connect the tuxdroid api */ + tux.server.autoConnect(TuxAPIConst.CLIENT_LEVEL_RESTRICTED, "AttitunesStudio", "attscene"); } /** @@ -186,6 +187,7 @@ public void destroy() { refreshStarted = false; + tux.destroy(); } /* @@ -1191,4 +1193,130 @@ } return result; } + + /* + * + */ + private void sendSimpleCmd(String cmd) + { + Hashtable<Object,Object> varStruct = new Hashtable<Object,Object>(); + Hashtable<Object,Object> varResult = new Hashtable<Object,Object>(); + + tux.server.request(cmd, varStruct, varResult, false); + } + + /** + * + * @param index + * @param length + */ + @SuppressWarnings("unchecked") + public void playScene(double index) + { + /* Translate the block format to the macro format */ + Hashtable<String,Object> blocksStruct = getBlocksStruct(); + List<Hashtable<String,Object>> macroStruct = new ArrayList<Hashtable<String,Object>>(); + String key; + Iterator<String> it = (Iterator<String>)blocksStruct.keys(); + Hashtable<String,Object> blockStruct; + Hashtable<String,Object> cmdStruct; + String[] cmds; + String wavPath; + String cmd; + String cmdStr; + double idxb; + String macro; + + while (it.hasNext()) + { + key = (String)it.next(); + blockStruct = (Hashtable<String,Object>)blocksStruct.get(key); + cmds = ATTBlockParams.attCmdToMacroCmd(blockStruct); + + for (int i = 0; i < cmds.length; i++) + { + cmdStruct = new Hashtable<String,Object>(); + cmdStruct.put("delay", (Double)blockStruct.get("start_time") + 0.5); + cmdStruct.put("cmd", cmds[i]); + + cmd = (String)blockStruct.get("cmd"); + + if (cmd.equals("wav_play")) + { + cmdStruct.put("delay", (Double)cmdStruct.get("delay") - 0.3); + if (attituneFile != null) + { + wavPath = attituneFile.getWaveFile((String)blockStruct.get("wav_name")); + cmdStruct.put("wav_path", wavPath); + } + } + else if (cmd.equals("tts_play")) + { + cmdStruct.put("delay", (Double)cmdStruct.get("delay") - 0.3); + } + + if ((Double)cmdStruct.get("delay") >= index) + { + if (cmdStruct.containsKey("wav_path")) + { + cmdStr = String.format("OSL_CMD:WAV:PLAY:0.0,0.0,%s", + (String)cmdStruct.get("wav_path")); + cmdStruct.put("cmd", cmdStr); + } + cmdStruct.put("delay", (Double)cmdStruct.get("delay") - index); + macroStruct.add(cmdStruct); + } + else if (cmdStruct.containsKey("wav_path")) + { + idxb = index - (Double)cmdStruct.get("delay"); + + if (idxb < (Double)blockStruct.get("duration")) + { + cmdStr = String.format("OSL_CMD:WAV:PLAY:%g,0.0,%s", + idxb, + (String)cmdStruct.get("wav_path")); + cmdStruct.put("cmd", cmdStr); + cmdStruct.put("delay", 0.0); + macroStruct.add(cmdStruct); + } + } + } + } + + macro = ""; + for (int i = 0; i < macroStruct.size(); i++) + { + cmd = String.format("%g:%s|", + macroStruct.get(i).get("delay"), + macroStruct.get(i).get("cmd")); + macro += cmd; + } + + sendSimpleCmd(String.format("macro/play?macro=%s", macro)); + } + + /** + * + */ + public void stop() + { + sendSimpleCmd("macro/stop?"); + } + + /** + * + * @param index + */ + public void playBlock(ATTBlock block) + { + String[] cmds = ATTBlockParams.attCmdToMacroCmd(block.getFunctionParams()); + String macro = ""; + + for (int i = 0; i < cmds.length; i++) + { + macro += String.format("0.1:%s|", cmds[i]); + } + + sendSimpleCmd(String.format("macro/play?macro=%s", macro)); + } } |
From: remi <c2m...@c2...> - 2008-07-30 11:11:30
|
Author: remi Date: 2008-07-30 13:11:36 +0200 (Wed, 30 Jul 2008) New Revision: 1423 Added: software_suite_v2/tuxware/tuxhttpserver/trunk/src/resources/ResourceMacro.py Modified: software_suite_v2/tuxware/tuxhttpserver/trunk/src/tuxhttpserver.py Log: * added the resource named "macro". This resource handle the macro commands format of libtuxosl and libtuxdriver. Added: software_suite_v2/tuxware/tuxhttpserver/trunk/src/resources/ResourceMacro.py =================================================================== --- software_suite_v2/tuxware/tuxhttpserver/trunk/src/resources/ResourceMacro.py (rev 0) +++ software_suite_v2/tuxware/tuxhttpserver/trunk/src/resources/ResourceMacro.py 2008-07-30 11:11:36 UTC (rev 1423) @@ -0,0 +1,74 @@ +# ----------------------------------------------------------------------------- +# /macro/play?macro=%s +# ----------------------------------------------------------------------------- +def funct_macro_play(id_client, parameters): + content_struct = copy.deepcopy(DEFAULT_CONTENT_STRUCT) + content_struct['root']['result'] = getStrError(E_TDREST_SUCCESS) + p_fmt = { + 'macro' : 'string', + } + + if not Glb_DonglePresent: + content_struct['root']['result'] = getStrError(E_TDREST_FAILED) + content = structToXML(content_struct, True) + return DEFAULT_HEADERS, content + + result, params = parseParameters(parameters, p_fmt) + + if result: + Glb_TuxDrv.ClearCommandStack() + Glb_TuxOSL.ClearCommandStack() + Glb_TuxOSL.PerformCommand(0.0, "OSL_CMD:TTS:STOP") + Glb_TuxOSL.PerformCommand(0.0, "OSL_CMD:WAV:STOP") + Glb_TuxDrv.ResetPositions() + macro = params['macro'].replace("|", "\n") + if len(macro) <= 16384: + Glb_TuxDrv.PerformMacroText(macro) + Glb_TuxOSL.PerformMacroText(macro) + else: + content_struct['root']['result'] = \ + getStrError(E_TDREST_FAILED) + else: + content_struct['root']['result'] = \ + getStrError(E_TDREST_INVALIDPARAMETERS) + + content = structToXML(content_struct, True) + + return DEFAULT_HEADERS, content + +Glb_ServiceContainer.createService('/macro/play?', + TDCC_LEVEL_FREE_CLIENT, + funct_macro_play, + "Macro", + "Play a macro.", + { + 'macro' : 'string', + }) + +# ----------------------------------------------------------------------------- +# /macro/stop? +# ----------------------------------------------------------------------------- +def funct_macro_stop(id_client, parameters): + content_struct = copy.deepcopy(DEFAULT_CONTENT_STRUCT) + content_struct['root']['result'] = getStrError(E_TDREST_SUCCESS) + + if not Glb_DonglePresent: + content_struct['root']['result'] = getStrError(E_TDREST_FAILED) + content = structToXML(content_struct, True) + return DEFAULT_HEADERS, content + + Glb_TuxDrv.ClearCommandStack() + Glb_TuxOSL.ClearCommandStack() + Glb_TuxOSL.PerformCommand(0.0, "OSL_CMD:TTS:STOP") + Glb_TuxOSL.PerformCommand(0.0, "OSL_CMD:WAV:STOP") + Glb_TuxDrv.ResetPositions() + + content = structToXML(content_struct, True) + + return DEFAULT_HEADERS, content + +Glb_ServiceContainer.createService('/macro/stop?', + TDCC_LEVEL_FREE_CLIENT, + funct_macro_stop, + "Macro", + "Stop the played macro.") \ No newline at end of file Modified: software_suite_v2/tuxware/tuxhttpserver/trunk/src/tuxhttpserver.py =================================================================== --- software_suite_v2/tuxware/tuxhttpserver/trunk/src/tuxhttpserver.py 2008-07-30 09:29:05 UTC (rev 1422) +++ software_suite_v2/tuxware/tuxhttpserver/trunk/src/tuxhttpserver.py 2008-07-30 11:11:36 UTC (rev 1423) @@ -172,6 +172,8 @@ exec(str) in globals() str = open('%s/resources/ResourceEyes.py' % APPLICATION_PATH, 'r').read() exec(str) in globals() + str = open('%s/resources/ResourceMacro.py' % APPLICATION_PATH, 'r').read() + exec(str) in globals() str = open('%s/resources/ResourceMouth.py' % APPLICATION_PATH, 'r').read() exec(str) in globals() str = open('%s/resources/ResourceFlippers.py' % APPLICATION_PATH, 'r').read() |
From: remi <c2m...@c2...> - 2008-07-30 09:28:57
|
Author: remi Date: 2008-07-30 11:29:05 +0200 (Wed, 30 Jul 2008) New Revision: 1422 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/ATTFormatReadWrite.java Log: * added the functions to translate the command from the *.att format to the macro format. 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-07-30 09:27:43 UTC (rev 1421) +++ software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/format/ATTBlockParams.java 2008-07-30 09:29:05 UTC (rev 1422) @@ -2,10 +2,19 @@ import java.util.Hashtable; +/** + * + * @author Remi Jocaille + * + */ public class ATTBlockParams { + /* ------------------------------------------------------------------------- + * Led commands + * ---------------------------------------------------------------------- */ + /* - * Led commands + * Leds blink */ public static Hashtable<String,Object> LEDS_BLINK_CANVAS = new Hashtable<String,Object>(); static { @@ -13,36 +22,115 @@ LEDS_BLINK_CANVAS.put("count", 1.0); LEDS_BLINK_CANVAS.put("speed", 1); } + private static String[] ledsBlinkTmc(Hashtable<String,Object> struct) + { + String[] result = new String[1]; + double duration = (Double)struct.get("speed") * 0.008; + String cmd = String.format("TUX_CMD:LED:BLINK:LED_BOTH,%d,%g", + struct.get("count"), duration); + result[0] = cmd; + return result; + } + + /* + * Leds on + */ public static Hashtable<String,Object> LEDS_ON_CANVAS = new Hashtable<String,Object>(); static { LEDS_ON_CANVAS.put("cmd", "leds_on"); LEDS_ON_CANVAS.put("duration", 0.0); } + private static String[] ledsOnTmc(Hashtable<String,Object> struct) + { + String[] result = new String[1]; + String cmd = "TUX_CMD:LED:ON:LED_BOTH,1.0"; + result[0] = cmd; + return result; + } + + /* + * Ledl on + */ public static Hashtable<String,Object> LEDL_ON_CANVAS = new Hashtable<String,Object>(); static { LEDL_ON_CANVAS.put("cmd", "ledl_on"); LEDL_ON_CANVAS.put("duration", 0.0); } + private static String[] ledlOnTmc(Hashtable<String,Object> struct) + { + String[] result = new String[1]; + String cmd = "TUX_CMD:LED:ON:LED_LEFT,1.0"; + result[0] = cmd; + return result; + } + + /* + * Ledr on + */ public static Hashtable<String,Object> LEDR_ON_CANVAS = new Hashtable<String,Object>(); static { LEDR_ON_CANVAS.put("cmd", "ledr_on"); LEDR_ON_CANVAS.put("duration", 0.0); } + private static String[] ledrOnTmc(Hashtable<String,Object> struct) + { + String[] result = new String[1]; + String cmd = "TUX_CMD:LED:ON:LED_RIGHT,1.0"; + result[0] = cmd; + return result; + } + + /* + * Leds off + */ public static Hashtable<String,Object> LEDS_OFF_CANVAS = new Hashtable<String,Object>(); static { LEDS_OFF_CANVAS.put("cmd", "leds_off"); LEDS_OFF_CANVAS.put("duration", 0.0); } + private static String[] ledsOffTmc(Hashtable<String,Object> struct) + { + String[] result = new String[1]; + String cmd = "TUX_CMD:LED:OFF:LED_BOTH"; + result[0] = cmd; + return result; + } + + /* + * Ledl off + */ public static Hashtable<String,Object> LEDL_OFF_CANVAS = new Hashtable<String,Object>(); static { LEDL_OFF_CANVAS.put("cmd", "ledl_off"); LEDL_OFF_CANVAS.put("duration", 0.0); } + private static String[] ledlOffTmc(Hashtable<String,Object> struct) + { + String[] result = new String[1]; + String cmd = "TUX_CMD:LED:OFF:LED_LEFT"; + result[0] = cmd; + return result; + } + + /* + * Ledr off + */ public static Hashtable<String,Object> LEDR_OFF_CANVAS = new Hashtable<String,Object>(); static { LEDR_OFF_CANVAS.put("cmd", "ledr_off"); LEDR_OFF_CANVAS.put("duration", 0.0); } + private static String[] ledrOffTmc(Hashtable<String,Object> struct) + { + String[] result = new String[1]; + String cmd = "TUX_CMD:LED:OFF:LED_RIGHT"; + result[0] = cmd; + return result; + } + + /* + * Leds command types + */ public static String[] LEDS_CMD_TYPES = { "leds_blink", "leds_on", @@ -52,8 +140,13 @@ "ledl_off", "ledr_off" }; + + /* ------------------------------------------------------------------------- + * Mouth and eyes commands + * ---------------------------------------------------------------------- */ + /* - * Mouth and eyes commands + * Mouth on */ public static Hashtable<String,Object> MOUTH_ON_CANVAS = new Hashtable<String,Object>(); static { @@ -61,32 +154,100 @@ MOUTH_ON_CANVAS.put("duration", 0.0); MOUTH_ON_CANVAS.put("count", 2); } + private static String[] mouthOnTmc(Hashtable<String,Object> struct) + { + String[] result = new String[1]; + String cmd = String.format("TUX_CMD:MOUTH:ON:%d,NDEF", + struct.get("count")); + result[0] = cmd; + return result; + } + + /* + * Mouth open + */ public static Hashtable<String,Object> MOUTH_OPEN_CANVAS = new Hashtable<String,Object>(); static { MOUTH_OPEN_CANVAS.put("cmd", "mouth_open"); MOUTH_OPEN_CANVAS.put("duration", 0.0); } + private static String[] mouthOpenTmc(Hashtable<String,Object> struct) + { + String[] result = new String[1]; + String cmd = "TUX_CMD:MOUTH:OPEN"; + result[0] = cmd; + return result; + } + + /* + * Mouth close + */ public static Hashtable<String,Object> MOUTH_CLOSE_CANVAS = new Hashtable<String,Object>(); static { MOUTH_CLOSE_CANVAS.put("cmd", "mouth_close"); MOUTH_CLOSE_CANVAS.put("duration", 0.0); } + private static String[] mouthCloseTmc(Hashtable<String,Object> struct) + { + String[] result = new String[1]; + String cmd = "TUX_CMD:MOUTH:CLOSE"; + result[0] = cmd; + return result; + } + + /* + * Eyes on + */ public static Hashtable<String,Object> EYES_ON_CANVAS = new Hashtable<String,Object>(); static { EYES_ON_CANVAS.put("cmd", "eyes_on"); EYES_ON_CANVAS.put("duration", 0.0); EYES_ON_CANVAS.put("count", 2); } + private static String[] eyesOnTmc(Hashtable<String,Object> struct) + { + String[] result = new String[1]; + String cmd = String.format("TUX_CMD:EYES:ON:%d,NDEF", + struct.get("count")); + result[0] = cmd; + return result; + } + + /* + * Eyes open + */ public static Hashtable<String,Object> EYES_OPEN_CANVAS = new Hashtable<String,Object>(); static { EYES_OPEN_CANVAS.put("cmd", "eyes_open"); EYES_OPEN_CANVAS.put("duration", 0.0); } + private static String[] eyesOpenTmc(Hashtable<String,Object> struct) + { + String[] result = new String[1]; + String cmd = "TUX_CMD:EYES:OPEN"; + result[0] = cmd; + return result; + } + + /* + * Eyes close + */ public static Hashtable<String,Object> EYES_CLOSE_CANVAS = new Hashtable<String,Object>(); static { EYES_CLOSE_CANVAS.put("cmd", "eyes_close"); EYES_CLOSE_CANVAS.put("duration", 0.0); } + private static String[] eyesCloseTmc(Hashtable<String,Object> struct) + { + String[] result = new String[1]; + String cmd = "TUX_CMD:EYES:CLOSE"; + result[0] = cmd; + return result; + } + + /* + * Eyes and mouth command types + */ public static String[] EYESMOUTH_CMD_TYPES = { "mouth_on", "mouth_open", @@ -95,8 +256,13 @@ "eyes_open", "eyes_close" }; + + /* ------------------------------------------------------------------------- + * Spinning commands + * ---------------------------------------------------------------------- */ + /* - * Spinning commands + * Spinning left */ public static Hashtable<String,Object> SPINNING_LEFT_CANVAS = new Hashtable<String,Object>(); static { @@ -105,6 +271,18 @@ SPINNING_LEFT_CANVAS.put("count", 2); SPINNING_LEFT_CANVAS.put("speed", 5); } + private static String[] spinlOnTmc(Hashtable<String,Object> struct) + { + String[] result = new String[1]; + String cmd = String.format("TUX_CMD:SPINNING:LEFT_ON:%d", + struct.get("count")); + result[0] = cmd; + return result; + } + + /* + * Spinning right + */ public static Hashtable<String,Object> SPINNING_RIGHT_CANVAS = new Hashtable<String,Object>(); static { SPINNING_RIGHT_CANVAS.put("cmd", "spinr_on"); @@ -112,12 +290,29 @@ SPINNING_RIGHT_CANVAS.put("count", 2); SPINNING_RIGHT_CANVAS.put("speed", 5); } + private static String[] spinrOnTmc(Hashtable<String,Object> struct) + { + String[] result = new String[1]; + String cmd = String.format("TUX_CMD:SPINNING:RIGHT_ON:%d", + struct.get("count")); + result[0] = cmd; + return result; + } + + /* + * Spinning command types + */ public static String[] SPINNING_CMD_TYPES = { "spinl_on", "spinr_on" }; + + /* ------------------------------------------------------------------------- + * Flippers commands + * ---------------------------------------------------------------------- */ + /* - * Flippers commands + * Flippers on */ public static Hashtable<String,Object> FLIPPERS_ON_CANVAS = new Hashtable<String,Object>(); static { @@ -125,23 +320,62 @@ FLIPPERS_ON_CANVAS.put("duration", 0.0); FLIPPERS_ON_CANVAS.put("count", 2); } + private static String[] flippersOnTmc(Hashtable<String,Object> struct) + { + String[] result = new String[1]; + String cmd = String.format("TUX_CMD:FLIPPERS:ON:%d,NDEF", + struct.get("count")); + result[0] = cmd; + return result; + } + + /* + * Flippers up + */ public static Hashtable<String,Object> FLIPPERS_UP_CANVAS = new Hashtable<String,Object>(); static { FLIPPERS_UP_CANVAS.put("cmd", "wings_up"); FLIPPERS_UP_CANVAS.put("duration", 0.0); } + private static String[] flippersUpTmc(Hashtable<String,Object> struct) + { + String[] result = new String[1]; + String cmd = "TUX_CMD:FLIPPERS:UP"; + result[0] = cmd; + return result; + } + + /* + * Flippers down + */ public static Hashtable<String,Object> FLIPPERS_DOWN_CANVAS = new Hashtable<String,Object>(); static { FLIPPERS_DOWN_CANVAS.put("cmd", "wings_down"); FLIPPERS_DOWN_CANVAS.put("duration", 0.0); } + private static String[] flippersDownTmc(Hashtable<String,Object> struct) + { + String[] result = new String[1]; + String cmd = "TUX_CMD:FLIPPERS:DOWN"; + result[0] = cmd; + return result; + } + + /* + * Flippers command types + */ public static String[] FLIPPERS_CMD_TYPES = { "wings_on", "wings_up", "wings_down" }; + + /* ------------------------------------------------------------------------- + * Wave and flash commands + * ---------------------------------------------------------------------- */ + /* - * Wave and flash commands + * Play flash */ public static Hashtable<String,Object> PLAY_FLASH_CANVAS = new Hashtable<String,Object>(); static { @@ -149,19 +383,57 @@ PLAY_FLASH_CANVAS.put("duration", 0.0); PLAY_FLASH_CANVAS.put("index", 0); } + private static String[] soundPlayTmc(Hashtable<String,Object> struct) + { + String[] result = new String[1]; + String cmd = String.format("TUX_CMD:SOUND_FLASH:PLAY:%d,100.0", + struct.get("index")); + result[0] = cmd; + return result; + } + + /* + * Play wave + */ public static Hashtable<String,Object> PLAY_WAVE_CANVAS = new Hashtable<String,Object>(); static { PLAY_WAVE_CANVAS.put("cmd", "wav_play"); PLAY_WAVE_CANVAS.put("duration", 0.0); PLAY_WAVE_CANVAS.put("wav_name", "none"); } + private static String[] wavPlayTmc(Hashtable<String,Object> struct) + { + String[] result = new String[1]; + String cmd = ""; + result[0] = cmd; + return result; + } + + /* + * Wave and flash command types + */ public static String[] WAVSOUND_CMD_TYPES = { "sound_play", "wav_play" }; + + /* ------------------------------------------------------------------------- + * TTS commands + * ---------------------------------------------------------------------- */ + /* - * TTS commands + * Locutor name list */ + private static String[] LOCUTOR_NAMES_LIST = { + "Bruno8k", "Julie8k", "Ryan8k", "Heather8k","Sofie8k", + "Klaus8k", "Sarah8k", "Graham8k","Lucy8k", "Salma8k", + "Mette8k", "Maria8k", "Chiara8k", "Femke8k", "Kari8k", + "Celia8k", "Erik8k", "Emma8k" + }; + + /* + * TTS play + */ public static Hashtable<String,Object> PLAY_TTS_CANVAS = new Hashtable<String,Object>(); static { PLAY_TTS_CANVAS.put("cmd", "tts_play"); @@ -170,7 +442,123 @@ PLAY_TTS_CANVAS.put("speaker", 3); PLAY_TTS_CANVAS.put("pitch", 100); } + private static String[] ttsPlayTmc(Hashtable<String,Object> struct) + { + String[] result = new String[3]; + String locutor = LOCUTOR_NAMES_LIST[(Integer)struct.get("speaker")-1]; + String cmd = String.format("OSL_CMD:TTS:SET_LOCUTOR:%s", locutor); + result[0] = cmd; + cmd = String.format("OSL_CMD:TTS:SET_PITCH:%d", struct.get("pitch")); + result[1] = cmd; + String text = (String)struct.get("text"); + text = text.replace("\n", " "); + cmd = String.format("OSL_CMD:TTS:SPEAK:%s", text); + result[2] = cmd; + return result; + } + + /* + * TTS command types + */ public static String[] TTS_CMD_TYPES = { "tts_play" }; + + /* ------------------------------------------------------------------------- + * ATT command to macro command + * ---------------------------------------------------------------------- */ + + public String[] attCmdToMacroCmd(Hashtable<String,Object> struct) + { + String cmd = (String)struct.get("cmd"); + + if (cmd.equals("leds_on")) + { + return ledsOnTmc(struct); + } + else if (cmd.equals("ledl_on")) + { + return ledlOnTmc(struct); + } + else if (cmd.equals("ledr_on")) + { + return ledrOnTmc(struct); + } + else if (cmd.equals("leds_off")) + { + return ledsOffTmc(struct); + } + else if (cmd.equals("ledl_off")) + { + return ledlOffTmc(struct); + } + else if (cmd.equals("ledr_off")) + { + return ledrOffTmc(struct); + } + else if (cmd.equals("leds_blink")) + { + return ledsBlinkTmc(struct); + } + else if (cmd.equals("mouth_on")) + { + return mouthOnTmc(struct); + } + else if (cmd.equals("mouth_open")) + { + return mouthOpenTmc(struct); + } + else if (cmd.equals("mouth_close")) + { + return mouthCloseTmc(struct); + } + else if (cmd.equals("eyes_on")) + { + return eyesOnTmc(struct); + } + else if (cmd.equals("eyes_open")) + { + return eyesOpenTmc(struct); + } + else if (cmd.equals("eyes_close")) + { + return eyesCloseTmc(struct); + } + else if (cmd.equals("sound_play")) + { + return soundPlayTmc(struct); + } + else if (cmd.equals("wav_play")) + { + return wavPlayTmc(struct); + } + else if (cmd.equals("spinl_on")) + { + return spinlOnTmc(struct); + } + else if (cmd.equals("spinr_on")) + { + return spinrOnTmc(struct); + } + else if (cmd.equals("tts_play")) + { + return ttsPlayTmc(struct); + } + else if (cmd.equals("wings_on")) + { + return flippersOnTmc(struct); + } + else if (cmd.equals("wings_up")) + { + return flippersUpTmc(struct); + } + else if (cmd.equals("wings_down")) + { + return flippersDownTmc(struct); + } + else + { + return null; + } + } } Modified: software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/format/ATTFormatReadWrite.java =================================================================== --- software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/format/ATTFormatReadWrite.java 2008-07-30 09:27:43 UTC (rev 1421) +++ software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/format/ATTFormatReadWrite.java 2008-07-30 09:29:05 UTC (rev 1422) @@ -162,7 +162,6 @@ attWorkPath = destination; xmlPath = attWorkPath + fwext + File.separator + "scene.xml"; wavsPath = attWorkPath + fwext + File.separator + "wavs" + File.separator; - System.out.println(xmlPath); return true; } |
From: remi <c2m...@c2...> - 2008-07-30 09:27:41
|
Author: remi Date: 2008-07-30 11:27:43 +0200 (Wed, 30 Jul 2008) New Revision: 1421 Modified: software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/visual/ATTBlockViewer.java Log: * added a function to create the hashtable structure (compatible with the *.att format) of the blocks from the viewer. 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-07-30 00:20:31 UTC (rev 1420) +++ software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/visual/ATTBlockViewer.java 2008-07-30 09:27:43 UTC (rev 1421) @@ -1168,4 +1168,27 @@ return true; } + + /* + * + */ + private Hashtable<String,Object> getBlocksStruct() + { + Hashtable<String,Object> result = new Hashtable<String,Object>(); + int count = 0; + String blockName = ""; + List<List<Object>> blocksSt; + + for (int i = 0; i < blockContainers.length; i++) + { + blocksSt = blockContainers[i].getBlockList(); + + for (int j = 0; j < blocksSt.size(); j++) + { + blockName = String.format("block_%03d", count++); + result.put(blockName, blocksSt.get(j).get(1)); + } + } + return result; + } } |
From: ulhume <c2m...@c2...> - 2008-07-30 00:20:22
|
Author: ulhume Date: 2008-07-30 02:20:31 +0200 (Wed, 30 Jul 2008) New Revision: 1420 Added: software_suite_v2/software/gadgets/DemosGadgets/tuxdroid-gadget-java-samples/trunk/tuxdroid-gadget-java-samples/resources/fr.po software_suite_v2/software/gadgets/DemosGadgets/tuxdroid-gadget-java-samples/trunk/tuxdroid-gadget-java-samples/resources/gadget.pot software_suite_v2/software/gadgets/DemosGadgets/tuxdroid-gadget-java-samples/trunk/tuxdroid-gadget-java-samples/resources/help.html software_suite_v2/software/gadgets/DemosGadgets/tuxdroid-gadget-java-samples/trunk/tuxdroid-gadget-java-samples/resources/help_fr.html Removed: software_suite_v2/software/gadgets/DemosGadgets/tuxdroid-gadget-java-samples/trunk/tuxdroid-gadget-java-samples/resources/help.txt Modified: software_suite_v2/software/gadgets/DemosGadgets/tuxdroid-gadget-java-samples/trunk/tuxdroid-gadget-java-samples/sources/net/karmaLab/tuxDroid/gadgets/HelloWorldGadget.java Log: i18n support sample Added: software_suite_v2/software/gadgets/DemosGadgets/tuxdroid-gadget-java-samples/trunk/tuxdroid-gadget-java-samples/resources/fr.po =================================================================== --- software_suite_v2/software/gadgets/DemosGadgets/tuxdroid-gadget-java-samples/trunk/tuxdroid-gadget-java-samples/resources/fr.po (rev 0) +++ software_suite_v2/software/gadgets/DemosGadgets/tuxdroid-gadget-java-samples/trunk/tuxdroid-gadget-java-samples/resources/fr.po 2008-07-30 00:20:31 UTC (rev 1420) @@ -0,0 +1,12 @@ +msgid "This sample gadget that is throwing a simple Hello World notification" +msgstr "Ceci est un simple gadget de Salut au Monde" + +msgid "Message sent when I'm saying hello" +msgstr "Message à afficher lorsque je dis bonjour" + +msgid "I'm the most wonderfull" +msgstr "Je suis le plus merveilleux" + +msgid "Hello World, %s" +msgstr "Salut le monde, %s" + Added: software_suite_v2/software/gadgets/DemosGadgets/tuxdroid-gadget-java-samples/trunk/tuxdroid-gadget-java-samples/resources/gadget.pot =================================================================== --- software_suite_v2/software/gadgets/DemosGadgets/tuxdroid-gadget-java-samples/trunk/tuxdroid-gadget-java-samples/resources/gadget.pot (rev 0) +++ software_suite_v2/software/gadgets/DemosGadgets/tuxdroid-gadget-java-samples/trunk/tuxdroid-gadget-java-samples/resources/gadget.pot 2008-07-30 00:20:31 UTC (rev 1420) @@ -0,0 +1,11 @@ +msgid "This sample gadget that is throwing a simple Hello World notification" +msgstr "" + +msgid "Message sent when I'm saying hello" +msgstr "" + +msgid "I'm the most wonderfull" +msgstr "" + +msgid "Hello World, %s" +msgstr "" Copied: software_suite_v2/software/gadgets/DemosGadgets/tuxdroid-gadget-java-samples/trunk/tuxdroid-gadget-java-samples/resources/help.html (from rev 1397, software_suite_v2/software/gadgets/DemosGadgets/tuxdroid-gadget-java-samples/trunk/tuxdroid-gadget-java-samples/resources/help.txt) =================================================================== --- software_suite_v2/software/gadgets/DemosGadgets/tuxdroid-gadget-java-samples/trunk/tuxdroid-gadget-java-samples/resources/help.html (rev 0) +++ software_suite_v2/software/gadgets/DemosGadgets/tuxdroid-gadget-java-samples/trunk/tuxdroid-gadget-java-samples/resources/help.html 2008-07-30 00:20:31 UTC (rev 1420) @@ -0,0 +1 @@ +This is some help... \ No newline at end of file Property changes on: software_suite_v2/software/gadgets/DemosGadgets/tuxdroid-gadget-java-samples/trunk/tuxdroid-gadget-java-samples/resources/help.html ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Deleted: software_suite_v2/software/gadgets/DemosGadgets/tuxdroid-gadget-java-samples/trunk/tuxdroid-gadget-java-samples/resources/help.txt =================================================================== --- software_suite_v2/software/gadgets/DemosGadgets/tuxdroid-gadget-java-samples/trunk/tuxdroid-gadget-java-samples/resources/help.txt 2008-07-30 00:19:46 UTC (rev 1419) +++ software_suite_v2/software/gadgets/DemosGadgets/tuxdroid-gadget-java-samples/trunk/tuxdroid-gadget-java-samples/resources/help.txt 2008-07-30 00:20:31 UTC (rev 1420) @@ -1 +0,0 @@ -This is some help... \ No newline at end of file Added: software_suite_v2/software/gadgets/DemosGadgets/tuxdroid-gadget-java-samples/trunk/tuxdroid-gadget-java-samples/resources/help_fr.html =================================================================== --- software_suite_v2/software/gadgets/DemosGadgets/tuxdroid-gadget-java-samples/trunk/tuxdroid-gadget-java-samples/resources/help_fr.html (rev 0) +++ software_suite_v2/software/gadgets/DemosGadgets/tuxdroid-gadget-java-samples/trunk/tuxdroid-gadget-java-samples/resources/help_fr.html 2008-07-30 00:20:31 UTC (rev 1420) @@ -0,0 +1 @@ +Un peu d'aide... \ No newline at end of file Property changes on: software_suite_v2/software/gadgets/DemosGadgets/tuxdroid-gadget-java-samples/trunk/tuxdroid-gadget-java-samples/resources/help_fr.html ___________________________________________________________________ Name: svn:mime-type + text/plain Modified: software_suite_v2/software/gadgets/DemosGadgets/tuxdroid-gadget-java-samples/trunk/tuxdroid-gadget-java-samples/sources/net/karmaLab/tuxDroid/gadgets/HelloWorldGadget.java =================================================================== --- software_suite_v2/software/gadgets/DemosGadgets/tuxdroid-gadget-java-samples/trunk/tuxdroid-gadget-java-samples/sources/net/karmaLab/tuxDroid/gadgets/HelloWorldGadget.java 2008-07-30 00:19:46 UTC (rev 1419) +++ software_suite_v2/software/gadgets/DemosGadgets/tuxdroid-gadget-java-samples/trunk/tuxdroid-gadget-java-samples/sources/net/karmaLab/tuxDroid/gadgets/HelloWorldGadget.java 2008-07-30 00:20:31 UTC (rev 1420) @@ -41,7 +41,7 @@ * have a working binding. */ public static class Configuration extends SimpleGadgetConfiguration { - private String message = "I'm a verrry simple gadget !!"; + private String message; /** * Message value. @@ -84,7 +84,7 @@ */ @Override public void start() { - throwMessageNotification("Hello World : " + configuration().getMessage()); + throwMessageNotification("Hello World, %s", configuration().getMessage()); } } |
From: ulhume <c2m...@c2...> - 2008-07-30 00:19:37
|
Author: ulhume Date: 2008-07-30 02:19:46 +0200 (Wed, 30 Jul 2008) New Revision: 1419 Modified: software_suite_v2/software/tools/tuxdroid-gadget-tester/trunk/tuxdroid-gadget-tester/sources/com/kysoh/tuxdroid/gadget/framework/tester/GadgetPanel.java Log: New Help file handling Modified: software_suite_v2/software/tools/tuxdroid-gadget-tester/trunk/tuxdroid-gadget-tester/sources/com/kysoh/tuxdroid/gadget/framework/tester/GadgetPanel.java =================================================================== --- software_suite_v2/software/tools/tuxdroid-gadget-tester/trunk/tuxdroid-gadget-tester/sources/com/kysoh/tuxdroid/gadget/framework/tester/GadgetPanel.java 2008-07-30 00:19:27 UTC (rev 1418) +++ software_suite_v2/software/tools/tuxdroid-gadget-tester/trunk/tuxdroid-gadget-tester/sources/com/kysoh/tuxdroid/gadget/framework/tester/GadgetPanel.java 2008-07-30 00:19:46 UTC (rev 1419) @@ -359,7 +359,7 @@ console.append(" execution : " + description.getExecutionMode()); console.append(" WorkingPath : " + gadget.getInterpreter().getWorkingPath()); console.append(" iconFile : " + description.getIconFile()); - console.append(" HelpFile : " + description.getHelpFile()); + console.append(" HelpFile : " + gadget.getHelpFile()); } public Gadget getGadget() { |
Author: ulhume Date: 2008-07-30 02:19:27 +0200 (Wed, 30 Jul 2008) New Revision: 1418 Added: software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/build.xml software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/build.xml Removed: software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/build.xml software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/build.xml Modified: software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/Gadget.java software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/GadgetDescription.java software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/GadgetInstance.java software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/GadgetParameter.java software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/GadgetToken.java software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/gadget/SimpleGadget.java Log: i18n support Deleted: software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/build.xml =================================================================== --- software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/build.xml 2008-07-29 20:04:08 UTC (rev 1417) +++ software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/build.xml 2008-07-30 00:19:27 UTC (rev 1418) @@ -1,3 +0,0 @@ -<project default="Update dependencies" name="Tuxdroid Gadget Framework Builder"> - <import file="./builder/build.xml"/> -</project> \ No newline at end of file Added: software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/build.xml =================================================================== --- software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/build.xml (rev 0) +++ software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/build.xml 2008-07-30 00:19:27 UTC (rev 1418) @@ -0,0 +1,3 @@ +<project default="Update dependencies" name="Tuxdroid Gadget Framework Builder"> + <import file="./builder/build.xml" /> +</project> \ No newline at end of file Modified: software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/Gadget.java =================================================================== --- software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/Gadget.java 2008-07-29 20:04:08 UTC (rev 1417) +++ software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/Gadget.java 2008-07-30 00:19:27 UTC (rev 1418) @@ -24,14 +24,17 @@ import java.io.File; import java.util.Iterator; +import java.util.Locale; import java.util.Vector; import java.util.logging.Logger; -import com.kysoh.tuxdroid.gadget.framework.container.interpreters.GadgetInterpreter; - +import net.karmaLab.po.I18n; +import net.karmaLab.po.I18nFactory; import net.karmaLab.tools.Listeners; import net.karmaLab.traces.Traces; +import com.kysoh.tuxdroid.gadget.framework.container.interpreters.GadgetInterpreter; + /** * @author yoran.brault@_bad_karma-lab.net (remove _bad_ before sending an * email) @@ -51,6 +54,7 @@ } private final Vector<GadgetParameter> parameters = new Vector<GadgetParameter>(); + private I18n i18n; /** * @return the configuration @@ -94,6 +98,10 @@ */ public void setInterpreter(GadgetInterpreter interpreter) { this.interpreter = interpreter; + i18n = I18nFactory.getI18n(new File(interpreter.getWorkingPath(), "resources")); + GadgetDescription.i18n = i18n; + GadgetToken.i18n = i18n; + GadgetParameter.i18n = i18n; } static final Logger logger = Traces.LOGGER(Gadget.class); @@ -146,7 +154,22 @@ return new File(interpreter.getWorkingPath(), description.getIconFile()); } - public File getHeloFile() { - return new File(interpreter.getWorkingPath(), description.getIconFile()); + public File getHelpFile() { + File helpFile = new File(interpreter.getWorkingPath(), "resources/help_" + Locale.getDefault().getLanguage() + ".html"); + if (!helpFile.exists()) { + helpFile = new File(interpreter.getWorkingPath(), "resources/help.html"); + if (!helpFile.exists()) { + return null; + } + } + return helpFile; } + + public static void main(String[] args) { + + } + + public String tr(String message, Object... tmp) { + return i18n.tr(message, tmp); + } } Modified: software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/GadgetDescription.java =================================================================== --- software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/GadgetDescription.java 2008-07-29 20:04:08 UTC (rev 1417) +++ software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/GadgetDescription.java 2008-07-30 00:19:27 UTC (rev 1418) @@ -24,6 +24,8 @@ import java.util.UUID; +import net.karmaLab.po.I18n; + public class GadgetDescription { private String name; private String description; @@ -80,11 +82,13 @@ this.name = name; } + static I18n i18n; + /** * @return the description */ public String getDescription() { - return description; + return i18n.tr(description); } /** @@ -126,21 +130,6 @@ } /** - * @return the helpFile - */ - public String getHelpFile() { - return helpFile; - } - - /** - * @param helpFile - * the helpFile to set - */ - public void setHelpFile(String helpFile) { - this.helpFile = helpFile; - } - - /** * @return the iconFile */ public String getIconFile() { Modified: software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/GadgetInstance.java =================================================================== --- software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/GadgetInstance.java 2008-07-29 20:04:08 UTC (rev 1417) +++ software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/GadgetInstance.java 2008-07-30 00:19:27 UTC (rev 1418) @@ -106,7 +106,14 @@ String name = parameters[0]; String[] tmp = new String[parameters.length - 1]; System.arraycopy(parameters, 1, tmp, 0, tmp.length); - if (name.equals("error")) { + if (name.equals("message")) { + String message = tmp[0]; + String[] tmp1 = new String[tmp.length - 1]; + if (tmp1.length > 0) { + System.arraycopy(tmp, 1, tmp1, 0, tmp1.length); + } + GadgetInstance.this.gadget.listeners.fire().notification(GadgetInstance.this, "message", gadget.tr(message, (Object[]) tmp1)); + } else if (name.equals("error")) { GadgetInstance.this.gadget.listeners.fire().errors(GadgetInstance.this, tmp[0]); } else if (name.equals("trace")) { GadgetInstance.this.gadget.listeners.fire().trace(GadgetInstance.this, tmp[0]); Modified: software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/GadgetParameter.java =================================================================== --- software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/GadgetParameter.java 2008-07-29 20:04:08 UTC (rev 1417) +++ software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/GadgetParameter.java 2008-07-30 00:19:27 UTC (rev 1418) @@ -22,6 +22,7 @@ package com.kysoh.tuxdroid.gadget.framework.container; +import net.karmaLab.po.I18n; import net.karmaLab.traces.ApplicationError; public class GadgetParameter { @@ -110,11 +111,13 @@ this.name = name; } + static I18n i18n; + /** * @return the description */ public String getDescription() { - return description; + return i18n.tr(description); } /** @@ -152,6 +155,9 @@ * @return the defaultValue */ public String getDefaultValue() { + if (kind == GadgetParameterType.stringParameter) { + defaultValue = i18n.tr(defaultValue); + } return defaultValue; } Modified: software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/GadgetToken.java =================================================================== --- software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/GadgetToken.java 2008-07-29 20:04:08 UTC (rev 1417) +++ software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/GadgetToken.java 2008-07-30 00:19:27 UTC (rev 1418) @@ -22,35 +22,40 @@ package com.kysoh.tuxdroid.gadget.framework.container; +import net.karmaLab.po.I18n; + public class GadgetToken { - private String name; - private String description; + private String name; + private String description; + static I18n i18n; - /** - * @return the name - */ - public String getName() { - return name; - } + /** + * @return the name + */ + public String getName() { + return name; + } - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } + /** + * @param name + * the name to set + */ + public void setName(String name) { + this.name = name; + } - /** - * @return the description - */ - public String getDescription() { - return description; - } + /** + * @return the description + */ + public String getDescription() { + return i18n.tr(description); + } - /** - * @param description the description to set - */ - public void setDescription(String description) { - this.description = description; - } + /** + * @param description + * the description to set + */ + public void setDescription(String description) { + this.description = description; + } } Deleted: software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/build.xml =================================================================== --- software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/build.xml 2008-07-29 20:04:08 UTC (rev 1417) +++ software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/build.xml 2008-07-30 00:19:27 UTC (rev 1418) @@ -1,3 +0,0 @@ -<project default="Update dependencies" name="tuxdroid gadget framework builder"> - <import file="./builder/build.xml"/> -</project> \ No newline at end of file Copied: software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/build.xml (from rev 1397, software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/build.xml) =================================================================== --- software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/build.xml (rev 0) +++ software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/build.xml 2008-07-30 00:19:27 UTC (rev 1418) @@ -0,0 +1,3 @@ +<project default="Update dependencies" name="Tuxdroid Gadget Framework Builder"> + <import file="./builder/build.xml"/> +</project> \ No newline at end of file Property changes on: software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/build.xml ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:mergeinfo + Modified: software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/gadget/SimpleGadget.java =================================================================== --- software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/gadget/SimpleGadget.java 2008-07-29 20:04:08 UTC (rev 1417) +++ software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/gadget/SimpleGadget.java 2008-07-30 00:19:27 UTC (rev 1418) @@ -118,8 +118,11 @@ * @param content * message content */ - protected void throwMessageNotification(String content) { - throwNotification("message", content); + protected void throwMessageNotification(String content, Object... arguments) { + Object[] tmp = new String[arguments.length + 1]; + tmp[0] = content; + System.arraycopy(arguments, 0, tmp, 1, arguments.length); + throwNotification("message", tmp); } /** |
From: jerome <c2m...@c2...> - 2008-07-29 20:04:00
|
Author: jerome Date: 2008-07-29 22:04:08 +0200 (Tue, 29 Jul 2008) New Revision: 1417 Added: software_suite_v2/software/gadgets/tuxdroid-gadget-shortcut/trunk/.classpath software_suite_v2/software/gadgets/tuxdroid-gadget-shortcut/trunk/.project software_suite_v2/software/gadgets/tuxdroid-gadget-shortcut/trunk/src/ software_suite_v2/software/gadgets/tuxdroid-gadget-shortcut/trunk/src/shortcutmanager.java Log: * Added shortcut manager source. Added: software_suite_v2/software/gadgets/tuxdroid-gadget-shortcut/trunk/.classpath =================================================================== --- software_suite_v2/software/gadgets/tuxdroid-gadget-shortcut/trunk/.classpath (rev 0) +++ software_suite_v2/software/gadgets/tuxdroid-gadget-shortcut/trunk/.classpath 2008-07-29 20:04:08 UTC (rev 1417) @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="lib" path="D:/test/tuxdroid-gadget-framework-full-0.1.jar"/> + <classpathentry kind="output" path="bin"/> +</classpath> Added: software_suite_v2/software/gadgets/tuxdroid-gadget-shortcut/trunk/.project =================================================================== --- software_suite_v2/software/gadgets/tuxdroid-gadget-shortcut/trunk/.project (rev 0) +++ software_suite_v2/software/gadgets/tuxdroid-gadget-shortcut/trunk/.project 2008-07-29 20:04:08 UTC (rev 1417) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>shortcutmanager</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> Added: software_suite_v2/software/gadgets/tuxdroid-gadget-shortcut/trunk/src/shortcutmanager.java =================================================================== --- software_suite_v2/software/gadgets/tuxdroid-gadget-shortcut/trunk/src/shortcutmanager.java (rev 0) +++ software_suite_v2/software/gadgets/tuxdroid-gadget-shortcut/trunk/src/shortcutmanager.java 2008-07-29 20:04:08 UTC (rev 1417) @@ -0,0 +1,78 @@ + +import java.io.IOException; + +import com.kysoh.tuxdroid.gadget.framework.gadget.SimpleGadget; +import com.kysoh.tuxdroid.gadget.framework.gadget.SimpleGadgetConfiguration; + + + + + +public class shortcutmanager extends SimpleGadget<shortcutmanager.Configuration>{ + + //public class that manage a simple configuration. + public static class Configuration extends SimpleGadgetConfiguration{ + + // Absolute Path/ link to the program to launch + private String path = "c:/windows/notepad.exe"; + + + public void setPath(String path){ + this.path = path; + } + + public String getPath(){ + return this.path; + } + + + + } + + //Configuration object. + + @Override + public void start() throws Exception { //gadget run part. + //Send something to say through gadget framework. + + + + if (this.configuration().isTraces()) + { + throwMessageNotification("Lauching "+this.configuration().getPath()+" ..."); + } + + + launchextprogram(this.configuration().getPath()); + + System.exit(0); + } + + public static void main(String[] args) throws InterruptedException, IOException { + //Stand alone behavior. + new shortcutmanager().boot(new Configuration()); + } + + + + // launch an external program + + private void launchextprogram(String cmd){ + + try { + + if (System.getProperty("os.name") == "Linux") + { + cmd="/bin/bash -c'"+cmd+"'"; + } + + Process p = Runtime.getRuntime().exec(cmd); + + } catch (IOException e) { + throwMessageNotification("Error: ("+e.getMessage()+")"); + } + } + + + +} |
From: jerome <c2m...@c2...> - 2008-07-29 19:52:35
|
Author: jerome Date: 2008-07-29 21:52:39 +0200 (Tue, 29 Jul 2008) New Revision: 1416 Added: software_suite_v2/software/gadgets/tuxdroid-gadget-shortcut/ software_suite_v2/software/gadgets/tuxdroid-gadget-shortcut/branches/ software_suite_v2/software/gadgets/tuxdroid-gadget-shortcut/tags/ software_suite_v2/software/gadgets/tuxdroid-gadget-shortcut/trunk/ Log: * Added shortcut manager directories structure. |
From: remi <c2m...@c2...> - 2008-07-29 14:15:49
|
Author: remi Date: 2008-07-29 16:15:58 +0200 (Tue, 29 Jul 2008) New Revision: 1415 Added: software_suite_v2/software/tools/attitunesStudio/trunk/images/aero.att Modified: software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java Log: * added an attitune sample file in the project. This *.att file is launched in the viewer to test the functionalities. Added: software_suite_v2/software/tools/attitunesStudio/trunk/images/aero.att =================================================================== (Binary files differ) Property changes on: software_suite_v2/software/tools/attitunesStudio/trunk/images/aero.att ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java =================================================================== --- software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java 2008-07-29 13:01:57 UTC (rev 1414) +++ software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java 2008-07-29 14:15:58 UTC (rev 1415) @@ -83,7 +83,7 @@ attBlockViewer.events.register(ATTConfig.EVENT_BLOCK_DRAG_STOPPED, this, "onBlockDragStopped"); /* Load a file */ - attBlockViewer.loadAttitune("C:/Others/Files/attitunes/aero.att"); + attBlockViewer.loadAttitune(getClass().getResource("aero.att").getPath()); /* Zoom plus button */ zoomPlusButton = new ATTSButton("/zoomPlusButton.png"); |
From: remi <c2m...@c2...> - 2008-07-29 13:01:47
|
Author: remi Date: 2008-07-29 15:01:57 +0200 (Tue, 29 Jul 2008) New Revision: 1414 Modified: software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/format/ATTFormatReadWrite.java Log: * fixed a little warning Modified: software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/format/ATTFormatReadWrite.java =================================================================== --- software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/format/ATTFormatReadWrite.java 2008-07-29 13:01:17 UTC (rev 1413) +++ software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/format/ATTFormatReadWrite.java 2008-07-29 13:01:57 UTC (rev 1414) @@ -36,6 +36,7 @@ /* * Attitune file fields */ + @SuppressWarnings("unused") private String attFilePath = ""; private String attWorkPath = ""; private String xmlPath = ""; |
From: remi <c2m...@c2...> - 2008-07-29 13:01:24
|
Author: remi Date: 2008-07-29 15:01:17 +0200 (Tue, 29 Jul 2008) New Revision: 1413 Modified: software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/visual/ATTBlockViewer.java Log: * updated the block dragging behavior. 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-07-29 09:37:33 UTC (rev 1412) +++ software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/visual/ATTBlockViewer.java 2008-07-29 13:01:17 UTC (rev 1413) @@ -383,6 +383,18 @@ setFocusedRow(newRow, true); } } + + /* Block dragging activation */ + if ((focusedBlock == clickedBlock) && (focusedBlock != null)) + { + draggingBlock = true; + events.emit(ATTConfig.EVENT_BLOCK_DRAG_STARTED, (ATTBlock)focusedBlock); + } + else + { + /* Update the time position */ + coordToTimePosition(x, y); + } } /* Right click */ else if (event.getButton() == MouseEvent.BUTTON3) @@ -407,18 +419,6 @@ } } - /* New block is clicked */ - if ((focusedBlock == clickedBlock) && (focusedBlock != null)) - { - draggingBlock = true; - events.emit(ATTConfig.EVENT_BLOCK_DRAG_STARTED, (ATTBlock)focusedBlock); - } - else - { - /* Update the time position */ - coordToTimePosition(x, y); - } - /* Refresh the viewer */ this.repaint(); } |
From: remi <c2m...@c2...> - 2008-07-29 09:37:30
|
Author: remi Date: 2008-07-29 11:37:33 +0200 (Tue, 29 Jul 2008) New Revision: 1412 Modified: software_suite_v2/tuxware/java-api/trunk/src/TestAPI.java Log: * added the "radio connected" event in the example. Modified: software_suite_v2/tuxware/java-api/trunk/src/TestAPI.java =================================================================== --- software_suite_v2/tuxware/java-api/trunk/src/TestAPI.java 2008-07-29 08:07:47 UTC (rev 1411) +++ software_suite_v2/tuxware/java-api/trunk/src/TestAPI.java 2008-07-29 09:37:33 UTC (rev 1412) @@ -13,6 +13,10 @@ System.out.println(str); } + public static void radio_connect(String value, Double delay){ + System.out.println("Radio is connected"); + } + /** * @param args */ @@ -21,6 +25,7 @@ TuxAPI tux = new TuxAPI("localhost", 270); System.out.println("Register the 'all' events callback"); tux.event.handler.register("all", new TestAPI(), "onAllEvent"); + tux.event.handler.register(TuxAPIConst.ST_NAME_RADIO_STATE, new TestAPI(), "radio_connect", "True", null); tux.button.remote.registerEventOnPressed(new TestAPI(), "remote_button", null); System.out.println("Connect to a Tuxdroid server"); tux.server.autoConnect(TuxAPIConst.CLIENT_LEVEL_RESTRICTED, "Test", "myPasswd"); |
Author: remi Date: 2008-07-29 10:07:47 +0200 (Tue, 29 Jul 2008) New Revision: 1411 Added: software_suite_v2/software/tools/attitunesStudio/ software_suite_v2/software/tools/attitunesStudio/branches/ software_suite_v2/software/tools/attitunesStudio/tags/ software_suite_v2/software/tools/attitunesStudio/trunk/ software_suite_v2/software/tools/attitunesStudio/trunk/.classpath software_suite_v2/software/tools/attitunesStudio/trunk/.project software_suite_v2/software/tools/attitunesStudio/trunk/images/ software_suite_v2/software/tools/attitunesStudio/trunk/images/TTS.png software_suite_v2/software/tools/attitunesStudio/trunk/images/Thumbs.db software_suite_v2/software/tools/attitunesStudio/trunk/images/actionButton1Enable.png software_suite_v2/software/tools/attitunesStudio/trunk/images/actionButton1Pressed.png software_suite_v2/software/tools/attitunesStudio/trunk/images/actionButton2Enable.png software_suite_v2/software/tools/attitunesStudio/trunk/images/actionButton2Pressed.PNG software_suite_v2/software/tools/attitunesStudio/trunk/images/background.png software_suite_v2/software/tools/attitunesStudio/trunk/images/leds.png software_suite_v2/software/tools/attitunesStudio/trunk/images/mouth+eyes.png software_suite_v2/software/tools/attitunesStudio/trunk/images/sound.png software_suite_v2/software/tools/attitunesStudio/trunk/images/spinning.png software_suite_v2/software/tools/attitunesStudio/trunk/images/wings.png software_suite_v2/software/tools/attitunesStudio/trunk/images/zoomFullButton.png software_suite_v2/software/tools/attitunesStudio/trunk/images/zoomMinusButton.png software_suite_v2/software/tools/attitunesStudio/trunk/images/zoomPlusButton.png software_suite_v2/software/tools/attitunesStudio/trunk/images/zoomPressedButton.png software_suite_v2/software/tools/attitunesStudio/trunk/src/ software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java software_suite_v2/software/tools/attitunesStudio/trunk/src/com/ software_suite_v2/software/tools/attitunesStudio/trunk/src/com/cloudgarden/ software_suite_v2/software/tools/attitunesStudio/trunk/src/com/cloudgarden/layout/ software_suite_v2/software/tools/attitunesStudio/trunk/src/com/cloudgarden/layout/AnchorConstraint.java software_suite_v2/software/tools/attitunesStudio/trunk/src/com/cloudgarden/layout/AnchorLayout.java software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/ software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/ software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/ATTConfig.java software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/ATTMisc.java software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/block/ software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/block/ATTBlock.java software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/block/ATTBlockContainer.java software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/format/ 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/ATTFormatReadWrite.java software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/format/ATTXmlParser.java software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/vector/ software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/vector/ATTAreaVector.java software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/vector/ATTPointVector.java software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/vector/ATTTlvVector.java software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/visual/ 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/ATTSButton.java software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/visual/ATTScrollbar.java software_suite_v2/software/tools/attitunesStudio/trunk/src/main.java Log: * added "attitunesStudio" project Added: software_suite_v2/software/tools/attitunesStudio/trunk/.classpath =================================================================== --- software_suite_v2/software/tools/attitunesStudio/trunk/.classpath (rev 0) +++ software_suite_v2/software/tools/attitunesStudio/trunk/.classpath 2008-07-29 08:07:47 UTC (rev 1411) @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="src" path="images"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="output" path="bin"/> +</classpath> Added: software_suite_v2/software/tools/attitunesStudio/trunk/.project =================================================================== --- software_suite_v2/software/tools/attitunesStudio/trunk/.project (rev 0) +++ software_suite_v2/software/tools/attitunesStudio/trunk/.project 2008-07-29 08:07:47 UTC (rev 1411) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>attitunes_studio</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> Added: software_suite_v2/software/tools/attitunesStudio/trunk/images/TTS.png =================================================================== (Binary files differ) Property changes on: software_suite_v2/software/tools/attitunesStudio/trunk/images/TTS.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: software_suite_v2/software/tools/attitunesStudio/trunk/images/Thumbs.db =================================================================== (Binary files differ) Property changes on: software_suite_v2/software/tools/attitunesStudio/trunk/images/Thumbs.db ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: software_suite_v2/software/tools/attitunesStudio/trunk/images/actionButton1Enable.png =================================================================== (Binary files differ) Property changes on: software_suite_v2/software/tools/attitunesStudio/trunk/images/actionButton1Enable.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: software_suite_v2/software/tools/attitunesStudio/trunk/images/actionButton1Pressed.png =================================================================== (Binary files differ) Property changes on: software_suite_v2/software/tools/attitunesStudio/trunk/images/actionButton1Pressed.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: software_suite_v2/software/tools/attitunesStudio/trunk/images/actionButton2Enable.png =================================================================== (Binary files differ) Property changes on: software_suite_v2/software/tools/attitunesStudio/trunk/images/actionButton2Enable.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: software_suite_v2/software/tools/attitunesStudio/trunk/images/actionButton2Pressed.PNG =================================================================== (Binary files differ) Property changes on: software_suite_v2/software/tools/attitunesStudio/trunk/images/actionButton2Pressed.PNG ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: software_suite_v2/software/tools/attitunesStudio/trunk/images/background.png =================================================================== (Binary files differ) Property changes on: software_suite_v2/software/tools/attitunesStudio/trunk/images/background.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: software_suite_v2/software/tools/attitunesStudio/trunk/images/leds.png =================================================================== (Binary files differ) Property changes on: software_suite_v2/software/tools/attitunesStudio/trunk/images/leds.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: software_suite_v2/software/tools/attitunesStudio/trunk/images/mouth+eyes.png =================================================================== (Binary files differ) Property changes on: software_suite_v2/software/tools/attitunesStudio/trunk/images/mouth+eyes.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: software_suite_v2/software/tools/attitunesStudio/trunk/images/sound.png =================================================================== (Binary files differ) Property changes on: software_suite_v2/software/tools/attitunesStudio/trunk/images/sound.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: software_suite_v2/software/tools/attitunesStudio/trunk/images/spinning.png =================================================================== (Binary files differ) Property changes on: software_suite_v2/software/tools/attitunesStudio/trunk/images/spinning.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: software_suite_v2/software/tools/attitunesStudio/trunk/images/wings.png =================================================================== (Binary files differ) Property changes on: software_suite_v2/software/tools/attitunesStudio/trunk/images/wings.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: software_suite_v2/software/tools/attitunesStudio/trunk/images/zoomFullButton.png =================================================================== (Binary files differ) Property changes on: software_suite_v2/software/tools/attitunesStudio/trunk/images/zoomFullButton.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: software_suite_v2/software/tools/attitunesStudio/trunk/images/zoomMinusButton.png =================================================================== (Binary files differ) Property changes on: software_suite_v2/software/tools/attitunesStudio/trunk/images/zoomMinusButton.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: software_suite_v2/software/tools/attitunesStudio/trunk/images/zoomPlusButton.png =================================================================== (Binary files differ) Property changes on: software_suite_v2/software/tools/attitunesStudio/trunk/images/zoomPlusButton.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: software_suite_v2/software/tools/attitunesStudio/trunk/images/zoomPressedButton.png =================================================================== (Binary files differ) Property changes on: software_suite_v2/software/tools/attitunesStudio/trunk/images/zoomPressedButton.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java =================================================================== --- software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java (rev 0) +++ software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java 2008-07-29 08:07:47 UTC (rev 1411) @@ -0,0 +1,360 @@ + +import com.cloudgarden.layout.AnchorConstraint; +import com.cloudgarden.layout.AnchorLayout; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.awt.Color; +import javax.swing.BoxLayout; +import javax.swing.WindowConstants; +import com.tuxisalive.attitunes.*; +import com.tuxisalive.attitunes.block.ATTBlock; +import com.tuxisalive.attitunes.block.ATTBlockContainer; +import com.tuxisalive.attitunes.visual.ATTBlockViewer; +import com.tuxisalive.attitunes.visual.ATTSButton; + +/** + * + * @author R Jocaille + * + */ +public class MainFrame extends javax.swing.JFrame +{ + private static final long serialVersionUID = 724080299924475945L; + + private ATTBlockViewer attBlockViewer; + + private ATTSButton zoomPlusButton; + private ATTSButton zoomMinusButton; + private ATTSButton zoomFullButton; + private ATTSButton createButton; + private ATTSButton deleteButton; + private ATTSButton copyButton; + private ATTSButton pastButton; + private ATTSButton playButton; + private ATTSButton stopButton; + + /** + * MainFrame constructor + */ + public MainFrame() + { + super(); + initGUI(); + this.setTitle("Attitunes studio"); + } + + /* + * Create the GUI + */ + private void initGUI() + { + try + { + /* Add a layout to the frame */ + BoxLayout thisLayout = new BoxLayout(getContentPane(), javax.swing.BoxLayout.Y_AXIS); + getContentPane().setLayout(thisLayout); + + /* Close window */ + setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); + this.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent evt) { + thisWindowClosing(evt); + } + }); + + /* Main viewer */ + attBlockViewer = new ATTBlockViewer(640, 300); + AnchorLayout mainViewerLayout = new AnchorLayout(); + attBlockViewer.setLayout(mainViewerLayout); + getContentPane().add(attBlockViewer); + attBlockViewer.loadImages("/"); + attBlockViewer.events.register(ATTConfig.EVENT_POSITION_CHANGED, this, "onPositionChanged"); + attBlockViewer.events.register(ATTConfig.EVENT_LENGTH_CHANGED, this, "onLengthChanged"); + attBlockViewer.events.register(ATTConfig.EVENT_ZOOM_CHANGED, this, "onZoomChanged"); + attBlockViewer.events.register(ATTConfig.EVENT_SCROLLBAR_DRAG_STARTED, this, "onScrollbarDragStarted"); + attBlockViewer.events.register(ATTConfig.EVENT_SCROLLBAR_DRAGGING, this, "onScrollbarDragging"); + attBlockViewer.events.register(ATTConfig.EVENT_SCROLLBAR_DRAG_STOPPED, this, "onScrollbarDragStopped"); + attBlockViewer.events.register(ATTConfig.EVENT_ROW_SELECTED, this, "onRowSelected"); + attBlockViewer.events.register(ATTConfig.EVENT_BLOCK_SELECTED, this, "onBlockSelected"); + attBlockViewer.events.register(ATTConfig.EVENT_BLOCK_DRAG_STARTED, this, "onBlockDragStarted"); + attBlockViewer.events.register(ATTConfig.EVENT_BLOCK_DRAGGING, this, "onBlockDragging"); + attBlockViewer.events.register(ATTConfig.EVENT_BLOCK_DRAG_STOPPED, this, "onBlockDragStopped"); + + /* Load a file */ + attBlockViewer.loadAttitune("C:/Others/Files/attitunes/aero.att"); + + /* Zoom plus button */ + zoomPlusButton = new ATTSButton("/zoomPlusButton.png"); + zoomPlusButton.setPressedIcon("/zoomPressedButton.png"); + zoomPlusButton.addMouseListener(new MouseAdapter() { + public void mousePressed(MouseEvent evt) + { + onZoomPlusButtonPressed(evt); + } + }); + attBlockViewer.add(zoomPlusButton, new AnchorConstraint(520, 270)); + + /* Zoom minus button */ + zoomMinusButton = new ATTSButton("/zoomMinusButton.png"); + zoomMinusButton.setPressedIcon("/zoomPressedButton.png"); + zoomMinusButton.addMouseListener(new MouseAdapter() { + public void mousePressed(MouseEvent evt) + { + onZoomMinusButtonPressed(evt); + } + }); + attBlockViewer.add(zoomMinusButton, new AnchorConstraint(550, 270)); + + /* Zoom full button */ + zoomFullButton = new ATTSButton("/zoomFullButton.png"); + zoomFullButton.setPressedIcon("/zoomPressedButton.png"); + zoomFullButton.addMouseListener(new MouseAdapter() { + public void mousePressed(MouseEvent evt) + { + onZoomFullButtonPressed(evt); + } + }); + attBlockViewer.add(zoomFullButton, new AnchorConstraint(580, 270)); + + /* Create button */ + createButton = new ATTSButton("Create", Color.WHITE, "/actionButton1Enable.png"); + createButton.setPressedIcon("/actionButton1Pressed.png"); + createButton.addMouseListener(new MouseAdapter() { + public void mousePressed(MouseEvent evt) + { + onCreateButtonPressed(evt); + } + }); + attBlockViewer.add(createButton, new AnchorConstraint(110, 271)); + + /* Delete button */ + deleteButton = new ATTSButton("Delete", Color.WHITE, "/actionButton1Enable.png"); + deleteButton.setPressedIcon("/actionButton1Pressed.png"); + deleteButton.addMouseListener(new MouseAdapter() { + public void mousePressed(MouseEvent evt) + { + onDeleteButtonPressed(evt); + } + }); + attBlockViewer.add(deleteButton, new AnchorConstraint(200, 271)); + + /* Copy button */ + copyButton = new ATTSButton("Copy", Color.WHITE, "/actionButton1Enable.png"); + copyButton.setPressedIcon("/actionButton1Pressed.png"); + copyButton.addMouseListener(new MouseAdapter() { + public void mousePressed(MouseEvent evt) + { + onCopyButtonPressed(evt); + } + }); + attBlockViewer.add(copyButton, new AnchorConstraint(290, 271)); + + /* Past button */ + pastButton = new ATTSButton("Past", Color.WHITE, "/actionButton1Enable.png"); + pastButton.setPressedIcon("/actionButton1Pressed.png"); + pastButton.addMouseListener(new MouseAdapter() { + public void mousePressed(MouseEvent evt) + { + onPastButtonPressed(evt); + } + }); + attBlockViewer.add(pastButton, new AnchorConstraint(380, 271)); + + /* Play button */ + playButton = new ATTSButton("Play", Color.BLACK, "/actionButton2Enable.png"); + playButton.setPressedIcon("/actionButton2Pressed.png"); + playButton.addMouseListener(new MouseAdapter() { + public void mousePressed(MouseEvent evt) + { + onPlayButtonPressed(evt); + } + }); + attBlockViewer.add(playButton, new AnchorConstraint(10, 248)); + + /* Stop button */ + stopButton = new ATTSButton("Stop", Color.BLACK, "/actionButton2Enable.png"); + stopButton.setPressedIcon("/actionButton2Pressed.png"); + stopButton.addMouseListener(new MouseAdapter() { + public void mousePressed(MouseEvent evt) + { + onStopButtonPressed(evt); + } + }); + attBlockViewer.add(stopButton, new AnchorConstraint(10, 273)); + + /* Pack the components and set the frame size */ + pack(); + setSize(648, 400); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + + /* ------------------------------------------------------------------------ + * Window events + * --------------------------------------------------------------------- */ + + /* + * Event on window closing + */ + private void thisWindowClosing(WindowEvent evt) + { + attBlockViewer.destroy(); + } + + /* ------------------------------------------------------------------------ + * Blocks viewer events + * --------------------------------------------------------------------- */ + + /* + * Event when the cursor position was changed + */ + public void onPositionChanged(Double newPosition) + { + } + + /* + * Event when the length of the scene was changed + */ + public void onLengthChanged(Double newLength) + { + } + + /* + * Event when the zoom was changed + */ + public void onZoomChanged(Integer newZoomFactor) + { + } + + /* + * Event when the scrollbar dragging was started + */ + public void onScrollbarDragStarted() + { + } + + /* + * Event when the scrollbar is dragged + */ + public void onScrollbarDragging() + { + } + + /* + * Event when the scrollbar dragging was stopped + */ + public void onScrollbarDragStopped() + { + } + + /* + * Event when a new row was selected + */ + public void onRowSelected(Integer rowIdx, ATTBlockContainer blockContainer) + { + } + + /* + * Event when a new block was selected + */ + public void onBlockSelected(ATTBlock block) + { + System.out.println(block.getFunctionParams()); + } + + /* + * Event when the block dragging was started + */ + public void onBlockDragStarted(ATTBlock block) + { + } + + /* + * Event when the block is dragged + */ + public void onBlockDragging(ATTBlock block, Double timeIdx) + { + } + + /* + * Event when the block dragging was stopped + */ + public void onBlockDragStopped(ATTBlock block) + { + } + + /* ------------------------------------------------------------------------ + * Blocks buttons events + * --------------------------------------------------------------------- */ + + /* + * Zoom plus button pressed + */ + public void onZoomPlusButtonPressed(MouseEvent evt) + { + attBlockViewer.setZoomFactor(attBlockViewer.getZoomFactor() + 1); + } + + /* + * Zoom minus button pressed + */ + public void onZoomMinusButtonPressed(MouseEvent evt) + { + attBlockViewer.setZoomFactor(attBlockViewer.getZoomFactor() - 1); + } + + /* + * Zoom full button pressed + */ + public void onZoomFullButtonPressed(MouseEvent evt) + { + attBlockViewer.setZoomFactor(1); + } + + /* + * Create button pressed + */ + public void onCreateButtonPressed(MouseEvent evt) + { + } + + /* + * Delete button pressed + */ + public void onDeleteButtonPressed(MouseEvent evt) + { + } + + /* + * Copy button pressed + */ + public void onCopyButtonPressed(MouseEvent evt) + { + } + + /* + * Past button pressed + */ + public void onPastButtonPressed(MouseEvent evt) + { + } + + /* + * Play button pressed + */ + public void onPlayButtonPressed(MouseEvent evt) + { + } + + /* + * Stop button pressed + */ + public void onStopButtonPressed(MouseEvent evt) + { + } +} Added: software_suite_v2/software/tools/attitunesStudio/trunk/src/com/cloudgarden/layout/AnchorConstraint.java =================================================================== --- software_suite_v2/software/tools/attitunesStudio/trunk/src/com/cloudgarden/layout/AnchorConstraint.java (rev 0) +++ software_suite_v2/software/tools/attitunesStudio/trunk/src/com/cloudgarden/layout/AnchorConstraint.java 2008-07-29 08:07:47 UTC (rev 1411) @@ -0,0 +1,85 @@ +/* + */ +package com.cloudgarden.layout; + +/** + * Used by both AnchorLayout (SWT) and AnchorLayoutManager (Swing) + */ +public class AnchorConstraint { + + /** + * Meaning: This side is not anchored. + */ + public static final int ANCHOR_NONE = 0; + + /** + * (Relative anchor) Meaning: This side is anchored so that it always + * occurs a fixed fraction of + * the distance along it's parent's side. The position is calculated by + * the formula " position = (parent side)*(value)/1000 " so for + * instance if top=100 and topType == ANCHOR_REL then the + * value of y for this side would be (parent height)*top/1000. + */ + public static final int ANCHOR_REL = 1; + + /** + * (Absolute anchor) Meaning: This side is anchored a fixed distance + * in pixels (given by the value for this side) from it's parent's respective side. + * For instance, if bottomType == ANCHOR_ABS and bottom = 100 then the + * bottom side of this component will remain fixed 100 pixels from + * the bottom side of it's parent container. + */ + public static final int ANCHOR_ABS = 2; + + public int top; + public int bottom; + public int left; + public int right; + public int topType; + public int bottomType; + public int rightType; + public int leftType; + + public AnchorConstraint() { + this(0, 0, 0, 0, ANCHOR_NONE, ANCHOR_NONE, ANCHOR_NONE, ANCHOR_NONE); + } + + /** + * Creates an AnchorConstraint. + * @param top - value (relative or absolute) for top side + * @param right - like 'top' but for right side + * @param bottom - like 'top' but for bottom side + * @param left - like 'top' but for left side + * @param topType - either ANCHOR_ABS, ANCHOR_REL or ANCHOR_NONE + * to indicate whether the 'top' parameter is an absolute value (in pixels) or + * a fractional value (in 1/1000 ths) of the height of this component's parent, + * denoting where the anchor will be applied (if at all). + * @param rightType - like 'topType' but for right side + * @param bottomType - like 'topType' but for bottom side + * @param leftType - like 'topType' but for left side + */ + public AnchorConstraint( + int top, + int right, + int bottom, + int left, + int topType, + int rightType, + int bottomType, + int leftType) { + this.top = top; + this.bottom = bottom; + this.left = left; + this.right = right; + this.topType = topType; + this.rightType = rightType; + this.bottomType = bottomType; + this.leftType = leftType; + } + + public AnchorConstraint(int left, int top) + { + this(top, 0, 0, left, ANCHOR_ABS, ANCHOR_NONE, ANCHOR_NONE, ANCHOR_ABS); + } + +} Added: software_suite_v2/software/tools/attitunesStudio/trunk/src/com/cloudgarden/layout/AnchorLayout.java =================================================================== --- software_suite_v2/software/tools/attitunesStudio/trunk/src/com/cloudgarden/layout/AnchorLayout.java (rev 0) +++ software_suite_v2/software/tools/attitunesStudio/trunk/src/com/cloudgarden/layout/AnchorLayout.java 2008-07-29 08:07:47 UTC (rev 1411) @@ -0,0 +1,255 @@ +/* + */ +package com.cloudgarden.layout; + +import java.awt.Component; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.LayoutManager2; +import java.awt.Rectangle; +import java.util.HashMap; + +/** + * Lays out components, using a combination of their "bounds" property + * and their AnchorConstraints layout constraint objects. + * <P> + * Sides of the components can be anchored either absolutely (eg, if the + * right side is anchored absolutely then it will always be a fixed number + * of pixels from the right side of it's parent container) or relatively (ie, + * if any side is anchored relatively then it will always occur a fixed + * fraction of the way along it's parent's side). Or they can be not anchored, + * at all in which case they will occur at places determined by their + * component's "bounds" property and the anchoring of the component's + * other sides. + */ +public class AnchorLayout implements LayoutManager2 { + + private int preferredWidth, preferredHeight, minHeight, minWidth; + private HashMap constraintMap = new HashMap(); + private boolean sizesCalculated = false; + private Container container; + + public AnchorLayout() { + super(); + } + + void initialize(Container parent) { + if (sizesCalculated) + return; + Component[] children = parent.getComponents(); + preferredWidth = 10000; + preferredHeight = 10000; + minWidth = 0; + minHeight = 0; + Rectangle pb = parent.getBounds(); + for (int i = 0; i < children.length; i++) { + Component child = children[i]; + if (child != null) { + Object ld = constraintMap.get(child); + Rectangle b = child.getBounds(); + Dimension pref = child.getPreferredSize(); + Dimension min = child.getMaximumSize(); + if (pref == null) + pref = child.getSize(); + if (min == null) + min = child.getSize(); + int minX = b.x + b.width; + int minY = b.y + b.height; + int maxX = b.x + b.width; + int maxY = b.y + b.height; + if (ld instanceof AnchorConstraint) { + AnchorConstraint ac = (AnchorConstraint) ld; + int acl = ac.left; + int acr = ac.right; + int aclt = ac.leftType; + int acrt = ac.rightType; + + if (aclt == AnchorConstraint.ANCHOR_REL) + acl = acl * pb.width / 1000; + if (acrt == AnchorConstraint.ANCHOR_REL) + acr = pb.width - acr * pb.width / 1000; + + if (aclt != AnchorConstraint.ANCHOR_NONE + && acrt != AnchorConstraint.ANCHOR_NONE) + maxX = acl + pref.width + acr; + if (aclt == AnchorConstraint.ANCHOR_NONE) + acl = 0; + if (acrt == AnchorConstraint.ANCHOR_NONE) + acr = 0; + minX = acl + min.width + acr; + + int act = ac.top; + int acb = ac.bottom; + int actt = ac.topType; + int acbt = ac.bottomType; + if (actt == AnchorConstraint.ANCHOR_REL) + act = act * pb.height / 1000; + if (acbt == AnchorConstraint.ANCHOR_REL) + acb = pb.height - acb * pb.height / 1000; + + if (actt != AnchorConstraint.ANCHOR_NONE + && acbt != AnchorConstraint.ANCHOR_NONE) + maxY = act + pref.height + acb; + if (actt == AnchorConstraint.ANCHOR_NONE) + act = 0; + if (acbt == AnchorConstraint.ANCHOR_NONE) + acb = 0; + minY = act + min.height + acb; + } + if (minX > minWidth) + minWidth = minX; + if (maxX > minWidth) + preferredWidth = maxX; + if (minY > minHeight) + minHeight = minY; + if (maxY > preferredHeight) + preferredHeight = maxY; + } + } + + } + + /* (non-Javadoc) + * @see org.eclipse.swt.widgets.Layout#layout(org.eclipse.swt.widgets.Composite, boolean) + */ + public void layoutContainer(Container container) { + this.container = container; + Component children[] = container.getComponents(); + Rectangle rect = container.getBounds(); + int width = rect.width; + int height = rect.height; + for (int i = 0; i < children.length; i++) { + Component child = children[i]; + if (child != null) { + Object ld = constraintMap.get(child); + Rectangle b = child.getBounds(); + Dimension pref = child.getPreferredSize(); + if (pref == null) + pref = child.getSize(); + if (ld instanceof AnchorConstraint) { + AnchorConstraint ac = (AnchorConstraint) ld; + int acl = ac.left; + int acr = ac.right; + int aclt = ac.leftType; + int acrt = ac.rightType; + if (aclt == AnchorConstraint.ANCHOR_REL) + acl = acl * width / 1000; + if (acrt == AnchorConstraint.ANCHOR_REL) + acr = width - acr * width / 1000; + + if (aclt != AnchorConstraint.ANCHOR_NONE) { + if (acrt != AnchorConstraint.ANCHOR_NONE) { + b.width = width - acr - acl; + b.x = acl; + } else { + b.width = pref.width; + if (b.width + acl > width) + b.width = width - acl; + b.x = acl; + } + } else { + if (acrt != AnchorConstraint.ANCHOR_NONE) { + b.x = width - acr - pref.width; + } + b.width = pref.width; + if (b.width + b.x > width) + b.width = width - b.x; + } + + int act = ac.top; + int acb = ac.bottom; + int actt = ac.topType; + int acbt = ac.bottomType; + if (actt == AnchorConstraint.ANCHOR_REL) + act = act * height / 1000; + if (acbt == AnchorConstraint.ANCHOR_REL) + acb = height - acb * height / 1000; + + if (actt != AnchorConstraint.ANCHOR_NONE) { + if (acbt != AnchorConstraint.ANCHOR_NONE) { + b.height = height - acb - act; + b.y = act; + } else { + b.height = pref.height; + if (b.height + act > height) + b.height = height - act; + b.y = act; + } + } else { + if (acbt != AnchorConstraint.ANCHOR_NONE) { + b.y = height - acb - pref.height; + } + b.height = pref.height; + if (b.height + b.y > height) + b.height = height - b.y; + } + child.setBounds(b); + } + } + } + } + + /* (non-Javadoc) + * @see java.awt.LayoutManager#addLayoutComponent(java.lang.String, java.awt.Component) + */ + public void addLayoutComponent(String name, Component comp) {} + + /* (non-Javadoc) + * @see java.awt.LayoutManager#removeLayoutComponent(java.awt.Component) + */ + public void removeLayoutComponent(Component comp) { + constraintMap.remove(comp); + } + + /* (non-Javadoc) + * @see java.awt.LayoutManager#preferredLayoutSize(java.awt.Container) + */ + public Dimension preferredLayoutSize(Container parent) { + initialize(parent); + return new Dimension(preferredWidth, preferredHeight); + } + + /* (non-Javadoc) + * @see java.awt.LayoutManager#minimumLayoutSize(java.awt.Container) + */ + public Dimension minimumLayoutSize(Container parent) { + initialize(parent); + return new Dimension(minWidth, minHeight); + } + + /* (non-Javadoc) + * @see java.awt.LayoutManager2#addLayoutComponent(java.awt.Component, java.lang.Object) + */ + public void addLayoutComponent(Component comp, Object constraints) { + constraintMap.put(comp, constraints); + } + + /* (non-Javadoc) + * @see java.awt.LayoutManager2#maximumLayoutSize(java.awt.Container) + */ + public Dimension maximumLayoutSize(Container target) { + return preferredLayoutSize(target); + } + + /* (non-Javadoc) + * @see java.awt.LayoutManager2#getLayoutAlignmentX(java.awt.Container) + */ + public float getLayoutAlignmentX(Container target) { + return 0; + } + + /* (non-Javadoc) + * @see java.awt.LayoutManager2#getLayoutAlignmentY(java.awt.Container) + */ + public float getLayoutAlignmentY(Container target) { + return 0; + } + + /* (non-Javadoc) + * @see java.awt.LayoutManager2#invalidateLayout(java.awt.Container) + */ + public void invalidateLayout(Container target) { + sizesCalculated = false; + } + +} Added: software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/ATTConfig.java =================================================================== --- software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/ATTConfig.java (rev 0) +++ software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/ATTConfig.java 2008-07-29 08:07:47 UTC (rev 1411) @@ -0,0 +1,96 @@ +package com.tuxisalive.attitunes; + +/** + * + * @author R Jocaille + * + */ +public interface ATTConfig +{ + public static int TLV_LEFT = 100; + public static int TLV_TOP = 45; + public static int TLV_BOTTOM_BORDER = 60; + public static int TLV_RIGHT_BORDER = 30; + + public static double INDICES_PER_PIXEL = 0.0159; + public static double ZOOM_DEPTH_COEFF = 1.666666; + + public static float[] SB_BACKGROUND_FILL_COLOR = {0.7f, 0.7f, 0.7f, 0.5f}; + public static float[] SB_BACKGROUND_LINE_COLOR = {1.0f, 1.0f, 1.0f, 1.0f}; + public static float[] SB_FRONT_LINE_COLOR = {0.0f, 0.0f, 0.0f, 1.0f}; + public static float[][] SB_FRONT_FILL_COLORS = { + {0.82f, 0.89f, 0.92f, 1.0f}, + {0.75f, 0.82f, 0.789f, 1.0f}, + {0.7f, 0.77f, 0.84f, 1.0f}, + }; + + public static int SB_HEIGHT = 17; + public static int SB_TOP_BORDER = 5; + + public static float[] BLOCK_VIEWER_FILL_COLOR = {0.7f, 0.7f, 0.7f, 0.9f}; + public static float[] PARTS_VIEWER_FILL_COLOR = {0.93f, 0.93f, 0.93f, 1.f}; + + public static float[] CURRENT_POS_BAR_COLOR = {1.0f, 0.0f, 0.0f, 0.6f}; + + public static int BLOCK_TYPE_LEDS = 0; + public static int BLOCK_TYPE_EYESMOUTH = 1; + public static int BLOCK_TYPE_WINGS = 2; + public static int BLOCK_TYPE_SPIN = 3; + public static int BLOCK_TYPE_WAV = 4; + public static int BLOCK_TYPE_TTS = 5; + public static int BLOCK_COUNT_TYPE = 6; + + public static float BLOCK_ALPHA_COLOR_VALUE = 0.8f; + + public static float[][] BLOCK_BLUE_COLORS = { + {0.32f, 0.6f, 0.83f, BLOCK_ALPHA_COLOR_VALUE}, + {0.28f, 0.53f, 0.79f, BLOCK_ALPHA_COLOR_VALUE}, + {0.20f, 0.40f, 0.68f, BLOCK_ALPHA_COLOR_VALUE}, + }; + public static float[][] BLOCK_ORANGE_COLORS = { + {0.92f, 0.71f, 0.20f, BLOCK_ALPHA_COLOR_VALUE}, + {0.88f, 0.66f, 0.216f, BLOCK_ALPHA_COLOR_VALUE}, + {0.75f, 0.49f, 0.0f, BLOCK_ALPHA_COLOR_VALUE}, + }; + public static float[][] BLOCK_RED_COLORS = { + {0.83f, 0.22f, 0.22f, 0.65f}, + {0.79f, 0.18f, 0.18f, 0.65f}, + {0.68f, 0.10f, 0.10f, 0.65f}, + }; + public static float[][] BLOCK_GREY_COLORS = { + {0.70f, 0.70f, 0.70f, BLOCK_ALPHA_COLOR_VALUE}, + {0.65f, 0.65f, 0.65f, BLOCK_ALPHA_COLOR_VALUE}, + {0.50f, 0.50f, 0.50f, BLOCK_ALPHA_COLOR_VALUE}, + }; + public static float[][] BLOCK_LIGHT_BLUE_COLORS = { + {0.82f, 0.89f, 0.92f, BLOCK_ALPHA_COLOR_VALUE}, + {0.75f, 0.82f, 0.789f, BLOCK_ALPHA_COLOR_VALUE}, + {0.7f, 0.77f, 0.84f, BLOCK_ALPHA_COLOR_VALUE}, + }; + + public static String EVENT_POSITION_CHANGED = "position_changed"; + public static String EVENT_LENGTH_CHANGED = "length_changed"; + public static String EVENT_ZOOM_CHANGED = "zoom_changed"; + public static String EVENT_ROW_SELECTED = "row_selected"; + public static String EVENT_BLOCK_SELECTED = "block_selected"; + public static String EVENT_BLOCK_DRAG_STARTED = "block_drag_started"; + public static String EVENT_BLOCK_DRAG_STOPPED = "block_drag_stopped"; + public static String EVENT_BLOCK_DRAGGING = "block_dragging"; + public static String EVENT_SCROLLBAR_DRAG_STARTED = "scrollbar_drag_started"; + public static String EVENT_SCROLLBAR_DRAG_STOPPED = "scrollbar_drag_stopped"; + public static String EVENT_SCROLLBAR_DRAGGING = "scrollbar_dragging"; + + public static String[] EVENT_LIST = { + EVENT_POSITION_CHANGED, + EVENT_LENGTH_CHANGED, + EVENT_ZOOM_CHANGED, + EVENT_ROW_SELECTED, + EVENT_BLOCK_SELECTED, + EVENT_BLOCK_DRAG_STARTED, + EVENT_BLOCK_DRAG_STOPPED, + EVENT_BLOCK_DRAGGING, + EVENT_SCROLLBAR_DRAG_STARTED, + EVENT_SCROLLBAR_DRAG_STOPPED, + EVENT_SCROLLBAR_DRAGGING, + }; +} \ No newline at end of file Added: software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/ATTMisc.java =================================================================== --- software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/ATTMisc.java (rev 0) +++ software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/ATTMisc.java 2008-07-29 08:07:47 UTC (rev 1411) @@ -0,0 +1,44 @@ +package com.tuxisalive.attitunes; + +/** + * + * @author R Jocaille + * + */ +public class ATTMisc +{ + + /** + * + * @param time + * @return + */ + public static String timeToString(double time) + { + int dMSec = (int)(time * 1000); + int minutes = dMSec / 60000; + int reste = dMSec % 60000; + int seconds = reste / 1000; + reste %= 1000; + int mSeconds = reste / 10; + return String.format("%02d:%02d:%02d", minutes, seconds, mSeconds); + } + + /** + * + * @param sec + */ + public static void sleep(Double sec) + { + int delay; + + try + { + sec = sec * 1000; + delay = sec.intValue(); + Thread.sleep(delay); + } + catch(Exception e) {} + } + +} Added: software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/block/ATTBlock.java =================================================================== --- software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/block/ATTBlock.java (rev 0) +++ software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/block/ATTBlock.java 2008-07-29 08:07:47 UTC (rev 1411) @@ -0,0 +1,605 @@ +package com.tuxisalive.attitunes.block; + +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Polygon; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; + +//import others.ReadFileIntoByteArray; + +import com.tuxisalive.attitunes.ATTConfig; +import com.tuxisalive.attitunes.vector.ATTAreaVector; +import com.tuxisalive.attitunes.vector.ATTPointVector; + + +/** + * + * @author R Jocaille + * + */ +public class ATTBlock +{ + private boolean visible; + public ATTPointVector lastClickedPoint; + private boolean focused; + private int blockType; + private double timeBegin; + private double length; + public boolean aLive; + private ATTAreaVector area; + private double viewWidthCoeff; + private double rowViewPosition; + private List<Integer> wavEnergyTable; + private String waveFile; + private Hashtable<String,Object> function; + + static private Color blockBlueColor0; + static private Color blockBlueColor1; + static private Color blockBlueColor2; + static private Color blockOrangeColor0; + static private Color blockOrangeColor1; + static private Color blockOrangeColor2; + static private Color blockRedColor0; + static private Color blockRedColor1; + static private Color blockRedColor2; + static private Color blockLightBlueColor0; + static private Color blockLightBlueColor1; + static private Color blockLightBlueColor2; + static private Color blockWaveformColor; + + static { + blockBlueColor0 = new Color(ATTConfig.BLOCK_BLUE_COLORS[0][0], + ATTConfig.BLOCK_BLUE_COLORS[0][1], + ATTConfig.BLOCK_BLUE_COLORS[0][2], + ATTConfig.BLOCK_BLUE_COLORS[0][3]); + blockBlueColor1 = new Color(ATTConfig.BLOCK_BLUE_COLORS[1][0], + ATTConfig.BLOCK_BLUE_COLORS[1][1], + ATTConfig.BLOCK_BLUE_COLORS[1][2], + ATTConfig.BLOCK_BLUE_COLORS[1][3]); + blockBlueColor2 = new Color(ATTConfig.BLOCK_BLUE_COLORS[2][0], + ATTConfig.BLOCK_BLUE_COLORS[2][1], + ATTConfig.BLOCK_BLUE_COLORS[2][2], + ATTConfig.BLOCK_BLUE_COLORS[2][3]); + blockOrangeColor0 = new Color(ATTConfig.BLOCK_ORANGE_COLORS[0][0], + ATTConfig.BLOCK_ORANGE_COLORS[0][1], + ATTConfig.BLOCK_ORANGE_COLORS[0][2], + ATTConfig.BLOCK_ORANGE_COLORS[0][3]); + blockOrangeColor1 = new Color(ATTConfig.BLOCK_ORANGE_COLORS[1][0], + ATTConfig.BLOCK_ORANGE_COLORS[1][1], + ATTConfig.BLOCK_ORANGE_COLORS[1][2], + ATTConfig.BLOCK_ORANGE_COLORS[1][3]); + blockOrangeColor2 = new Color(ATTConfig.BLOCK_ORANGE_COLORS[2][0], + ATTConfig.BLOCK_ORANGE_COLORS[2][1], + ATTConfig.BLOCK_ORANGE_COLORS[2][2], + ATTConfig.BLOCK_ORANGE_COLORS[2][3]); + blockRedColor0 = new Color(ATTConfig.BLOCK_RED_COLORS[0][0], + ATTConfig.BLOCK_RED_COLORS[0][1], + ATTConfig.BLOCK_RED_COLORS[0][2], + ATTConfig.BLOCK_RED_COLORS[0][3]); + blockRedColor1 = new Color(ATTConfig.BLOCK_RED_COLORS[1][0], + ATTConfig.BLOCK_RED_COLORS[1][1], + ATTConfig.BLOCK_RED_COLORS[1][2], + ATTConfig.BLOCK_RED_COLORS[1][3]); + blockRedColor2 = new Color(ATTConfig.BLOCK_RED_COLORS[2][0], + ATTConfig.BLOCK_RED_COLORS[2][1], + ATTConfig.BLOCK_RED_COLORS[2][2], + ATTConfig.BLOCK_RED_COLORS[2][3]); + blockLightBlueColor0 = new Color(ATTConfig.BLOCK_LIGHT_BLUE_COLORS[0][0], + ATTConfig.BLOCK_LIGHT_BLUE_COLORS[0][1], + ATTConfig.BLOCK_LIGHT_BLUE_COLORS[0][2], + ATTConfig.BLOCK_LIGHT_BLUE_COLORS[0][3]); + blockLightBlueColor1 = new Color(ATTConfig.BLOCK_LIGHT_BLUE_COLORS[1][0], + ATTConfig.BLOCK_LIGHT_BLUE_COLORS[1][1], + ATTConfig.BLOCK_LIGHT_BLUE_COLORS[1][2], + ATTConfig.BLOCK_LIGHT_BLUE_COLORS[1][3]); + blockLightBlueColor2 = new Color(ATTConfig.BLOCK_LIGHT_BLUE_COLORS[2][0], + ATTConfig.BLOCK_LIGHT_BLUE_COLORS[2][1], + ATTConfig.BLOCK_LIGHT_BLUE_COLORS[2][2], + ATTConfig.BLOCK_LIGHT_BLUE_COLORS[2][3]); + blockWaveformColor = new Color(0.f, 0.f, 0.f, 0.5f); + } + + /** + * + * @param blockType + */ + public ATTBlock(int blockType) + { + visible = true; + lastClickedPoint = new ATTPointVector(); + lastClickedPoint.x = 0; + lastClickedPoint.y = 0; + focused = false; + this.blockType = blockType; + timeBegin = 0.; + length = 1.0; + aLive = true; + area = new ATTAreaVector(); + area.top = 0; + area.left = 0; + area.width = 0; + area.height = 0; + viewWidthCoeff = 0.; + rowViewPosition = 0.0; + wavEnergyTable = new ArrayList<Integer>(); + waveFile = ""; + function = new Hashtable<String,Object>(); + } + + /** + * + * @param value + */ + public void setPosition(double value) + { + if ((value >= 0.0) && (value <= 600. - length)) + { + timeBegin = value; + } + } + + /** + * + * @return + */ + public double getPosition() + { + return timeBegin; + } + + /** + * + * @param value + */ + public void setLength(double value) + { + if (value < 0.3) + { + value = 0.3; + } + length = value; + function.put("duration", (Double)value); + } + + /** + * + * @return + */ + public double getLength() + { + return length; + } + + /** + * + * @param fp + */ + public void setFunctionParams(Hashtable<String,Object> fp) + { + function.clear(); + + Iterator<String> it = fp.keySet().iterator(); + while (it.hasNext()) + { + String key = it.next(); + function.put(key, fp.get(key)); + } + + if (function.containsKey("duration")) + { + setLength((Double)function.get("duration")); + } + else + { + setLength(0.); + } + } + + /** + * + * @return + */ + public Hashtable<String,Object> getFunctionParams() + { + return function; + } + + /** + * + * @return + */ + public boolean isAssigned() + { + if (function.size() > 0) + { + return true; + } + else + { + return false; + } + } + + /** + * + * @return + */ + public boolean haveDuration() + { + if (function.containsKey("duration")) + { + if ((Double)function.get("duration") > 0.) + { + return true; + } + } + return false; + } + + /** + * + * @return + */ + public String getWavPath() + { + return waveFile; + } + + /** + * + */ + public void closeWaveFile() + { + wavEnergyTable.clear(); + setLength(0.); + } + + /* + * + */ + private int logVal(double val) + { + if (val < 0) + { + val = Math.abs(val); + } + + if (val < 1.) + { + val = 1.; + } + + return -(int)(((double)(Math.log(val) / Math.log(127.))) * 127.); + } + + /* + * + */ + private static byte[] byteArrayFromWaveFile(String path) throws IOException + { + byte[] result; + File f = new File(path); + int waveLength = (int)f.length(); + int bIdx = 0; + int bRead = 1; + InputStream waveIS = new FileInputStream(f); + + result = new byte[waveLength]; + + while (bRead != 0) + { + bRead = waveIS.read(result, bIdx, result.length - bIdx); + + if (bRead != 0) + { + bIdx += bRead; + } + + if (bIdx >= waveLength) + { + break; + } + } + + waveIS.close(); + return result; + } + + /** + * + * @param path + * @return + */ + public boolean loadWaveFile(String path) + { + byte[] waveFormByteArray = null; + int[] waveFormIntArray = null; + int i, j; + double accu; + + try + { + waveFormByteArray = byteArrayFromWaveFile(path); + } + catch (IOException e) + { + return false; + } + + waveFormIntArray = new int[waveFormByteArray.length - 44]; + j = 0; + + for (i = 44; i < waveFormByteArray.length; i++) + { + waveFormIntArray[j] = 128 - Math.abs(waveFormByteArray[i]); + j++; + } + + wavEnergyTable.clear(); + + for (i = 0; i < (waveFormIntArray.length / 10); i++) + { + accu = 0.; + for (j = 0; j < 10; j++) + { + accu += waveFormIntArray[i * 10 + j]; + } + accu /= 10.; + wavEnergyTable.add(logVal(accu)); + } + + setLength((double)(wavEnergyTable.size() / 800.)); + + return true; + } + + /** + * + * @param value + */ + public void setFocused(boolean value) + { + focused = value; + } + + /** + * + * @return + */ + public boolean getFocused() + { + return focused; + } + + /** + * + * @param g + */ + public void draw(Graphics g) + { + Color color0 = blockBlueColor0; + Color color1 = blockBlueColor1; + Color color2 = blockBlueColor2; + + if (!aLive) + { + return; + } + if (!visible) + { + return; + } + + if (area.width == 0) + { + return; + } + else if (focused) + { + color0 = blockRedColor0; + color1 = blockRedColor1; + color2 = blockRedColor2; + } + else + { + if (blockType == ATTConfig.BLOCK_TYPE_WAV) + { + color0 = blockLightBlueColor0; + color1 = blockLightBlueColor1; + color2 = blockLightBlueColor2; + } + else if (blockType == ATTConfig.BLOCK_TYPE_TTS) + { + color0 = blockLightBlueColor0; + color1 = blockLightBlueColor1; + color2 = blockLightBlueColor2; + } + else if (blockType == ATTConfig.BLOCK_TYPE_EYESMOUTH) + { + if (function.containsKey("cmd")) + { + String cmd = (String)function.get("cmd"); + + if (cmd.contains("mouth")) + { + color0 = blockOrangeColor0; + color1 = blockOrangeColor1; + color2 = blockOrangeColor2; + } + } + } + } + + g.setColor(color0); + g.fillRect(area.left + 1, + area.top + 1, + area.width - 1, + 6); + g.setColor(color1); + g.fillRect(area.left + 1, + area.top + 7, + area.width - 1, + 2); + g.setColor(color2); + g.fillRect(area.left + 1, + area.top + 9, + area.width - 1, + 18); + g.setColor(Color.BLACK); + g.drawRect(area.left, + area.top, + area.width, + area.height); + + /* Draw waveform if exists */ + if (wavEnergyTable.size() == 0) + { + return; + } + + double pixWavValCoeff = (double)(area.height - 2) / 256.; + double relBlockBeginPos = rowViewPosition - getPosition(); + + if (relBlockBeginPos < 0.) + { + relBlockBeginPos = 0.; + } + + Polygon p = new Polygon(); + + int yRel = area.top + (area.height / 2); + int xRel = area.left + 1; + double idxTime; + int eIdx; + int val; + int x, y; + int idx; + + p.addPoint(xRel, yRel); + + for (int i = 0; i < area.width; i++) + { + idxTime = relBlockBeginPos + (i * viewWidthCoeff); + eIdx = (int)(idxTime * 800); + if (eIdx < wavEnergyTable.size()) + { + val = (int)(Math.abs(wavEnergyTable.get(eIdx)) * pixWavValCoeff); + x = i + xRel; + y = yRel - val; + p.addPoint(x, y); + } + } + + for (int i = 0; i < area.width; i++) + { + idx = area.width - 1 - i; + idxTime = relBlockBeginPos + (idx * viewWidthCoeff); + eIdx = (int)(idxTime * 800); + if (eIdx < wavEnergyTable.size()) + { + val = (int)(-Math.abs(wavEnergyTable.get(eIdx)) * pixWavValCoeff); + x = idx + xRel; + y = yRel - val; + p.addPoint(x, y); + } + } + + g.setColor(blockWaveformColor); + g.fillPolygon(p); + g.setColor(Color.BLACK); + g.drawPolygon(p); + } + + /** + * + * @param rowViewCell + * @param viewTimePosition + * @param viewTimeLength + * @param cursorPosition + */ + public void updateCoord(ATTAreaVector rowViewCell, double viewTimePosition, + double viewTimeLength, double cursorPosition) + { + int border = rowViewCell.height / 8; + area.top = rowViewCell.top + border - 1; + area.height = rowViewCell.height - (border * 2) + 2; + viewWidthCoeff = viewTimeLength / (double)rowViewCell.width; + rowViewPosition = viewTimePosition; + double tB = viewTimePosition; + double tE = viewTimePosition + viewTimeLength; + + if (timeBegin > tE) + { + visible = false; + area.width = 0; + return; + } + + if ((timeBegin + length) < tB) + { + visible = false; + area.width = 0; + return; + } + + double mtB; + double mtE; + + if (timeBegin < tB) + { + mtB = tB; + } + else + { + mtB = timeBegin; + } + + if ((timeBegin + length) > tE) + { + mtE = tE; + } + else + { + mtE = timeBegin + length; + } + + area.left = (int)((mtB / viewWidthCoeff) - (viewTimePosition / viewWidthCoeff) + rowViewCell.left); + area.width = (int)Math.floor((mtE - mtB) / viewWidthCoeff); + visible = true; + } + + /** + * + * @param x + * @param y + * @param cursorPosition + * @return + */ + public boolean pointInBlock(int x, int y, double cursorPosition) + { + int xb; + int mx; + boolean ret = false; + + if ((x > area.left) && (x < (area.left + area.width))) + { + if ((y > area.top) && (y < (area.top + area.height))) + { + ret = true; + xb = (int)(timeBegin / viewWidthCoeff); + mx = (int)(cursorPosition / viewWidthCoeff); + lastClickedPoint.x = mx - xb; + lastClickedPoint.y = y - area.top; + } + } + + return ret; + } +} Added: software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/block/ATTBlockContainer.java =================================================================== --- software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/block/ATTBlockContainer.java (rev 0) +++ software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/block/ATTBlockContainer.java 2008-07-29 08:07:47 UTC (rev 1411) @@ -0,0 +1,267 @@ +package com.tuxisalive.attitunes.block; + +import java.awt.Color; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.Toolkit; +import java.util.ArrayList; +import java.util.List; + +import com.tuxisalive.attitunes.ATTConfig; +import com.tuxisalive.attitunes.vector.ATTAreaVector; +import com.tuxisalive.attitunes.vector.ATTTlvVector; + +/** + * + * @author R Jocaille + * + */ +public class ATTBlockContainer +{ + public List<ATTBlock> blocks; + public int blockType; + private ATTAreaVector area; + static private Color focusColor; + private boolean focused; + private String label; + private Image icon; + static private Font labelFont; + + static { + focusColor = new Color(1.f, 0.f, 0.f, 0.13f); + labelFont = new Font("SansSerif", Font.PLAIN, 10); + } + + /** + * + * @param blockType + * @param minEcart + * @param backgroundColor + */ + public ATTBlockContainer(int blockType) + { + blocks = new ArrayList<ATTBlock>(); + area = new ATTAreaVector(); + area.top = 0; + area.left = 0; + area.width = 0; + area.height = 0; + focused = false; + label = "Undefined"; + this.blockType = blockType; + icon = null; + } + + /** + * + * @return + */ + public List<List<Object>> getBlockList() + { + List<List<Object>> result = new ArrayList<List<Object>>(); + ATTBlock block; + + for (int i = 0; i < blocks.size(); i++) + { + block = blocks.get(i); + if (block.aLive) + { + List<Object> blockInfo = new ArrayList<Object>(); + blockInfo.add(block.getPosition()); + blockInfo.add(block.getFunctionParams()); + blockInfo.add(block); + result.add(blockInfo); + } + } + + return result; + } + + /** + * + * @param text + * @param iconPath + */ + public void setLabel(String text, String iconPath) + { + label = text; + icon = Toolkit.getDefaultToolkit().getImage(getClass().getResource(iconPath)); + } + + /** + * + * @param value + */ + public void setFocused(boolean value) + { + focused = value; + } + + /** + * + * @return + */ + public boolean getFocused() + { + return focused; + } + + /** + * + * @param g + */ + public void draw(Graphics g) + { + int x = area.left - 97; + int y = area.top; + int w, h; + + /* Draw lines */ + g.setColor(Color.BLACK); + g.drawLine(x, y, area.width + 99, y); + y += area.height; + g.drawLine(x, y, area.width + 99, y); + + /* Draw Label */ + x = area.left - 90; + y = area.top + 15; + g.setColor(Color.BLACK); + g.setFont(labelFont); + String[] labelS = label.split("\n"); + g.drawString(labelS[0], x, y); + + if (labelS.length > 1) + { + y = area.top + 25; + g.drawString(labelS[1], x, y); + } + + /* Draw focus */ + if (focused) + { + x = area.left - 97; + w = area.width + 98; + y = area.top + 1; + h = area.height - 1; + + g.setColor(focusColor); + g.fillRect(x, y, w, h); + } + + /* Draw icon */ + if(icon != null) + { + g.drawImage(icon, area.left - 34, area.top + 1, null); + } + } + + /** + * + * @param g + */ + public void drawAll(Graphics g) + { + ATTBlock block; + + this.draw(g); + + for (int i = 0; i < blocks.size(); i++) + { + block = blocks.get(i); + if (block.aLive) + { + block.draw(g); + } + } + } + + /** + * + * @param mainView + * @param cursorPosition + */ + public void updateCoord(ATTTlvVector mainView, double cursorPosition) + { + ATTBlock block; + double flAreaHeight; + int tmpVal; + + flAreaHeight = (double)mainView.height / ATTConfig.BLOCK_COUNT_TYPE; + area.top = (int)(flAreaHeight * blockType) + mainView.top; + tmpVal = (int)(flAreaHeight * (blockType + 1)) + mainView.top; + area.height = tmpVal - area.top; + area.width = mainView.width; + area.left = mainView.left; + + for (int i = 0; i < blocks.size(); i++) + { + block = blocks.get(i); + if (block.aLive) + { + block.updateCoord(area, mainView.timePosition, mainView.timeLength, cursorPosition); + } + } + } + + /** + * + * @return + */ + public ATTBlock newBlock() + { + ATTBlock result = new ATTBlock(blockType); + blocks.add(result); + + return result; + } + + /** + * + * @param blockId + * @return + */ + public boolean deleteBlock(int blockId) + { + if (blockId < blocks.size()) + { + blocks.get(blockId).aLive = false; + return true; + } + return false; + } + + /** + * + */ + public void clearBlocks() + { + blocks.clear(); + } + + /** + * + * @param x + * @param y + * @return + */ + public boolean pointInRow(int x, int y) + { + boolean ret = false; + int xb; + int xe; + + xb = area.left - 100; + xe = xb + area.width + 100; + + if ((x >= xb) && (x <= xe)) + { + if ((y >= area.top) && (y <= (area.top + area.height))) + { + ret = true; + } + } + + return ret; + } +} Added: 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 (rev 0) +++ software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/format/ATTBlockParams.java 2008-07-29 08:07:47 UTC (rev 1411) @@ -0,0 +1,176 @@ +package com.tuxisalive.attitunes.format; + +import java.util.Hashtable; + +public class ATTBlockParams +{ + /* + * Led commands + */ + 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); + } + public static Hashtable<String,Object> LEDS_ON_CANVAS = new Hashtable<String,Object>(); + static { + LEDS_ON_CANVAS.put("cmd", "leds_on"); + LEDS_ON_CANVAS.put("duration", 0.0); + } + public static Hashtable<String,Object> LEDL_ON_CANVAS = new Hashtable<String,Object>(); + static { + LEDL_ON_CANVAS.put("cmd", "ledl_on"); + LEDL_ON_CANVAS.put("duration", 0.0); + } + public static Hashtable<String,Object> LEDR_ON_CANVAS = new Hashtable<String,Object>(); + static { + LEDR_ON_CANVAS.put("cmd", "ledr_on"); + LEDR_ON_CANVAS.put("duration", 0.0); + } + public static Hashtable<String,Object> LEDS_OFF_CANVAS = new Hashtable<String,Object>(); + static { + LEDS_OFF_CANVAS.put("cmd", "leds_off"); + LEDS_OFF_CANVAS.put("duration", 0.0); + } + public static Hashtable<String,Object> LEDL_OFF_CANVAS = new Hashtable<String,Object>(); + static { + LEDL_OFF_CANVAS.put("cmd", "ledl_off"); + LEDL_OFF_CANVAS.put("duration", 0.0); + } + public static Hashtable<String,Object> LEDR_OFF_CANVAS = new Hashtable<String,Object>(); + static { + LEDR_OFF_CANVAS.put("cmd", "ledr_off"); + LEDR_OFF_CANVAS.put("duration", 0.0); + } + public static String[] LEDS_CMD_TYPES = { + "leds_blink", + "leds_on", + "ledl_on", + "ledr_on", + "leds_off", + "ledl_off", + "ledr_off" + }; + /* + * Mouth and eyes commands + */ + public static Hashtable<String,Object> MOUTH_ON_CANVAS = new Hashtable<String,Object>(); + static { + MOUTH_ON_CANVAS.put("cmd", "mouth_on"); + MOUTH_ON_CANVAS.put("duration", 0.0); + MOUTH_ON_CANVAS.put("count", 2); + } + public static Hashtable<String,Object> MOUTH_OPEN_CANVAS = new Hashtable<String,Object>(); + static { + MOUTH_OPEN_CANVAS.put("cmd", "mouth_open"); + MOUTH_OPEN_CANVAS.put("duration", 0.0); + } + public static Hashtable<String,Object> MOUTH_CLOSE_CANVAS = new Hashtable<String,Object>(); + static { + MOUTH_CLOSE_CANVAS.put("cmd", "mouth_close"); + MOUTH_CLOSE_CANVAS.put("duration", 0.0); + } + public static Hashtable<String,Object> EYES_ON_CANVAS = new Hashtable<String,Object>(); + static { + EYES_ON_CANVAS.put("cmd", "eyes_on"); + EYES_ON_CANVAS.put("duration", 0.0); + EYES_ON_CANVAS.put("count", 2); + } + public static Hashtable<String,Object> EYES_OPEN_CAN... [truncated message content] |
From: remi <c2m...@c2...> - 2008-07-29 08:01:00
|
Author: remi Date: 2008-07-29 10:01:09 +0200 (Tue, 29 Jul 2008) New Revision: 1410 Added: software_suite_v2/software/chatterTuxServer/ software_suite_v2/software/chatterTuxServer/branches/ software_suite_v2/software/chatterTuxServer/tags/ software_suite_v2/software/chatterTuxServer/trunk/ software_suite_v2/software/chatterTuxServer/trunk/chattertux_start.bat software_suite_v2/software/chatterTuxServer/trunk/chattertux_stop.bat software_suite_v2/software/chatterTuxServer/trunk/chattertuxsender.bat software_suite_v2/software/chatterTuxServer/trunk/chattertuxsenderx.bat software_suite_v2/software/chatterTuxServer/trunk/chtuxstart.ico software_suite_v2/software/chatterTuxServer/trunk/chtuxstop.ico software_suite_v2/software/chatterTuxServer/trunk/files/ software_suite_v2/software/chatterTuxServer/trunk/files/ChatterTux.ini software_suite_v2/software/chatterTuxServer/trunk/files/ChatterTux.py software_suite_v2/software/chatterTuxServer/trunk/files/ChatterTuxHTTPServer.py software_suite_v2/software/chatterTuxServer/trunk/files/ChatterTuxSender.py software_suite_v2/software/chatterTuxServer/trunk/files/ConfIni.py software_suite_v2/software/chatterTuxServer/trunk/installer.nsi Log: * added "chatterTuxServer" project Added: software_suite_v2/software/chatterTuxServer/trunk/chattertux_start.bat =================================================================== --- software_suite_v2/software/chatterTuxServer/trunk/chattertux_start.bat (rev 0) +++ software_suite_v2/software/chatterTuxServer/trunk/chattertux_start.bat 2008-07-29 08:01:09 UTC (rev 1410) @@ -0,0 +1 @@ +c:/tuxdroid/bin/python/python.exe c:/tuxdroid/bin/chattertux/ChatterTux.py \ No newline at end of file Added: software_suite_v2/software/chatterTuxServer/trunk/chattertux_stop.bat =================================================================== --- software_suite_v2/software/chatterTuxServer/trunk/chattertux_stop.bat (rev 0) +++ software_suite_v2/software/chatterTuxServer/trunk/chattertux_stop.bat 2008-07-29 08:01:09 UTC (rev 1410) @@ -0,0 +1 @@ +c:/tuxdroid/bin/chattertuxsender CMD:SERVER:CLOSE \ No newline at end of file Added: software_suite_v2/software/chatterTuxServer/trunk/chattertuxsender.bat =================================================================== --- software_suite_v2/software/chatterTuxServer/trunk/chattertuxsender.bat (rev 0) +++ software_suite_v2/software/chatterTuxServer/trunk/chattertuxsender.bat 2008-07-29 08:01:09 UTC (rev 1410) @@ -0,0 +1 @@ +c:/tuxdroid/bin/python/python.exe c:/tuxdroid/bin/chattertux/ChatterTuxSender.py 127.0.0.1 271 %1 \ No newline at end of file Added: software_suite_v2/software/chatterTuxServer/trunk/chattertuxsenderx.bat =================================================================== --- software_suite_v2/software/chatterTuxServer/trunk/chattertuxsenderx.bat (rev 0) +++ software_suite_v2/software/chatterTuxServer/trunk/chattertuxsenderx.bat 2008-07-29 08:01:09 UTC (rev 1410) @@ -0,0 +1 @@ +c:/tuxdroid/bin/python/python.exe c:/tuxdroid/bin/chattertux/ChatterTuxSender.py %1 %2 %3 \ No newline at end of file Added: software_suite_v2/software/chatterTuxServer/trunk/chtuxstart.ico =================================================================== (Binary files differ) Property changes on: software_suite_v2/software/chatterTuxServer/trunk/chtuxstart.ico ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: software_suite_v2/software/chatterTuxServer/trunk/chtuxstop.ico =================================================================== (Binary files differ) Property changes on: software_suite_v2/software/chatterTuxServer/trunk/chtuxstop.ico ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: software_suite_v2/software/chatterTuxServer/trunk/files/ChatterTux.ini =================================================================== --- software_suite_v2/software/chatterTuxServer/trunk/files/ChatterTux.ini (rev 0) +++ software_suite_v2/software/chatterTuxServer/trunk/files/ChatterTux.ini 2008-07-29 08:01:09 UTC (rev 1410) @@ -0,0 +1,59 @@ +[VOICE CONFIGURATION] +locutor = Bruno +pitch = 130 + +[:)] +action = tts +cmd = Je suis content ! + +[:(] +action = tts +cmd = Merde ! + +[oeil] +action = api +cmd = tux.eyes.onAsync(2, SSV_NDEF) + +[bouche] +action = api +cmd = tux.mouth.onAsync(2, SSV_NDEF) + +[ailes] +action = api +cmd = tux.flippers.onAsync(2, SSV_NDEF) + +[tux] +action = tts +cmd = Teucksss ! C'est moi ! + +[lol] +action = tts +cmd = Ha ha ha + +[mdr] +action = tts +cmd = Mort de rire ! + +[non] +action = tts +cmd = Non non ! + +[salut] +action = tts +cmd = Salut mec ! + +[bye] +action = tts +cmd = Bye ! + +[R] +action = tts +cmd = Je vais le dire a R ! + +[je] +action = api +cmd = tux.eyes.onAsync(2, SSV_NDEF) + +[le] +action = api +cmd = tux.mouth.onAsync(2, SSV_NDEF) \ No newline at end of file Added: software_suite_v2/software/chatterTuxServer/trunk/files/ChatterTux.py =================================================================== --- software_suite_v2/software/chatterTuxServer/trunk/files/ChatterTux.py (rev 0) +++ software_suite_v2/software/chatterTuxServer/trunk/files/ChatterTux.py 2008-07-29 08:01:09 UTC (rev 1410) @@ -0,0 +1,79 @@ +import time +import sys +import signal +import os +import threading + +from tuxisalive.api import * +from ChatterTuxHTTPServer import ChatterTuxHTTPServer, handler +from tuxisalive.lib.wordlogger import WordLogger +from ConfIni import readConf + +APPLICATION_PATH = os.path.realpath(os.path.dirname(sys.argv[0])) +myConf = readConf(os.path.join(APPLICATION_PATH, "ChatterTux.ini")) + +tux = TuxAPI('127.0.0.1', 270) +tux.server.autoConnect(CLIENT_LEVEL_RESTRICTED, 'ChatterTux', 'nopasswd') + +if myConf.has_key("VOICE CONFIGURATION"): + tux.tts.setLocutor(myConf["VOICE CONFIGURATION"]["locutor"]) + tux.tts.setPitch(eval(myConf["VOICE CONFIGURATION"]["pitch"])) + +def onCmdServerClose(*args): + twl.stop() + tux.destroy() + s.stop() + +def playAttitune(path): + if tux.access.acquire(): + if tux.attitune.load(path): + tux.attitune.play() + tux.access.release() + +def _onEventWord(word): + try: + tux.attitune.stop() + tux.tts.stop() + tux.wav.stop() + action = myConf[word] + if action["action"] == "tts": + if tux.access.acquire(): + tux.tts.speakAsync(action["cmd"]) + tux.access.release() + elif action["action"] == "attitune": + playAttitune(action["cmd"]) + elif action["action"] == "api": + if action["cmd"].find("tux.") == 0: + try: + if tux.access.acquire(): + exec(action["cmd"]) in globals() + tux.access.release() + except: + pass + elif action["action"] == "wav": + if tux.access.acquire(): + tux.wav.play(action["cmd"]) + tux.access.release() + except: + pass + +def onEventWord(p1, p2, word): + word = word.upper() + print word + if myConf.has_key(word): + t = threading.Thread(target = _onEventWord, args = (word,)) + t.start() + +def onEventWord2(word): + onEventWord("", "", word) + +if __name__ == "__main__": + handler.register(onEventWord, ("EVENT", "WORD", None)) + handler.register(onCmdServerClose, ("CMD", "SERVER", "CLOSE")) + s = ChatterTuxHTTPServer() + t = threading.Thread(target = s.start) + t.start() + + twl = WordLogger() + twl.handler.register(onEventWord2) + twl.start() Added: software_suite_v2/software/chatterTuxServer/trunk/files/ChatterTuxHTTPServer.py =================================================================== --- software_suite_v2/software/chatterTuxServer/trunk/files/ChatterTuxHTTPServer.py (rev 0) +++ software_suite_v2/software/chatterTuxServer/trunk/files/ChatterTuxHTTPServer.py 2008-07-29 08:01:09 UTC (rev 1410) @@ -0,0 +1,173 @@ +# -*- coding: latin1 -*- + + +# Copyright (C) 2008 C2ME Sa +# R Jocaille <rem...@c2...> +# Distributed under the terms of the GNU General Public License +# http://www.gnu.org/copyleft/gpl.html + +from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer +from SocketServer import ThreadingMixIn +import threading +import re +import urllib +import sys +import httplib +import time + +from tuxisalive.lib.logger import * +from tuxisalive.api.TuxEventHandler import TuxEventHandler + +handler = TuxEventHandler() + +class ChatterTuxHTTPServer(object): + """ + """ + + def __init__(self, port = 271): + """ + """ + self.__logger = SimpleLogger("ChatterTuxServer") + self.__logger.resetLog() + self.__logger.setLevel(LOG_LEVEL_DEBUG) + self.__logger.setTarget(LOG_TARGET_BOTH) + self.__port = port + self.__started = False + self.__startedMutex = threading.Lock() + self.__server = None + self.__quit = False + self.__createServer() + + def __createServer(self): + """ + """ + if self.__server != None: + return False + + self.__killOldServer() + + try: + self.__server = HTTPServer(('', self.__port), TDHttpRequestHandler) + self.__logger.logInfo("Create a server on port %d" % self.__port) + except: + self.__server = None + return False + + return True + + def __killOldServer(self): + """ + """ + h = httplib.HTTP("127.0.0.1:%s", self.__port) + try: + h.connect() + except: + return + h.putrequest("GET", "CMD:SERVER:CLOSE") + h.endheaders() + try: + errcode, errmsg, headers = h.getreply() + time.sleep(1.0) + except: + pass + + def start(self): + """ + """ + if self.__getStarted(): + return False + + if self.__server == None: + return False + + try: + self.__setStarted(True) + self.__logger.logInfo("Server started.") + self.__serve_forever() + except: + pass + + self.__logger.logInfo("Server stopped.") + return True + + def __serve_forever(self): + self.__quit = False + while not self.__quit: + self.__server.handle_request() + self.__server.server_close() + + def stop(self): + """ + """ + self.__quit = True + + def __setStarted(self, value = True): + """ + """ + self.__startedMutex.acquire() + self.__started = value + self.__startedMutex.release() + + def __getStarted(self): + """ + """ + value = False + self.__startedMutex.acquire() + value = self.__started + self.__startedMutex.release() + return value + +class TDHttpRequestHandler(BaseHTTPRequestHandler): + """ + """ + + def do_GET(self): + """ + """ + try: + self.path = urllib.unquote_plus(self.path) + + p = self.path.split(":") + if len(p) == 3: + handler.emit(*tuple(p)) + elif len(p) > 3: + np = [] + lastArg = "" + for i, a in enumerate(p): + if i >= 2: + if i == 2: + lastArg = a + else: + lastArg = "%s:%s" % (lastArg, a) + else: + np.append(a) + np.append(lastArg) + handler.emit(*tuple(np)) + + except: + self.send_response(404) + try: + self.send_response(200) + except: + print "Handle error" + + def handle_one_request(self): + """ + """ + try: + BaseHTTPRequestHandler.handle_one_request(self) + except: + print "handle_one_request error" + + def log_request(self, code='-', size='-'): + """ + """ + pass + +if __name__ == "__main__": + def onRequest(cmdType, cmd, value): + print cmdType, cmd, value + + handler.register(onRequest, ("EVENT", "WORD", None)) + s = ChatterTuxHTTPServer() + s.start() \ No newline at end of file Added: software_suite_v2/software/chatterTuxServer/trunk/files/ChatterTuxSender.py =================================================================== --- software_suite_v2/software/chatterTuxServer/trunk/files/ChatterTuxSender.py (rev 0) +++ software_suite_v2/software/chatterTuxServer/trunk/files/ChatterTuxSender.py 2008-07-29 08:01:09 UTC (rev 1410) @@ -0,0 +1,29 @@ +import httplib +import sys + +def sendRequest(host, port, request): + hp = "%s:%d" % (host, port) + h = httplib.HTTP(hp) + try: + h.connect() + except: + return 1 + h.putrequest("GET", request) + h.endheaders() + errcode, errmsg, headers = h.getreply() + if errcode != 200: + return 1 + else: + return 0 + +if __name__ == "__main__": + if len(sys.argv) != 4: + sys.exit(1) + host = sys.argv[1] + try: + port = eval(sys.argv[2]) + except: + sys.exit(1) + request = sys.argv[3] + ret = sendRequest(host, port, request) + sys.exit(ret) \ No newline at end of file Added: software_suite_v2/software/chatterTuxServer/trunk/files/ConfIni.py =================================================================== --- software_suite_v2/software/chatterTuxServer/trunk/files/ConfIni.py (rev 0) +++ software_suite_v2/software/chatterTuxServer/trunk/files/ConfIni.py 2008-07-29 08:01:09 UTC (rev 1410) @@ -0,0 +1,35 @@ +import sys +import re +import os + +SECTION = re.compile('^\s*\[\s*([^\]]*)\s*\]\s*$') +PARAM = re.compile('^\s*(\w+)\s*=\s*(.*)\s*$') +COMMENT = re.compile('^\s*;.*$') + +def readConf(iniPath): + """ + """ + result = {} + + if not os.path.isfile(iniPath): + return result + try: + f = open(iniPath) + except: + return result + d = {} + for line in f: + if COMMENT.match(line): continue + m = SECTION.match(line) + if m: + section, = m.groups() + d[section] = {} + m = PARAM.match(line) + if m: + key, val = m.groups() + d[section][key] = val + + for k, v in d.items(): + result[k.upper()] = v + + return result \ No newline at end of file Added: software_suite_v2/software/chatterTuxServer/trunk/installer.nsi =================================================================== --- software_suite_v2/software/chatterTuxServer/trunk/installer.nsi (rev 0) +++ software_suite_v2/software/chatterTuxServer/trunk/installer.nsi 2008-07-29 08:01:09 UTC (rev 1410) @@ -0,0 +1,99 @@ +; installer.nsi +; This installer which install the python 2.4 for tuxdroid use +; ----------------------------------------------------------------------------- + +; HM NIS Edit Wizard helper defines +!define PRODUCT_NAME "Chatter Tux" +!define PRODUCT_VERSION "0.0.1-ALPHA" + + +; The name of the installer +Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" + +; The file to write +OutFile "chatterTux_${PRODUCT_VERSION}.exe" + +; The default installation directory +InstallDir c:\tuxdroid\bin\chattertux + +; Request application privileges for Windows Vista +RequestExecutionLevel user + +; ----------------------------------------------------------------------------- +; Section "" +; ----------------------------------------------------------------------------- + +Section "" + ; Check that the tuxisalive package + ReadRegStr $0 HKLM SOFTWARE\Tuxdroid\pyTuxisalive "Install_Dir" + StrCmp $0 "" endNoInstall + + ; Write the file in c:\tuxdroid\bin\python + SetOutPath $INSTDIR + SetOverwrite ifnewer + File /r files\* + + SetOutPath "c:\tuxdroid\bin" + SetOverwrite ifnewer + File "chattertux_start.bat" + File "chattertux_stop.bat" + File "chattertuxsender.bat" + File "chattertuxsenderx.bat" + + SetOutPath "c:\tuxdroid\ico" + SetOverwrite ifnewer + File "chtuxstart.ico" + File "chtuxstop.ico" + + ; Write shortcut in start menu + CreateDirectory "$SMPROGRAMS\Tuxdroid" + CreateDirectory "$SMPROGRAMS\Tuxdroid\ChatterTux" + CreateShortCut "$SMPROGRAMS\Tuxdroid\ChatterTux\Start.lnk" "c:\tuxdroid\bin\chattertux_start.bat" "" "c:\tuxdroid\ico\chtuxstart.ico" 0 + CreateShortCut "$SMPROGRAMS\Tuxdroid\ChatterTux\Stop.lnk" "c:\tuxdroid\bin\chattertux_stop.bat" "" "c:\tuxdroid\ico\chtuxstop.ico" 0 + + ; Write the installation path into the registry + WriteRegStr HKLM SOFTWARE\Tuxdroid\chatterTux "Install_Dir" "$INSTDIR" + + ; Write the uninstall keys for Windows + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\chatterTux" "DisplayName" "${PRODUCT_NAME} ${PRODUCT_VERSION}" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\chatterTux" "UninstallString" "$INSTDIR\uninstall.exe" + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\chatterTux" "NoModify" 1 + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\chatterTux" "NoRepair" 1 + + ; Write the uninstall file + WriteUninstaller "uninstall.exe" + Quit + + endNoInstall: + MessageBox MB_OK "Aborded : Tuxisalive python package not found." + Quit +SectionEnd + +; ----------------------------------------------------------------------------- +; Section "Uninstall" +; ----------------------------------------------------------------------------- + +Section "Uninstall" + ExecWait "c:\tuxdroid\bin\chattertux_stop.bat" + + ; Remove registry keys + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\chatterTux" + DeleteRegKey HKLM SOFTWARE\Tuxdroid\chatterTux + + ; Remove files and uninstaller + RMDir /r $INSTDIR + Delete $INSTDIR\uninstall.exe + Delete "c:\tuxdroid\bin\chattertux_start.bat" + Delete "c:\tuxdroid\bin\chattertux_stop.bat" + Delete "c:\tuxdroid\bin\chattertuxsender.bat" + Delete "c:\tuxdroid\bin\chattertuxsenderx.bat" + Delete "c:\tuxdroid\ico\chtuxstart.ico" + Delete "c:\tuxdroid\ico\chtuxstop.ico" + + ; Remove shortcuts + Delete "$SMPROGRAMS\Tuxdroid\ChatterTux\*.*" + RMDir "$SMPROGRAMS\Tuxdroid\ChatterTux" + + ; Quit the uninstaller + Quit +SectionEnd |