Minor tweaks
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14540 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -20,4 +20,4 @@ DEPFILES=$(PROGRAM).d
|
|||||||
|
|
||||||
include ../../../src/makeprog.env
|
include ../../../src/makeprog.env
|
||||||
|
|
||||||
@IF_GNU_MAKE@-include $(DEPFILES)
|
-include $(DEPFILES)
|
||||||
|
@@ -34,12 +34,12 @@
|
|||||||
#include "wx/wx.h"
|
#include "wx/wx.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "emulator.h"
|
|
||||||
|
|
||||||
#ifdef __WXX11__
|
#ifdef __WXX11__
|
||||||
#include "wx/x11/reparent.h"
|
#include "wx/x11/reparent.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "emulator.h"
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// resources
|
// resources
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -113,8 +113,9 @@ bool wxEmulatorApp::OnInit()
|
|||||||
m_xnestWindow = new wxAdoptedWindow;
|
m_xnestWindow = new wxAdoptedWindow;
|
||||||
|
|
||||||
wxString cmd;
|
wxString cmd;
|
||||||
cmd.Printf(wxT("Xnest :100 -geometry %dx%d+50+50"),
|
// 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"),
|
||||||
|
(int) m_emulatorInfo.m_emulatorScreenSize.x, (int) m_emulatorInfo.m_emulatorScreenSize.y);
|
||||||
|
|
||||||
// Asynchronously executes Xnest
|
// Asynchronously executes Xnest
|
||||||
if (0 == wxExecute(cmd))
|
if (0 == wxExecute(cmd))
|
||||||
@@ -131,6 +132,8 @@ bool wxEmulatorApp::OnInit()
|
|||||||
frame->Destroy();
|
frame->Destroy();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_containerWindow->DoResize();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// success: wxApp::OnRun() will be called which will enter the main message
|
// 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
|
// The offset from the top-left of the main emulator
|
||||||
// bitmap and the virtual screen (where Xnest is
|
// bitmap and the virtual screen (where Xnest is
|
||||||
// positioned)
|
// positioned)
|
||||||
m_emulatorInfo.m_emulatorScreenPosition = wxPoint(45, 57);
|
m_emulatorInfo.m_emulatorScreenPosition = wxPoint(56, 69);
|
||||||
|
|
||||||
// The emulated screen size
|
// The emulated screen size
|
||||||
m_emulatorInfo.m_emulatorScreenSize = wxSize(240, 320);
|
m_emulatorInfo.m_emulatorScreenSize = wxSize(240, 320);
|
||||||
@@ -230,6 +233,11 @@ wxEmulatorContainer::wxEmulatorContainer(wxWindow* parent, wxWindowID id):
|
|||||||
}
|
}
|
||||||
|
|
||||||
void wxEmulatorContainer::OnSize(wxSizeEvent& event)
|
void wxEmulatorContainer::OnSize(wxSizeEvent& event)
|
||||||
|
{
|
||||||
|
DoResize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxEmulatorContainer::DoResize()
|
||||||
{
|
{
|
||||||
wxSize sz = GetClientSize();
|
wxSize sz = GetClientSize();
|
||||||
if (wxGetApp().m_emulatorInfo.m_emulatorBackgroundBitmap.Ok() &&
|
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 bitmapWidth = wxGetApp().m_emulatorInfo.m_emulatorBackgroundBitmap.GetWidth();
|
||||||
int bitmapHeight = wxGetApp().m_emulatorInfo.m_emulatorBackgroundBitmap.GetHeight();
|
int bitmapHeight = wxGetApp().m_emulatorInfo.m_emulatorBackgroundBitmap.GetHeight();
|
||||||
|
|
||||||
int x = wxMax(0, (sz.x - bitmapWidth)/2.0);
|
int x = wxMax(0, (int) ((sz.x - bitmapWidth)/2.0));
|
||||||
int y = wxMax(0, (sz.y - bitmapHeight)/2.0);
|
int y = wxMax(0, (int) ((sz.y - bitmapHeight)/2.0));
|
||||||
|
|
||||||
x += wxGetApp().m_emulatorInfo.m_emulatorScreenPosition.x;
|
x += wxGetApp().m_emulatorInfo.m_emulatorScreenPosition.x;
|
||||||
y += wxGetApp().m_emulatorInfo.m_emulatorScreenPosition.y;
|
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 bitmapWidth = wxGetApp().m_emulatorInfo.m_emulatorBackgroundBitmap.GetWidth();
|
||||||
int bitmapHeight = wxGetApp().m_emulatorInfo.m_emulatorBackgroundBitmap.GetHeight();
|
int bitmapHeight = wxGetApp().m_emulatorInfo.m_emulatorBackgroundBitmap.GetHeight();
|
||||||
|
|
||||||
int x = wxMax(0, (sz.x - bitmapWidth)/2.0);
|
int x = wxMax(0, (int) ((sz.x - bitmapWidth)/2.0));
|
||||||
int y = wxMax(0, (sz.y - bitmapHeight)/2.0);
|
int y = wxMax(0, (int) ((sz.y - bitmapHeight)/2.0));
|
||||||
|
|
||||||
dc.DrawBitmap(wxGetApp().m_emulatorInfo.m_emulatorBackgroundBitmap, x, y);
|
dc.DrawBitmap(wxGetApp().m_emulatorInfo.m_emulatorBackgroundBitmap, x, y);
|
||||||
}
|
}
|
||||||
|
@@ -88,6 +88,8 @@ public:
|
|||||||
|
|
||||||
wxEmulatorContainer(wxWindow* parent, wxWindowID id);
|
wxEmulatorContainer(wxWindow* parent, wxWindowID id);
|
||||||
|
|
||||||
|
void DoResize();
|
||||||
|
|
||||||
void OnSize(wxSizeEvent& event);
|
void OnSize(wxSizeEvent& event);
|
||||||
void OnPaint(wxPaintEvent& event);
|
void OnPaint(wxPaintEvent& event);
|
||||||
void OnEraseBackground(wxEraseEvent& event);
|
void OnEraseBackground(wxEraseEvent& event);
|
||||||
|
Reference in New Issue
Block a user