package Current.popups.Unfold; import Current.gui.*; import Current.basic.*; import Current.manage.*; import Current.plot.Dyadic.*; import java.applet.Applet; import java.awt.event.*; import java.awt.*; public class BoxAnalyzerCanvas extends DBCanvas implements MouseListener { UnfoldCanvas U; ListenSquare[][] L=new ListenSquare[2][2000]; ListenSquare FLIP,O0,O1; ListenSquare I; Integer[][] R=new Integer[4][2000]; Integer [][] R0=new Integer[2][100]; ListenSquare[][] L0=new ListenSquare[2][100]; int N,N0,N1,N00,N01; int space; int[] top; int[] bot; double radius; int mode; int offset0,offset1; DyadicTile DT; // the current box tile public BoxAnalyzerCanvas(UnfoldCanvas U) { this.U=U; mode=0; offset0=0; offset1=0; N=0; radius=0; I=new ListenSquare(0,0,12,12,Color.white); FLIP=new ListenSquare(18,4,16,16,Color.white); O0=new ListenSquare(42,6,12,12,Color.white); O0.on=1; O1=new ListenSquare(60,6,12,12,Color.white); O1.on=1; FLIP.on=1; setBackground(new Color(0,80,0)); setSize(100,24); addMouseListener(this); DT=null; if (U==null) { System.out.println("U should not be null."); } U.UC.F.choice=0; } public void paint(Graphics gfx) { Graphics2D g=(Graphics2D) gfx; Dimension D=this.getSize(); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.setColor(Color.white); I.infoRender(g); FLIP.render(g,new Color(0,100,100)); O0.render(g,new Color(0,0,200)); O1.render(g,new Color(0,0,80)); g.setFont(new Font("Monospaced",Font.PLAIN,10)); if (DT!=null) { // draw this iff DT has been defined. leaderRender(g); recordRender(g); } g.setColor(Color.white); g.drawRect(0,0,D.width-1,D.height-1); } public void colorsOff(int q) { for(int i=1;i1) offset0=R[0][1].intValue(); setUp(); } if(O1.inside(X)==1) { if(N1>1) offset1=R[2][1].intValue(); System.out.println(offset1); setUp(); } if(I.inside(X)==1) document(); for(int i=1;iOLD) { OLD=NEW; ++count; n[count]=i-1; } } if(2*countN) ii=ii-N; if((r[0][ii]!=ii)&&(r[0][ii]!=0)) { R[0][count0]=new Integer(ii); R[1][count0]=new Integer(r[0][ii]); s0=R[0][count0].toString(); s1=R[1][count0].toString(); size0=5*Math.max(s0.length(),s1.length())+5; col0=new Color(0,0,180); L[0][count0]=new ListenSquare(space0-2,0,size0,24,col0); space0=space0+size0; ++count0; } } N0=count0; ii=offset1; space0=space0+7; for(int i=1;i<=N;++i) { ii=i+offset1; if(ii>N) ii=ii-N; if((r[1][ii]!=ii)&&(r[1][ii]!=0)) { R[2][count1]=new Integer(ii); R[3][count1]=new Integer(r[1][ii]); s2=R[2][count1].toString(); s3=R[3][count1].toString(); size1=5*Math.max(s2.length(),s3.length())+5; col1=new Color(0,0,180); L[1][count1]=new ListenSquare(space0-2,0,size1,24,col1); space0=space0+size1; ++count1; } } N1=count1; } public void setRecord1(int space) { int space0=space; int space1=space; int count0=1; int count1=1; int size0; int size1; Color col0=new Color(0,0,0); Color col1=new Color(0,0,0); int[][] r=DT.record; N=r[0][0]; String s0=new String(); String s1=new String(); String s2=new String(); String s3=new String(); int ii=offset1; for(int i=1;i<=N;++i) { ii=i+offset1; if(ii>N) ii=ii-N; if((r[1][ii]!=ii)&&(r[1][ii]!=0)) { R[2][count1]=new Integer(ii); R[3][count1]=new Integer(r[1][ii]); s2=R[2][count1].toString(); s3=R[3][count1].toString(); size0=5*Math.max(s2.length(),s3.length())+5; col1=new Color(0,0,180); L[1][count1]=new ListenSquare(space0-2,0,size0,24,col1); space0=space0+size0; ++count1; } } N1=count1; ii=offset0; space0=space0+7; for(int i=1;i<=N;++i) { ii=i+offset0; if(ii>N)ii=ii-N; if((r[0][ii]!=ii)&&(r[0][ii]!=0)) { R[0][count0]=new Integer(ii); R[1][count0]=new Integer(r[0][ii]); s0=R[0][count0].toString(); s1=R[1][count0].toString(); size0=5*Math.max(s0.length(),s1.length())+5; col0=new Color(0,0,180); L[0][count0]=new ListenSquare(space0-2,0,size0,24,col0); space0=space0+size0; ++count0; } } N0=count0; } public void document() { U.M.mcbSend(new HelpDocument("BoxAnalyzerCanvas.html")); } }