Make first real commit: copy of CaRMetal 4.2.8
This commit is contained in:
parent
002acfc88e
commit
c312811084
1120 changed files with 226843 additions and 1 deletions
37
eric/GUI/window/CanvasPanel.java
Normal file
37
eric/GUI/window/CanvasPanel.java
Normal file
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.GUI.pipe_tools;
|
||||
import eric.GUI.windowComponent;
|
||||
import eric.GUI.themes;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Graphics;
|
||||
import javax.swing.BoxLayout;
|
||||
import eric.JEricPanel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class CanvasPanel extends windowComponent {
|
||||
|
||||
public void init() {
|
||||
setBounds(themes.getVerticalBorderWidth()+themes.getLeftPanelWidth()+themes.getVerticalPanelBorderWidth()+themes.getTabLeftBorderWidth(),
|
||||
themes.getTitleBarHeight()+themes.getMenuBarHeight()+themes.getCommentsHeight(),
|
||||
pipe_tools.getWindowSize().width-themes.getLeftPanelWidth()-themes.getVerticalPanelBorderWidth()-themes.getTotalRightPanelWidth()-2*themes.getVerticalBorderWidth()-themes.getTabLeftBorderWidth()-themes.getTabRightBorderWidth(),
|
||||
pipe_tools.getWindowSize().height-themes.getTitleBarHeight()-themes.getMenuBarHeight()-themes.getMainTabPanelHeight()-themes.getCommentsHeight()-themes.getStatusBarHeight());
|
||||
}
|
||||
|
||||
public CanvasPanel() {
|
||||
super();
|
||||
setLayout(new BorderLayout());
|
||||
// setOpaque(true);
|
||||
}
|
||||
|
||||
}
|
61
eric/GUI/window/CloseBox.java
Normal file
61
eric/GUI/window/CloseBox.java
Normal file
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.GUI.pipe_tools;
|
||||
import eric.GUI.windowComponent;
|
||||
import eric.GUI.themes;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Image;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class CloseBox extends windowComponent {
|
||||
|
||||
private String btn="zclosebutton.png";
|
||||
private String overbtn="zclosebuttonover.png";
|
||||
private Image icon=themes.getImage(btn);
|
||||
|
||||
public void paintComponent(Graphics g) {
|
||||
Dimension d=this.getSize();
|
||||
g.drawImage(icon, 0, 0, d.width, d.height,
|
||||
this);
|
||||
}
|
||||
|
||||
public CloseBox() {
|
||||
}
|
||||
|
||||
public void init() {
|
||||
// win=StaticTools.getMainWindow(this);
|
||||
int marginL;
|
||||
if (themes.MacLF()) {
|
||||
marginL=themes.getBoxesMarginWidth();
|
||||
} else {
|
||||
marginL=pipe_tools.getWindowSize().width-themes.getBoxesMarginWidth()-themes.getCloseBoxDim().width-themes.getTotalRightPanelWidth();
|
||||
}
|
||||
this.setBounds(marginL,
|
||||
themes.getBoxesMarginHeight(),
|
||||
themes.getCloseBoxDim().width,
|
||||
themes.getCloseBoxDim().height);
|
||||
}
|
||||
|
||||
public void mousePressed(MouseEvent e) {
|
||||
pipe_tools.quitAll();
|
||||
}
|
||||
|
||||
public void mouseEntered(MouseEvent arg0) {
|
||||
icon=themes.getImage(overbtn);
|
||||
repaint();
|
||||
}
|
||||
|
||||
public void mouseExited(MouseEvent arg0) {
|
||||
icon=themes.getImage(btn);
|
||||
repaint();
|
||||
}
|
||||
}
|
181
eric/GUI/window/ContentPane.java
Normal file
181
eric/GUI/window/ContentPane.java
Normal file
|
@ -0,0 +1,181 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.GUI.palette.PaletteManager;
|
||||
import eric.GUI.pipe_tools;
|
||||
import eric.GUI.themes;
|
||||
import eric.JLogoWindow;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import javax.swing.JLabel;
|
||||
import eric.JEricPanel;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.ToolTipManager;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.plaf.ColorUIResource;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class ContentPane extends JEricPanel {
|
||||
private static CanvasPanel CANVASPANEL;
|
||||
private LeftPanel LEFTPANEL;
|
||||
private LeftPanel_content LEFTPANELCONTENT;
|
||||
private RightPanel RIGHTPANEL;
|
||||
private ResizeBox RESIZE;
|
||||
private TitleBar TITLE;
|
||||
private MenuBar MENU;
|
||||
private VerticalLeftBorder VERTICALLEFTBORDER;
|
||||
private VerticalLeftPanelBorder VERTICALLEFTPANELBORDER;
|
||||
private VerticalRightBorder VERTICALRIGHTBORDER;
|
||||
private CloseBox CLOSEBOX;
|
||||
private ReduceBox REDUCEBOX;
|
||||
private GrowBox GROWBOX;
|
||||
private comments TABTOPBORDER;
|
||||
private tab_left TABLEFTBORDER;
|
||||
private tab_right TABRIGHTBORDER;
|
||||
private tab_bottom TABBOTTOMBORDER;
|
||||
private tab_main_panel TABMAINPANEL;
|
||||
private tab_control_panel TABCONTROLPANEL;
|
||||
private Open_left_panel_btn OPENLEFTPANEL;
|
||||
private Open_right_panel_btn OPENRIGHTPANEL;
|
||||
private Open_middle_panel_btn OPENMIDDLEPANEL;
|
||||
private Monkey_panel_btn MONKEYBTN;
|
||||
|
||||
|
||||
|
||||
|
||||
public void paintComponent(Graphics g) {
|
||||
final java.awt.Dimension d=this.getSize();
|
||||
g.setColor(Color.lightGray);
|
||||
g.fillRect(0, 0, d.width, d.height);
|
||||
}
|
||||
|
||||
public ContentPane() {
|
||||
setLayout(null);
|
||||
VERTICALLEFTPANELBORDER=new VerticalLeftPanelBorder();
|
||||
CANVASPANEL=new CanvasPanel();
|
||||
LEFTPANEL=new LeftPanel();
|
||||
LEFTPANELCONTENT=new LeftPanel_content();
|
||||
RIGHTPANEL=new RightPanel();
|
||||
TABTOPBORDER=new comments();
|
||||
TABLEFTBORDER=new tab_left();
|
||||
TABRIGHTBORDER=new tab_right();
|
||||
TABBOTTOMBORDER=new tab_bottom();
|
||||
TABMAINPANEL=new tab_main_panel();
|
||||
TABCONTROLPANEL=new tab_control_panel();
|
||||
|
||||
// resizebox needs to be in front of every component :
|
||||
if (!themes.isApplet()) {
|
||||
RESIZE=new ResizeBox();
|
||||
add(RESIZE);
|
||||
}
|
||||
|
||||
add(CANVASPANEL);
|
||||
|
||||
if (!themes.isApplet()) {
|
||||
GROWBOX=new GrowBox();
|
||||
REDUCEBOX=new ReduceBox();
|
||||
CLOSEBOX=new CloseBox();
|
||||
TITLE=new TitleBar();
|
||||
MENU=new MenuBar();
|
||||
VERTICALLEFTBORDER=new VerticalLeftBorder();
|
||||
VERTICALRIGHTBORDER=new VerticalRightBorder();
|
||||
OPENLEFTPANEL=new Open_left_panel_btn();
|
||||
OPENRIGHTPANEL=new Open_right_panel_btn();
|
||||
OPENMIDDLEPANEL=new Open_middle_panel_btn();
|
||||
MONKEYBTN=new Monkey_panel_btn();
|
||||
add(OPENLEFTPANEL);
|
||||
add(OPENRIGHTPANEL);
|
||||
add(OPENMIDDLEPANEL);
|
||||
add(MONKEYBTN);
|
||||
add(GROWBOX);
|
||||
add(REDUCEBOX);
|
||||
add(CLOSEBOX);
|
||||
add(TITLE);
|
||||
add(MENU);
|
||||
add(VERTICALLEFTBORDER);
|
||||
add(VERTICALRIGHTBORDER);
|
||||
}
|
||||
add(VERTICALLEFTPANELBORDER);
|
||||
add(TABCONTROLPANEL);
|
||||
add(TABMAINPANEL);
|
||||
add(TABLEFTBORDER);
|
||||
add(TABRIGHTBORDER);
|
||||
add(TABTOPBORDER);
|
||||
add(TABBOTTOMBORDER);
|
||||
add(LEFTPANEL);
|
||||
add(LEFTPANELCONTENT);
|
||||
add(RIGHTPANEL);
|
||||
|
||||
ToolTipManager.sharedInstance().setInitialDelay(100);
|
||||
ToolTipManager.sharedInstance().setDismissDelay(10000);
|
||||
UIManager.put("ToolTip.background", new ColorUIResource(213, 227, 253));
|
||||
pipe_tools.setStandardKeyInputs();
|
||||
}
|
||||
|
||||
public void rebuiltRightPanel(){
|
||||
final String gicon=PaletteManager.geomSelectedIcon();
|
||||
int i=getComponentZOrder(RIGHTPANEL);
|
||||
remove(RIGHTPANEL);
|
||||
RIGHTPANEL=null;
|
||||
RIGHTPANEL=new RightPanel();
|
||||
add(RIGHTPANEL, i);
|
||||
// I know, this is weird, but it work's :
|
||||
setComponents();
|
||||
setComponents();
|
||||
PaletteManager.setSelected_with_clic(gicon,true);
|
||||
PaletteManager.initPaletteConsideringMode();
|
||||
}
|
||||
|
||||
public void setTitle(String s){
|
||||
TITLE.setTitle(s);
|
||||
}
|
||||
|
||||
|
||||
public static void setCurrentPanel(tab_canvas_panel canvas){
|
||||
CANVASPANEL.removeAll();
|
||||
CANVASPANEL.add(canvas);
|
||||
CANVASPANEL.revalidate();
|
||||
CANVASPANEL.repaint();
|
||||
}
|
||||
|
||||
public static JEricPanel getCanvasPanel(){
|
||||
return CANVASPANEL;
|
||||
}
|
||||
|
||||
public void setComponents() {
|
||||
RIGHTPANEL.init();
|
||||
CANVASPANEL.init();
|
||||
TABTOPBORDER.init();
|
||||
TABLEFTBORDER.init();
|
||||
TABRIGHTBORDER.init();
|
||||
TABBOTTOMBORDER.init();
|
||||
LEFTPANEL.init();
|
||||
LEFTPANELCONTENT.init();
|
||||
|
||||
TABMAINPANEL.init();
|
||||
TABCONTROLPANEL.init();
|
||||
VERTICALLEFTPANELBORDER.init();
|
||||
|
||||
if (!themes.isApplet()) {
|
||||
REDUCEBOX.init();
|
||||
CLOSEBOX.init();
|
||||
GROWBOX.init();
|
||||
TITLE.init();
|
||||
MENU.init();
|
||||
VERTICALLEFTBORDER.init();
|
||||
VERTICALRIGHTBORDER.init();
|
||||
RESIZE.init();
|
||||
OPENLEFTPANEL.init();
|
||||
OPENRIGHTPANEL.init();
|
||||
OPENMIDDLEPANEL.init();
|
||||
MONKEYBTN.init();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
73
eric/GUI/window/GrowBox.java
Normal file
73
eric/GUI/window/GrowBox.java
Normal file
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.GUI.pipe_tools;
|
||||
import eric.GUI.windowComponent;
|
||||
import eric.GUI.themes;
|
||||
import eric.JZirkelCanvas;
|
||||
import eric.bar.JPropertiesBar;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Image;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.MouseEvent;
|
||||
import javax.swing.JFrame;
|
||||
import rene.gui.Global;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class GrowBox extends windowComponent {
|
||||
|
||||
private String btn="zgrowbutton.png";
|
||||
private String overbtn="zgrowbuttonover.png";
|
||||
private Image icon=themes.getImage(btn);
|
||||
|
||||
public void paintComponent(Graphics g) {
|
||||
Dimension d=this.getSize();
|
||||
g.drawImage(icon, 0, 0, d.width, d.height,
|
||||
this);
|
||||
}
|
||||
|
||||
public GrowBox() {
|
||||
}
|
||||
|
||||
public void init() {
|
||||
// win=StaticTools.getMainWindow(this);
|
||||
int x;
|
||||
if (themes.MacLF()) {
|
||||
x=themes.getBoxesMarginWidth()+themes.getCloseBoxDim().width+themes.getReduceBoxDim().width;
|
||||
} else {
|
||||
x=pipe_tools.getWindowSize().width-themes.getBoxesMarginWidth()-themes.getCloseBoxDim().width-themes.getGrowBoxDim().width-themes.getTotalRightPanelWidth();
|
||||
}
|
||||
this.setBounds(x,
|
||||
themes.getBoxesMarginHeight(),
|
||||
themes.getGrowBoxDim().width,
|
||||
themes.getGrowBoxDim().height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
pipe_tools.setWindowBounds(Global.getScreen());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent arg0) {
|
||||
icon=themes.getImage(overbtn);
|
||||
repaint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseExited(MouseEvent arg0) {
|
||||
icon=themes.getImage(btn);
|
||||
repaint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
}
|
||||
}
|
66
eric/GUI/window/ImageFilter.java
Normal file
66
eric/GUI/window/ImageFilter.java
Normal file
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.*;
|
||||
import java.io.File;
|
||||
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
|
||||
public class ImageFilter extends FileFilter {
|
||||
|
||||
@Override
|
||||
public boolean accept(final File f) {
|
||||
if (f.isDirectory()) {
|
||||
return true;
|
||||
}
|
||||
final String extension = this.getExtension(f);
|
||||
if (extension != null) {
|
||||
if (extension.equals("tiff") || extension.equals("tif")
|
||||
|| extension.equals("svg") || extension.equals("gif")
|
||||
|| extension.equals("jpeg") || extension.equals("jpg")
|
||||
|| extension.equals("eps") || extension.equals("png")) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Images";
|
||||
}
|
||||
|
||||
public String getExtension(final File f) {
|
||||
String ext = null;
|
||||
final String s = f.getName();
|
||||
final int i = s.lastIndexOf('.');
|
||||
|
||||
if (i > 0 && i < s.length() - 1) {
|
||||
ext = s.substring(i + 1).toLowerCase();
|
||||
}
|
||||
return ext;
|
||||
}
|
||||
}
|
195
eric/GUI/window/LeftPanel.java
Normal file
195
eric/GUI/window/LeftPanel.java
Normal file
|
@ -0,0 +1,195 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.GUI.pipe_tools;
|
||||
import eric.GUI.windowComponent;
|
||||
import eric.GUI.themes;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Image;
|
||||
import rene.gui.Global;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class LeftPanel extends windowComponent {
|
||||
|
||||
private static LeftPanel me;
|
||||
private static int factorySize=250;
|
||||
private static int actualSize=0; //width of this panel
|
||||
private static final int marginW=5, marginH=4, space=2;
|
||||
private static int H=themes.getIcon("leftpanelbackground.gif").getIconHeight();
|
||||
private static Image on_btn=themes.getImage("leftpanel_on_btn.gif");
|
||||
private static Image off_btn=themes.getImage("leftpanel_off_btn.gif");
|
||||
private static Dimension btn_dim=new Dimension(themes.getIcon("leftpanel_on_btn.gif").getIconWidth(), themes.getIcon("leftpanel_on_btn.gif").getIconHeight());
|
||||
|
||||
private static LeftPanel_macros_btn macros_btn=new LeftPanel_macros_btn();
|
||||
private static LeftPanel_history_btn history_btn=new LeftPanel_history_btn();
|
||||
private static LeftPanel_help_btn help_btn=new LeftPanel_help_btn();
|
||||
private static LeftPanel_scripts_btn scripts_btn=new LeftPanel_scripts_btn();
|
||||
|
||||
private static LeftPanel_close_btn close_btn=new LeftPanel_close_btn();
|
||||
|
||||
public void paintComponent(Graphics g) {
|
||||
Dimension d=getSize();
|
||||
g.setColor(Color.white);
|
||||
g.fillRect(0, 0, d.width, d.height);
|
||||
g.drawImage(themes.getImage("leftpanelbackground.gif"), 0, 0, d.width, H, this);
|
||||
// super.paintComponent(g);
|
||||
}
|
||||
|
||||
public static Image getOnBtn() {
|
||||
return on_btn;
|
||||
}
|
||||
|
||||
public static Image getOffBtn() {
|
||||
return off_btn;
|
||||
}
|
||||
|
||||
public static Dimension getBtnDim() {
|
||||
return btn_dim;
|
||||
}
|
||||
|
||||
public static void selectHelp(){
|
||||
select(help_btn);
|
||||
}
|
||||
|
||||
public static void select(LeftPanel_btn btn) {
|
||||
macros_btn.select(macros_btn.equals(btn));
|
||||
history_btn.select(history_btn.equals(btn));
|
||||
help_btn.select(help_btn.equals(btn));
|
||||
scripts_btn.select(scripts_btn.equals(btn));
|
||||
me.repaint();
|
||||
pipe_tools.actualiseLeftPanels();
|
||||
}
|
||||
|
||||
public static int x(LeftPanel_btn btn) {
|
||||
int macr=marginW;
|
||||
int hist=macr+((macros_btn.isVisible())?space+btn_dim.width:0);
|
||||
int help=hist+((history_btn.isVisible())?space+btn_dim.width:0);
|
||||
int scripts=help+((scripts_btn.isVisible())?space+btn_dim.width:0);
|
||||
if (macros_btn.equals(btn)) {
|
||||
return macr;
|
||||
} else if (history_btn.equals(btn)) {
|
||||
return hist;
|
||||
} else if (help_btn.equals(btn)) {
|
||||
return help;
|
||||
} else if(scripts_btn.equals(btn)){
|
||||
return scripts;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int y() {
|
||||
return marginH;
|
||||
}
|
||||
|
||||
public static void setPanelWidth(int size) {
|
||||
actualSize=size;
|
||||
}
|
||||
|
||||
public static int getPanelWidth() {
|
||||
return actualSize;
|
||||
}
|
||||
|
||||
public static int getPanelHeight() {
|
||||
return H;
|
||||
}
|
||||
|
||||
public static boolean isPanelVisible() {
|
||||
return (actualSize!=0);
|
||||
}
|
||||
|
||||
public static void setMacroBtnVisible(boolean b){
|
||||
macros_btn.setVisible(b);
|
||||
LeftPanel_content.setPanelVisibility();
|
||||
me.init();
|
||||
}
|
||||
public static void setHistoryBtnVisible(boolean b){
|
||||
history_btn.setVisible(b);
|
||||
LeftPanel_content.setPanelVisibility();
|
||||
me.init();
|
||||
}
|
||||
public static void setHelpBtnVisible(boolean b){
|
||||
help_btn.setVisible(b);
|
||||
LeftPanel_content.setPanelVisibility();
|
||||
me.init();
|
||||
}
|
||||
public static void setScriptsBtnVisible(boolean b){
|
||||
scripts_btn.setVisible(b);
|
||||
LeftPanel_content.setPanelVisibility();
|
||||
me.init();
|
||||
}
|
||||
public static boolean isMacroBtnVisible(){
|
||||
return macros_btn.isVisible();
|
||||
}
|
||||
public static boolean isHistoryBtnVisible(){
|
||||
return history_btn.isVisible();
|
||||
}
|
||||
public static boolean isHelpBtnVisible(){
|
||||
return help_btn.isVisible();
|
||||
}
|
||||
public static boolean isScriptsBtnVisible(){
|
||||
return scripts_btn.isVisible();
|
||||
}
|
||||
|
||||
public static boolean isHistoryPanelVisible() {
|
||||
return ((isPanelVisible())&&(history_btn.isPanelSelected()));
|
||||
}
|
||||
public static boolean isHelpPanelVisible() {
|
||||
return ((isPanelVisible())&&(help_btn.isPanelSelected()));
|
||||
}
|
||||
public static boolean isMacroPanelVisible() {
|
||||
return ((isPanelVisible())&&(macros_btn.isPanelSelected()));
|
||||
}
|
||||
public static boolean isScriptsPanelVisible(){
|
||||
return ((isPanelVisible())&&(scripts_btn.isPanelSelected()));
|
||||
}
|
||||
|
||||
public static int getFactorySize(){
|
||||
return factorySize;
|
||||
}
|
||||
|
||||
public static void setFactorySize(int size){
|
||||
factorySize=size;
|
||||
actualSize=size;
|
||||
pipe_tools.setWindowComponents();
|
||||
|
||||
}
|
||||
|
||||
public static void showPanel(boolean vis) {
|
||||
int w=(vis)?Global.getParameter("leftpanelwidth", factorySize):0;
|
||||
setPanelWidth(w);
|
||||
pipe_tools.setWindowComponents();
|
||||
pipe_tools.actualiseLeftPanels();
|
||||
}
|
||||
|
||||
public void init() {
|
||||
setBounds(themes.getVerticalBorderWidth(),
|
||||
themes.getTitleBarHeight()+themes.getMenuBarHeight()+themes.getCommentsHeight(),
|
||||
actualSize,
|
||||
H);
|
||||
macros_btn.init();
|
||||
history_btn.init();
|
||||
help_btn.init();
|
||||
scripts_btn.init();
|
||||
close_btn.init();
|
||||
}
|
||||
|
||||
public LeftPanel() {
|
||||
super();
|
||||
me=this;
|
||||
setOpaque(true);
|
||||
setLayout(null);
|
||||
add(macros_btn);
|
||||
add(history_btn);
|
||||
add(help_btn);
|
||||
add(scripts_btn);
|
||||
add(close_btn);
|
||||
}
|
||||
}
|
15
eric/GUI/window/LeftPanel_btn.java
Normal file
15
eric/GUI/window/LeftPanel_btn.java
Normal file
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package eric.GUI.window;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public interface LeftPanel_btn {
|
||||
public void select(boolean b);
|
||||
public boolean isPanelSelected();
|
||||
}
|
64
eric/GUI/window/LeftPanel_close_btn.java
Normal file
64
eric/GUI/window/LeftPanel_close_btn.java
Normal file
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.GUI.themes;
|
||||
import eric.GUI.windowComponent;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class LeftPanel_close_btn extends windowComponent {
|
||||
|
||||
private boolean over=false;
|
||||
private static int W=themes.getIcon("tab_close.png").getIconWidth();
|
||||
private static int H=themes.getIcon("tab_close.png").getIconHeight();
|
||||
private static int marginW=5;
|
||||
private static int marginH=8;
|
||||
|
||||
@Override
|
||||
public void paintComponent(Graphics g) {
|
||||
Dimension d=getSize();
|
||||
if (over) {
|
||||
g.drawImage(themes.getImage("tab_close_over.png"), 0, 0, d.width, d.height,
|
||||
this);
|
||||
} else {
|
||||
g.drawImage(themes.getImage("tab_close.png"), 0, 0, d.width, d.height,
|
||||
this);
|
||||
}
|
||||
}
|
||||
|
||||
public void init() {
|
||||
setBounds(LeftPanel.getPanelWidth()-W-marginW, marginH, W, H);
|
||||
}
|
||||
|
||||
public LeftPanel_close_btn() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
// LeftPanel.showPanel(false);
|
||||
// Open_left_panel_btn.setSelected(false);
|
||||
// over=false;
|
||||
Open_left_panel_btn.toggle();
|
||||
}
|
||||
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
over=true;
|
||||
repaint();
|
||||
}
|
||||
|
||||
public void mouseExited(MouseEvent e) {
|
||||
over=false;
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
|
||||
|
79
eric/GUI/window/LeftPanel_content.java
Normal file
79
eric/GUI/window/LeftPanel_content.java
Normal file
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.GUI.pipe_tools;
|
||||
import eric.GUI.themes;
|
||||
import eric.GUI.windowComponent;
|
||||
import eric.JHelpPanel;
|
||||
import eric.JSprogram.JScriptsLeftPanel;
|
||||
import eric.macros.MacrosList;
|
||||
import java.awt.Dimension;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JComponent;
|
||||
import rene.zirkel.construction.ConstructionDisplayPanel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class LeftPanel_content extends windowComponent {
|
||||
|
||||
private static LeftPanel_content me;
|
||||
private static JComponent JP;
|
||||
|
||||
public void init() {
|
||||
setBounds(themes.getVerticalBorderWidth(),
|
||||
themes.getTitleBarHeight()+themes.getMenuBarHeight()+LeftPanel.getPanelHeight()+themes.getCommentsHeight(),
|
||||
themes.getLeftPanelWidth(),
|
||||
pipe_tools.getWindowSize().height-themes.getTitleBarHeight()-themes.getMenuBarHeight()-themes.getMainTabPanelHeight()-LeftPanel.getPanelHeight()-themes.getCommentsHeight());
|
||||
if (JP instanceof JHelpPanel) {
|
||||
JHelpPanel jh=(JHelpPanel) JP;
|
||||
jh.fixPanelSize(getSize().width, getSize().height);
|
||||
} else if (JP instanceof MacrosList) {
|
||||
MacrosList ml=(MacrosList) JP;
|
||||
ml.fixPanelSize(getSize().width, getSize().height);
|
||||
} else if (JP instanceof ConstructionDisplayPanel) {
|
||||
ConstructionDisplayPanel cdp=(ConstructionDisplayPanel) JP;
|
||||
cdp.fixPanelSize(getSize().width, getSize().height);
|
||||
} else if(JP instanceof JScriptsLeftPanel){
|
||||
JScriptsLeftPanel jsp = (JScriptsLeftPanel) JP;
|
||||
jsp.fixPanelSize(getSize().width, getSize().height);
|
||||
}
|
||||
}
|
||||
|
||||
public LeftPanel_content() {
|
||||
me=this;
|
||||
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
|
||||
}
|
||||
|
||||
public static void setPanelVisibility(){
|
||||
if (JP instanceof MacrosList) {
|
||||
JP.setVisible(LeftPanel.isMacroBtnVisible());
|
||||
} else if (JP instanceof ConstructionDisplayPanel) {
|
||||
JP.setVisible(LeftPanel.isHistoryBtnVisible());
|
||||
} else if (JP instanceof JHelpPanel) {
|
||||
JP.setVisible(LeftPanel.isHelpBtnVisible());
|
||||
} else if (JP instanceof JScriptsLeftPanel) {
|
||||
JP.setVisible(LeftPanel.isScriptsBtnVisible());
|
||||
}
|
||||
}
|
||||
|
||||
public static void setContent(JComponent jp) {
|
||||
JP=jp;
|
||||
me.removeAll();
|
||||
me.add(jp);
|
||||
me.init();
|
||||
me.revalidate();
|
||||
setPanelVisibility();
|
||||
me.repaint();
|
||||
}
|
||||
|
||||
public static Dimension getPanelSize() {
|
||||
return me.getSize();
|
||||
}
|
||||
}
|
||||
|
||||
|
67
eric/GUI/window/LeftPanel_help_btn.java
Normal file
67
eric/GUI/window/LeftPanel_help_btn.java
Normal file
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.GUI.pipe_tools;
|
||||
import eric.GUI.themes;
|
||||
import eric.GUI.windowComponent;
|
||||
import eric.JZirkelCanvas;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class LeftPanel_help_btn extends windowComponent implements LeftPanel_btn{
|
||||
|
||||
private boolean over=false;
|
||||
private boolean selected=false;
|
||||
private static int X=(themes.getIcon("leftpanel_on_btn.gif").getIconWidth()-themes.getIcon("left_help.png").getIconWidth())/2;
|
||||
private static int Y=3;
|
||||
|
||||
@Override
|
||||
public void paintComponent(Graphics g) {
|
||||
Dimension d=getSize();
|
||||
if (selected) {
|
||||
g.drawImage(LeftPanel.getOnBtn(), 0, 0, d.width, d.height,
|
||||
this);
|
||||
} else {
|
||||
g.drawImage(LeftPanel.getOffBtn(), 0, 0, d.width, d.height,
|
||||
this);
|
||||
}
|
||||
g.drawImage(themes.getImage("left_help.png"),X,Y,this);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void init() {
|
||||
setBounds(LeftPanel.x(this),LeftPanel.y(),LeftPanel.getBtnDim().width,LeftPanel.getBtnDim().height);
|
||||
}
|
||||
|
||||
public LeftPanel_help_btn() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
LeftPanel.select(this);
|
||||
|
||||
}
|
||||
|
||||
public void select(boolean b) {
|
||||
selected=b;
|
||||
}
|
||||
|
||||
public boolean isPanelSelected() {
|
||||
return selected;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
63
eric/GUI/window/LeftPanel_history_btn.java
Normal file
63
eric/GUI/window/LeftPanel_history_btn.java
Normal file
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.GUI.pipe_tools;
|
||||
import eric.GUI.themes;
|
||||
import eric.GUI.windowComponent;
|
||||
import eric.JZirkelCanvas;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.event.MouseEvent;
|
||||
import rene.zirkel.ZirkelCanvas;
|
||||
import rene.zirkel.construction.ConstructionDisplayPanel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class LeftPanel_history_btn extends windowComponent implements LeftPanel_btn {
|
||||
|
||||
private boolean over=false;
|
||||
private boolean selected=false;
|
||||
private static int X=(themes.getIcon("leftpanel_on_btn.gif").getIconWidth()-themes.getIcon("left_history.png").getIconWidth())/2;
|
||||
private static int Y=2;
|
||||
|
||||
@Override
|
||||
public void paintComponent(Graphics g) {
|
||||
Dimension d=getSize();
|
||||
if (selected) {
|
||||
g.drawImage(LeftPanel.getOnBtn(), 0, 0, d.width, d.height,
|
||||
this);
|
||||
} else {
|
||||
g.drawImage(LeftPanel.getOffBtn(), 0, 0, d.width, d.height,
|
||||
this);
|
||||
}
|
||||
g.drawImage(themes.getImage("left_history.png"), X, Y, this);
|
||||
}
|
||||
|
||||
public void init() {
|
||||
setBounds(LeftPanel.x(this), LeftPanel.y(), LeftPanel.getBtnDim().width, LeftPanel.getBtnDim().height);
|
||||
}
|
||||
|
||||
public LeftPanel_history_btn() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
LeftPanel.select(this);
|
||||
}
|
||||
|
||||
public void select(boolean b) {
|
||||
selected=b;
|
||||
}
|
||||
|
||||
public boolean isPanelSelected() {
|
||||
return selected;
|
||||
}
|
||||
}
|
||||
|
||||
|
62
eric/GUI/window/LeftPanel_macros_btn.java
Normal file
62
eric/GUI/window/LeftPanel_macros_btn.java
Normal file
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.GUI.themes;
|
||||
import eric.GUI.windowComponent;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class LeftPanel_macros_btn extends windowComponent implements LeftPanel_btn{
|
||||
|
||||
private boolean over=false;
|
||||
private boolean selected=true;
|
||||
private static int X=(themes.getIcon("leftpanel_on_btn.gif").getIconWidth()-themes.getIcon("left_macros.png").getIconWidth())/2;
|
||||
private static int Y=3;
|
||||
|
||||
@Override
|
||||
public void paintComponent(Graphics g) {
|
||||
Dimension d=getSize();
|
||||
if (selected) {
|
||||
g.drawImage(LeftPanel.getOnBtn(), 0, 0, d.width, d.height,
|
||||
this);
|
||||
} else {
|
||||
g.drawImage(LeftPanel.getOffBtn(), 0, 0, d.width, d.height,
|
||||
this);
|
||||
}
|
||||
g.drawImage(themes.getImage("left_macros.png"),X,Y,this);
|
||||
}
|
||||
|
||||
public void init() {
|
||||
setBounds(LeftPanel.x(this),LeftPanel.y(),LeftPanel.getBtnDim().width,LeftPanel.getBtnDim().height);
|
||||
}
|
||||
|
||||
public LeftPanel_macros_btn() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
LeftPanel.select(this);
|
||||
}
|
||||
|
||||
public void select(boolean b) {
|
||||
selected=b;
|
||||
}
|
||||
|
||||
public boolean isPanelSelected() {
|
||||
return selected;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
55
eric/GUI/window/LeftPanel_scripts_btn.java
Normal file
55
eric/GUI/window/LeftPanel_scripts_btn.java
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.GUI.themes;
|
||||
import eric.GUI.windowComponent;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author PM
|
||||
*/
|
||||
public class LeftPanel_scripts_btn extends windowComponent implements LeftPanel_btn {
|
||||
|
||||
private boolean selected = false;
|
||||
private static int X = (themes.getIcon("leftpanel_on_btn.gif").getIconWidth()-17)/2; //17 : voir ligne 34
|
||||
private static int Y = 3;
|
||||
|
||||
public LeftPanel_scripts_btn() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintComponent(Graphics g) {
|
||||
Dimension d=getSize();
|
||||
if (selected) {
|
||||
g.drawImage(LeftPanel.getOnBtn(), 0, 0, d.width, d.height, this);
|
||||
} else {
|
||||
g.drawImage(LeftPanel.getOffBtn(), 0, 0, d.width, d.height, this);
|
||||
}
|
||||
g.drawImage(themes.resizeExistingIcon("/eric/GUI/icons/themes/common/scripts.png", 17, 17).getImage(),X,Y,this);
|
||||
}
|
||||
|
||||
public void init() {
|
||||
setBounds(LeftPanel.x(this),LeftPanel.y(),LeftPanel.getBtnDim().width,LeftPanel.getBtnDim().height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
LeftPanel.select(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void select(boolean b) {
|
||||
selected = b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPanelSelected() {
|
||||
return selected;
|
||||
}
|
||||
}
|
186
eric/GUI/window/MainApplet.java
Normal file
186
eric/GUI/window/MainApplet.java
Normal file
|
@ -0,0 +1,186 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.FileTools;
|
||||
import eric.GUI.pipe_tools;
|
||||
import eric.GUI.themes;
|
||||
import eric.JZirkelCanvas;
|
||||
import eric.Media;
|
||||
import java.awt.Image;
|
||||
import java.awt.Point;
|
||||
import java.net.URL;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import javax.swing.JApplet;
|
||||
import javax.swing.SwingUtilities;
|
||||
import rene.zirkel.ZirkelCanvas;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class MainApplet extends JApplet implements MainContainer {
|
||||
|
||||
private ContentPane CONTENT;
|
||||
private String Source=null;
|
||||
|
||||
public MainApplet() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
try {
|
||||
pipe_tools.init(this);
|
||||
SwingUtilities.invokeAndWait(new Runnable() {
|
||||
public void run() {
|
||||
createGUI();
|
||||
openFILES();
|
||||
}
|
||||
});
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
|
||||
// JSObject window=JSObject.getWindow(this);
|
||||
// String[] message={"An alert message"};
|
||||
// window.call("alert", message);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
if (Source!=null) {
|
||||
FileTools.setWorkBookSource(Source);
|
||||
}else{
|
||||
pipe_tools.AppletLoadedMessage_To_HTML();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void createGUI() {
|
||||
tab_main_panel.removeAllBtns(CONTENT);
|
||||
Media.clearMedias();
|
||||
setLayout(null);
|
||||
themes.init();
|
||||
CONTENT = new ContentPane();
|
||||
setContentPane(CONTENT);
|
||||
}
|
||||
|
||||
public void openFILES() {
|
||||
try {
|
||||
Source = getParameter("source");
|
||||
final String filename = getParameter("file");
|
||||
URL url = new URL(getCodeBase(), filename);
|
||||
if (url.getFile().toLowerCase().endsWith(".zirs")) {
|
||||
URL myURL = new URL(getCodeBase(), filename);
|
||||
FileTools.openWorkBook(url.getFile(), myURL.openStream());
|
||||
} else if (url.getFile().toLowerCase().endsWith(".zir")) {
|
||||
URL myURL = new URL(getCodeBase(), filename);
|
||||
FileTools.openFile(url.getFile(), myURL.openStream(), 0);
|
||||
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
setComponents();
|
||||
|
||||
// try {
|
||||
// String src = getParameter("source");
|
||||
// src = src.trim();
|
||||
// FileTools.setWorkBookSource(src);
|
||||
// } catch (Exception ex2) {
|
||||
// setComponents();
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
public void setComponents() {
|
||||
CONTENT.setComponents();
|
||||
}
|
||||
|
||||
public ContentPane getContent() {
|
||||
return CONTENT;
|
||||
}
|
||||
|
||||
public Point getMouseLoc() {
|
||||
return CONTENT.getMousePosition();
|
||||
}
|
||||
|
||||
public Image getImage(String s) {
|
||||
Image myimage;
|
||||
myimage = getImage(themes.class.getResource(themes.getCommonThemePath() + s));
|
||||
if (myimage == null) {
|
||||
myimage = getImage(themes.class.getResource(themes.getCurrentThemePath() + s));
|
||||
}
|
||||
if (myimage == null) {
|
||||
myimage = getImage(themes.class.getResource(themes.getCommonThemePath() + "null.gif"));
|
||||
}
|
||||
return myimage;
|
||||
}
|
||||
|
||||
public Image getPaletteImage(String s) {
|
||||
Image myimage;
|
||||
try {
|
||||
myimage = getImage(themes.class.getResource(themes.getPalettePath() + s + ".png"));
|
||||
} catch (final Exception e) {
|
||||
try {
|
||||
myimage = getImage(themes.class.getResource(themes.getPalettePath() + s + ".gif"));
|
||||
} catch (final Exception ex) {
|
||||
try {
|
||||
myimage = getImage(themes.class.getResource(themes.getBarPath() + s + ".png"));
|
||||
} catch (final Exception ex2) {
|
||||
try {
|
||||
myimage = getImage(themes.class.getResource(themes.getBarPath() + s + ".gif"));
|
||||
} catch (final Exception ex3) {
|
||||
myimage = getImage(themes.class.getResource(themes.getCommonThemePath() + "null.gif"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return myimage;
|
||||
}
|
||||
|
||||
public boolean isApplet() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLocation(int x, int y) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point getLocation() {
|
||||
return new Point(0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSize(int w, int h) {
|
||||
}
|
||||
|
||||
/* these methods are made for communication between the applet
|
||||
* and the web page.
|
||||
*/
|
||||
public String get() {
|
||||
return FileTools.getWorkBookSource();
|
||||
}
|
||||
|
||||
public void set(String s) {
|
||||
createGUI();
|
||||
s = s.trim();
|
||||
FileTools.setWorkBookSource(s);
|
||||
}
|
||||
|
||||
public void JSsend(final String s) {
|
||||
ZirkelCanvas zc = JZirkelCanvas.getCurrentZC();
|
||||
zc.JSsend(s);
|
||||
zc.repaint();
|
||||
}
|
||||
|
||||
public String JSreceive(final String s) {
|
||||
ZirkelCanvas zc = JZirkelCanvas.getCurrentZC();
|
||||
return zc.JSreceive(s);
|
||||
}
|
||||
}
|
32
eric/GUI/window/MainContainer.java
Normal file
32
eric/GUI/window/MainContainer.java
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package eric.GUI.window;
|
||||
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Image;
|
||||
import java.awt.Point;
|
||||
import javax.swing.JRootPane;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public interface MainContainer{
|
||||
public void setComponents();
|
||||
public ContentPane getContent();
|
||||
public Point getMouseLoc();
|
||||
public Image getImage(String s);
|
||||
public Image getPaletteImage(String s);
|
||||
public boolean isApplet();
|
||||
public void setLocation(int x, int y);
|
||||
public Point getLocation();
|
||||
public void setSize(int w,int h);
|
||||
public Dimension getSize();
|
||||
public JRootPane getRootPane();
|
||||
// public Image createImage(int width, int height);
|
||||
}
|
162
eric/GUI/window/MainWindow.java
Normal file
162
eric/GUI/window/MainWindow.java
Normal file
|
@ -0,0 +1,162 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
/*
|
||||
* NewJZirkelFrame.java
|
||||
*
|
||||
* Created on 26 oct. 2009, 08:41:46
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.GUI.pipe_tools;
|
||||
import eric.GUI.themes;
|
||||
import eric.OS;
|
||||
import java.awt.Image;
|
||||
import java.awt.MouseInfo;
|
||||
import java.awt.Point;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.awt.event.WindowListener;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JFrame;
|
||||
import rene.gui.Global;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class MainWindow extends JFrame implements MainContainer, WindowListener {
|
||||
|
||||
private int WIN_w=1280, WIN_h=800;
|
||||
private ContentPane CONTENT=null;
|
||||
|
||||
@Override
|
||||
public void repaint() {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public MainWindow() {
|
||||
super();
|
||||
pipe_tools.init(this);
|
||||
addWindowListener(this);
|
||||
setUndecorated(true);
|
||||
setLayout(null);
|
||||
themes.init();
|
||||
CONTENT=new ContentPane();
|
||||
setContentPane(CONTENT);
|
||||
|
||||
if (OS.isUnix()) {
|
||||
// A cause du "MToolkit" du lanceur desktop sur Linux, on ouvre
|
||||
// la fenêtre en plein écran au démarrage :
|
||||
setBounds(Global.getScreenX(), Global.getScreenY(), Global.getScreenW(), Global.getScreenH());
|
||||
setSize(Global.getScreenW(), Global.getScreenH());
|
||||
} else {
|
||||
if (WIN_w>Global.getScreenW()) {
|
||||
WIN_w=Global.getScreenW();
|
||||
}
|
||||
if (WIN_h>Global.getScreenH()) {
|
||||
WIN_h=Global.getScreenH();
|
||||
}
|
||||
int x=(Global.getScreenW()-WIN_w)/2;
|
||||
int y=(Global.getScreenH()-WIN_h)/2;
|
||||
setBounds(Global.getScreenX()+x, Global.getScreenY()+y, WIN_w, WIN_h);
|
||||
setSize(WIN_w, WIN_h);
|
||||
}
|
||||
|
||||
setComponents();
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void setComponents() {
|
||||
CONTENT.setComponents();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ContentPane getContent() {
|
||||
return CONTENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point getMouseLoc() {
|
||||
return MouseInfo.getPointerInfo().getLocation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Image getImage(String s) {
|
||||
ImageIcon myicon;
|
||||
try {
|
||||
myicon=new ImageIcon(themes.class.getResource(themes.getCommonThemePath()+s));
|
||||
} catch (final Exception e) {
|
||||
try {
|
||||
myicon=new ImageIcon(themes.class.getResource(themes.getCurrentThemePath()+s));
|
||||
} catch (final Exception ex) {
|
||||
myicon=new ImageIcon(themes.class.getResource(themes.getCommonThemePath()+"null.gif"));
|
||||
}
|
||||
}
|
||||
return myicon.getImage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Image getPaletteImage(String s) {
|
||||
ImageIcon myicon;
|
||||
try {
|
||||
myicon=new ImageIcon(themes.class.getResource(themes.getPalettePath()+s+".png"));
|
||||
} catch (final Exception e) {
|
||||
try {
|
||||
myicon=new ImageIcon(themes.class.getResource(themes.getPalettePath()+s+".gif"));
|
||||
} catch (final Exception ex) {
|
||||
try {
|
||||
myicon=new ImageIcon(themes.class.getResource(themes.getBarPath()+s+".png"));
|
||||
} catch (final Exception ex2) {
|
||||
try {
|
||||
myicon=new ImageIcon(themes.class.getResource(themes.getBarPath()+s+".gif"));
|
||||
} catch (final Exception ex3) {
|
||||
myicon=new ImageIcon(themes.class.getResource(themes.getCommonThemePath()+"null.gif"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return myicon.getImage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplet() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowOpened(WindowEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowClosing(WindowEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowClosed(WindowEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowIconified(WindowEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowDeiconified(WindowEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowActivated(WindowEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowDeactivated(WindowEvent e) {
|
||||
tab_main_panel.hidePopups();
|
||||
}
|
||||
}
|
35
eric/GUI/window/Margin.java
Normal file
35
eric/GUI/window/Margin.java
Normal file
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import eric.JEricPanel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class Margin extends JEricPanel {
|
||||
|
||||
public static final int HORIZONTAL=1, VERTICAL=2;
|
||||
|
||||
public Margin(int length, int orientation) {
|
||||
int w, h;
|
||||
if (orientation==HORIZONTAL) {
|
||||
w=length;
|
||||
h=1;
|
||||
} else {
|
||||
w=1;
|
||||
h=length;
|
||||
}
|
||||
Dimension d=new Dimension(w, h);
|
||||
setPreferredSize(d);
|
||||
setMinimumSize(d);
|
||||
setMaximumSize(d);
|
||||
setSize(d);
|
||||
setOpaque(false);
|
||||
setFocusable(false);
|
||||
}
|
||||
}
|
74
eric/GUI/window/MenuBar.java
Normal file
74
eric/GUI/window/MenuBar.java
Normal file
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.GUI.pipe_tools;
|
||||
import eric.GUI.windowComponent;
|
||||
import eric.GUI.themes;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.MouseInfo;
|
||||
import java.awt.Point;
|
||||
import java.awt.event.MouseEvent;
|
||||
import javax.swing.BoxLayout;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class MenuBar extends windowComponent {
|
||||
|
||||
private Point winloc;
|
||||
private Point origin;
|
||||
private Point current;
|
||||
private static MenuBar me;
|
||||
|
||||
@Override
|
||||
public void paintComponent(Graphics g) {
|
||||
Dimension d=getSize();
|
||||
g.drawImage(themes.getImage("menubar.gif"), 0, 0, d.width, d.height,
|
||||
this);
|
||||
}
|
||||
|
||||
public void init() {
|
||||
setBounds(0, themes.getTitleBarHeight(), pipe_tools.getWindowSize().width-themes.getTotalRightPanelWidth(), themes.getMenuBarHeight());
|
||||
}
|
||||
|
||||
public MenuBar() {
|
||||
me=this;
|
||||
setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
|
||||
add(pipe_tools.getMenuBar());
|
||||
}
|
||||
|
||||
public static void setMenuVisible(boolean b) {
|
||||
try {
|
||||
me.getComponent(0).setVisible(b);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isMenuVisible() {
|
||||
return me.getComponent(0).isVisible();
|
||||
}
|
||||
|
||||
public static void reloadMenuBar() {
|
||||
me.removeAll();
|
||||
me.add(pipe_tools.getMenuBar());
|
||||
me.revalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
origin=MouseInfo.getPointerInfo().getLocation();
|
||||
winloc=pipe_tools.getWindowLocation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseDragged(MouseEvent arg0) {
|
||||
current=MouseInfo.getPointerInfo().getLocation();
|
||||
pipe_tools.setWindowLocation(winloc.x+current.x-origin.x, winloc.y+current.y-origin.y);
|
||||
pipe_tools.setWindowComponents();
|
||||
}
|
||||
}
|
92
eric/GUI/window/Monkey_panel_btn.java
Normal file
92
eric/GUI/window/Monkey_panel_btn.java
Normal file
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.GUI.pipe_tools;
|
||||
import eric.GUI.windowComponent;
|
||||
import eric.GUI.themes;
|
||||
import java.awt.AlphaComposite;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Image;
|
||||
import java.awt.event.MouseEvent;
|
||||
import rene.gui.Global;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class Monkey_panel_btn extends windowComponent {
|
||||
|
||||
private static Monkey_panel_btn me;
|
||||
private Image icon_off=themes.getImage("monkeybtn_off.png");
|
||||
private Image icon_on=themes.getImage("monkeybtn_on.png");
|
||||
private boolean isselected=false;
|
||||
private boolean isover=false;
|
||||
|
||||
public void paintComponent(Graphics g) {
|
||||
Dimension d=this.getSize();
|
||||
final int w=d.width;
|
||||
final int h=d.height;
|
||||
|
||||
final Graphics2D g2=windowComponent.getGraphics2D(g);
|
||||
if (isselected) {
|
||||
g2.drawImage(icon_on, 0, 0, w, h, this);
|
||||
} else {
|
||||
g2.drawImage(icon_off, 0, 0, w, h, this);
|
||||
}
|
||||
if (isover) {
|
||||
final AlphaComposite ac=AlphaComposite.getInstance(
|
||||
AlphaComposite.SRC_OVER, 0.3f);
|
||||
g2.setComposite(ac);
|
||||
g2.setColor(new Color(0, 0, 80));
|
||||
g2.fillRect(7, 5, 17, 11);
|
||||
}
|
||||
}
|
||||
|
||||
public Monkey_panel_btn() {
|
||||
me=this;
|
||||
setToolTipText(Global.Loc("monkey.btn.tooltip"));
|
||||
}
|
||||
|
||||
public static void setSelected(boolean b) {
|
||||
me.isselected=b;
|
||||
me.repaint();
|
||||
}
|
||||
|
||||
public void init() {
|
||||
int x=pipe_tools.getWindowSize().width-themes.getTotalRightPanelWidth()-3*themes.getOpenLeftPanelBtnDim().width-themes.getOpenMiddlePanelBtnDim().width-3*themes.getOpenPanelsBtnsMarginW();
|
||||
this.setBounds(x,
|
||||
themes.getOpenPanelsBtnsMarginH(),
|
||||
themes.getOpenLeftPanelBtnDim().width,
|
||||
themes.getOpenLeftPanelBtnDim().height);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void mousePressed(MouseEvent e) {
|
||||
isselected=true;
|
||||
repaint();
|
||||
pipe_tools.monkeyStart();
|
||||
}
|
||||
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
isselected=false;
|
||||
repaint();
|
||||
pipe_tools.monkeyStop();
|
||||
}
|
||||
|
||||
public void mouseEntered(MouseEvent arg0) {
|
||||
isover=true;
|
||||
repaint();
|
||||
}
|
||||
|
||||
public void mouseExited(MouseEvent arg0) {
|
||||
isover=false;
|
||||
repaint();
|
||||
}
|
||||
}
|
112
eric/GUI/window/Open_left_panel_btn.java
Normal file
112
eric/GUI/window/Open_left_panel_btn.java
Normal file
|
@ -0,0 +1,112 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.GUI.palette.PaletteManager;
|
||||
import eric.GUI.pipe_tools;
|
||||
import eric.GUI.windowComponent;
|
||||
import eric.GUI.themes;
|
||||
import eric.JGeneralMenuBar;
|
||||
import java.awt.AlphaComposite;
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Image;
|
||||
import java.awt.Stroke;
|
||||
import java.awt.event.MouseEvent;
|
||||
import rene.gui.Global;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class Open_left_panel_btn extends windowComponent {
|
||||
|
||||
private static Open_left_panel_btn me;
|
||||
private Image icon_off=themes.getImage("leftpanel_off.png");
|
||||
private Image icon_on=themes.getImage("leftpanel_on.png");
|
||||
private boolean isselected=false;
|
||||
private boolean isover=false;
|
||||
|
||||
public void paintComponent(Graphics g) {
|
||||
Dimension d=this.getSize();
|
||||
final int w=d.width;
|
||||
final int h=d.height;
|
||||
|
||||
final Graphics2D g2=windowComponent.getGraphics2D(g);
|
||||
if (isselected) {
|
||||
g2.drawImage(icon_on, 0, 0, w, h, this);
|
||||
} else {
|
||||
g2.drawImage(icon_off, 0, 0, w, h, this);
|
||||
}
|
||||
if (isover) {
|
||||
final AlphaComposite ac=AlphaComposite.getInstance(
|
||||
AlphaComposite.SRC_OVER, 0.3f);
|
||||
g2.setComposite(ac);
|
||||
g2.setColor(new Color(0, 0, 80));
|
||||
g2.fillRect(7, 5, 17, 11);
|
||||
}
|
||||
}
|
||||
|
||||
public Open_left_panel_btn() {
|
||||
me=this;
|
||||
setToolTipText(Global.Loc("menu.display.leftpanel"));
|
||||
}
|
||||
|
||||
public static void setSelected(boolean b) {
|
||||
me.isselected=b;
|
||||
me.repaint();
|
||||
}
|
||||
|
||||
public void init() {
|
||||
int x=pipe_tools.getWindowSize().width-themes.getTotalRightPanelWidth()-2*themes.getOpenLeftPanelBtnDim().width-themes.getOpenMiddlePanelBtnDim().width-themes.getOpenPanelsBtnsMarginW();
|
||||
this.setBounds(x,
|
||||
themes.getOpenPanelsBtnsMarginH(),
|
||||
themes.getOpenLeftPanelBtnDim().width,
|
||||
themes.getOpenLeftPanelBtnDim().height);
|
||||
}
|
||||
|
||||
public static void open() {
|
||||
if (!LeftPanel.isPanelVisible()) {
|
||||
toggle();
|
||||
}
|
||||
}
|
||||
|
||||
public static void setmode(){
|
||||
if (me!=null) {
|
||||
me.isselected=LeftPanel.isPanelVisible();
|
||||
}
|
||||
}
|
||||
|
||||
public static void toggle() {
|
||||
LeftPanel.showPanel(!LeftPanel.isPanelVisible());
|
||||
if (me!=null) {
|
||||
me.isselected=LeftPanel.isPanelVisible();
|
||||
me.repaint();
|
||||
}
|
||||
JGeneralMenuBar.initToggleItems();
|
||||
tab_main_panel.initToggleItems();
|
||||
if (pipe_tools.isApplet()) {
|
||||
pipe_tools.setWindowComponents();
|
||||
PaletteManager.init();
|
||||
}
|
||||
}
|
||||
|
||||
public void mousePressed(MouseEvent e) {
|
||||
toggle();
|
||||
}
|
||||
|
||||
public void mouseEntered(MouseEvent arg0) {
|
||||
isover=true;
|
||||
repaint();
|
||||
}
|
||||
|
||||
public void mouseExited(MouseEvent arg0) {
|
||||
isover=false;
|
||||
repaint();
|
||||
}
|
||||
}
|
99
eric/GUI/window/Open_middle_panel_btn.java
Normal file
99
eric/GUI/window/Open_middle_panel_btn.java
Normal file
|
@ -0,0 +1,99 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.GUI.pipe_tools;
|
||||
import eric.GUI.windowComponent;
|
||||
import eric.GUI.themes;
|
||||
import eric.JGeneralMenuBar;
|
||||
import java.awt.AlphaComposite;
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Image;
|
||||
import java.awt.Stroke;
|
||||
import java.awt.event.MouseEvent;
|
||||
import rene.gui.Global;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class Open_middle_panel_btn extends windowComponent {
|
||||
|
||||
private static Open_middle_panel_btn me;
|
||||
private Image icon_off=themes.getImage("middlepanel_off.png");
|
||||
private Image icon_on=themes.getImage("middlepanel_on.png");
|
||||
private boolean isselected=false;
|
||||
private boolean isover=false;
|
||||
|
||||
public void paintComponent(Graphics g) {
|
||||
Dimension d=this.getSize();
|
||||
final int w=d.width;
|
||||
final int h=d.height;
|
||||
|
||||
final Graphics2D g2=windowComponent.getGraphics2D(g);
|
||||
if (isselected) {
|
||||
g2.drawImage(icon_on, 0, 0, w, h, this);
|
||||
} else {
|
||||
g2.drawImage(icon_off, 0, 0, w, h, this);
|
||||
}
|
||||
if (isover) {
|
||||
final AlphaComposite ac=AlphaComposite.getInstance(
|
||||
AlphaComposite.SRC_OVER, 0.3f);
|
||||
g2.setComposite(ac);
|
||||
g2.setColor(new Color(0, 0, 80));
|
||||
g2.fillRect(7, 5, 17, 11);
|
||||
}
|
||||
}
|
||||
|
||||
public Open_middle_panel_btn() {
|
||||
me=this;
|
||||
isselected=Global.getParameter("comment", false);
|
||||
setToolTipText(Global.Loc("menu.display.comment"));
|
||||
}
|
||||
|
||||
public static void setmode(){
|
||||
if (me!=null) {
|
||||
me.isselected=Global.getParameter("comment", false);
|
||||
}
|
||||
}
|
||||
|
||||
public static void toggle() {
|
||||
if (me!=null) {
|
||||
me.isselected=!me.isselected;
|
||||
me.repaint();
|
||||
}
|
||||
Global.setParameter("comment", !Global.getParameter("comment", false));
|
||||
pipe_tools.setWindowComponents();
|
||||
comments.refresh();
|
||||
JGeneralMenuBar.initToggleItems();
|
||||
tab_main_panel.initToggleItems();
|
||||
}
|
||||
|
||||
public void init() {
|
||||
int x=pipe_tools.getWindowSize().width-themes.getTotalRightPanelWidth()-themes.getOpenLeftPanelBtnDim().width-themes.getOpenPanelsBtnsMarginW()-themes.getOpenMiddlePanelBtnDim().width;
|
||||
this.setBounds(x,
|
||||
themes.getOpenPanelsBtnsMarginH(),
|
||||
themes.getOpenLeftPanelBtnDim().width,
|
||||
themes.getOpenLeftPanelBtnDim().height);
|
||||
}
|
||||
|
||||
public void mousePressed(MouseEvent e) {
|
||||
toggle();
|
||||
}
|
||||
|
||||
public void mouseEntered(MouseEvent arg0) {
|
||||
isover=true;
|
||||
repaint();
|
||||
}
|
||||
|
||||
public void mouseExited(MouseEvent arg0) {
|
||||
isover=false;
|
||||
repaint();
|
||||
}
|
||||
}
|
103
eric/GUI/window/Open_right_panel_btn.java
Normal file
103
eric/GUI/window/Open_right_panel_btn.java
Normal file
|
@ -0,0 +1,103 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.GUI.palette.PaletteManager;
|
||||
import eric.GUI.pipe_tools;
|
||||
import eric.GUI.windowComponent;
|
||||
import eric.GUI.themes;
|
||||
import eric.JGeneralMenuBar;
|
||||
import java.awt.AlphaComposite;
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Image;
|
||||
import java.awt.Stroke;
|
||||
import java.awt.event.MouseEvent;
|
||||
import rene.gui.Global;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class Open_right_panel_btn extends windowComponent {
|
||||
|
||||
private Image icon_off=themes.getImage("rightpanel_off.png");
|
||||
private Image icon_on=themes.getImage("rightpanel_on.png");
|
||||
private boolean isselected=true;
|
||||
private boolean isover=false;
|
||||
private static Open_right_panel_btn me;
|
||||
|
||||
public void paintComponent(Graphics g) {
|
||||
Dimension d=this.getSize();
|
||||
final int w=d.width;
|
||||
final int h=d.height;
|
||||
|
||||
final Graphics2D g2=windowComponent.getGraphics2D(g);
|
||||
|
||||
if (isselected) {
|
||||
g2.drawImage(icon_on, 0, 0, w, h, this);
|
||||
} else {
|
||||
g2.drawImage(icon_off, 0, 0, w, h, this);
|
||||
}
|
||||
if (isover) {
|
||||
final AlphaComposite ac=AlphaComposite.getInstance(
|
||||
AlphaComposite.SRC_OVER, 0.3f);
|
||||
g2.setComposite(ac);
|
||||
g2.setColor(new Color(0, 0, 80));
|
||||
g2.fillRect(6, 5, 17, 11);
|
||||
}
|
||||
}
|
||||
|
||||
public Open_right_panel_btn() {
|
||||
me=this;
|
||||
setToolTipText(Global.Loc("menu.display.palette"));
|
||||
}
|
||||
|
||||
public void init() {
|
||||
int x=pipe_tools.getWindowSize().width-themes.getTotalRightPanelWidth()-themes.getOpenLeftPanelBtnDim().width-themes.getOpenPanelsBtnsMarginW();
|
||||
this.setBounds(x,
|
||||
themes.getOpenPanelsBtnsMarginH(),
|
||||
themes.getOpenLeftPanelBtnDim().width,
|
||||
themes.getOpenLeftPanelBtnDim().height);
|
||||
}
|
||||
|
||||
public static void setmode(){
|
||||
if (me!=null) {
|
||||
me.isselected=RightPanel.isPanelVisible();
|
||||
}
|
||||
}
|
||||
|
||||
public static void toggle() {
|
||||
RightPanel.showPanel(!RightPanel.isPanelVisible());
|
||||
if (me!=null) {
|
||||
me.isselected=RightPanel.isPanelVisible();
|
||||
me.repaint();
|
||||
}
|
||||
JGeneralMenuBar.initToggleItems();
|
||||
tab_main_panel.initToggleItems();
|
||||
PaletteManager.refresh();
|
||||
if (pipe_tools.isApplet()){
|
||||
pipe_tools.setWindowComponents();
|
||||
PaletteManager.init();
|
||||
}
|
||||
}
|
||||
|
||||
public void mousePressed(MouseEvent e) {
|
||||
toggle();
|
||||
}
|
||||
|
||||
public void mouseEntered(MouseEvent arg0) {
|
||||
isover=true;
|
||||
repaint();
|
||||
}
|
||||
|
||||
public void mouseExited(MouseEvent arg0) {
|
||||
isover=false;
|
||||
repaint();
|
||||
}
|
||||
}
|
66
eric/GUI/window/ReduceBox.java
Normal file
66
eric/GUI/window/ReduceBox.java
Normal file
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.GUI.pipe_tools;
|
||||
import eric.GUI.windowComponent;
|
||||
import eric.GUI.themes;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Image;
|
||||
import java.awt.event.MouseEvent;
|
||||
import javax.swing.JFrame;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class ReduceBox extends windowComponent {
|
||||
|
||||
private String btn="zreducebutton.png";
|
||||
private String overbtn="zreducebuttonover.png";
|
||||
private Image icon=themes.getImage(btn);
|
||||
|
||||
public void paintComponent(Graphics g) {
|
||||
Dimension d=this.getSize();
|
||||
g.drawImage(icon, 0, 0, d.width, d.height,
|
||||
this);
|
||||
}
|
||||
|
||||
public ReduceBox() {
|
||||
}
|
||||
|
||||
public void init() {
|
||||
// win=StaticTools.getMainWindow(this);
|
||||
int x;
|
||||
if (themes.MacLF()) {
|
||||
x=themes.getBoxesMarginWidth()+themes.getCloseBoxDim().width;
|
||||
} else {
|
||||
x=pipe_tools.getWindowSize().width-themes.getBoxesMarginWidth()-themes.getCloseBoxDim().width-themes.getGrowBoxDim().width-themes.getReduceBoxDim().width-themes.getTotalRightPanelWidth();
|
||||
}
|
||||
this.setBounds(x,
|
||||
themes.getBoxesMarginHeight(),
|
||||
themes.getReduceBoxDim().width,
|
||||
themes.getReduceBoxDim().height);
|
||||
}
|
||||
|
||||
public void mousePressed(MouseEvent e) {
|
||||
if (pipe_tools.getWindow() instanceof MainWindow) {
|
||||
MainWindow mw=(MainWindow) pipe_tools.getWindow();
|
||||
mw.setExtendedState(JFrame.ICONIFIED);
|
||||
mw.setComponents();
|
||||
}
|
||||
}
|
||||
|
||||
public void mouseEntered(MouseEvent arg0) {
|
||||
icon=themes.getImage(overbtn);
|
||||
repaint();
|
||||
}
|
||||
|
||||
public void mouseExited(MouseEvent arg0) {
|
||||
icon=themes.getImage(btn);
|
||||
repaint();
|
||||
}
|
||||
}
|
73
eric/GUI/window/ResizeBox.java
Normal file
73
eric/GUI/window/ResizeBox.java
Normal file
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.GUI.pipe_tools;
|
||||
import eric.GUI.windowComponent;
|
||||
import eric.GUI.themes;
|
||||
import eric.JZirkelCanvas;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.MouseInfo;
|
||||
import java.awt.Point;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class ResizeBox extends windowComponent {
|
||||
private Point origin;
|
||||
private Point current;
|
||||
private int winWidth;
|
||||
private int winHeight;
|
||||
|
||||
public void paintComponent(Graphics g) {
|
||||
Dimension d=this.getSize();
|
||||
g.drawImage(themes.getImage("zoombox.png"), 0, 0, d.width, d.height,
|
||||
this);
|
||||
}
|
||||
|
||||
public ResizeBox() {
|
||||
|
||||
}
|
||||
|
||||
public void init(){
|
||||
this.setBounds(pipe_tools.getWindowSize().width-themes.getResizeBoxWidth()-themes.getTotalRightPanelWidth(),
|
||||
pipe_tools.getWindowSize().height-themes.getResizeBoxHeight(),
|
||||
themes.getResizeBoxWidth(),
|
||||
themes.getResizeBoxHeight());
|
||||
}
|
||||
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
repaint();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
origin=MouseInfo.getPointerInfo().getLocation();
|
||||
winWidth=pipe_tools.getWindowSize().width;
|
||||
winHeight=pipe_tools.getWindowSize().height;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void mouseDragged(MouseEvent arg0) {
|
||||
current=MouseInfo.getPointerInfo().getLocation();
|
||||
int w=winWidth+current.x-origin.x;
|
||||
int h=winHeight+current.y-origin.y;
|
||||
Toolkit.getDefaultToolkit().sync();
|
||||
pipe_tools.setWindowSize(Math.max(w,210), Math.max(h,70));
|
||||
pipe_tools.setWindowComponents();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
}
|
||||
|
||||
}
|
95
eric/GUI/window/RightPanel.java
Normal file
95
eric/GUI/window/RightPanel.java
Normal file
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.GUI.palette.PaletteManager;
|
||||
import eric.GUI.pipe_tools;
|
||||
import eric.GUI.windowComponent;
|
||||
import eric.GUI.themes;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Image;
|
||||
import javax.swing.BoxLayout;
|
||||
import rene.gui.Global;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class RightPanel extends windowComponent {
|
||||
|
||||
private static int VerticalSeparator=1;
|
||||
private static Image back=themes.getImage("rightback.png");
|
||||
private static RightPanel me;
|
||||
// private static int actualSize; //width of this panel
|
||||
|
||||
public static boolean isPanelVisible() {
|
||||
return (me.getSize().width!=0);
|
||||
}
|
||||
|
||||
public static int getPanelWidth() {
|
||||
return me.getSize().width;
|
||||
}
|
||||
|
||||
public static int getSeparatorWidth() {
|
||||
if (isPanelVisible()) {
|
||||
return VerticalSeparator;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static void setPanelWidth(int size) {
|
||||
Dimension d=new Dimension(size, pipe_tools.getWindowSize().height);
|
||||
me.setPreferredSize(d);
|
||||
me.setMaximumSize(d);
|
||||
me.setMinimumSize(d);
|
||||
me.setSize(d);
|
||||
}
|
||||
|
||||
public static void showPanel(boolean vis) {
|
||||
int w=(vis)?(themes.getPaletteIconPerRow()*themes.getPaletteIconWidth()):0;
|
||||
|
||||
// if ((w>0)&&(Global.getScreenW()>=pipe_tools.getWindowSize().width+w)) {
|
||||
// pipe_tools.setWindowSize(pipe_tools.getWindowSize().width+w+VerticalSeparator, pipe_tools.getWindowSize().height);
|
||||
// }
|
||||
if(w>0){
|
||||
if(Global.getScreenW()>=pipe_tools.getWindowSize().width+w){
|
||||
pipe_tools.setWindowSize(pipe_tools.getWindowSize().width+w+VerticalSeparator, pipe_tools.getWindowSize().height);
|
||||
} else {
|
||||
pipe_tools.setWindowSize(Global.getScreenW()+VerticalSeparator, pipe_tools.getWindowSize().height);
|
||||
}
|
||||
}
|
||||
if (w==0) {
|
||||
pipe_tools.setWindowSize(pipe_tools.getWindowSize().width-getPanelWidth()-VerticalSeparator, pipe_tools.getWindowSize().height);
|
||||
}
|
||||
setPanelWidth(w);
|
||||
me.setBounds(pipe_tools.getWindowSize().width-getPanelWidth(), 0, getPanelWidth(), pipe_tools.getWindowSize().height);
|
||||
pipe_tools.setWindowComponents();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintComponent(Graphics g) {
|
||||
Dimension d=getSize();
|
||||
g.drawImage(back, 0, 0, d.width, d.height, this);
|
||||
}
|
||||
|
||||
public void init() {
|
||||
setBounds(pipe_tools.getWindowSize().width-themes.getRightPanelWidth(),
|
||||
0,
|
||||
themes.getRightPanelWidth(),
|
||||
pipe_tools.getWindowSize().height);
|
||||
PaletteManager.init();
|
||||
}
|
||||
|
||||
public RightPanel() {
|
||||
super();
|
||||
me=this;
|
||||
setPanelWidth(themes.getPaletteIconPerRow()*themes.getPaletteIconWidth());
|
||||
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
|
||||
setAlignmentX(0.0f);
|
||||
PaletteManager.construct(this);
|
||||
}
|
||||
}
|
79
eric/GUI/window/TitleBar.java
Normal file
79
eric/GUI/window/TitleBar.java
Normal file
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.GUI.pipe_tools;
|
||||
import eric.GUI.windowComponent;
|
||||
import eric.GUI.themes;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.MouseInfo;
|
||||
import java.awt.Point;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.font.FontRenderContext;
|
||||
import java.awt.font.LineMetrics;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import rene.gui.Global;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class TitleBar extends windowComponent {
|
||||
private Point origin;
|
||||
private Point current;
|
||||
private Point winloc;
|
||||
private Font TextFont=new Font("System", Font.PLAIN, 13);
|
||||
private Color TextColor=Color.DARK_GRAY;
|
||||
private String title;
|
||||
|
||||
public void paintComponent(Graphics g) {
|
||||
Dimension d=getSize();
|
||||
Graphics2D g2d=(Graphics2D) g;
|
||||
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
|
||||
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
|
||||
|
||||
g2d.drawImage(themes.getImage("titlebar.gif"), 0, 0, d.width, d.height,
|
||||
this);
|
||||
g2d.setFont(TextFont);
|
||||
FontRenderContext frc=g2d.getFontRenderContext();
|
||||
Rectangle2D bounds=TextFont.getStringBounds(title, frc);
|
||||
LineMetrics metrics=TextFont.getLineMetrics(title, frc);
|
||||
float width=(float) bounds.getWidth(); // The width of our text
|
||||
float lineheight=metrics.getHeight(); // Total line height
|
||||
float ascent=metrics.getAscent(); // Top of text to baseline
|
||||
g2d.setColor(TextColor);
|
||||
g2d.drawString(title, (pipe_tools.getWindowSize().width-themes.getTotalRightPanelWidth()-width)/2, lineheight+3);
|
||||
}
|
||||
|
||||
public void init() {
|
||||
// win=StaticTools.getMainWindow(this);
|
||||
setBounds(0, 0, pipe_tools.getWindowSize().width-themes.getTotalRightPanelWidth(), themes.getTitleBarHeight());
|
||||
}
|
||||
|
||||
public TitleBar() {
|
||||
title=Global.Loc("program.name");
|
||||
}
|
||||
|
||||
public void mousePressed(MouseEvent e) {
|
||||
origin=MouseInfo.getPointerInfo().getLocation();
|
||||
winloc=pipe_tools.getWindowLocation();
|
||||
}
|
||||
|
||||
public void mouseDragged(MouseEvent arg0) {
|
||||
current=MouseInfo.getPointerInfo().getLocation();
|
||||
pipe_tools.setWindowLocation(winloc.x+current.x-origin.x, winloc.y+current.y-origin.y);
|
||||
// pipe_tools.setWindowComponents();
|
||||
}
|
||||
|
||||
void setTitle(String s){
|
||||
title=s;
|
||||
getParent().repaint();
|
||||
}
|
||||
}
|
52
eric/GUI/window/VerticalLeftBorder.java
Normal file
52
eric/GUI/window/VerticalLeftBorder.java
Normal file
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.GUI.pipe_tools;
|
||||
import eric.GUI.windowComponent;
|
||||
import eric.GUI.themes;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.MouseInfo;
|
||||
import java.awt.Point;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class VerticalLeftBorder extends windowComponent {
|
||||
private Point origin;
|
||||
private Point current;
|
||||
private Point winloc;
|
||||
|
||||
public void paintComponent(Graphics g) {
|
||||
Dimension d=getSize();
|
||||
g.drawImage(themes.getImage("verticalseparator.png"), 0, 0, d.width, d.height,
|
||||
this);
|
||||
}
|
||||
|
||||
public void init() {
|
||||
// win=StaticTools.getMainWindow(this);
|
||||
setBounds(0,
|
||||
themes.getTitleBarHeight()+themes.getMenuBarHeight(),
|
||||
themes.getVerticalBorderWidth(),
|
||||
pipe_tools.getWindowSize().height-themes.getTitleBarHeight()-themes.getMenuBarHeight()-themes.getMainTabPanelHeight());
|
||||
}
|
||||
|
||||
public VerticalLeftBorder() {
|
||||
}
|
||||
|
||||
public void mousePressed(MouseEvent e) {
|
||||
origin=MouseInfo.getPointerInfo().getLocation();
|
||||
winloc=pipe_tools.getWindowLocation();
|
||||
}
|
||||
|
||||
public void mouseDragged(MouseEvent arg0) {
|
||||
current=MouseInfo.getPointerInfo().getLocation();
|
||||
pipe_tools.setWindowLocation(winloc.x+current.x-origin.x, winloc.y+current.y-origin.y);
|
||||
pipe_tools.setWindowComponents();
|
||||
}
|
||||
}
|
76
eric/GUI/window/VerticalLeftPanelBorder.java
Normal file
76
eric/GUI/window/VerticalLeftPanelBorder.java
Normal file
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.GUI.pipe_tools;
|
||||
import eric.GUI.windowComponent;
|
||||
import eric.GUI.themes;
|
||||
import java.awt.Cursor;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.MouseInfo;
|
||||
import java.awt.Point;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class VerticalLeftPanelBorder extends windowComponent {
|
||||
private Point origin;
|
||||
private Point current;
|
||||
//private boolean mousepressed;
|
||||
|
||||
@Override
|
||||
public void paintComponent(Graphics g) {
|
||||
Dimension d=getSize();
|
||||
g.drawImage(themes.getImage("verticalseparator.png"), 0, 0, d.width, d.height,
|
||||
this);
|
||||
}
|
||||
|
||||
public void init() {
|
||||
// win=StaticTools.getMainWindow(this);
|
||||
setBounds(themes.getLeftPanelWidth()+themes.getVerticalBorderWidth(),
|
||||
themes.getTitleBarHeight()+themes.getMenuBarHeight()+themes.getCommentsHeight(),
|
||||
themes.getVerticalPanelBorderWidth(),
|
||||
pipe_tools.getWindowSize().height-themes.getTitleBarHeight()-themes.getMenuBarHeight()-themes.getMainTabPanelHeight()-themes.getCommentsHeight());
|
||||
}
|
||||
|
||||
public VerticalLeftPanelBorder() {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
setCursor(Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {
|
||||
setCursor(Cursor.getDefaultCursor());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
origin=MouseInfo.getPointerInfo().getLocation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e){
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseDragged(MouseEvent arg0) {
|
||||
current=MouseInfo.getPointerInfo().getLocation();
|
||||
int w = LeftPanel.getFactorySize()+current.x-origin.x;
|
||||
if(w>=115 && w<=this.getParent().getWidth()/2) {
|
||||
LeftPanel.setFactorySize(w);
|
||||
origin=current;
|
||||
}
|
||||
//LeftPanel.setFactorySize(LeftPanel.getFactorySize()+current.x-origin.x);
|
||||
// LeftPanel.setFactorySize(LeftPanel.getFactorySize()+current.x-origin.x);
|
||||
// origin=current;
|
||||
}
|
||||
}
|
52
eric/GUI/window/VerticalRightBorder.java
Normal file
52
eric/GUI/window/VerticalRightBorder.java
Normal file
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.GUI.pipe_tools;
|
||||
import eric.GUI.windowComponent;
|
||||
import eric.GUI.themes;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.MouseInfo;
|
||||
import java.awt.Point;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class VerticalRightBorder extends windowComponent {
|
||||
private Point origin;
|
||||
private Point current;
|
||||
private Point winloc;
|
||||
|
||||
public void paintComponent(Graphics g) {
|
||||
Dimension d=getSize();
|
||||
g.drawImage(themes.getImage("verticalseparator.png"), 0, 0, d.width, d.height,
|
||||
this);
|
||||
}
|
||||
|
||||
public void init() {
|
||||
// win=StaticTools.getMainWindow(this);
|
||||
setBounds(pipe_tools.getWindowSize().width-themes.getVerticalBorderWidth()-themes.getTotalRightPanelWidth(),
|
||||
themes.getTitleBarHeight()+themes.getMenuBarHeight(),
|
||||
themes.getVerticalBorderWidth(),
|
||||
pipe_tools.getWindowSize().height-themes.getTitleBarHeight()-themes.getMenuBarHeight()-themes.getMainTabPanelHeight());
|
||||
}
|
||||
|
||||
public VerticalRightBorder() {
|
||||
}
|
||||
|
||||
public void mousePressed(MouseEvent e) {
|
||||
origin=MouseInfo.getPointerInfo().getLocation();
|
||||
winloc=pipe_tools.getWindowLocation();
|
||||
}
|
||||
|
||||
public void mouseDragged(MouseEvent arg0) {
|
||||
current=MouseInfo.getPointerInfo().getLocation();
|
||||
pipe_tools.setWindowLocation(winloc.x+current.x-origin.x, winloc.y+current.y-origin.y);
|
||||
pipe_tools.setWindowComponents();
|
||||
}
|
||||
}
|
29
eric/GUI/window/clock.java
Normal file
29
eric/GUI/window/clock.java
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package eric.GUI.window;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class clock {
|
||||
private static long time;
|
||||
|
||||
// public static void start(){
|
||||
// time=Calendar.getInstance().getTimeInMillis();
|
||||
// System.out.println("-- start --");
|
||||
// }
|
||||
// public static void stop(){
|
||||
// System.out.println((Calendar.getInstance().getTimeInMillis()-time)+" ms");
|
||||
// }
|
||||
// public static void print(String message){
|
||||
// long newtime=Calendar.getInstance().getTimeInMillis();
|
||||
// System.out.println(message+" : "+(newtime-time));
|
||||
// time=newtime;
|
||||
// }
|
||||
}
|
87
eric/GUI/window/comments.java
Normal file
87
eric/GUI/window/comments.java
Normal file
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.GUI.pipe_tools;
|
||||
import eric.GUI.windowComponent;
|
||||
import eric.GUI.themes;
|
||||
import eric.JZirkelCanvas;
|
||||
import eric.OS;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Image;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.geom.Point2D;
|
||||
import javax.swing.BorderFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class comments extends windowComponent {
|
||||
|
||||
private comments_area Label;
|
||||
private static comments me;
|
||||
private static Image bottom=themes.getImage("tab_top.gif");
|
||||
private static int H=themes.getIcon("tab_top.gif").getIconHeight();
|
||||
private Point2D start=new Point2D.Float(0, 0);
|
||||
// private float[] dist = {0.0f, 0.2f, 0.4f, 0.6f, 0.8f, 1.0f};
|
||||
// private Color[] colors = {Color.YELLOW, Color.ORANGE, Color.RED, Color.MAGENTA, Color.BLUE, Color.BLACK};
|
||||
private float[] dist={0.0f, 1.0f};
|
||||
// private Color[] colors={new Color(213, 232, 255), new Color(193, 212, 235)};
|
||||
private Color[] colors={new Color(225, 239, 253), new Color(193, 212, 235)};
|
||||
// private Color[] colors={new Color(225, 239, 253), new Color(146, 196, 247)};
|
||||
private boolean JavaOlderThan6=OS.isJavaOlderThan(6);
|
||||
|
||||
public void paintComponent(Graphics g) {
|
||||
Dimension d=getSize();
|
||||
Graphics2D g2d=windowComponent.getGraphics2D(g);
|
||||
if (JavaOlderThan6) {
|
||||
g2d.setColor(colors[1]);
|
||||
g2d.fillRect(0, 0, d.width, d.height);
|
||||
} else {
|
||||
|
||||
java.awt.LinearGradientPaint paint=new java.awt.LinearGradientPaint(start, new Point2D.Float(0, d.height), dist, colors);
|
||||
g2d.setPaint(paint);
|
||||
g2d.fillRect(0, 0, d.width, d.height);
|
||||
}
|
||||
g2d.setColor(Color.black);
|
||||
g2d.drawLine(0, d.height,d.width, d.height);
|
||||
super.paintComponent(g);
|
||||
}
|
||||
|
||||
public void init() {
|
||||
setBounds(themes.getVerticalBorderWidth(),
|
||||
themes.getTitleBarHeight()+themes.getMenuBarHeight(),
|
||||
pipe_tools.getWindowSize().width-2*themes.getVerticalBorderWidth()-themes.getTotalRightPanelWidth(),
|
||||
themes.getCommentsHeight());
|
||||
Label.init();
|
||||
}
|
||||
|
||||
public comments() {
|
||||
me=this;
|
||||
setLayout(null);
|
||||
Label=new comments_area();
|
||||
add(Label);
|
||||
}
|
||||
|
||||
public static void refresh() {
|
||||
me.init();
|
||||
me.validate();
|
||||
me.repaint();
|
||||
}
|
||||
|
||||
public static void setLabelText(String s) {
|
||||
me.Label.setLabelText(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
Label.edit();
|
||||
}
|
||||
}
|
232
eric/GUI/window/comments_area.java
Normal file
232
eric/GUI/window/comments_area.java
Normal file
|
@ -0,0 +1,232 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.GUI.pipe_tools;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.event.FocusAdapter;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JScrollBar;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.ScrollPaneConstants;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.plaf.basic.BasicScrollBarUI;
|
||||
import rene.gui.Global;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class comments_area extends JScrollPane {
|
||||
|
||||
private static int margins=3;
|
||||
private static int marginLeft=0, marginTop=0, marginRight=0;
|
||||
private static int scrollBarWidth=15;
|
||||
private static Font commentFont=new Font("Verdana", 0, 14);
|
||||
private static Color commentColor=new Color(20, 20, 20);
|
||||
JLabel text_area;
|
||||
private JLabel inviteLabel;
|
||||
private static MouseAdapter ma=null;
|
||||
private String label="";
|
||||
|
||||
public comments_area() {
|
||||
super();
|
||||
text_area=new JLabel("") {
|
||||
|
||||
@Override
|
||||
public Dimension getPreferredSize() {
|
||||
Dimension superPreferred=super.getPreferredSize();
|
||||
Container p=getParent();
|
||||
return new Dimension(p.getBounds().width-2*margins-scrollBarWidth, superPreferred.height);
|
||||
}
|
||||
};
|
||||
setViewportView(text_area);
|
||||
addMouseListener(new MouseAdapter() {
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
edit();
|
||||
}
|
||||
});
|
||||
text_area.setOpaque(false);
|
||||
text_area.setVerticalTextPosition(SwingConstants.TOP);
|
||||
text_area.setHorizontalTextPosition(SwingConstants.LEFT);
|
||||
text_area.setHorizontalAlignment(SwingConstants.LEFT);
|
||||
text_area.setVerticalAlignment(SwingConstants.TOP);
|
||||
text_area.setFont(commentFont);
|
||||
text_area.setForeground(commentColor);
|
||||
text_area.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
|
||||
|
||||
setOpaque(false);
|
||||
this.getViewport().setOpaque(false);
|
||||
setBorder(BorderFactory.createEmptyBorder(margins, margins, margins, margins));
|
||||
|
||||
JScrollBar vsb=getVerticalScrollBar();
|
||||
Dimension newsbsize=new Dimension(scrollBarWidth, 0);
|
||||
vsb.setUI(new BasicScrollBarUI());
|
||||
vsb.setPreferredSize(newsbsize);
|
||||
vsb.setUnitIncrement(16);
|
||||
setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
||||
|
||||
|
||||
inviteLabel=new JLabel(Global.Loc("comment.emptycomment"));
|
||||
inviteLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
|
||||
inviteLabel.setVerticalTextPosition(SwingConstants.CENTER);
|
||||
inviteLabel.setHorizontalTextPosition(SwingConstants.CENTER);
|
||||
inviteLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
inviteLabel.setVerticalAlignment(SwingConstants.CENTER);
|
||||
inviteLabel.setOpaque(false);
|
||||
inviteLabel.setFont(commentFont);
|
||||
inviteLabel.setForeground(commentColor);
|
||||
text_area.add(inviteLabel);
|
||||
setInviteLabel();
|
||||
ma=new MouseAdapter() {
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
final Component cp=e.getComponent();
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
cp.requestFocus();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
void init() {
|
||||
Container p=getParent();
|
||||
if (p!=null) {
|
||||
setBounds(0, 0, p.getBounds().width, p.getBounds().height);
|
||||
inviteLabel.setBounds(0, 0, p.getBounds().width-2*margins-scrollBarWidth, p.getBounds().height-2*margins);
|
||||
setLabelText(label);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setLabelText(String s) {
|
||||
Container p=getParent();
|
||||
if (p!=null) {
|
||||
label=s;
|
||||
// I really don't know why, but it seems that the width is increased
|
||||
// by 30%. E.g. ask for 500px will give a 650px div...
|
||||
int pix=10*(p.getBounds().width-2*margins-scrollBarWidth)/13-1;
|
||||
text_area.setText("<html><div style=\"width: "+pix+"px; text-align: justify;\">"+s+"</div></html>");
|
||||
setInviteLabel();
|
||||
}
|
||||
}
|
||||
|
||||
public String getLabelText() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setInviteLabel() {
|
||||
inviteLabel.setVisible(label.equals(""));
|
||||
}
|
||||
|
||||
public void implementMouseAdapter() {
|
||||
final ContentPane pane=pipe_tools.getContent();
|
||||
implementMouseAdapter(pane);
|
||||
}
|
||||
|
||||
public void implementMouseAdapter(Container comp) {
|
||||
if (!(comp instanceof JLabel)) {
|
||||
comp.addMouseListener(ma);
|
||||
}
|
||||
for (int i=0; i<comp.getComponentCount(); i++) {
|
||||
Container cp=(Container) comp.getComponent(i);
|
||||
implementMouseAdapter(cp);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeMouseAdapter() {
|
||||
if (ma!=null) {
|
||||
ContentPane pane=pipe_tools.getContent();
|
||||
removeMouseAdapter(pane);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeMouseAdapter(Container comp) {
|
||||
if (!(comp instanceof JLabel)) {
|
||||
comp.removeMouseListener(ma);
|
||||
}
|
||||
for (int i=0; i<comp.getComponentCount(); i++) {
|
||||
Container cp=(Container) comp.getComponent(i);
|
||||
removeMouseAdapter(cp);
|
||||
}
|
||||
}
|
||||
|
||||
public void edit() {
|
||||
final comments com=(comments) getParent();
|
||||
final JTextArea jtf=new JTextArea();
|
||||
jtf.setOpaque(false);
|
||||
jtf.setText(label);
|
||||
jtf.setBounds(getBounds());
|
||||
jtf.setFont(commentFont);
|
||||
jtf.setForeground(commentColor);
|
||||
jtf.setLineWrap(true);
|
||||
com.removeMouseListener(com);
|
||||
implementMouseAdapter();
|
||||
jtf.addKeyListener(new KeyAdapter() {
|
||||
|
||||
@Override
|
||||
public void keyPressed(final KeyEvent e) {
|
||||
if (e.getKeyCode()==KeyEvent.VK_ENTER) {
|
||||
jtf.replaceSelection("<br>");
|
||||
// e.consume();
|
||||
} else if (e.getKeyCode()==KeyEvent.VK_ESCAPE) {
|
||||
removeMouseAdapter();
|
||||
com.remove(jtf);
|
||||
com.revalidate();
|
||||
com.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
public void keyReleased(final KeyEvent e) {
|
||||
pipe_tools.setComments(jtf.getText());
|
||||
setLabelText(jtf.getText());
|
||||
}
|
||||
});
|
||||
jtf.addFocusListener(new FocusAdapter() {
|
||||
|
||||
@Override
|
||||
public void focusLost(final FocusEvent e) {
|
||||
// setLabelText(jtf.getText());
|
||||
setViewportView(text_area);
|
||||
com.remove(jtf);
|
||||
com.revalidate();
|
||||
com.repaint();
|
||||
com.addMouseListener(com);
|
||||
removeMouseAdapter();
|
||||
revalidate();
|
||||
validate();
|
||||
repaint();
|
||||
}
|
||||
});
|
||||
setViewportView(jtf);
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
jtf.requestFocus();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
52
eric/GUI/window/myJMenuItem.java
Normal file
52
eric/GUI/window/myJMenuItem.java
Normal file
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.GUI.themes;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.Icon;
|
||||
import eric.JSprogram.ScriptItem;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake modified by PM Mazat
|
||||
*/
|
||||
public class myJMenuItem extends JMenuItem implements ActionListener {
|
||||
private boolean selected;
|
||||
|
||||
public void action() {
|
||||
}
|
||||
public myJMenuItem(String s) {
|
||||
super(s);
|
||||
addActionListener(this);
|
||||
setFont(themes.TabMenusFont);
|
||||
}
|
||||
|
||||
public myJMenuItem(String s, Icon i){
|
||||
super(s, i);
|
||||
addActionListener(this);
|
||||
setFont(themes.TabMenusFont);
|
||||
}
|
||||
|
||||
public myJMenuItem(ScriptItem si, Icon i){
|
||||
super(si.getScriptName(), i);
|
||||
addActionListener(this);
|
||||
setFont(themes.TabMenusFont);
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
action();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(final boolean sel) {
|
||||
selected=sel;
|
||||
final int fontstyle=(selected)?1:0;
|
||||
setFont(new java.awt.Font(themes.TabMenusFont.getFontName(), fontstyle, themes.TabMenusFont.getSize()));
|
||||
repaint();
|
||||
}
|
||||
}
|
79
eric/GUI/window/nav_left.java
Normal file
79
eric/GUI/window/nav_left.java
Normal file
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.GUI.windowComponent;
|
||||
import eric.GUI.themes;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Image;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.image.FilteredImageSource;
|
||||
import javax.swing.GrayFilter;
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class nav_left extends windowComponent {
|
||||
|
||||
private static int marginW=0;
|
||||
private static int W=themes.getIcon("navleft.png").getIconWidth();
|
||||
private static int H=themes.getIcon("navleft.png").getIconHeight();
|
||||
private boolean over=false;
|
||||
private boolean active=false;
|
||||
private static boolean disable=false;
|
||||
private static nav_left myself=null;
|
||||
|
||||
@Override
|
||||
public void paintComponent(Graphics g) {
|
||||
Dimension d=getSize();
|
||||
if (disable) {
|
||||
final GrayFilter filter=new GrayFilter(true, 40);
|
||||
Image disImage=createImage(new FilteredImageSource(themes.getImage("navleft.png").getSource(), filter));
|
||||
ImageIcon myicn=new ImageIcon(disImage);
|
||||
g.drawImage(myicn.getImage(), 0, 0, d.width, d.height, this);
|
||||
return;
|
||||
}
|
||||
if (active) {
|
||||
g.drawImage(themes.getImage("navleftpushed.png"), 0, 0, d.width, d.height,
|
||||
this);
|
||||
}else{
|
||||
g.drawImage(themes.getImage("navleft.png"), 0, 0, d.width, d.height,
|
||||
this);
|
||||
}
|
||||
}
|
||||
|
||||
public void init() {
|
||||
setBounds(marginW+tab_control_panel.getMarginLeft(),
|
||||
tab_control_panel.getMarginTop(),
|
||||
W,
|
||||
H);
|
||||
}
|
||||
|
||||
public nav_left() {
|
||||
myself=this;
|
||||
}
|
||||
|
||||
public static void setDisabled(boolean b){
|
||||
disable=b;
|
||||
if (myself!=null) myself.repaint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
active=true;
|
||||
repaint();
|
||||
tab_main_panel.setNextActiveBtn(-1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
active=false;
|
||||
repaint();
|
||||
}
|
||||
}
|
86
eric/GUI/window/nav_menu1.java
Normal file
86
eric/GUI/window/nav_menu1.java
Normal file
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.GUI.windowComponent;
|
||||
import eric.GUI.themes;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.event.MouseEvent;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.event.PopupMenuEvent;
|
||||
import javax.swing.event.PopupMenuListener;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class nav_menu1 extends windowComponent implements PopupMenuListener {
|
||||
|
||||
private static int marginW=60;
|
||||
private static int W=themes.getIcon("navmenu1.png").getIconWidth();
|
||||
private static int H=themes.getIcon("navmenu1.png").getIconHeight();
|
||||
private boolean over=false;
|
||||
private boolean active=false;
|
||||
private static nav_menu1 myself=null;
|
||||
|
||||
@Override
|
||||
public void paintComponent(Graphics g) {
|
||||
Dimension d=getSize();
|
||||
if (active) {
|
||||
g.drawImage(themes.getImage("navmenu1pushed.png"), 0, 0, d.width, d.height,
|
||||
this);
|
||||
} else {
|
||||
g.drawImage(themes.getImage("navmenu1.png"), 0, 0, d.width, d.height,
|
||||
this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void init() {
|
||||
setBounds(marginW+tab_control_panel.getMarginLeft(),
|
||||
tab_control_panel.getMarginTop(),
|
||||
W,
|
||||
H);
|
||||
}
|
||||
|
||||
public nav_menu1() {
|
||||
myself=this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
JPopupMenu popup=tab_main_panel.getTabPopup();
|
||||
popup.removePopupMenuListener(this);
|
||||
active=true;
|
||||
popup.addPopupMenuListener(this);
|
||||
popup.show(this, (W-popup.getPreferredSize().width)/2, -2-popup.getPreferredSize().height);
|
||||
repaint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
}
|
||||
|
||||
public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
|
||||
removeMouseListener(this);
|
||||
}
|
||||
|
||||
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
|
||||
active=false;
|
||||
repaint();
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
addMouseListener(myself);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void popupMenuCanceled(PopupMenuEvent e) {
|
||||
}
|
||||
}
|
||||
|
||||
|
85
eric/GUI/window/nav_menu2.java
Normal file
85
eric/GUI/window/nav_menu2.java
Normal file
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.GUI.windowComponent;
|
||||
import eric.GUI.themes;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Image;
|
||||
import java.awt.event.MouseEvent;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.event.PopupMenuEvent;
|
||||
import javax.swing.event.PopupMenuListener;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class nav_menu2 extends windowComponent implements PopupMenuListener{
|
||||
|
||||
private static int marginW=95;
|
||||
private static int W=themes.getIcon("navmenu2.png").getIconWidth();
|
||||
private static int H=themes.getIcon("navmenu2.png").getIconHeight();
|
||||
private static Image offimage=themes.getImage("navmenu2.png");
|
||||
private static Image onimage=themes.getImage("navmenu2pushed.png");
|
||||
private boolean over=false;
|
||||
private boolean active=false;
|
||||
private static nav_menu2 myself=null;
|
||||
|
||||
@Override
|
||||
public void paintComponent(Graphics g) {
|
||||
Dimension d=getSize();
|
||||
if (active) {
|
||||
g.drawImage(onimage, 0, 0, d.width, d.height,this);
|
||||
} else {
|
||||
g.drawImage(offimage, 0, 0, d.width, d.height,this);
|
||||
}
|
||||
}
|
||||
|
||||
public void init() {
|
||||
setBounds(marginW+tab_control_panel.getMarginLeft(),
|
||||
tab_control_panel.getMarginTop(),
|
||||
W,
|
||||
H);
|
||||
}
|
||||
|
||||
public nav_menu2() {
|
||||
myself=this;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
JPopupMenu popup=tab_main_panel.getCtrlPopup();
|
||||
popup.removePopupMenuListener(this);
|
||||
active=true;
|
||||
popup.addPopupMenuListener(this);
|
||||
popup.show(this, (W-popup.getPreferredSize().width)/2, -2-popup.getPreferredSize().height);
|
||||
repaint();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
|
||||
removeMouseListener(this);
|
||||
}
|
||||
|
||||
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
|
||||
active=false;
|
||||
repaint();
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
addMouseListener(myself);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void popupMenuCanceled(PopupMenuEvent e) {
|
||||
}
|
||||
}
|
||||
|
||||
|
81
eric/GUI/window/nav_right.java
Normal file
81
eric/GUI/window/nav_right.java
Normal file
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.GUI.windowComponent;
|
||||
import eric.GUI.themes;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Image;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.image.FilteredImageSource;
|
||||
import javax.swing.GrayFilter;
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class nav_right extends windowComponent {
|
||||
|
||||
private static int marginW=24;
|
||||
private static int W=themes.getIcon("navright.png").getIconWidth();
|
||||
private static int H=themes.getIcon("navright.png").getIconHeight();
|
||||
private boolean over=false;
|
||||
private boolean active=false;
|
||||
private static boolean disable=false;
|
||||
private static nav_right myself=null;
|
||||
|
||||
@Override
|
||||
public void paintComponent(Graphics g) {
|
||||
Dimension d=getSize();
|
||||
if (disable) {
|
||||
final GrayFilter filter=new GrayFilter(true, 40);
|
||||
Image disImage=createImage(new FilteredImageSource(themes.getImage("navright.png").getSource(), filter));
|
||||
ImageIcon myicn=new ImageIcon(disImage);
|
||||
g.drawImage(myicn.getImage(), 0, 0, d.width, d.height, this);
|
||||
return;
|
||||
}
|
||||
if (active) {
|
||||
g.drawImage(themes.getImage("navrightpushed.png"), 0, 0, d.width, d.height,
|
||||
this);
|
||||
} else {
|
||||
g.drawImage(themes.getImage("navright.png"), 0, 0, d.width, d.height,
|
||||
this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void init() {
|
||||
setBounds(marginW+tab_control_panel.getMarginLeft(),
|
||||
tab_control_panel.getMarginTop(),
|
||||
W,
|
||||
H);
|
||||
}
|
||||
|
||||
public nav_right() {
|
||||
myself=this;
|
||||
}
|
||||
|
||||
public static void setDisabled(boolean b) {
|
||||
disable=b;
|
||||
if (myself!=null) {
|
||||
myself.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
active=true;
|
||||
repaint();
|
||||
tab_main_panel.setNextActiveBtn(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
active=false;
|
||||
repaint();
|
||||
}
|
||||
}
|
65
eric/GUI/window/tab_bottom.java
Normal file
65
eric/GUI/window/tab_bottom.java
Normal file
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.GUI.palette.PaletteManager;
|
||||
import eric.GUI.pipe_tools;
|
||||
import eric.GUI.windowComponent;
|
||||
import eric.GUI.themes;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Point;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.SwingConstants;
|
||||
import rene.gui.Global;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class tab_bottom extends windowComponent {
|
||||
|
||||
private Point winloc;
|
||||
private static JLabel status=new JLabel();
|
||||
private int margin=10;
|
||||
|
||||
public void paintComponent(Graphics g) {
|
||||
Dimension d=getSize();
|
||||
g.drawImage(themes.getImage("tab_bottom.gif"), 0, 0, d.width, d.height, this);
|
||||
// g.setColor(Color.black);
|
||||
// g.drawRect(0, Themes.getTabTopBorderHeight(), d.width-1, d.height-1-Themes.getTabTopBorderHeight());
|
||||
super.paintComponent(g);
|
||||
}
|
||||
|
||||
public void init() {
|
||||
// win=StaticTools.getMainWindow(this);
|
||||
setBounds(themes.getVerticalBorderWidth()+themes.getLeftPanelWidth()+themes.getVerticalPanelBorderWidth(),
|
||||
pipe_tools.getWindowSize().height-themes.getMainTabPanelHeight()-themes.getStatusBarHeight(),
|
||||
pipe_tools.getWindowSize().width-2*themes.getVerticalBorderWidth()-themes.getLeftPanelWidth()-themes.getVerticalPanelBorderWidth()-themes.getTotalRightPanelWidth(),
|
||||
themes.getStatusBarHeight());
|
||||
PaletteManager.fixsize(status, getBounds().width, getBounds().height);
|
||||
}
|
||||
|
||||
public tab_bottom() {
|
||||
setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
|
||||
setOpaque(false);
|
||||
status.setForeground(new Color(70, 70, 70));
|
||||
status.setFont(new Font(Global.GlobalFont, 0, 13));
|
||||
status.setHorizontalAlignment(JLabel.CENTER);
|
||||
status.setVerticalAlignment(JLabel.CENTER);
|
||||
add(status);
|
||||
}
|
||||
|
||||
public static void showStatus(String txt) {
|
||||
status.setText(txt);
|
||||
}
|
||||
|
||||
public static String getStatus() {
|
||||
return status.getText();
|
||||
}
|
||||
}
|
279
eric/GUI/window/tab_btn.java
Normal file
279
eric/GUI/window/tab_btn.java
Normal file
|
@ -0,0 +1,279 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.GUI.pipe_tools;
|
||||
import eric.GUI.windowComponent;
|
||||
import eric.GUI.themes;
|
||||
import eric.JZirkelCanvas;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Event;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Image;
|
||||
import java.awt.Point;
|
||||
import java.awt.event.MouseEvent;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.event.PopupMenuEvent;
|
||||
import javax.swing.event.PopupMenuListener;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class tab_btn extends windowComponent implements Comparable<tab_btn>, PopupMenuListener {
|
||||
|
||||
private tab_canvas_panel panel;
|
||||
private Point origin;
|
||||
private Point current;
|
||||
private Point btnloc;
|
||||
private boolean active=true;
|
||||
private boolean over=false;
|
||||
private tab_close_btn CloseBtn;
|
||||
private tab_btn_label Label;
|
||||
private String Tooltip="";
|
||||
private static Image on_btn_right=themes.getImage("tab_btn_on_right_border.gif");
|
||||
private static Image on_btn_left=themes.getImage("tab_btn_on_left_border.gif");
|
||||
private static Image on_btn=themes.getImage("tab_btn_on.gif");
|
||||
private static Image off_btn_right=themes.getImage("tab_btn_off_right_border.gif");
|
||||
private static Image off_btn_left=themes.getImage("tab_btn_off_left_border.gif");
|
||||
private static Image off_btn=themes.getImage("tab_btn_off.gif");
|
||||
private static Image off_over_btn_right=themes.getImage("tab_btn_off_over_right_border.gif");
|
||||
private static Image off_over_btn_left=themes.getImage("tab_btn_off_over_left_border.gif");
|
||||
private static Image off_over_btn=themes.getImage("tab_btn_off_over.gif");
|
||||
private static Image file_icon=themes.getImage("tab_file_icon.png");
|
||||
private boolean Changed=false;
|
||||
|
||||
public void paintComponent(Graphics g) {
|
||||
|
||||
Dimension d=getSize();
|
||||
final Graphics2D g2=windowComponent.getGraphics2D(g);
|
||||
|
||||
|
||||
|
||||
g2.drawImage(getBackgroundImage(), 0, 0, d.width, d.height,
|
||||
this);
|
||||
g2.drawImage(getLeftBorder(), 0, 0, themes.getTabCornerWidth(), d.height,
|
||||
this);
|
||||
g2.drawImage(getRightBorder(), d.width-themes.getTabCornerWidth(), 0, themes.getTabCornerWidth(), d.height,
|
||||
this);
|
||||
|
||||
if (!JZirkelCanvas.isWorkBook()) {
|
||||
g2.drawImage(file_icon, 4, 2, this);
|
||||
}
|
||||
// g2.setColor(Color.darkGray);
|
||||
// g2.drawLine(0, d.height-1, d.width-1, d.height-1);
|
||||
// g2.drawLine(d.width-1, d.height-1, d.width-1, 0);
|
||||
// if (!active) {
|
||||
// g2.drawLine(d.width-1, 0, 0, 0);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
public tab_btn(String label, String tooltip) {
|
||||
super();
|
||||
label=pipe_tools.processTabName(label);
|
||||
Label=new tab_btn_label(label);
|
||||
Tooltip=tooltip;
|
||||
setLayout(null);
|
||||
CloseBtn=new tab_close_btn();
|
||||
panel=new tab_canvas_panel(this);
|
||||
add(CloseBtn);
|
||||
add(Label);
|
||||
// setToolTipText(tooltip);
|
||||
setOpaque(true);
|
||||
}
|
||||
|
||||
public tab_btn(String label) {
|
||||
this(label, label);
|
||||
}
|
||||
|
||||
public void setChanged(boolean b) {
|
||||
Changed=b;
|
||||
Label.setChanged(b);
|
||||
repaint();
|
||||
}
|
||||
|
||||
public void setActive(boolean act) {
|
||||
active=act;
|
||||
if (active) {
|
||||
ContentPane.setCurrentPanel(panel);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getActive() {
|
||||
return active;
|
||||
}
|
||||
|
||||
public void setOver(boolean ov) {
|
||||
over=ov;
|
||||
}
|
||||
|
||||
public tab_close_btn getTabCloseBtn() {
|
||||
return CloseBtn;
|
||||
}
|
||||
|
||||
public tab_btn_label getTabLabel() {
|
||||
return Label;
|
||||
}
|
||||
|
||||
public tab_canvas_panel getPanel() {
|
||||
return panel;
|
||||
}
|
||||
|
||||
public void setTabName(String name, String tooltip) {
|
||||
name=pipe_tools.processTabName(name);
|
||||
Label.setLabelText(name);
|
||||
setToolTip(tooltip);
|
||||
}
|
||||
|
||||
public void setToolTip(String tooltip){
|
||||
Tooltip = tooltip;
|
||||
setToolTipText(Tooltip);
|
||||
}
|
||||
|
||||
public String getTabName() {
|
||||
return Label.getLabelText();
|
||||
}
|
||||
|
||||
public void editName() {
|
||||
if (pipe_tools.isTabEditAccepted()) {
|
||||
Label.edit();
|
||||
}
|
||||
}
|
||||
|
||||
public void init() {
|
||||
setToolTipText(Tooltip);
|
||||
getTabCloseBtn().init();
|
||||
getTabLabel().init();
|
||||
getPanel().init();
|
||||
}
|
||||
|
||||
private Image getRightBorder(){
|
||||
if (active) {
|
||||
return tab_btn.on_btn_right;
|
||||
}
|
||||
if (over) {
|
||||
return tab_btn.off_over_btn_right;
|
||||
}
|
||||
return tab_btn.off_btn_right;
|
||||
}
|
||||
|
||||
private Image getLeftBorder(){
|
||||
if (active) {
|
||||
return tab_btn.on_btn_left;
|
||||
}
|
||||
if (over) {
|
||||
return tab_btn.off_over_btn_left;
|
||||
}
|
||||
return tab_btn.off_btn_left;
|
||||
}
|
||||
|
||||
|
||||
private Image getBackgroundImage() {
|
||||
if (active) {
|
||||
return tab_btn.on_btn;
|
||||
}
|
||||
if (over) {
|
||||
return tab_btn.off_over_btn;
|
||||
}
|
||||
return tab_btn.off_btn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point getToolTipLocation(MouseEvent event) {
|
||||
return new Point(0, getSize().height+2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
origin=pipe_tools.getWindow().getMouseLoc();
|
||||
btnloc=getLocation();
|
||||
tab_main_panel.setActiveBtn(this);
|
||||
repaint();
|
||||
// pipe_tools.onTabActivate();
|
||||
// Right-clic :
|
||||
if (e.getModifiers()==Event.META_MASK) {
|
||||
JPopupMenu popup=tab_main_panel.getCtrlPopup();
|
||||
popup.removePopupMenuListener(this);
|
||||
popup.addPopupMenuListener(this);
|
||||
popup.show(this, (getSize().width-popup.getPreferredSize().width)/2, -2-popup.getPreferredSize().height);
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
|
||||
tab_main_panel.setOverBtn(this);
|
||||
repaint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {
|
||||
// Check whether the mouse cursor is still over the panel
|
||||
|
||||
// if (getMousePosition(true)!=null) {
|
||||
// return;
|
||||
// }
|
||||
over=false;
|
||||
repaint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
tab_main_panel.reorderBTNS(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseDragged(MouseEvent e) {
|
||||
getParent().setComponentZOrder(this, 0);
|
||||
current=pipe_tools.getWindow().getMouseLoc();
|
||||
if (current==null) {
|
||||
return;
|
||||
}
|
||||
setLocation(btnloc.x+current.x-origin.x, btnloc.y);
|
||||
tab_main_panel.reorderBTNS(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseMoved(MouseEvent e) {
|
||||
tab_main_panel.setOverBtn(this);
|
||||
repaint();
|
||||
|
||||
}
|
||||
|
||||
public int compareTo(tab_btn o) {
|
||||
int middle=(2*getBounds().x+getBounds().width)/2;
|
||||
if ((middle>o.getBounds().x)) {
|
||||
return 1;
|
||||
|
||||
}
|
||||
if ((middle<o.getBounds().x)) {
|
||||
return -1;
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
|
||||
removeMouseListener(this);
|
||||
}
|
||||
|
||||
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
|
||||
repaint();
|
||||
final tab_btn btn=this;
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
addMouseListener(btn);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void popupMenuCanceled(PopupMenuEvent e) {
|
||||
}
|
||||
}
|
177
eric/GUI/window/tab_btn_label.java
Normal file
177
eric/GUI/window/tab_btn_label.java
Normal file
|
@ -0,0 +1,177 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.GUI.pipe_tools;
|
||||
import eric.GUI.themes;
|
||||
import eric.JZirkelCanvas;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.event.FocusAdapter;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class tab_btn_label extends JLabel {
|
||||
|
||||
private static final int fileMarginLeft=20, workbookMarginLeft=5;
|
||||
private static int marginLeft=fileMarginLeft, marginTop=2, marginRight=15;
|
||||
private MouseAdapter ma=null;
|
||||
private boolean over=false;
|
||||
private String label="";
|
||||
|
||||
public void init() {
|
||||
int w=tab_main_panel.visibleWidth((tab_btn) getParent());
|
||||
setBounds(marginLeft,
|
||||
marginTop,
|
||||
w-marginLeft-marginRight,
|
||||
getParent().getSize().height-2*marginTop);
|
||||
String lbl=(tab_main_panel.rightcut((tab_btn) getParent()))?label+"...":label;
|
||||
setText(lbl);
|
||||
}
|
||||
|
||||
public void setLabelText(String s) {
|
||||
super.setText(label=s);
|
||||
}
|
||||
|
||||
public String getLabelText() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public tab_btn_label(String lbl) {
|
||||
super(lbl);
|
||||
label=lbl;
|
||||
setFont(themes.TabFont);
|
||||
setVerticalTextPosition(SwingConstants.TOP);
|
||||
setBorder(null);
|
||||
setOpaque(false);
|
||||
}
|
||||
|
||||
public void setChanged(boolean b) {
|
||||
Color col=Color.black;
|
||||
if (b) {
|
||||
col=themes.TabChangedColor;
|
||||
}
|
||||
marginLeft=(JZirkelCanvas.isWorkBook())?workbookMarginLeft:fileMarginLeft;
|
||||
setForeground(col);
|
||||
init();
|
||||
repaint();
|
||||
}
|
||||
|
||||
public void implementMouseAdapter() {
|
||||
tab_btn btn=(tab_btn) getParent();
|
||||
tab_main_panel mp=tab_main_panel.getme();
|
||||
tab_control_panel tcp=tab_control_panel.getme();
|
||||
final ContentPane pane=pipe_tools.getContent();
|
||||
ma=new MouseAdapter() {
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
pane.requestFocus();
|
||||
}
|
||||
};
|
||||
for (int i=0; i<pane.getComponentCount(); i++) {
|
||||
Component cp=pane.getComponent(i);
|
||||
cp.addMouseListener(ma);
|
||||
}
|
||||
for (int i=0; i<mp.getComponentCount(); i++) {
|
||||
Component cp=mp.getComponent(i);
|
||||
cp.addMouseListener(ma);
|
||||
}
|
||||
for (int i=0; i<tcp.getComponentCount(); i++) {
|
||||
Component cp=tcp.getComponent(i);
|
||||
cp.addMouseListener(ma);
|
||||
}
|
||||
|
||||
pane.addMouseListener(ma);
|
||||
}
|
||||
|
||||
public void removeMouseAdapter() {
|
||||
if (ma!=null) {
|
||||
tab_btn btn=(tab_btn) getParent();
|
||||
tab_main_panel mp=tab_main_panel.getme();
|
||||
tab_control_panel tcp=tab_control_panel.getme();
|
||||
ContentPane pane=pipe_tools.getContent();
|
||||
for (int i=0; i<pane.getComponentCount(); i++) {
|
||||
Component cp=pane.getComponent(i);
|
||||
cp.removeMouseListener(ma);
|
||||
}
|
||||
for (int i=0; i<mp.getComponentCount(); i++) {
|
||||
Component cp=mp.getComponent(i);
|
||||
cp.removeMouseListener(ma);
|
||||
}
|
||||
for (int i=0; i<tcp.getComponentCount(); i++) {
|
||||
Component cp=tcp.getComponent(i);
|
||||
cp.removeMouseListener(ma);
|
||||
}
|
||||
pane.removeMouseListener(ma);
|
||||
ma=null;
|
||||
}
|
||||
}
|
||||
|
||||
public void edit() {
|
||||
final tab_btn btn=(tab_btn) getParent();
|
||||
final tab_btn_label myself=this;
|
||||
final JTextField jtf=new JTextField(label);
|
||||
jtf.setBounds(getBounds());
|
||||
jtf.setFont(themes.TabFont);
|
||||
setVisible(false);
|
||||
implementMouseAdapter();
|
||||
jtf.addKeyListener(new KeyAdapter() {
|
||||
|
||||
@Override
|
||||
public void keyPressed(final KeyEvent e) {
|
||||
if (e.getKeyCode()==KeyEvent.VK_ENTER) {
|
||||
myself.setVisible(true);
|
||||
btn.remove(jtf);
|
||||
btn.revalidate();
|
||||
btn.repaint();
|
||||
removeMouseAdapter();
|
||||
} else if (e.getKeyCode()==KeyEvent.VK_ESCAPE) {
|
||||
myself.setVisible(true);
|
||||
jtf.setText(label);
|
||||
btn.remove(jtf);
|
||||
btn.revalidate();
|
||||
btn.repaint();
|
||||
removeMouseAdapter();
|
||||
}
|
||||
}
|
||||
});
|
||||
jtf.addFocusListener(new FocusAdapter() {
|
||||
|
||||
@Override
|
||||
public void focusLost(final FocusEvent e) {
|
||||
myself.setLabelText(pipe_tools.processTabName(jtf.getText()));
|
||||
tab_main_panel.getActiveBtn().setToolTip(label+".zir");
|
||||
removeMouseAdapter();
|
||||
myself.setVisible(true);
|
||||
btn.remove(jtf);
|
||||
btn.revalidate();
|
||||
btn.repaint();
|
||||
removeMouseAdapter();
|
||||
tab_main_panel.initBTNS(null);
|
||||
}
|
||||
});
|
||||
btn.add(jtf);
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
jtf.selectAll();
|
||||
jtf.requestFocus();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
25
eric/GUI/window/tab_canvas_panel.java
Normal file
25
eric/GUI/window/tab_canvas_panel.java
Normal file
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
|
||||
import eric.JZirkelCanvas;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class tab_canvas_panel extends JZirkelCanvas {
|
||||
private tab_btn BTN;
|
||||
|
||||
public tab_canvas_panel(tab_btn btn) {
|
||||
super();
|
||||
BTN=btn;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
71
eric/GUI/window/tab_close_btn.java
Normal file
71
eric/GUI/window/tab_close_btn.java
Normal file
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.GUI.pipe_tools;
|
||||
import eric.GUI.windowComponent;
|
||||
import eric.GUI.themes;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Image;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class tab_close_btn extends windowComponent {
|
||||
|
||||
private static int marginW=5, marginH=7;
|
||||
private static int W=themes.getIcon("tab_close.png").getIconWidth();
|
||||
private static int H=themes.getIcon("tab_close.png").getIconHeight();
|
||||
private static Image overIMG=themes.getImage("tab_close_over.png");
|
||||
private static Image IMG=themes.getImage("tab_close.png");
|
||||
private boolean over=false;
|
||||
|
||||
@Override
|
||||
public void paintComponent(Graphics g) {
|
||||
if (tab_main_panel.getBTNSsize()==1) return;
|
||||
Dimension d=getSize();
|
||||
if (tab_main_panel.rightcut((tab_btn) getParent())) {
|
||||
return;
|
||||
}
|
||||
if (over) {
|
||||
g.drawImage(themes.getImage("tab_close_over.png"), 0, 0, d.width, d.height,
|
||||
this);
|
||||
} else {
|
||||
g.drawImage(themes.getImage("tab_close.png"), 0, 0, d.width, d.height,
|
||||
this);
|
||||
}
|
||||
}
|
||||
|
||||
public void init() {
|
||||
setBounds(getParent().getBounds().width-W-marginW,
|
||||
marginH,
|
||||
W,
|
||||
H);
|
||||
}
|
||||
|
||||
public tab_close_btn() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
over=true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {
|
||||
over=false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
tab_btn parent=(tab_btn) getParent();
|
||||
tab_main_panel.setActiveBtn(parent);
|
||||
parent.repaint();
|
||||
pipe_tools.closeCurrent();
|
||||
}
|
||||
}
|
71
eric/GUI/window/tab_control_panel.java
Normal file
71
eric/GUI/window/tab_control_panel.java
Normal file
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.GUI.pipe_tools;
|
||||
import eric.GUI.windowComponent;
|
||||
import eric.GUI.themes;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class tab_control_panel extends windowComponent {
|
||||
private static int MarginLeft=10,MarginTop=8;
|
||||
private nav_left NavLeftBtn;
|
||||
private nav_right NavRightBtn;
|
||||
private nav_menu1 NavMenu1Btn;
|
||||
private nav_menu2 NavMenu2Btn;
|
||||
private static tab_control_panel myself;
|
||||
|
||||
public void paintComponent(Graphics g) {
|
||||
Dimension d=getSize();
|
||||
g.drawImage(themes.getImage("tabbar.gif"), 0, 0, d.width, d.height,this);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void paintComponent(final java.awt.Graphics g) {
|
||||
// }
|
||||
|
||||
|
||||
public void init() {
|
||||
// win=StaticTools.getMainWindow(this);
|
||||
setBounds(pipe_tools.getWindowSize().width-themes.getTabControlPanelWidth()-themes.getTotalRightPanelWidth(),
|
||||
pipe_tools.getWindowSize().height-themes.getMainTabPanelHeight(),
|
||||
themes.getTabControlPanelWidth(),
|
||||
themes.getMainTabPanelHeight());
|
||||
NavLeftBtn.init();
|
||||
NavRightBtn.init();
|
||||
NavMenu1Btn.init();
|
||||
NavMenu2Btn.init();
|
||||
}
|
||||
|
||||
public tab_control_panel() {
|
||||
myself=this;
|
||||
setLayout(null);
|
||||
NavLeftBtn=new nav_left();
|
||||
NavRightBtn=new nav_right();
|
||||
NavMenu1Btn=new nav_menu1();
|
||||
NavMenu2Btn=new nav_menu2();
|
||||
add(NavLeftBtn);
|
||||
add(NavRightBtn);
|
||||
add(NavMenu1Btn);
|
||||
add(NavMenu2Btn);
|
||||
}
|
||||
|
||||
public static tab_control_panel getme(){
|
||||
return myself;
|
||||
}
|
||||
|
||||
public static int getMarginLeft(){
|
||||
return MarginLeft;
|
||||
}
|
||||
public static int getMarginTop(){
|
||||
return MarginTop;
|
||||
}
|
||||
}
|
38
eric/GUI/window/tab_left.java
Normal file
38
eric/GUI/window/tab_left.java
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.GUI.pipe_tools;
|
||||
import eric.GUI.windowComponent;
|
||||
import eric.GUI.themes;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Point;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class tab_left extends windowComponent {
|
||||
|
||||
private Point winloc;
|
||||
|
||||
public void paintComponent(Graphics g) {
|
||||
Dimension d=getSize();
|
||||
g.drawImage(themes.getImage("tab_left.gif"), 0, 0, d.width, d.height,
|
||||
this);
|
||||
}
|
||||
|
||||
public void init() {
|
||||
// win=StaticTools.getMainWindow(this);
|
||||
setBounds(themes.getVerticalBorderWidth()+themes.getLeftPanelWidth()+themes.getVerticalPanelBorderWidth(),
|
||||
themes.getTitleBarHeight()+themes.getMenuBarHeight()+themes.getCommentsHeight()-1,
|
||||
themes.getTabLeftBorderWidth(),
|
||||
pipe_tools.getWindowSize().height-themes.getTitleBarHeight()-themes.getMenuBarHeight()-themes.getCommentsHeight()-themes.getStatusBarHeight()-themes.getMainTabPanelHeight()+2);
|
||||
}
|
||||
|
||||
public tab_left() {
|
||||
}
|
||||
}
|
530
eric/GUI/window/tab_main_panel.java
Normal file
530
eric/GUI/window/tab_main_panel.java
Normal file
|
@ -0,0 +1,530 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.FileTools;
|
||||
import eric.GUI.palette.PaletteManager;
|
||||
import eric.GUI.pipe_tools;
|
||||
import eric.GUI.windowComponent;
|
||||
import eric.GUI.themes;
|
||||
import eric.JZirkelCanvas;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.event.MouseWheelEvent;
|
||||
import java.awt.event.MouseWheelListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import eric.JEricPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.JSeparator;
|
||||
import javax.swing.SwingUtilities;
|
||||
import rene.gui.Global;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class tab_main_panel extends windowComponent implements MouseWheelListener {
|
||||
|
||||
private Color foreColor=new Color(0, 0, 0);
|
||||
private static myJMenuItem paletteitem, leftpanelitem, commentitem;
|
||||
|
||||
@Override
|
||||
public void paintComponent(Graphics g) {
|
||||
Dimension d=getSize();
|
||||
g.drawImage(themes.getImage("tabbar.gif"), 0, 0, d.width, d.height,
|
||||
this);
|
||||
}
|
||||
|
||||
public void init() {
|
||||
// win=StaticTools.getMainWindow(this);
|
||||
int wdth=pipe_tools.getWindowSize().width-themes.getTotalRightPanelWidth()-themes.getTabControlPanelWidth();
|
||||
setBounds(0,
|
||||
pipe_tools.getWindowSize().height-themes.getMainTabPanelHeight(),
|
||||
wdth,
|
||||
themes.getMainTabPanelHeight());
|
||||
initBTNS(null);
|
||||
showActiveBtn();
|
||||
}
|
||||
|
||||
public tab_main_panel() {
|
||||
me=this;
|
||||
setOpaque(true);
|
||||
setLayout(null);
|
||||
addMouseWheelListener(this);
|
||||
createTabAndCanvas("Figure 1");
|
||||
|
||||
// setFocusable(true);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseWheelMoved(MouseWheelEvent e) {
|
||||
if (BTNS.size()==0) {
|
||||
return;
|
||||
}
|
||||
int notches=e.getWheelRotation();
|
||||
int askedOffset=offset-notches*30;
|
||||
|
||||
if ((notches<0)&&(askedOffset>0)) {
|
||||
askedOffset=0;
|
||||
} else {
|
||||
if ((notches>0)&&(Rect_width*BTNS.size()+askedOffset<=getSize().width)) {
|
||||
askedOffset=getSize().width-Rect_width*(BTNS.size());
|
||||
}
|
||||
}
|
||||
offset=askedOffset;
|
||||
deOverAll();
|
||||
initBTNS(null);
|
||||
}
|
||||
/***************/
|
||||
/* STATIC PART */
|
||||
/***************/
|
||||
private static int Rect_width=150;
|
||||
private static int offset=0;
|
||||
private static int leftmargin=20;
|
||||
private static tab_main_panel me=null;
|
||||
private static ArrayList<tab_btn> BTNS=new ArrayList();
|
||||
private static JPopupMenu tab_popup=null, ctrl_popup=null;
|
||||
|
||||
public static tab_main_panel getme() {
|
||||
return me;
|
||||
}
|
||||
|
||||
public static void removeAllBtns(ContentPane content) {
|
||||
if (content!=null) {
|
||||
for (int i=0; i<BTNS.size(); i++) {
|
||||
content.remove(BTNS.get(i));
|
||||
}
|
||||
}
|
||||
BTNS.clear();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove tab and select the next tab or the tab before
|
||||
* depending if you removed the last one or not
|
||||
* @param btn : the tab_btn btn you want to remove
|
||||
*/
|
||||
public static void removeBtnAndSelect(tab_btn btn) {
|
||||
if (BTNS.size()>1) {
|
||||
int i=getActiveBtnPos();
|
||||
removeBtn(btn);
|
||||
if (i<BTNS.size()) {
|
||||
setActiveBtn(BTNS.get(i));
|
||||
} else {
|
||||
setActiveBtn(BTNS.get(i-1));
|
||||
}
|
||||
showActiveBtn();
|
||||
me.revalidate();
|
||||
me.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove tab from the JPanel and from the BTNS arrayList
|
||||
* @param btn : the tab_btn btn you want to remove
|
||||
*/
|
||||
public static void removeBtn(tab_btn btn) {
|
||||
if (BTNS.size()>1) {
|
||||
me.remove(btn);
|
||||
BTNS.remove(btn);
|
||||
initBTNS(null);
|
||||
}
|
||||
}
|
||||
|
||||
public static void addBtnAndSelect(String label) {
|
||||
tab_btn btn=new tab_btn(label);
|
||||
int i=getActiveBtnPos()+1;
|
||||
if (i==BTNS.size()) {
|
||||
me.add(btn);
|
||||
BTNS.add(btn);
|
||||
} else {
|
||||
me.add(btn, i);
|
||||
BTNS.add(i, btn);
|
||||
}
|
||||
initBTNS(null);
|
||||
setActiveBtn(btn);
|
||||
showActiveBtn();
|
||||
btn.editName();
|
||||
}
|
||||
|
||||
public static tab_btn addBtn(String name) {
|
||||
tab_btn btn=new tab_btn(name, name);
|
||||
me.add(btn);
|
||||
BTNS.add(btn);
|
||||
return btn;
|
||||
}
|
||||
|
||||
public static void createTabAndCanvas(String label, String tooltip) {
|
||||
tab_btn btn=new tab_btn(label, tooltip);
|
||||
me.add(btn);
|
||||
BTNS.add(btn);
|
||||
setActiveBtn(btn);
|
||||
showActiveBtn();
|
||||
}
|
||||
|
||||
public static void createTabAndCanvas(String label) {
|
||||
createTabAndCanvas(label, label);
|
||||
}
|
||||
|
||||
// j is the offset (1 for the next to the right, -1 to the left)
|
||||
public static void setNextActiveBtn(int j) {
|
||||
int i=getActiveBtnPos();
|
||||
try {
|
||||
setActiveBtn(BTNS.get(i+j));
|
||||
showActiveBtn();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
initNAVbtns();
|
||||
}
|
||||
|
||||
public static void setCurrentTabName(String name, String tooltip) {
|
||||
getActiveBtn().setTabName(name, tooltip);
|
||||
}
|
||||
|
||||
public static void setActiveBtn(int k) {
|
||||
setActiveBtn(BTNS.get(k));
|
||||
}
|
||||
|
||||
public static void setActiveBtn(final tab_btn btn) {
|
||||
JZirkelCanvas.stopAllScripts();
|
||||
btn.setActive(true);
|
||||
for (int i=0; i<BTNS.size(); i++) {
|
||||
if (!BTNS.get(i).equals(btn)) {
|
||||
BTNS.get(i).setActive(false);
|
||||
}
|
||||
BTNS.get(i).repaint();
|
||||
}
|
||||
initNAVbtns();
|
||||
pipe_tools.onTabActivate();
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
btn.getPanel().setComments();
|
||||
JZirkelCanvas.restartAllScripts();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static tab_btn getLastBtn() {
|
||||
if (BTNS.size()>0) {
|
||||
return BTNS.get(BTNS.size()-1);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void currentTabHaveChanged(boolean b) {
|
||||
getActiveBtn().setChanged(b);
|
||||
}
|
||||
|
||||
public static void allTabsHaveChanged(boolean b) {
|
||||
for (int i=0; i<BTNS.size(); i++) {
|
||||
BTNS.get(i).setChanged(b);
|
||||
}
|
||||
}
|
||||
|
||||
public static tab_btn getActiveBtn() {
|
||||
for (int i=0; i<BTNS.size(); i++) {
|
||||
if (BTNS.get(i).getActive()) {
|
||||
return BTNS.get(i);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static tab_canvas_panel getPanel(int i) {
|
||||
return BTNS.get(i).getPanel();
|
||||
}
|
||||
|
||||
public static tab_canvas_panel getActivePanel() {
|
||||
for (int i=0; i<BTNS.size(); i++) {
|
||||
if (BTNS.get(i).getActive()) {
|
||||
return BTNS.get(i).getPanel();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int getActiveBtnPos() {
|
||||
for (int i=0; i<BTNS.size(); i++) {
|
||||
if (BTNS.get(i).getActive()) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static int getBTNSsize() {
|
||||
return BTNS.size();
|
||||
}
|
||||
|
||||
public static tab_btn getBTN(int i) {
|
||||
return BTNS.get(i);
|
||||
}
|
||||
|
||||
public static void showActiveBtn() {
|
||||
tab_btn btn=getActiveBtn();
|
||||
boolean b1=(btn.getBounds().x+btn.getSize().width>me.getSize().width);
|
||||
if ((btn.getBounds().x+btn.getSize().width>me.getSize().width)) {
|
||||
offset-=btn.getBounds().x+btn.getSize().width-me.getSize().width;
|
||||
} else if (btn.getBounds().x<0) {
|
||||
offset+=-btn.getBounds().x;
|
||||
}
|
||||
initBTNS(null);
|
||||
}
|
||||
|
||||
public static void setOverBtn(tab_btn btn) {
|
||||
btn.setOver(true);
|
||||
for (int i=0; i<BTNS.size(); i++) {
|
||||
if (!BTNS.get(i).equals(btn)) {
|
||||
BTNS.get(i).setOver(false);
|
||||
}
|
||||
BTNS.get(i).repaint();
|
||||
}
|
||||
}
|
||||
|
||||
public static void reorderBTNS(tab_btn exceptBtn) {
|
||||
Collections.sort(BTNS);
|
||||
initBTNS(exceptBtn);
|
||||
initNAVbtns();
|
||||
}
|
||||
|
||||
public static void deOverAll() {
|
||||
for (int i=0; i<BTNS.size(); i++) {
|
||||
BTNS.get(i).setOver(false);
|
||||
}
|
||||
}
|
||||
|
||||
public static void deactiveAll() {
|
||||
for (int i=0; i<BTNS.size(); i++) {
|
||||
BTNS.get(i).setActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
public static void initNAVbtns() {
|
||||
int i=getActiveBtnPos();
|
||||
nav_left.setDisabled(i==0);
|
||||
nav_right.setDisabled(i==(BTNS.size()-1));
|
||||
}
|
||||
|
||||
public static void initBTNS(tab_btn except) {
|
||||
for (int i=0; i<BTNS.size(); i++) {
|
||||
tab_btn btn=BTNS.get(i);
|
||||
if (!btn.equals(except)) {
|
||||
int x=themes.getLeftPanelWidth()+themes.getVerticalPanelBorderWidth()+leftmargin+offset+i*Rect_width;
|
||||
int y=0;
|
||||
btn.setBounds(x, y, Rect_width-1, themes.getTabBtnHeight());
|
||||
btn.init();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean rightcut(tab_btn btn) {
|
||||
boolean b1=(btn.getBounds().x+btn.getSize().width>me.getSize().width);
|
||||
boolean b2=(btn.getBounds().x<me.getSize().width);
|
||||
return (b1&&b2);
|
||||
}
|
||||
|
||||
public static int visibleWidth(tab_btn btn) {
|
||||
if (rightcut(btn)) {
|
||||
return ((me.getSize().width-btn.getBounds().x));
|
||||
} else {
|
||||
return Rect_width;
|
||||
}
|
||||
}
|
||||
|
||||
public static JPopupMenu getTabPopup() {
|
||||
initTabPopupMenu();
|
||||
return tab_popup;
|
||||
}
|
||||
|
||||
public static void initTabPopupMenu() {
|
||||
tab_popup=new JPopupMenu();
|
||||
for (int i=0; i<BTNS.size(); i++) {
|
||||
final int j=i;
|
||||
myJMenuItem item=new myJMenuItem(BTNS.get(i).getTabName()) {
|
||||
|
||||
@Override
|
||||
public void action() {
|
||||
setActiveBtn(BTNS.get(j));
|
||||
showActiveBtn();
|
||||
}
|
||||
};
|
||||
if (BTNS.get(i).getActive()) {
|
||||
item.setFont(themes.TabSelectedMenusFont);
|
||||
}
|
||||
tab_popup.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
public static JPopupMenu getCtrlPopup() {
|
||||
initCtrlPopupMenu();
|
||||
return ctrl_popup;
|
||||
}
|
||||
|
||||
public static void initCtrlPopupMenu() {
|
||||
ctrl_popup=new JPopupMenu();
|
||||
myJMenuItem item=new myJMenuItem(Global.Loc("tab.popup.rename")) {
|
||||
|
||||
@Override
|
||||
public void action() {
|
||||
getActiveBtn().editName();
|
||||
}
|
||||
};
|
||||
if (!JZirkelCanvas.isWorkBook()) {
|
||||
item.setEnabled(false);
|
||||
}
|
||||
ctrl_popup.add(item);
|
||||
item=new myJMenuItem(Global.Loc("tab.popup.newfigure")) {
|
||||
|
||||
@Override
|
||||
public void action() {
|
||||
newTabBtn();
|
||||
}
|
||||
};
|
||||
ctrl_popup.add(item);
|
||||
item=new myJMenuItem(Global.Loc("tab.popup.duplicate")) {
|
||||
|
||||
@Override
|
||||
public void action() {
|
||||
pipe_tools.duplicateTab();
|
||||
}
|
||||
};
|
||||
ctrl_popup.add(item);
|
||||
item=new myJMenuItem(Global.Loc("tab.popup.savefileonly")) {
|
||||
|
||||
@Override
|
||||
public void action() {
|
||||
pipe_tools.saveFigure();
|
||||
}
|
||||
};
|
||||
ctrl_popup.add(item);
|
||||
ctrl_popup.add(new JSeparator());
|
||||
|
||||
item=new myJMenuItem(Global.Loc("tab.popup.openworkbook")) {
|
||||
|
||||
@Override
|
||||
public void action() {
|
||||
FileTools.openWorkBook();
|
||||
}
|
||||
};
|
||||
ctrl_popup.add(item);
|
||||
item=new myJMenuItem(Global.Loc("tab.popup.saveworkbookas")) {
|
||||
|
||||
@Override
|
||||
public void action() {
|
||||
FileTools.saveWorkBookAs();
|
||||
}
|
||||
};
|
||||
ctrl_popup.add(item);
|
||||
item=new myJMenuItem(Global.Loc("tab.popup.saveworkbook")) {
|
||||
|
||||
@Override
|
||||
public void action() {
|
||||
FileTools.saveWorkBook(JZirkelCanvas.getWorkBookFileName());
|
||||
}
|
||||
};
|
||||
ctrl_popup.add(item);
|
||||
ctrl_popup.add(new JSeparator());
|
||||
|
||||
leftpanelitem=new myJMenuItem(Global.Loc("menu.display.leftpanel")) {
|
||||
|
||||
@Override
|
||||
public void action() {
|
||||
Open_left_panel_btn.toggle();
|
||||
}
|
||||
};
|
||||
ctrl_popup.add(leftpanelitem);
|
||||
commentitem=new myJMenuItem(Global.Loc("menu.display.comment")) {
|
||||
|
||||
@Override
|
||||
public void action() {
|
||||
Open_middle_panel_btn.toggle();
|
||||
}
|
||||
};
|
||||
ctrl_popup.add(commentitem);
|
||||
paletteitem=new myJMenuItem(Global.Loc("menu.display.palette")) {
|
||||
|
||||
@Override
|
||||
public void action() {
|
||||
Open_right_panel_btn.toggle();
|
||||
}
|
||||
};
|
||||
ctrl_popup.add(paletteitem);
|
||||
ctrl_popup.add(new JSeparator());
|
||||
|
||||
item=new myJMenuItem(Global.Loc("menu.display.restrictedenvironment")) {
|
||||
|
||||
@Override
|
||||
public void action() {
|
||||
pipe_tools.showRestrictedEnvironmentManager();
|
||||
}
|
||||
};
|
||||
ctrl_popup.add(item);
|
||||
item=new myJMenuItem(Global.Loc("menu.special.definejob")) {
|
||||
|
||||
@Override
|
||||
public void action() {
|
||||
pipe_tools.showExerciseManager();
|
||||
}
|
||||
};
|
||||
ctrl_popup.add(item);
|
||||
initToggleItems();
|
||||
}
|
||||
|
||||
public static void hidePopups() {
|
||||
if (tab_popup!=null) {
|
||||
tab_popup.setVisible(false);
|
||||
}
|
||||
if (ctrl_popup!=null) {
|
||||
ctrl_popup.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean nameExists(String name) {
|
||||
for (int i=0; i<BTNS.size(); i++) {
|
||||
if (name.equals(BTNS.get(i).getTabName())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static String uniqueName(String name) {
|
||||
if (nameExists(name) && !getActiveBtn().getTabName().equals(name)) { //bug du nom lors d'enregistrement de .zir
|
||||
//if (nameExists(name)) {
|
||||
return uniqueNumberedName(name);
|
||||
} else {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
public static String uniqueNumberedName(String base) {
|
||||
int count=1;
|
||||
// System.out.print(base+":");
|
||||
base=base.replaceAll("[\\s0-9]+$", "");
|
||||
// System.out.println(base);
|
||||
while (nameExists(base+" "+count)) {
|
||||
count++;
|
||||
}
|
||||
return (base+" "+count);
|
||||
}
|
||||
|
||||
public static void newTabBtn() {
|
||||
addBtnAndSelect(uniqueNumberedName(Global.Loc("tab.newfigurebasename")));
|
||||
}
|
||||
|
||||
public static void initToggleItems() {
|
||||
if (commentitem!=null) {
|
||||
commentitem.setSelected(Global.getParameter("comment", false));
|
||||
leftpanelitem.setSelected(LeftPanel.isPanelVisible());
|
||||
paletteitem.setSelected(RightPanel.isPanelVisible());
|
||||
}
|
||||
}
|
||||
}
|
38
eric/GUI/window/tab_right.java
Normal file
38
eric/GUI/window/tab_right.java
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eric.GUI.window;
|
||||
|
||||
import eric.GUI.pipe_tools;
|
||||
import eric.GUI.windowComponent;
|
||||
import eric.GUI.themes;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Point;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class tab_right extends windowComponent {
|
||||
|
||||
private Point winloc;
|
||||
|
||||
public void paintComponent(Graphics g) {
|
||||
Dimension d=getSize();
|
||||
g.drawImage(themes.getImage("tab_right.gif"), 0, 0, d.width, d.height,
|
||||
this);
|
||||
}
|
||||
|
||||
public void init() {
|
||||
// win=StaticTools.getMainWindow(this);
|
||||
setBounds(pipe_tools.getWindowSize().width-themes.getVerticalBorderWidth()-themes.getTabRightBorderWidth()-themes.getTotalRightPanelWidth(),
|
||||
themes.getTitleBarHeight()+themes.getMenuBarHeight()+themes.getCommentsHeight()-1,
|
||||
themes.getTabRightBorderWidth(),
|
||||
pipe_tools.getWindowSize().height-themes.getTitleBarHeight()-themes.getMenuBarHeight()-themes.getCommentsHeight()-themes.getStatusBarHeight()-themes.getMainTabPanelHeight()+2);
|
||||
}
|
||||
|
||||
public tab_right() {
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue