1    /*
2    Copyright 2003 by Ralph Hartley
3    This software is licenced under the terms of the
4    Gnu Public Licence
5    */
6    import javax.swing.*;
7    import javax.swing.event.*;
8    import java.io.*;
9    import java.awt.event.*;
10   import java.awt.*;
11   import java.util.*;
12   
13   public class EditFrame extends JInternalFrame {
14   
15     Editor edit;
16   
17     Vector edits = new Vector(); 
18   
19     public static Dimension defaultsize = new Dimension(700,600);
20   
21     public void setSize(Dimension size) {
22       if (size==null) size = defaultsize;
23       super.setSize(size);
24   
25   /*    try {
26         Dimension maxsize = Toolkit.GetDefaultToolkit().getScreenSize();
27   
28         if (size.width>maxsize.width) size = new Dimension(maxsize.width);
29         if (size.height>maxsize.height) size = new Dimension(maxsize.height);
30   
31       } (catch HeadlessException ex) {
32         ErrorFile.exception(ex);
33       }
34   */
35     }
36   
37     public EditFrame(String s,boolean a,boolean b,boolean c,boolean d,
38           	   Editor edit,boolean insert) {
39       super(s,a,b,c,d);
40       this.edits.add(edit);
41       this.edit = edit;
42   
43   //    addInternalFrameListener(new InternalFrameAdapter() {
44   //      public void internalFrameClosing(InternalFrameEvent e) {
45   //        cleanup();
46   //      }});
47   
48       if (insert) getContentPane().add(edit,BorderLayout.CENTER);
49     }
50   
51     public EditFrame(String s,boolean a,boolean b,boolean c,boolean d) {
52       super(s,a,b,c,d);
53     }
54     
55     public void dispose() {
56       CartoFrame fr = null;
57       for (Iterator it = edits.iterator(); it.hasNext();) {
58         Editor edit = (Editor)it.next();
59         fr = edit.frame;
60         edit.cleanup();
61       }
62       edits = null;
63       super.dispose();
64       if (fr!=null) fr.desk.remove(this);
65       fr = null;
66     }
67   
68   }
69