/* Copyright 2006 Eric Hakenholz This file is part of C.a.R. software. C.a.R. is a free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. C.a.R. is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package eric.controls; import java.awt.Color; import java.awt.Rectangle; import java.awt.event.MouseEvent; import java.util.ArrayList; import rene.util.xml.XmlTag; import rene.util.xml.XmlWriter; import rene.zirkel.ZirkelCanvas; import rene.zirkel.objects.ExpressionObject; import rene.zirkel.objects.TextObject; import eric.GUI.palette.PaletteManager; import eric.JZirkelCanvas; import eric.bar.JPropertiesBar; import rene.gui.Global; import rene.zirkel.objects.ConstructionObject; /** * * @author erichake */ public class JControlsManager { static Color bordercolor1=new Color(80, 80, 80); static Color bordercolor2=new Color(180, 180, 250); static Color bordercolor3=new Color(255, 25, 25); static int MAGNET=10; ZirkelCanvas ZC; public ArrayList CPs=new ArrayList(); Rectangle r=new Rectangle(); Rectangle r2=new Rectangle(); ArrayList XmlTags=new ArrayList(); public JControlsManager(final ZirkelCanvas zc) { ZC=zc; } public void addControl(final JCanvasPanel jcp, final boolean editme, final int x, final int y, final int w, final int h) { jcp.setDims(x, y, w, h); CPs.add(jcp); ZC.add(jcp); showHandles(jcp); ZC.revalidate(); if (editme) { JPropertiesBar.EditObject(jcp); } } public JCanvasCheckBox addChkBox(final ExpressionObject o, final int x, final int y, final int w, final int h) { final JCanvasCheckBox jcb=new JCanvasCheckBox(ZC, o); addControl(jcb, o==null, x, y, w, h); return jcb; } public JCanvasButton addButton(final ExpressionObject o, final int x, final int y, final int w, final int h) { final JCanvasButton jcb=new JCanvasButton(ZC, o); addControl(jcb, o==null, x, y, w, h); return jcb; } public JCanvasTxtfield addTxtField(final ExpressionObject o, final int x, final int y, final int w, final int h) { final JCanvasTxtfield jcb=new JCanvasTxtfield(ZC, o); addControl(jcb, o==null, x, y, w, h); return jcb; } public JCanvasSlider addSlider(final ExpressionObject o, final int x, final int y, final int w, final int h) { final JCanvasSlider jcs=new JCanvasSlider(ZC, o, -5, 5, -2); addControl(jcs, o==null, x, y, w, h); return jcs; } public JCanvasPopup addPopup(final ExpressionObject o, final int x, final int y, final int w, final int h) { final JCanvasPopup jcp=new JCanvasPopup(ZC, o); addControl(jcp, o==null, x, y, w, h); return jcp; } public void analyseResize(final JCanvasPanel jp) { r=jp.getBounds(r); for (int i=0; i1) { JCanvasPanel jp=(JCanvasPanel) CPs.get(0); jp.setComment(Global.Loc("canvas.3D.floor")); jp=(JCanvasPanel) CPs.get(1); jp.setComment(Global.Loc("canvas.3D.system")); final TextObject t=(TextObject) ZC.getConstruction().find("Text2"); if (t!=null) { t.setLines(Global.Loc("canvas.3D.rightclic")); } } } public void collectXmlTag(final XmlTag tag) { XmlTags.add(tag); } public void readXmlTags() { for (int i=0; i0) { XmlTags.clear(); hideHandles(null); } } }