//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // 构造函数 HWND CChildWnd::Create() { // 转到开始 Restart(); // 获取窗口状态 BOOL bMaximized = CClientWnd::GetChildCount() ? ((GetWindowLong(CClientWnd::m_hWnd, GWL_EXSTYLE) & WS_EX_CLIENTEDGE) == FALSE) : CIni::GetInt(INI_MaxOnOpen); // 创建窗口 m_hWnd = CreateMDIWindow(STR_AppName TEXT("ChildWnd"), m_tzFileName, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CClientWnd::m_hWnd, g_hInst, (LPARAM) this); if (m_hWnd) { // 调整播放窗口大小 SetVideoSize(m_uWidth, m_uHeight); _ExIf(bMaximized, ShowWindow(m_hWnd, SW_MAXIMIZE)); // 播放设置 SetPlayWnd(m_hPlayWnd); _ExIf(CIni::GetInt(INI_DirectDraw, TRUE), EnableDDraw()); _ExIf(CIni::GetInt(INI_PlayOnOpen), Play()); } return m_hWnd; }
/***************************************************************************** * VideoSettings constructor and destructor *****************************************************************************/ VideoSettings::VideoSettings() : fVideoSize( SIZE_100 ), fFlags( FLAG_CORRECT_RATIO ), fSettings( new BMessage( 'sett' ) ) { // read settings from disk status_t ret = load_settings( fSettings, "video_settings", "VideoLAN Client" ); if ( ret == B_OK ) { uint32_t flags; if ( fSettings->FindInt32( "flags", (int32*)&flags ) == B_OK ) SetFlags( flags ); uint32_t size; if ( fSettings->FindInt32( "video size", (int32*)&size ) == B_OK ) SetVideoSize( size ); } else { // figure out if we should use vertical sync by default BScreen screen(B_MAIN_SCREEN_ID); if (screen.IsValid()) { display_mode mode; screen.GetMode(&mode); float refresh = (mode.timing.pixel_clock * 1000) / ((mode.timing.h_total)* (mode.timing.v_total)); if (refresh < MIN_AUTO_VSYNC_REFRESH) AddFlags(FLAG_SYNC_RETRACE); } } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // 缩放 VOID CChildWnd::OnPlayZoom(UINT uCmd, BOOL bCascade) { DWORD dwWidth; DWORD dwHeight; _ExIf(bCascade && (CClientWnd::HasEdge() == FALSE), SendMessage(CClientWnd::m_hWnd, WM_MDICASCADE, 0, 0)); dwWidth = m_uWidth; dwHeight = m_uHeight; if (uCmd == IDM_Play_ZoomHalf) { dwWidth /= 2; dwHeight /= 2; } else if (uCmd == IDM_Play_ZoomDouble) { dwWidth *= 2; dwHeight *= 2; } SetVideoSize(dwWidth, dwHeight); }