2 JPC-RR: A x86 PC Hardware Emulator
5 Copyright (C) 2007-2009 Isis Innovation Limited
6 Copyright (C) 2009-2010 H. Ilari Liusvaara
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License version 2 as published by
10 the Free Software Foundation.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License along
18 with this program; if not, write to the Free Software Foundation, Inc.,
19 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 Based on JPC x86 PC Hardware emulator,
22 A project from the Physics Dept, The University of Oxford
24 Details about original JPC can be found at:
26 www-jpc.physics.ox.ac.uk
30 package org
.jpc
.plugins
;
33 import java
.awt
.event
.ActionListener
;
34 import java
.awt
.event
.ActionEvent
;
36 import org
.jpc
.pluginsbase
.Plugins
;
37 import org
.jpc
.pluginsbase
.Plugin
;
38 import org
.jpc
.pluginsaux
.HUDRenderer
;
39 import org
.jpc
.pluginsaux
.PCMonitorPanel
;
40 import org
.jpc
.pluginsaux
.PCMonitorPanelEmbedder
;
42 import java
.awt
.image
.BufferedImage
;
43 import java
.awt
.image
.DataBufferInt
;
44 import org
.jpc
.emulator
.VGADigitalOut
;
45 import org
.jpc
.emulator
.*;
46 import static org
.jpc
.Misc
.moveWindow
;
47 import static org
.jpc
.Misc
.errorDialog
;
48 import org
.jpc
.pluginsaux
.PNGSaver
;
54 public class PCMonitor
implements Plugin
, PCMonitorPanelEmbedder
56 private static final long serialVersionUID
= 7;
57 private int nativeWidth
;
58 private int nativeHeight
;
59 private JFrame monitorWindow
;
60 private PCMonitorPanel panel
;
62 public PCMonitor(Plugins manager
)
64 panel
= new PCMonitorPanel(this);
65 manager
.addSlaveObject(this, panel
);
67 monitorWindow
= new JFrame("VGA Monitor");
68 monitorWindow
.getContentPane().add("Center", panel
.getMonitorPanel());
69 JMenuBar bar
= new JMenuBar();
70 for(JMenu menu
: panel
.getMenusNeeded())
72 monitorWindow
.setJMenuBar(bar
);
74 monitorWindow
.setDefaultCloseOperation(JFrame
.DO_NOTHING_ON_CLOSE
);
75 Dimension d
= monitorWindow
.getSize();
76 nativeWidth
= d
.width
;
77 nativeHeight
= d
.height
;
79 monitorWindow
.setVisible(true);
82 public void eci_pcmonitor_setwinpos(Integer x
, Integer y
)
84 moveWindow(monitorWindow
, x
.intValue(), y
.intValue(), nativeWidth
, nativeHeight
);
87 public boolean systemShutdown()
93 public void pcStopping()
98 public void pcStarting()
103 public void reconnect(PC pc
)
108 public void notifySizeChange(int w
, int h
)
110 monitorWindow
.pack();
111 Dimension d
= monitorWindow
.getSize();
112 nativeWidth
= d
.width
;
113 nativeHeight
= d
.height
;
118 //Panel has its own thread.