Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23902/src/net/sourceforge/bprocessor/gui
Modified Files:
GUI.java
Added Files:
CameraView.java
Log Message:
Added add remove and set for the cameratreeview as a separate class CameraView
--- NEW FILE: CameraView.java ---
//---------------------------------------------------------------------------------
// $Id: CameraView.java,v 1.1 2006/01/25 14:44:41 rimestad Exp $
//
// Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net)
// Released under the Lesser GNU Public License v2.1
//---------------------------------------------------------------------------------
package net.sourceforge.bprocessor.gui;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import net.sourceforge.bprocessor.gui.treeview.CameraTreeView;
import net.sourceforge.bprocessor.model.Camera;
import net.sourceforge.bprocessor.model.Project;
import net.sourceforge.bprocessor.model.Selection;
/**
* A component for displaying views
* @author rimestad
*
*/
public class CameraView extends JPanel implements ActionListener {
/** Add button */
private JButton add;
/** Remove button */
private JButton remove;
/** set button */
private JButton set;
/** The tree of cams */
private CameraTreeView ctv;
/**
* The constructor
*
*/
public CameraView() {
super();
setSize(100, 500);
this.setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
ctv = new CameraTreeView();
add(new JScrollPane(ctv), BorderLayout.CENTER);
// create buttons
JPanel but = new JPanel();
but.setLayout(new BoxLayout(but, BoxLayout.LINE_AXIS));
add = new JButton("+");
remove = new JButton("-");
set = new JButton("Set");
add.addActionListener(this);
remove.addActionListener(this);
set.addActionListener(this);
but.add(add);
but.add(set);
but.add(remove);
this.setBackground(new Color(255, 255, 255));
this.add(but, BorderLayout.SOUTH);
}
/**
* Handle the actions on plus and minus
* @param a The actionevent
*/
public void actionPerformed(ActionEvent a) {
Object which = a.getSource();
Project p = Project.getInstance();
if (which == add) {
p.intern(p.getCurrentCamera());
p.setCurrentCamera(new Camera(p.getCurrentCamera(), "default"));
} else if (which == remove) {
Object[] tar = Selection.primary().toArray();
if (tar[0] instanceof Camera) {
p.remove((Camera)tar[0]);
}
} else if (which == set) {
Object[] tar = Selection.primary().toArray();
if (tar[0] instanceof Camera) {
Camera c = new Camera((Camera)tar[0], "default");
p.setCurrentCamera(c);
p.changed(c);
}
}
}
}
Index: GUI.java
===================================================================
RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/GUI.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** GUI.java 25 Jan 2006 11:01:14 -0000 1.24
--- GUI.java 25 Jan 2006 14:44:41 -0000 1.25
***************
*** 25,29 ****
import net.sourceforge.bprocessor.gui.attrview.AttributeView;
import net.sourceforge.bprocessor.gui.splash.SplashWindow;
- import net.sourceforge.bprocessor.gui.treeview.CameraTreeView;
import net.sourceforge.bprocessor.gui.treeview.SpaceTreeView;
import net.sourceforge.bprocessor.gui.treeview.SurfaceTreeView;
--- 25,28 ----
***************
*** 329,333 ****
tp.addTab("Spaces", new JScrollPane (new SpaceTreeView()));
tp.addTab("Surfaces", new JScrollPane (new SurfaceTreeView()));
! tp.addTab("Views", new JScrollPane (new CameraTreeView()));
registerPanel(tp, SPLIT_LEFT);
--- 328,332 ----
tp.addTab("Spaces", new JScrollPane (new SpaceTreeView()));
tp.addTab("Surfaces", new JScrollPane (new SurfaceTreeView()));
! tp.addTab("Views", new CameraView());
registerPanel(tp, SPLIT_LEFT);
***************
*** 356,360 ****
*/
public void start() {
! plash = new SplashWindow("splash3_24bit.png", null);
setSize(800, 600);
}
--- 355,359 ----
*/
public void start() {
! plash = new SplashWindow("splash3_24bit.png", this);
setSize(800, 600);
}
|