Minor tweaks

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14540 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart 2002-03-10 14:41:07 +00:00
parent ec0674452a
commit 0470b3826a
3 changed files with 20 additions and 10 deletions

View File

@ -20,4 +20,4 @@ DEPFILES=$(PROGRAM).d
include ../../../src/makeprog.env
@IF_GNU_MAKE@-include $(DEPFILES)
-include $(DEPFILES)

View File

@ -34,12 +34,12 @@
#include "wx/wx.h"
#endif
#include "emulator.h"
#ifdef __WXX11__
#include "wx/x11/reparent.h"
#endif
#include "emulator.h"
// ----------------------------------------------------------------------------
// resources
// ----------------------------------------------------------------------------
@ -113,8 +113,9 @@ bool wxEmulatorApp::OnInit()
m_xnestWindow = new wxAdoptedWindow;
wxString cmd;
cmd.Printf(wxT("Xnest :100 -geometry %dx%d+50+50"),
(int) m_emulatorScreenSize.x, (int) m_emulatorScreenSize.y);
// cmd.Printf(wxT("Xnest :100 -geometry %dx%d+50+50"),
cmd.Printf(wxT("Xnest :100 -geometry %dx%d"),
(int) m_emulatorInfo.m_emulatorScreenSize.x, (int) m_emulatorInfo.m_emulatorScreenSize.y);
// Asynchronously executes Xnest
if (0 == wxExecute(cmd))
@ -131,6 +132,8 @@ bool wxEmulatorApp::OnInit()
frame->Destroy();
return FALSE;
}
m_containerWindow->DoResize();
#endif
// success: wxApp::OnRun() will be called which will enter the main message
@ -150,7 +153,7 @@ bool wxEmulatorApp::LoadEmulator()
// The offset from the top-left of the main emulator
// bitmap and the virtual screen (where Xnest is
// positioned)
m_emulatorInfo.m_emulatorScreenPosition = wxPoint(45, 57);
m_emulatorInfo.m_emulatorScreenPosition = wxPoint(56, 69);
// The emulated screen size
m_emulatorInfo.m_emulatorScreenSize = wxSize(240, 320);
@ -230,6 +233,11 @@ wxEmulatorContainer::wxEmulatorContainer(wxWindow* parent, wxWindowID id):
}
void wxEmulatorContainer::OnSize(wxSizeEvent& event)
{
DoResize();
}
void wxEmulatorContainer::DoResize()
{
wxSize sz = GetClientSize();
if (wxGetApp().m_emulatorInfo.m_emulatorBackgroundBitmap.Ok() &&
@ -238,8 +246,8 @@ void wxEmulatorContainer::OnSize(wxSizeEvent& event)
int bitmapWidth = wxGetApp().m_emulatorInfo.m_emulatorBackgroundBitmap.GetWidth();
int bitmapHeight = wxGetApp().m_emulatorInfo.m_emulatorBackgroundBitmap.GetHeight();
int x = wxMax(0, (sz.x - bitmapWidth)/2.0);
int y = wxMax(0, (sz.y - bitmapHeight)/2.0);
int x = wxMax(0, (int) ((sz.x - bitmapWidth)/2.0));
int y = wxMax(0, (int) ((sz.y - bitmapHeight)/2.0));
x += wxGetApp().m_emulatorInfo.m_emulatorScreenPosition.x;
y += wxGetApp().m_emulatorInfo.m_emulatorScreenPosition.y;
@ -259,8 +267,8 @@ void wxEmulatorContainer::OnPaint(wxPaintEvent& event)
int bitmapWidth = wxGetApp().m_emulatorInfo.m_emulatorBackgroundBitmap.GetWidth();
int bitmapHeight = wxGetApp().m_emulatorInfo.m_emulatorBackgroundBitmap.GetHeight();
int x = wxMax(0, (sz.x - bitmapWidth)/2.0);
int y = wxMax(0, (sz.y - bitmapHeight)/2.0);
int x = wxMax(0, (int) ((sz.x - bitmapWidth)/2.0));
int y = wxMax(0, (int) ((sz.y - bitmapHeight)/2.0));
dc.DrawBitmap(wxGetApp().m_emulatorInfo.m_emulatorBackgroundBitmap, x, y);
}

View File

@ -88,6 +88,8 @@ public:
wxEmulatorContainer(wxWindow* parent, wxWindowID id);
void DoResize();
void OnSize(wxSizeEvent& event);
void OnPaint(wxPaintEvent& event);
void OnEraseBackground(wxEraseEvent& event);