Author: remi
Date: 2008-08-16 19:56:54 +0200 (Sat, 16 Aug 2008)
New Revision: 1524
Modified:
software_suite_v2/software/tools/attitunesStudio/trunk/src/GUI/AttituneWaveListFrame.java
software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.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/messages.properties
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/messages_fr.properties
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/visual/ATTBlockViewer.java
Log:
* passed attitunes studio to BETA version. Need polishing and testing
Modified:
software_suite_v2/software/tools/attitunesStudio/trunk/src/GUI/AttituneWaveListFrame.java
===================================================================
---
software_suite_v2/software/tools/attitunesStudio/trunk/src/GUI/AttituneWaveListFrame.java
2008-08-16 17:46:17 UTC (rev 1523)
+++
software_suite_v2/software/tools/attitunesStudio/trunk/src/GUI/AttituneWaveListFrame.java
2008-08-16 17:56:54 UTC (rev 1524)
@@ -4,6 +4,8 @@
import javax.swing.border.BevelBorder;
import javax.sound.sampled.*;
+import com.tuxisalive.attitunes.block.ATTBlock;
+import com.tuxisalive.attitunes.ATTConfig;
import com.tuxisalive.attitunes.ATTMessages;
import com.tuxisalive.attitunes.visual.ATTBlockViewer;
import java.awt.GridBagConstraints;
@@ -13,6 +15,9 @@
import java.awt.event.MouseEvent;
import java.io.*;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
/**
@@ -45,6 +50,8 @@
private JButton jButtonClose;
private JPanel jPanelBottom;
private JPanel jPanelMain;
+
+ private JFileChooser fileChooser;
{
//Set Look & Feel
@@ -68,6 +75,8 @@
this.setResizable(false);
/* Init the frame */
initGUI();
+ /* Fill the wave list */
+ fillWaveList();
}
private void initGUI() {
@@ -159,6 +168,7 @@
}
{
jButtonReplace = new
JButton();
+
jButtonReplace.setVisible(false);
jPanelActions.add(jButtonReplace, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0,
GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0,
0), 0, 0));
jButtonReplace.setText(ATTMessages.getString("AttituneWaveListFrame.8"));
jButtonReplace.addMouseListener(new MouseAdapter() {
@@ -169,6 +179,11 @@
}
}
}
+
+ /* Create the file chooser */
+ fileChooser = new JFileChooser();
+ fileChooser.addChoosableFileFilter(new
AttituneWavFilter());
+
this.setSize(413, 250);
}
} catch(Exception e) {
@@ -177,6 +192,21 @@
}
/*
+ * Fill the wave list
+ */
+ private void fillWaveList()
+ {
+ Hashtable<String,Object> wavsStruct =
blockViewer.attituneFile.getWavsStruct();
+ List<String> wavsList = new ArrayList<String>();
+ for (int i = 0; i < (Integer)wavsStruct.get("count"); i++)
+ {
+
wavsList.add((String)wavsStruct.get(String.format("wav%d", i)));
+ }
+ ListModel jListWaveModel = new
DefaultComboBoxModel(wavsList.toArray());
+ jListWave.setModel(jListWaveModel);
+ }
+
+ /*
* Check the format of a wave file
*/
private boolean checkWavFormat(String waveFile)
@@ -235,7 +265,32 @@
*/
private void jButtonAddMousePressed(MouseEvent evt)
{
- System.out.println("jButtonAdd.mousePressed, event="+evt);
+ /* Load a file viewer to select a wav file */
+ if (fileChooser.showOpenDialog(this) !=
JFileChooser.APPROVE_OPTION)
+ {
+ return;
+ }
+ File selFile = fileChooser.getSelectedFile();
+ if (selFile == null)
+ {
+ return;
+ }
+
+ if (!checkWavFormat(selFile.getPath()))
+ {
+ JOptionPane.showMessageDialog(this,
+
ATTMessages.getString("AttituneWaveListFrame.6"),
+
ATTMessages.getString("AttituneWaveListFrame.1"),
+ JOptionPane.WARNING_MESSAGE);
+ return;
+ }
+
+ if (!blockViewer.insertWaveFile(selFile.getPath()))
+ {
+ return;
+ }
+
+ fillWaveList();
}
/*
@@ -243,7 +298,42 @@
*/
private void jButtonDeleteMousePressed(MouseEvent evt)
{
- System.out.println("jButtonDelete.mousePressed, event="+evt);
+ /* If the wave list is empty do quit */
+ if (jListWave.getModel().getSize() == 0)
+ {
+ return;
+ }
+
+ /* Averting for the block deleting */
+ int result = JOptionPane.showConfirmDialog(
+ this,
+
ATTMessages.getString("AttituneWaveListFrame.7"), //$NON-NLS-1$
+
ATTMessages.getString("AttituneWaveListFrame.1"), //$NON-NLS-1$
+ JOptionPane.YES_NO_OPTION,
+ JOptionPane.WARNING_MESSAGE);
+ if (result == JOptionPane.NO_OPTION)
+ {
+ return;
+ }
+
+ String waveName = (String)jListWave.getSelectedValue();
+
+ if (!blockViewer.deleteWaveFile(waveName))
+ {
+ return;
+ }
+
+ for (int i = 0; i <
blockViewer.blockContainers[ATTConfig.BLOCK_TYPE_WAV].blocks.size(); i++)
+ {
+ ATTBlock tmpBlock =
blockViewer.blockContainers[ATTConfig.BLOCK_TYPE_WAV].blocks.get(i);
+
+ if
(((String)tmpBlock.getFunctionParams().get("wav_name")).equals(waveName))
+ {
+ blockViewer.deleteBlock(tmpBlock);
+ }
+ }
+
+ fillWaveList();
}
/*
Modified:
software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java
===================================================================
--- software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java
2008-08-16 17:46:17 UTC (rev 1523)
+++ software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java
2008-08-16 17:56:54 UTC (rev 1524)
@@ -589,6 +589,12 @@
*/
public void onMenuItemWaveList(MenuItem menuItem)
{
+ ComboBoxModel cmdModel;
+
+ cmdModel = new DefaultComboBoxModel();
+ jComboBoxCmdName.setModel(cmdModel);
+ jComboBoxCmdName.setSelectedItem("");
+ showBlockConf("");
AttituneWaveListFrame pFrame = new
AttituneWaveListFrame(attBlockViewer);
pFrame.setLocationRelativeTo(null);
pFrame.setVisible(true);
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-08-16 17:46:17 UTC (rev 1523)
+++
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/format/ATTFormatReadWrite.java
2008-08-16 17:56:54 UTC (rev 1524)
@@ -241,6 +241,13 @@
return false;
}
+ /* Make sure that the wav directory exists */
+ File destWavs = new File(wavsPath);
+ if (!destWavs.isDirectory())
+ {
+ destWavs.mkdirs();
+ }
+
String waveName =
wavePath.substring(wavePath.lastIndexOf(File.separator) +
File.separator.length(),
wavePath.length());
String destWavePath = wavsPath + waveName;
Modified:
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/messages.properties
===================================================================
---
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/messages.properties
2008-08-16 17:46:17 UTC (rev 1523)
+++
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/messages.properties
2008-08-16 17:56:54 UTC (rev 1524)
@@ -17,7 +17,7 @@
MainFrame.93=Your attitune has been saved
MainFrame.95=You are sure that do you want deleting this block ?
MainFrame.96=Block deleting
-MainFrame.98=Attitunes studio is still under developpement
+MainFrame.98=Welcome to the BETA version of Attitunes Studio
MainFrame.99=Show / Hide the block properties
MainFrame.100=Command :
MainFrame.101=Test
@@ -75,6 +75,6 @@
AttituneWaveListFrame.3=Add
AttituneWaveListFrame.4=Delete
AttituneWaveListFrame.5=Close
-AttituneWaveListFrame.6=Only the PCM Mono 8K 8Bit wave files are supported
+AttituneWaveListFrame.6=Only the PCM Mono 8K 8Bit wave files are supported !
AttituneWaveListFrame.7=This operation will deleting the blocks which use this
wave file !\nContinue ?
AttituneWaveListFrame.8=Replace
Modified:
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/messages_fr.properties
===================================================================
---
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/messages_fr.properties
2008-08-16 17:46:17 UTC (rev 1523)
+++
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/messages_fr.properties
2008-08-16 17:56:54 UTC (rev 1524)
@@ -17,7 +17,7 @@
MainFrame.93=Votre attitune a bien �t� sauvegard�e
MainFrame.95=Vous �tes sur de vouloir supprimer ce bloc ?
MainFrame.96=Suppression de bloc
-MainFrame.98=Attitunes studio est encore en d�veloppement
+MainFrame.98=Bienvenue dans la version BETA de Attitunes Studio
MainFrame.99=Afficher / cacher les propri�t�s du bloc
MainFrame.100=Commande :
MainFrame.101=Tester
@@ -75,6 +75,6 @@
AttituneWaveListFrame.3=Ajouter
AttituneWaveListFrame.4=Supprimer
AttituneWaveListFrame.5=Fermer
-AttituneWaveListFrame.6=Seuls les fichiers son au format Wav PCM Mono 8K 8Bit
sont support�s
+AttituneWaveListFrame.6=Seuls les sons au format Wav PCM Mono 8K 8Bit sont
support�s !
AttituneWaveListFrame.7=Cette op�ration va supprimer tout les blocs utilisant
ce fichier son !\nVoulez-vous continuer ?
AttituneWaveListFrame.8=Remplacer
Modified:
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/visual/ATTBlockViewer.java
===================================================================
---
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/visual/ATTBlockViewer.java
2008-08-16 17:46:17 UTC (rev 1523)
+++
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/visual/ATTBlockViewer.java
2008-08-16 17:56:54 UTC (rev 1524)
@@ -56,7 +56,7 @@
private ATTBlockContainer blockContainer3;
private ATTBlockContainer blockContainer4;
private ATTBlockContainer blockContainer5;
- private ATTBlockContainer[] blockContainers;
+ public ATTBlockContainer[] blockContainers;
private SLock refreshMutex;
private double refreshDelay;
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn