Author: remi
Date: 2008-08-15 13:08:50 +0200 (Fri, 15 Aug 2008)
New Revision: 1496
Removed:
software_suite_v2/software/tools/attitunesStudio/trunk/images/background.png
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/cloudgarden/
Modified:
software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/ATTConfig.java
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/visual/ATTBlockViewer.java
Log:
* visual refactoring
Deleted:
software_suite_v2/software/tools/attitunesStudio/trunk/images/background.png
===================================================================
(Binary files differ)
Modified:
software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java
===================================================================
--- software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java
2008-08-15 09:23:22 UTC (rev 1495)
+++ software_suite_v2/software/tools/attitunesStudio/trunk/src/MainFrame.java
2008-08-15 11:08:50 UTC (rev 1496)
@@ -1,8 +1,6 @@
import GUI.*;
-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;
@@ -40,6 +38,7 @@
private ATTBlockViewer attBlockViewer;
+ private JPanel jPanelBlock;
private ATTSButton zoomPlusButton;
private ATTSButton zoomMinusButton;
private ATTSButton zoomFullButton;
@@ -99,15 +98,11 @@
/* Add a layout to the frame */
frameLayout = new GridBagLayout();
+ frameLayout.columnWidths = new int[] {7};
+ frameLayout.rowWeights = new double[] {0.1, 0.1, 0.1};
+ frameLayout.rowHeights = new int[] {7, 7, 7};
+ frameLayout.columnWeights = new double[] {0.1};
setLayout(frameLayout);
-
- /* Create the layout constraint */
- GridBagConstraints c = new GridBagConstraints();
- c.fill = GridBagConstraints.BOTH;
- c.weightx = 1.0;
- c.weighty = 1.0;
- c.gridwidth = GridBagConstraints.REMAINDER;;
- c.gridheight = 1;
/* Close window */
this.addWindowListener(new WindowAdapter() {
@@ -117,23 +112,11 @@
});
/* Main viewer */
- attBlockViewer = new ATTBlockViewer(640, 300);
- attBlockViewer.setPreferredSize(new
java.awt.Dimension(640, 300));
- AnchorLayout mainViewerLayout = new AnchorLayout();
- attBlockViewer.setLayout(mainViewerLayout);
- frameLayout.setConstraints(attBlockViewer, c);
- this.add(attBlockViewer);
-
- Button test = new Button("Hello"); //$NON-NLS-1$
- test.setPreferredSize(new java.awt.Dimension(640, 200));
- frameLayout.setConstraints(test, c);
- this.add(test);
-
- /* Status bar */
- statusBar = new AttituneStatusBar("Hello", "world",
"coucou"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- frameLayout.setConstraints(statusBar, c);
- this.add(statusBar);
-
+ attBlockViewer = new ATTBlockViewer(640, 262);
+ attBlockViewer.setPreferredSize(new
java.awt.Dimension(640, 262));
+ attBlockViewer.setMinimumSize(new
java.awt.Dimension(640, 262));
+ attBlockViewer.setMaximumSize(new
java.awt.Dimension(640, 262));
+ this.add(attBlockViewer, new GridBagConstraints(0, 0,
1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new
Insets(0, 0, 0, 0), 0, 0));
attBlockViewer.loadImages("/"); //$NON-NLS-1$
attBlockViewer.events.register(ATTConfig.EVENT_POSITION_CHANGED, this,
"onPositionChanged"); //$NON-NLS-1$
attBlockViewer.events.register(ATTConfig.EVENT_LENGTH_CHANGED, this,
"onLengthChanged"); //$NON-NLS-1$
@@ -149,39 +132,47 @@
attBlockViewer.events.register(ATTConfig.EVENT_ATTITUNE_LOADED, this,
"onAttituneLoaded"); //$NON-NLS-1$
attBlockViewer.events.register(ATTConfig.EVENT_ATTITUNE_SAVED, this,
"onAttituneSaved"); //$NON-NLS-1$
- /* Zoom plus button */
- zoomPlusButton = new ATTSButton("/zoomPlusButton.png");
//$NON-NLS-1$
- zoomPlusButton.setPressedIcon(new
ImageIcon(getClass().getResource("/zoomPressedButton.png"))); //$NON-NLS-1$
- zoomPlusButton.addMouseListener(new MouseAdapter() {
- public void mousePressed(MouseEvent evt)
- {
- onZoomPlusButtonPressed(evt);
- }
- });
- attBlockViewer.add(zoomPlusButton, new
AnchorConstraint(520, 270));
+ /* Main viewer commander */
+ jPanelBlock = new JPanel();
+ jPanelBlock.setSize(new java.awt.Dimension(640, 25));
+ jPanelBlock.setPreferredSize(new
java.awt.Dimension(640, 25));
+ jPanelBlock.setMinimumSize(new java.awt.Dimension(640,
25));
+ jPanelBlock.setMaximumSize(new java.awt.Dimension(640,
25));
+ jPanelBlock.setBackground(new Color(
+ ATTConfig.TLV_BACKGROUND_COLOR[0],
+ ATTConfig.TLV_BACKGROUND_COLOR[1],
+ ATTConfig.TLV_BACKGROUND_COLOR[2],
+ ATTConfig.TLV_BACKGROUND_COLOR[3]));
+ GridBagLayout jPanelBlockLayout = new GridBagLayout();
+ this.add(jPanelBlock, new GridBagConstraints(0, 1, 1,
1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0,
0, 0, 0), 0, 0));
+ jPanelBlockLayout.rowWeights = new double[] {0.1};
+ jPanelBlockLayout.rowHeights = new int[] {7};
+ jPanelBlockLayout.columnWeights = new double[] {0.1,
0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1};
+ jPanelBlockLayout.columnWidths = new int[] {7, 7, 7, 7,
7, 7, 7, 7, 7};
+ jPanelBlock.setLayout(jPanelBlockLayout);
- /* Zoom minus button */
- zoomMinusButton = new
ATTSButton("/zoomMinusButton.png"); //$NON-NLS-1$
- zoomMinusButton.setPressedIcon(new
ImageIcon(getClass().getResource("/zoomPressedButton.png"))); //$NON-NLS-1$
- zoomMinusButton.addMouseListener(new MouseAdapter() {
+ /* Play button */
+ playButton = new
ATTSButton(ATTMessages.getString("MainFrame.62"), Color.BLACK,
"/actionButton2Enable.png"); //$NON-NLS-1$ //$NON-NLS-2$
+ playButton.setPressedIcon(new
ImageIcon(getClass().getResource("/actionButton2Pressed.PNG"))); //$NON-NLS-1$
+ playButton.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent evt)
{
- onZoomMinusButtonPressed(evt);
+ onPlayButtonPressed(evt);
}
});
- attBlockViewer.add(zoomMinusButton, new
AnchorConstraint(550, 270));
-
- /* Zoom full button */
- zoomFullButton = new ATTSButton("/zoomFullButton.png");
//$NON-NLS-1$
- zoomFullButton.setPressedIcon(new
ImageIcon(getClass().getResource("/zoomPressedButton.png"))); //$NON-NLS-1$
- zoomFullButton.addMouseListener(new MouseAdapter() {
+ jPanelBlock.add(playButton, new GridBagConstraints(0,
0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new
Insets(0, 0, 0, 0), 0, 0));
+
+ /* Stop button */
+ stopButton = new
ATTSButton(ATTMessages.getString("MainFrame.65"), Color.BLACK,
"/actionButton2Enable.png"); //$NON-NLS-1$ //$NON-NLS-2$
+ stopButton.setPressedIcon(new
ImageIcon(getClass().getResource("/actionButton2Pressed.PNG"))); //$NON-NLS-1$
+ stopButton.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent evt)
{
- onZoomFullButtonPressed(evt);
+ onStopButtonPressed(evt);
}
});
- attBlockViewer.add(zoomFullButton, new
AnchorConstraint(580, 270));
-
+ jPanelBlock.add(stopButton, new GridBagConstraints(1,
0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new
Insets(0, 0, 0, 0), 0, 0));
+
/* Create button */
createButton = new
ATTSButton(ATTMessages.getString("MainFrame.50"), Color.WHITE,
"/actionButton1Enable.png"); //$NON-NLS-1$ //$NON-NLS-2$
createButton.setPressedIcon(new
ImageIcon(getClass().getResource("/actionButton1Pressed.png"))); //$NON-NLS-1$
@@ -191,8 +182,8 @@
onCreateButtonPressed(evt);
}
});
- attBlockViewer.add(createButton, new
AnchorConstraint(110, 271));
-
+ jPanelBlock.add(createButton, new GridBagConstraints(2,
0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new
Insets(0, 0, 0, 0), 0, 0));
+
/* Delete button */
deleteButton = new
ATTSButton(ATTMessages.getString("MainFrame.53"), Color.WHITE,
"/actionButton1Enable.png"); //$NON-NLS-1$ //$NON-NLS-2$
deleteButton.setPressedIcon(new
ImageIcon(getClass().getResource("/actionButton1Pressed.png"))); //$NON-NLS-1$
@@ -202,8 +193,8 @@
onDeleteButtonPressed(evt);
}
});
- attBlockViewer.add(deleteButton, new
AnchorConstraint(200, 271));
-
+ jPanelBlock.add(deleteButton, new GridBagConstraints(3,
0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new
Insets(0, 0, 0, 0), 0, 0));
+
/* Copy button */
copyButton = new
ATTSButton(ATTMessages.getString("MainFrame.56"), Color.WHITE,
"/actionButton1Enable.png"); //$NON-NLS-1$ //$NON-NLS-2$
copyButton.setPressedIcon(new
ImageIcon(getClass().getResource("/actionButton1Pressed.png"))); //$NON-NLS-1$
@@ -213,8 +204,8 @@
onCopyButtonPressed(evt);
}
});
- attBlockViewer.add(copyButton, new
AnchorConstraint(290, 271));
-
+ jPanelBlock.add(copyButton, new GridBagConstraints(4,
0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new
Insets(0, 0, 0, 0), 0, 0));
+
/* Past button */
pastButton = new
ATTSButton(ATTMessages.getString("MainFrame.59"), Color.WHITE,
"/actionButton1Enable.png"); //$NON-NLS-1$ //$NON-NLS-2$
pastButton.setPressedIcon(new
ImageIcon(getClass().getResource("/actionButton1Pressed.png"))); //$NON-NLS-1$
@@ -224,31 +215,50 @@
onPastButtonPressed(evt);
}
});
- attBlockViewer.add(pastButton, new
AnchorConstraint(380, 271));
-
- /* Play button */
- playButton = new
ATTSButton(ATTMessages.getString("MainFrame.62"), Color.BLACK,
"/actionButton2Enable.png"); //$NON-NLS-1$ //$NON-NLS-2$
- playButton.setPressedIcon(new
ImageIcon(getClass().getResource("/actionButton2Pressed.PNG"))); //$NON-NLS-1$
- playButton.addMouseListener(new MouseAdapter() {
+ jPanelBlock.add(pastButton, new GridBagConstraints(5,
0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new
Insets(0, 0, 0, 0), 0, 0));
+
+ /* Zoom plus button */
+ zoomPlusButton = new ATTSButton("/zoomPlusButton.png");
//$NON-NLS-1$
+ zoomPlusButton.setPressedIcon(new
ImageIcon(getClass().getResource("/zoomPressedButton.png"))); //$NON-NLS-1$
+ zoomPlusButton.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent evt)
{
- onPlayButtonPressed(evt);
+ onZoomPlusButtonPressed(evt);
}
});
- attBlockViewer.add(playButton, new AnchorConstraint(10,
248));
-
- /* Stop button */
- stopButton = new
ATTSButton(ATTMessages.getString("MainFrame.65"), Color.BLACK,
"/actionButton2Enable.png"); //$NON-NLS-1$ //$NON-NLS-2$
- stopButton.setPressedIcon(new
ImageIcon(getClass().getResource("/actionButton2Pressed.PNG"))); //$NON-NLS-1$
- stopButton.addMouseListener(new MouseAdapter() {
+ jPanelBlock.add(zoomPlusButton, new
GridBagConstraints(6, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
+
+ /* Zoom minus button */
+ zoomMinusButton = new
ATTSButton("/zoomMinusButton.png"); //$NON-NLS-1$
+ zoomMinusButton.setPressedIcon(new
ImageIcon(getClass().getResource("/zoomPressedButton.png"))); //$NON-NLS-1$
+ zoomMinusButton.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent evt)
{
- onStopButtonPressed(evt);
+ onZoomMinusButtonPressed(evt);
}
});
- attBlockViewer.add(stopButton, new AnchorConstraint(10,
273));
- attBlockViewer.repaint();
+ jPanelBlock.add(zoomMinusButton, new
GridBagConstraints(7, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
+
+ /* Zoom full button */
+ zoomFullButton = new ATTSButton("/zoomFullButton.png");
//$NON-NLS-1$
+ zoomFullButton.setPressedIcon(new
ImageIcon(getClass().getResource("/zoomPressedButton.png"))); //$NON-NLS-1$
+ zoomFullButton.addMouseListener(new MouseAdapter() {
+ public void mousePressed(MouseEvent evt)
+ {
+ onZoomFullButtonPressed(evt);
+ }
+ });
+ jPanelBlock.add(zoomFullButton, new
GridBagConstraints(8, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
+
+ /* Status bar */
+ statusBar = new AttituneStatusBar("Hello", "world",
"coucou"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ statusBar.setSize(new java.awt.Dimension(640, 15));
+ statusBar.setPreferredSize(new java.awt.Dimension(640,
15));
+ statusBar.setMinimumSize(new java.awt.Dimension(640,
15));
+ statusBar.setMaximumSize(new java.awt.Dimension(640,
15));
+ this.add(statusBar, new GridBagConstraints(0, 2, 1, 1,
0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0,
0, 0), 0, 0));
+
/* Create the file chooser */
fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
@@ -257,6 +267,7 @@
/* Pack the components and set the frame size */
pack();
setSize(648, 400);
+ attBlockViewer.repaint();
/* Load the template file */
attBlockViewer.loadAttitune(ATTConfig.ATT_TEMPLATE_PATH); //$NON-NLS-1$
Modified:
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
2008-08-15 09:23:22 UTC (rev 1495)
+++
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/ATTConfig.java
2008-08-15 11:08:50 UTC (rev 1496)
@@ -9,12 +9,13 @@
{
public static int TLV_LEFT
= 100;
public static int TLV_TOP
= 45;
- public static int TLV_BOTTOM_BORDER
= 60;
+ public static int TLV_BOTTOM_BORDER
= 29;
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[] TLV_BACKGROUND_COLOR
= {0.168f, 0.168f, 0.168f, 1.0f};
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};
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-15 09:23:22 UTC (rev 1495)
+++
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/visual/ATTBlockViewer.java
2008-08-15 11:08:50 UTC (rev 1496)
@@ -33,8 +33,6 @@
private int width;
private int height;
- private Image background;
-
private ATTTlvVector tlv;
private ATTScrollbar scrollbar;
@@ -109,8 +107,6 @@
AWTEvent.KEY_EVENT_MASK);
this.addKeyListener(this);
this.setFocusable(true);
- /* Reset the images */
- background = null;
/* Time line viewer */
tlv = new ATTTlvVector();
tlv.left = ATTConfig.TLV_LEFT;
@@ -284,9 +280,6 @@
public boolean loadImages(String path)
{
String imgFileName;
-
- imgFileName = path + "background.png"; //$NON-NLS-1$
- background =
getToolkit().getImage(getClass().getResource(imgFileName));
imgFileName = path + "leds.png"; //$NON-NLS-1$
blockContainer0.setLabel(ATTMessages.getString("ATTBlockViewer.7"),
imgFileName); //$NON-NLS-1$
@@ -796,7 +789,7 @@
public void repaint()
{
updateCoord();
- super.repaint(0, 0, width, height - 37);
+ super.repaint(0, 0, width, height);
}
/**
@@ -828,10 +821,12 @@
try
{
/* Draw the background */
- if (background != null)
- {
- backBuffer1.drawImage(background, 0, 0, this);
- }
+ backBuffer1.setColor(new Color(
+ ATTConfig.TLV_BACKGROUND_COLOR[0],
+ ATTConfig.TLV_BACKGROUND_COLOR[1],
+ ATTConfig.TLV_BACKGROUND_COLOR[2],
+ ATTConfig.TLV_BACKGROUND_COLOR[3]));
+ backBuffer1.fillRect(0, 0, width, height);
/* Draw the scroll bar */
scrollbar.paint(backBuffer1);
/* Draw the timeline rule */
-------------------------------------------------------------------------
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