From: Julian Smart Date: Sun, 10 Mar 2002 14:41:07 +0000 (+0000) Subject: Minor tweaks X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/0470b3826a114b510bb4937daa137ee061541b04?hp=ec0674452aec8adbb30a5a345f6c67f2013a2641 Minor tweaks git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14540 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/utils/emulator/src/Makefile.in b/utils/emulator/src/Makefile.in index 314b59ac86..a5965d35a8 100644 --- a/utils/emulator/src/Makefile.in +++ b/utils/emulator/src/Makefile.in @@ -20,4 +20,4 @@ DEPFILES=$(PROGRAM).d include ../../../src/makeprog.env -@IF_GNU_MAKE@-include $(DEPFILES) +-include $(DEPFILES) diff --git a/utils/emulator/src/emulator.cpp b/utils/emulator/src/emulator.cpp index 2740f75923..bf43a462ce 100644 --- a/utils/emulator/src/emulator.cpp +++ b/utils/emulator/src/emulator.cpp @@ -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); } diff --git a/utils/emulator/src/emulator.h b/utils/emulator/src/emulator.h index 34f5d7a868..9a59883d67 100644 --- a/utils/emulator/src/emulator.h +++ b/utils/emulator/src/emulator.h @@ -88,6 +88,8 @@ public: wxEmulatorContainer(wxWindow* parent, wxWindowID id); + void DoResize(); + void OnSize(wxSizeEvent& event); void OnPaint(wxPaintEvent& event); void OnEraseBackground(wxEraseEvent& event);