Applied patch [ 1212020 ] MediaCtrl DirectShow drawing and sample
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34472 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -291,7 +291,7 @@ bool MyApp::OnInit()
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
MyFrame::MyFrame(const wxString& title)
|
MyFrame::MyFrame(const wxString& title)
|
||||||
: wxFrame(NULL, wxID_ANY, title)
|
: wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(400,400))
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Create Menus
|
// Create Menus
|
||||||
@@ -842,11 +842,13 @@ MyNotebookPage::MyNotebookPage(wxNotebook* theBook) :
|
|||||||
wxPanel(theBook, wxID_ANY), m_nLoops(0), m_bLoop(false)
|
wxPanel(theBook, wxID_ANY), m_nLoops(0), m_bLoop(false)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Create and attach the first/main sizer
|
// Create and attach the sizer
|
||||||
//
|
//
|
||||||
wxBoxSizer* vertsizer = new wxBoxSizer(wxVERTICAL);
|
wxFlexGridSizer* sizer = new wxFlexGridSizer(2, 1, 0, 0);
|
||||||
this->SetSizer(vertsizer);
|
this->SetSizer(sizer);
|
||||||
this->SetAutoLayout(true);
|
this->SetAutoLayout(true);
|
||||||
|
sizer->AddGrowableRow(0);
|
||||||
|
sizer->AddGrowableCol(0);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create our media control
|
// Create our media control
|
||||||
@@ -858,7 +860,7 @@ MyNotebookPage::MyNotebookPage(wxNotebook* theBook) :
|
|||||||
wxASSERT_MSG(bOK, wxT("Could not create media control!"));
|
wxASSERT_MSG(bOK, wxT("Could not create media control!"));
|
||||||
wxUnusedVar(bOK);
|
wxUnusedVar(bOK);
|
||||||
|
|
||||||
vertsizer->Add(m_mediactrl, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
|
sizer->Add(m_mediactrl, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 5);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create our slider
|
// Create our slider
|
||||||
@@ -868,20 +870,7 @@ MyNotebookPage::MyNotebookPage(wxNotebook* theBook) :
|
|||||||
0, //end
|
0, //end
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
wxSL_HORIZONTAL );
|
wxSL_HORIZONTAL );
|
||||||
vertsizer->Add(m_slider, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND , 5);
|
sizer->Add(m_slider, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND , 5);
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Create the second sizer which will position things
|
|
||||||
// vertically -
|
|
||||||
//
|
|
||||||
// -------Menu----------
|
|
||||||
// [m_mediactrl]
|
|
||||||
//
|
|
||||||
// [m_slider]
|
|
||||||
//
|
|
||||||
wxBoxSizer* horzsizer = new wxBoxSizer(wxHORIZONTAL);
|
|
||||||
vertsizer->Add(horzsizer, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Slider events
|
// Slider events
|
||||||
|
@@ -1076,12 +1076,19 @@ bool wxAMMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent,
|
|||||||
// Connect Events
|
// Connect Events
|
||||||
//
|
//
|
||||||
//TODO: Greg Hazel reports problems with this... but win2k seems fine on mine...
|
//TODO: Greg Hazel reports problems with this... but win2k seems fine on mine...
|
||||||
// m_ctrl->Connect(m_ctrl->GetId(), wxEVT_ERASE_BACKGROUND,
|
//-------------------------------------------------------------------------------
|
||||||
// wxEraseEventHandler(wxAMMediaEvtHandler::OnEraseBackground),
|
// My problem with this was only with a previous patch, probably the third rewrite
|
||||||
// NULL, (wxEvtHandler*) this);
|
// fixed it as a side-effect. In fact, the erase background style of drawing not
|
||||||
m_ctrl->Connect(m_ctrl->GetId(), wxEVT_PAINT,
|
// only works now, but is much better than paint-based updates (the paint event
|
||||||
wxPaintEventHandler(wxAMMediaEvtHandler::OnPaint),
|
// handler flickers if the wxMediaCtrl shares a sizer with another child window,
|
||||||
|
// or is on a notebook)
|
||||||
|
// - Greg Hazel
|
||||||
|
m_ctrl->Connect(m_ctrl->GetId(), wxEVT_ERASE_BACKGROUND,
|
||||||
|
wxEraseEventHandler(wxAMMediaEvtHandler::OnEraseBackground),
|
||||||
NULL, (wxEvtHandler*) this);
|
NULL, (wxEvtHandler*) this);
|
||||||
|
//m_ctrl->Connect(m_ctrl->GetId(), wxEVT_PAINT,
|
||||||
|
// wxPaintEventHandler(wxAMMediaEvtHandler::OnPaint),
|
||||||
|
// NULL, (wxEvtHandler*) this);
|
||||||
|
|
||||||
//
|
//
|
||||||
// As noted below, we need to catch the Top Level Window's
|
// As noted below, we need to catch the Top Level Window's
|
||||||
@@ -1492,6 +1499,16 @@ void wxAMMediaBackend::Move(int WXUNUSED(x), int WXUNUSED(y),
|
|||||||
srcRect.top = 0; srcRect.left = 0;
|
srcRect.top = 0; srcRect.left = 0;
|
||||||
srcRect.bottom = m_bestSize.y; srcRect.right = m_bestSize.x;
|
srcRect.bottom = m_bestSize.y; srcRect.right = m_bestSize.x;
|
||||||
|
|
||||||
|
//it happens.
|
||||||
|
if (w < 0)
|
||||||
|
{
|
||||||
|
w = 0;
|
||||||
|
}
|
||||||
|
if (h < 0)
|
||||||
|
{
|
||||||
|
h = 0;
|
||||||
|
}
|
||||||
|
|
||||||
//position in window client coordinates to display and stretch to
|
//position in window client coordinates to display and stretch to
|
||||||
destRect.top = 0; destRect.left = 0;
|
destRect.top = 0; destRect.left = 0;
|
||||||
destRect.bottom = h; destRect.right = w;
|
destRect.bottom = h; destRect.right = w;
|
||||||
@@ -1627,8 +1644,10 @@ void wxAMMediaEvtHandler::OnEraseBackground(wxEraseEvent& evt)
|
|||||||
::ReleaseDC((HWND)pThis->m_ctrl->GetHandle(), hdc);
|
::ReleaseDC((HWND)pThis->m_ctrl->GetHandle(), hdc);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
evt.Skip();
|
evt.Skip();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// wxAMMediaEvtHandler::OnPaint
|
// wxAMMediaEvtHandler::OnPaint
|
||||||
|
Reference in New Issue
Block a user