// ----------------------------------------------------------------------------
MyFrame::MyFrame(const wxString& title)
- : wxFrame(NULL, wxID_ANY, title)
+ : wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(400,400))
{
//
// Create Menus
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);
- this->SetSizer(vertsizer);
+ wxFlexGridSizer* sizer = new wxFlexGridSizer(2, 1, 0, 0);
+ this->SetSizer(sizer);
this->SetAutoLayout(true);
+ sizer->AddGrowableRow(0);
+ sizer->AddGrowableCol(0);
//
// Create our media control
wxASSERT_MSG(bOK, wxT("Could not create media control!"));
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
0, //end
wxDefaultPosition, wxDefaultSize,
wxSL_HORIZONTAL );
- vertsizer->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);
+ sizer->Add(m_slider, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND , 5);
//
// Slider events
//
// Connect Events
//
-//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),
-// NULL, (wxEvtHandler*) this);
- m_ctrl->Connect(m_ctrl->GetId(), wxEVT_PAINT,
- wxPaintEventHandler(wxAMMediaEvtHandler::OnPaint),
+ //TODO: Greg Hazel reports problems with this... but win2k seems fine on mine...
+ //-------------------------------------------------------------------------------
+ // My problem with this was only with a previous patch, probably the third rewrite
+ // fixed it as a side-effect. In fact, the erase background style of drawing not
+ // only works now, but is much better than paint-based updates (the paint event
+ // 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);
+ //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
srcRect.top = 0; srcRect.left = 0;
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
destRect.top = 0; destRect.left = 0;
destRect.bottom = h; destRect.right = w;
//---------------------------------------------------------------------------
void wxAMMediaBackend::OnStop()
{
- //send the event to our child
- wxMediaEvent theEvent(wxEVT_MEDIA_STOP, m_ctrl->GetId());
- m_ctrl->ProcessEvent(theEvent);
+ //send the event to our child
+ wxMediaEvent theEvent(wxEVT_MEDIA_STOP, m_ctrl->GetId());
+ m_ctrl->ProcessEvent(theEvent);
- //if the user didn't veto it, stop the stream
- if (theEvent.IsAllowed())
- {
- //Interestingly enough, DirectShow does not actually stop
- //the filters - even when it reaches the end!
- wxVERIFY( Stop() );
-
- //send the event to our child
- wxMediaEvent theEvent(wxEVT_MEDIA_FINISHED,
- m_ctrl->GetId());
- m_ctrl->ProcessEvent(theEvent);
- }
+ //if the user didn't veto it, stop the stream
+ if (theEvent.IsAllowed())
+ {
+ //Interestingly enough, DirectShow does not actually stop
+ //the filters - even when it reaches the end!
+ wxVERIFY( Stop() );
+
+ //send the event to our child
+ wxMediaEvent theEvent(wxEVT_MEDIA_FINISHED,
+ m_ctrl->GetId());
+ m_ctrl->ProcessEvent(theEvent);
+ }
}
//---------------------------------------------------------------------------
//TODO: Use wxClientDC?
HDC hdc = ::GetDC((HWND)pThis->m_ctrl->GetHandle());
if( pThis->m_pVMC->RepaintVideo((HWND)pThis->m_ctrl->GetHandle(),
- hdc) != 0 )
+ hdc) != 0 )
{
wxASSERT(false);
- }
+ }
::ReleaseDC((HWND)pThis->m_ctrl->GetHandle(), hdc);
}
else
+ {
evt.Skip();
+ }
}
//---------------------------------------------------------------------------