void CPPageFullscreen::OnUpdateSetFullscreenRes() { CMonitor curmonitor; CMonitors monitors; CString strCurMon; curmonitor = monitors.GetNearestMonitor(AfxGetApp()->m_pMainWnd); curmonitor.GetName(strCurMon); if (m_iMonitorTypeCtrl.GetCurSel() == 0) { m_iMonitorTypeCtrl.SetCurSel(iCurMon); m_f_hmonitor = strCurMon; } SetModified(); }
void CPPageFullscreen::OnUpdateFullScrCombo() { CMonitors monitors; CMonitor curmonitor; CString str, strCurMonID, strCurMon; str = m_MonitorDisplayNames[m_iMonitorTypeCtrl.GetCurSel()]; if (str.GetLength() == 14) { m_f_hmonitor = str.Left(7); } if (str.GetLength() == 19) { m_f_hmonitor = str.Left(12); } strCurMonID = str.Right(7); curmonitor = monitors.GetNearestMonitor(AfxGetApp()->m_pMainWnd); curmonitor.GetName(strCurMon); if (m_f_hmonitor == _T("Current") && m_AutoChangeFullscrRes.bEnabled > 0) { m_f_hmonitor = strCurMon; } if (m_f_hmonitor != _T("Current") && m_f_hmonitor != strCurMon) { m_AutoChangeFullscrRes.bEnabled = false; } ModesUpdate(); SetModified(); }
GraphicsInterface::GraphicsInterface() { InitializeCriticalSection(&_csCreateDisplay); _hTimerQueue = CreateTimerQueue(); _hDisplayTimer = NULL; _nDisplayType = 0; _override_always_up = false; _bmInfo = NULL; if (m_ssSettings.bOSDAllMonitors) { CMonitors cm; for (int i = 0; i < cm.GetCount(); ++i) { _ges.push_back(new GraphicsEngine(i)); } } else { GraphicsEngine* ge = new GraphicsEngine(m_ssSettings.nOSDMonitor); _ges.push_back(ge); } }
void CLMenu::UpdatePosition(CPoint pt) { if(!IsWindow(m_hWnd) || !IsWindowVisible()) { return; } CMonitors monitors; CMonitor *monitor = monitors.GetMonitor(pt); if(!monitor) { return; } CRect r; GetWindowRect(&r); if(parent) { r.MoveToXY(pt.x - SHADOW_SIZE - BORDER_SIZE, pt.y - SHADOW_SIZE - BORDER_SIZE - RADIUS / 2); } else { switch(position) { case DockPositionBottom: { r.MoveToXY(pt.x - SHADOW_SIZE - BORDER_SIZE - RADIUS / 2 - ARROW_WIDTH / 2, pt.y - SHADOW_SIZE - BORDER_SIZE - RADIUS - ARROW_HEIGHT - ITEM_HEIGHT * ItemCount(TRUE)); } break; case DockPositionTop: { r.MoveToXY(pt.x - SHADOW_SIZE - BORDER_SIZE - RADIUS / 2 - ARROW_WIDTH / 2, pt.y - SHADOW_SIZE - BORDER_SIZE); } break; case DockPositionRight: { r.MoveToXY(pt.x - SHADOW_SIZE - BORDER_SIZE - RADIUS - ITEM_ADDITION - GetMaxItemWidth(), pt.y - SHADOW_SIZE - BORDER_SIZE - RADIUS / 2 - (ITEM_HEIGHT * ItemCount(TRUE)) / 2); } break; case DockPositionLeft: { r.MoveToXY(pt.x - SHADOW_SIZE - BORDER_SIZE, pt.y - SHADOW_SIZE - BORDER_SIZE - RADIUS / 2 - (ITEM_HEIGHT * ItemCount(TRUE)) / 2); } break; default: { r.MoveToXY(pt.x - SHADOW_SIZE - BORDER_SIZE, pt.y - SHADOW_SIZE - BORDER_SIZE - RADIUS / 2); } break; } } CRect monitorRect = monitor->Rect(); // update position on the screen //int a = arrowOffset; //arrowOffset = 0; if(r.left < monitorRect.left) { /*arrowOffset = r.left - monitor->rect.left; if(arrowOffset < SHADOW_SIZE + RADIUS / 2) { arrowOffset = 0; }*/ r.MoveToX(monitorRect.left); } if(r.top < monitorRect.top) { r.MoveToY(monitorRect.top); } if(r.bottom > monitorRect.bottom) { r.MoveToY(r.top - (r.bottom - monitorRect.bottom)); } //int arrowRight = r.Width() - SHADOW_SIZE * 2 - RADIUS - ARROW_WIDTH; if(!parent) { if(r.right > monitorRect.right) { /*arrowOffset = r.right - monitor->rect.right; if(arrowOffset > arrowRight) { arrowOffset = arrowRight; }*/ r.MoveToX(r.left - (r.right - monitorRect.right)); } } else { CRect rect; parent->GetWindowRect(&rect); if(r.right > monitorRect.right) { /*arrowOffset = r.right - monitor->rect.right; if(arrowOffset > arrowRight) { arrowOffset = arrowRight; }*/ r.MoveToX(rect.left - r.Width() + SHADOW_SIZE * 2); } } SetWindowPos(this, r.left, r.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); /*if(a != arrowOffset) { DrawBckg(); Draw(); }*/ }
bool CLMenu::Popup(CLMenu *Parent, DockPosition position, int X, int Y) { if(!IsWindow(m_hWnd) || IsWindowVisible()) { return FALSE; } CMonitors monitors; CMonitor *monitor = monitors.GetMonitor(CPoint(X, Y)); if(!monitor) { return FALSE; } CLMenu::position = position; parent = Parent; SetSelected(NULL); if(ItemCount(TRUE, TRUE) == 0) { return FALSE; } CRect r; if(parent) { r.left = X - SHADOW_SIZE - BORDER_SIZE; r.top = Y - SHADOW_SIZE - BORDER_SIZE - RADIUS / 2; r.right = r.left + SHADOW_SIZE * 2 + BORDER_SIZE * 2 + RADIUS + ITEM_ADDITION + GetMaxItemWidth(); r.bottom = r.top + SHADOW_SIZE * 2 + BORDER_SIZE * 2 + RADIUS + ITEM_HEIGHT * ItemCount(TRUE); } else { switch(position) { case DockPositionBottom: { r.left = X - SHADOW_SIZE - BORDER_SIZE - RADIUS / 2 - ARROW_WIDTH / 2; r.top = Y - SHADOW_SIZE - BORDER_SIZE - RADIUS - ARROW_HEIGHT - ITEM_HEIGHT * ItemCount(TRUE); r.right = r.left + SHADOW_SIZE * 2 + BORDER_SIZE * 2 + RADIUS + ITEM_ADDITION + GetMaxItemWidth(); r.bottom = Y + SHADOW_SIZE + BORDER_SIZE; } break; case DockPositionTop: { r.left = X - SHADOW_SIZE - BORDER_SIZE - RADIUS / 2 - ARROW_WIDTH / 2; r.top = Y - SHADOW_SIZE - BORDER_SIZE; r.right = r.left + SHADOW_SIZE * 2 + BORDER_SIZE * 2 + RADIUS + ITEM_ADDITION + GetMaxItemWidth(); r.bottom = Y + SHADOW_SIZE + BORDER_SIZE + ARROW_HEIGHT + RADIUS + ITEM_HEIGHT * ItemCount(TRUE); } break; case DockPositionRight: { r.left = X - SHADOW_SIZE - BORDER_SIZE - RADIUS - ITEM_ADDITION - GetMaxItemWidth(); r.top = Y - SHADOW_SIZE - BORDER_SIZE - RADIUS / 2 - (ITEM_HEIGHT * ItemCount(TRUE)) / 2; r.right = X + SHADOW_SIZE + BORDER_SIZE; r.bottom = r.top + SHADOW_SIZE * 2 + BORDER_SIZE * 2 + RADIUS + ITEM_HEIGHT * ItemCount(TRUE); } break; case DockPositionLeft: { r.left = X - SHADOW_SIZE - BORDER_SIZE; r.top = Y - SHADOW_SIZE - BORDER_SIZE - RADIUS / 2 - (ITEM_HEIGHT * ItemCount(TRUE)) / 2; r.right = X + SHADOW_SIZE + BORDER_SIZE + RADIUS + ITEM_ADDITION + GetMaxItemWidth(); r.bottom = r.top + SHADOW_SIZE * 2 + BORDER_SIZE * 2 + RADIUS + ITEM_HEIGHT * ItemCount(TRUE); } break; default: { r.left = X - SHADOW_SIZE - BORDER_SIZE; r.top = Y - SHADOW_SIZE - BORDER_SIZE - RADIUS / 2; r.right = r.left + SHADOW_SIZE * 2 + BORDER_SIZE * 2 + RADIUS + ITEM_ADDITION + GetMaxItemWidth(); r.bottom = r.top + SHADOW_SIZE * 2 + BORDER_SIZE * 2 + RADIUS + ITEM_HEIGHT * ItemCount(TRUE); } break; } } // update position on the screen CRect monitorRect = monitor->Rect(); arrowOffset = 3; if(r.left < monitorRect.left) { arrowOffset = r.left - monitorRect.left; if(arrowOffset < SHADOW_SIZE + RADIUS / 2) { arrowOffset = 3; } r.MoveToX(monitorRect.left); } if(r.top < monitorRect.top) { r.MoveToY(monitorRect.top); } if(r.bottom > monitorRect.bottom) { r.MoveToY(r.top - (r.bottom - monitorRect.bottom)); } int arrowRight = r.Width() - SHADOW_SIZE * 2 - RADIUS - ARROW_WIDTH; if(!parent) { if(r.right > monitorRect.right) { arrowOffset = r.right - monitorRect.right; if(arrowOffset > arrowRight) { arrowOffset = arrowRight - 3; } r.MoveToX(r.left - (r.right - monitorRect.right)); } } else { CRect rect; parent->GetWindowRect(&rect); if(r.right > monitorRect.right) { arrowOffset = r.right - monitorRect.right; if(arrowOffset > arrowRight) { arrowOffset = arrowRight - 3; } r.MoveToX(rect.left - r.Width() + SHADOW_SIZE * 2); } } SetWindowPos(this, r.left, r.top, r.Width(), r.Height(), SWP_NOZORDER | SWP_NOACTIVATE); POSITION p = items.GetHeadPosition(); while(p) { DrawItem(items.GetAt(p)); items.GetNext(p); } DrawBckg(); DrawLayer(); tmp = new CDIB(); tmp->Resize(dib->Width(), dib->Height()); UpdateLayer(tmp); ShowWindow(SW_SHOW); SetTimer(TIMER_SHOW, 10, NULL); showStartAt = GetTickCount(); return TRUE; }
/* static */ BOOL CALLBACK CMonitors::MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) { CMonitors *self = (CMonitors *)dwData; return self->MonitorEnumProc(hMonitor, hdcMonitor, lprcMonitor); }
BOOL CPPageFullscreen::OnInitDialog() { __super::OnInitDialog(); SetHandCursor(m_hWnd, IDC_COMBO1); const CAppSettings& s = AfxGetAppSettings(); m_fullScreenMonitor = s.strFullScreenMonitor; m_bLaunchFullscreen = s.fLaunchfullscreen; m_fExitFullScreenAtTheEnd = s.fExitFullScreenAtTheEnd; m_autoChangeFSModes = s.autoChangeFSMode.modes; m_bAutoChangeFSModeEnabled = s.autoChangeFSMode.bEnabled; m_bAutoChangeFSModeApplyDefModeAtFSExist = s.autoChangeFSMode.bApplyDefaultModeAtFSExit; m_bAutoChangeFSModeRestoreResAfterProgExit = s.autoChangeFSMode.bRestoreResAfterProgExit; m_uAutoChangeFullscrResDelay = s.autoChangeFSMode.uDelay; CMonitors monitors; CString currentMonitorName; monitors.GetNearestMonitor(AfxGetMainWnd()).GetName(currentMonitorName); m_fullScreenMonitorCtrl.AddString(ResStr(IDS_FULLSCREENMONITOR_CURRENT)); m_monitorDisplayNames.emplace_back(_T("Current")); m_iFullScreenMonitor = 0; for (int i = 0; i < monitors.GetCount(); i++) { CMonitor monitor = monitors.GetMonitor(i); if (monitor.IsMonitor()) { CString monitorName; monitor.GetName(monitorName); CString str = monitorName; if (monitorName == currentMonitorName) { str.AppendFormat(_T(" - [%s]"), ResStr(IDS_FULLSCREENMONITOR_CURRENT)); } DISPLAY_DEVICE displayDevice = { sizeof(displayDevice) }; if (EnumDisplayDevices(monitorName, 0, &displayDevice, 0)) { str.AppendFormat(_T(" - %s"), displayDevice.DeviceString); } m_fullScreenMonitorCtrl.AddString(str); m_monitorDisplayNames.emplace_back(monitorName); if (m_fullScreenMonitor == monitorName && m_iFullScreenMonitor == 0) { m_iFullScreenMonitor = m_fullScreenMonitorCtrl.GetCount() - 1; } } } if (m_fullScreenMonitorCtrl.GetCount() > 2) { GetDlgItem(IDC_COMBO1)->EnableWindow(TRUE); } else { m_iFullScreenMonitor = 0; GetDlgItem(IDC_COMBO1)->EnableWindow(FALSE); } m_list.SetExtendedStyle(m_list.GetExtendedStyle() | LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER | LVS_EX_GRIDLINES | LVS_EX_BORDERSELECT | LVS_EX_ONECLICKACTIVATE | LVS_EX_CHECKBOXES | LVS_EX_FLATSB); m_list.InsertColumn(COL_N, ResStr(IDS_PPAGE_FS_CLN_ON_OFF), LVCFMT_LEFT, 60); m_list.InsertColumn(COL_FRAMERATE_START, ResStr(IDS_PPAGE_FS_CLN_FROM_FPS), LVCFMT_RIGHT, 60); m_list.InsertColumn(COL_FRAMERATE_STOP, ResStr(IDS_PPAGE_FS_CLN_TO_FPS), LVCFMT_RIGHT, 60); m_list.InsertColumn(COL_DISPLAY_MODE, ResStr(IDS_PPAGE_FS_CLN_DISPLAY_MODE), LVCFMT_LEFT, 135); m_bHideFullscreenControls = s.bHideFullscreenControls; m_uHideFullscreenControlsDelay = s.uHideFullscreenControlsDelay; m_bHideFullscreenDockedPanels = s.bHideFullscreenDockedPanels; auto addHidePolicy = [&](LPCTSTR lpszName, CAppSettings::HideFullscreenControlsPolicy ePolicy) { int n = m_hidePolicy.InsertString(-1, lpszName); if (n >= 0) { VERIFY(m_hidePolicy.SetItemData(n, static_cast<DWORD_PTR>(ePolicy)) != CB_ERR); if (ePolicy == s.eHideFullscreenControlsPolicy) { VERIFY(m_hidePolicy.SetCurSel(n) == n); } } else { ASSERT(FALSE); } }; auto loadString = [&](UINT nID) { CString ret; VERIFY(ret.LoadString(nID)); return ret; }; addHidePolicy(loadString(IDS_PPAGEFULLSCREEN_SHOWNEVER), CAppSettings::HideFullscreenControlsPolicy::SHOW_NEVER); addHidePolicy(loadString(IDS_PPAGEFULLSCREEN_SHOWMOVED), CAppSettings::HideFullscreenControlsPolicy::SHOW_WHEN_CURSOR_MOVED); addHidePolicy(loadString(IDS_PPAGEFULLSCREEN_SHOHHOVERED), CAppSettings::HideFullscreenControlsPolicy::SHOW_WHEN_HOVERED); m_delaySpinner.SetRange32(0, 9); CorrectComboListWidth(m_fullScreenMonitorCtrl); CorrectComboListWidth(m_hidePolicy); CorrectComboBoxHeaderWidth(GetDlgItem(IDC_CHECK2)); CorrectComboBoxHeaderWidth(GetDlgItem(IDC_CHECK4)); ModesUpdate(); EnableToolTips(TRUE); UpdateData(FALSE); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void GraphicsInterface::DisplayInfo(wstring wstrText, bool bArtwork, wchar_t *wcArt, int display_time, bool bUpdateOnly) { GraphicsEngineOptions geo; RECT rcScreen; CMonitors cm; POINT pt = { 0, 0 }; Color cNull = Color(0, 0, 0, 0); Color cTemp; Color cOutline; Color cArtOutline; Color cDropShadow; REAL rTemp; if (!m_ssSettings.bVisualFeedback) return; if (m_ssSettings.bNoDisplayWhenActive && m_ITCom->IsActiveWindow()) return; if (bUpdateOnly && (_nDisplayType == 1 || !IsDisplayVisible())) return; EnterCriticalSection(&_csCreateDisplay); _nDisplayType = 0; // Configure geo.nDisplayAlpha = m_ssSettings.nOSDAlpha; geo.bDisplayTopMost = m_ssSettings.bOSDTopMost; geo.nMaxWidth = m_ssSettings.nOSDMaxWidth; geo.nArtScaleMode = m_ssSettings.nArtMode == 3 ? ART_SCALEMODEHEIGHT : ART_SCALEMODESIZE; geo.saAlign = (Gdiplus::StringAlignment)m_ssSettings.nOSDTextJustify; geo.bForceToWidth = m_ssSettings.bOSDForceWidth; if (!bArtwork || NULL == wcArt || 0 == wcscmp(wcArt, L"")) { for (const auto& ge : _ges) { ge->SetOptions(geo); ge->BeginRender(5); } } else { for (const auto& ge : _ges) { ge->SetOptions(geo); ge->BeginRender(m_ssSettings.nDisplayLayout); } } // Set background and borders rTemp = (REAL)m_ssSettings.nOSDBorderSize; cOutline = Color(GetRValue(m_ssSettings.lOSDBorderColor), GetGValue(m_ssSettings.lOSDBorderColor), GetBValue(m_ssSettings.lOSDBorderColor)); cTemp = Color(GetRValue(m_ssSettings.lOSDBkColorRef), GetGValue(m_ssSettings.lOSDBkColorRef), GetBValue(m_ssSettings.lOSDBkColorRef)); cDropShadow = Color(GetRValue(m_ssSettings.lDropShadowColor), GetGValue(m_ssSettings.lDropShadowColor), GetBValue(m_ssSettings.lDropShadowColor)); cArtOutline = Color(GetRValue(m_ssSettings.lArtBorderColor), GetGValue(m_ssSettings.lArtBorderColor), GetBValue(m_ssSettings.lArtBorderColor)); for (const auto& ge : _ges) { ge->SetDisplayBorder(m_ssSettings.bOSDOutlineMode ? cNull : cOutline, rTemp); ge->SetDisplayBackground(m_ssSettings.bOSDOutlineMode ? cNull : cTemp); } // Add album art if needed if (bArtwork && m_ssSettings.bShowArtwork) { for (const auto& ge : _ges) { ge->AddArt(wcArt, false, cArtOutline, 1.5f, (float)m_ssSettings.nArtConstSize, m_ssSettings.nArtMode == 3 ? IMG_SCALENONE : IMG_SCALEALL); } } // Cache text height for shapes static REAL text_height; if (!bUpdateOnly) text_height = _ges.at(0)->GetTextHeight(m_ssSettings.wcFontFace, (float)m_ssSettings.nOSDFontPoint, m_ssSettings.nOSDFontStyle); // Break string into lines, add to display wchar_t *lpToken = NULL; wchar_t *lpContext = NULL; std::wstring line; size_t current_position = 0; size_t next_rating = 0; size_t next_format = 0; int old_font_style = m_ssSettings.nOSDFontStyle; cTemp = Color(GetRValue(m_ssSettings.lOSDColorRef), GetGValue(m_ssSettings.lOSDColorRef), GetBValue(m_ssSettings.lOSDColorRef)); Color cShapeFill = Color(GetRValue(m_ssSettings.lRatingShapeFill), GetGValue(m_ssSettings.lRatingShapeFill), GetBValue(m_ssSettings.lRatingShapeFill)); Color cShapeOutline = Color(GetRValue(m_ssSettings.lRatingShapeOutline), GetGValue(m_ssSettings.lRatingShapeOutline), GetBValue(m_ssSettings.lRatingShapeOutline)); lpToken = wcstok_s(const_cast<wchar_t*>(wstrText.c_str()), L"\n", &lpContext); while (NULL != lpToken && m_ssSettings.nDisplayLayout != 4) { for (const auto& ge : _ges) { ge->BeginLine(); } line = lpToken; current_position = 0; do { next_rating = line.find(L"%rating%", current_position); next_format = line.find(L"<", current_position); if ((next_rating == std::wstring::npos && next_format != std::wstring::npos) || (next_format != std::wstring::npos && next_rating != std::wstring::npos && next_format < next_rating)) { // format if ((next_format - current_position) > 0) { for (const auto& ge : _ges) { ge->AddString(line.substr(current_position, next_format - current_position).c_str(), false, m_ssSettings.nOSDFontStyle, (float)m_ssSettings.nOSDFontPoint, cTemp, m_ssSettings.wcFontFace, m_ssSettings.bOSDOutlineMode ? cOutline : cNull, 1.5f, m_ssSettings.bUseDropShadow ? m_ssSettings.fDropShadowOffset : 0.0f, cDropShadow); } } if (line.compare(next_format, 3, L"<b>") == 0) { m_ssSettings.nOSDFontStyle |= FontStyleBold; current_position = next_format + 3; } else if (line.compare(next_format, 3, L"<i>") == 0) { m_ssSettings.nOSDFontStyle |= FontStyleItalic; current_position = next_format + 3; } else if (line.compare(next_format, 4, L"</b>") == 0) { m_ssSettings.nOSDFontStyle &= ~FontStyleBold; current_position = next_format + 4; } else if (line.compare(next_format, 4, L"</i>") == 0) { m_ssSettings.nOSDFontStyle &= ~FontStyleItalic; current_position = next_format + 4; } else { for (const auto& ge : _ges) { ge->AddString(line.substr(next_format, 1).c_str(), false, m_ssSettings.nOSDFontStyle, (float)m_ssSettings.nOSDFontPoint, cTemp, m_ssSettings.wcFontFace, m_ssSettings.bOSDOutlineMode ? cOutline : cNull, 1.5f, m_ssSettings.bUseDropShadow ? m_ssSettings.fDropShadowOffset : 0.0f, cDropShadow); } current_position = next_format + 1; } } else if ((next_format == std::wstring::npos && next_rating != std::wstring::npos) || (next_format != std::wstring::npos && next_rating != std::wstring::npos && next_rating < next_format)) { // rating if ((next_rating - current_position) > 0) { for (const auto& ge : _ges) { ge->AddString(line.substr(current_position, next_rating - current_position).c_str(), false, m_ssSettings.nOSDFontStyle, (float)m_ssSettings.nOSDFontPoint, cTemp, m_ssSettings.wcFontFace, m_ssSettings.bOSDOutlineMode ? cOutline : cNull, 1.5f, m_ssSettings.bUseDropShadow ? m_ssSettings.fDropShadowOffset : 0.0f, cDropShadow); } } // Add rating long lRating = m_ITCom->GetTrackRating(); long lWhole = (lRating - (lRating % 20)) / 20; lRating = lRating - lWhole * 20; long lHalf = (lRating - (lRating % 10)) / 10; long lEmpty = 5 - lWhole - lHalf; RectF rfShape = RectF(0, 0, text_height, text_height); for (int i = 0; i < lWhole; i++) { for (const auto& ge : _ges) { if (m_ssSettings.nRatingType == 1) ge->AddImage(m_ssSettings.wcRatingFullPath); else ge->AddShape((ShapeType)m_ssSettings.nRatingShapeType, FillAll, rfShape, false, cShapeOutline, 3.0, cShapeFill); } } for (int i = 0; i < lHalf; i++) { for (const auto& ge : _ges) { if (m_ssSettings.nRatingType == 1) ge->AddImage(m_ssSettings.wcRatingHalfPath); else ge->AddShape((ShapeType)m_ssSettings.nRatingShapeType, (ShapeStyle)(m_ssSettings.nRatingShapeStyle + 2), rfShape, false, cShapeOutline, 3.0, cShapeFill); } } for (int i = 0; i < lEmpty; i++) { for (const auto& ge : _ges) { if (m_ssSettings.nRatingType == 1) ge->AddImage(m_ssSettings.wcRatingEmptyPath); else ge->AddShape((ShapeType)m_ssSettings.nRatingShapeType, FillNone, rfShape, false, cShapeOutline, 3.0, cShapeFill); } } current_position = next_rating + 8; } else { // no special processing needed if (line.substr(current_position, std::wstring::npos).length() > 0) { for (const auto& ge : _ges) { ge->AddString(line.substr(current_position, std::wstring::npos).c_str(), false, m_ssSettings.nOSDFontStyle, (float)m_ssSettings.nOSDFontPoint, cTemp, m_ssSettings.wcFontFace, m_ssSettings.bOSDOutlineMode ? cOutline : cNull, 1.5f, m_ssSettings.bUseDropShadow ? m_ssSettings.fDropShadowOffset : 0.0f, cDropShadow); } } } } while (next_format != std::wstring::npos || next_rating != std::wstring::npos); for (const auto& ge : _ges) { ge->EndLine(); } lpToken = wcstok_s(NULL, L"\n", &lpContext); } // Restore font style m_ssSettings.nOSDFontStyle = old_font_style; // Show display, start timer if (_bmInfo) { delete _bmInfo; _bmInfo = NULL; } if (m_ssSettings.bOSDAllMonitors) { bool has_track_pos = (NULL != wcsstr(m_ssSettings.wcOSDFormat, L"%track_position%")); int monitor = 1; for (const auto& ge : _ges) { // Position display cm.GetMonitorRect(monitor, rcScreen); pt.x = rcScreen.left + (LONG)ceilf((m_ssSettings.nOSDHoriz / 100.0f) * (rcScreen.right - rcScreen.left)); pt.y = rcScreen.top + (LONG)ceilf((m_ssSettings.nOSDVert / 100.0f) * (rcScreen.bottom - rcScreen.top)); if (has_track_pos) ge->EndRender(pt, rcScreen); else ge->EndRender(pt, rcScreen, m_ssSettings.bOSDAlwaysUp, &_bmInfo); ++monitor; } } else { // Position display if (!cm.GetMonitorRect(m_ssSettings.nOSDMonitor, rcScreen)) SystemParametersInfo(SPI_GETWORKAREA, 0, &rcScreen, 0); pt.x = rcScreen.left + (LONG)ceilf((m_ssSettings.nOSDHoriz / 100.0f) * (rcScreen.right - rcScreen.left)); pt.y = rcScreen.top + (LONG)ceilf((m_ssSettings.nOSDVert / 100.0f) * (rcScreen.bottom - rcScreen.top)); if (NULL != wcsstr(m_ssSettings.wcOSDFormat, L"%track_position%")) { for (const auto& ge : _ges) { ge->EndRender(pt, rcScreen); } } else { for (const auto& ge : _ges) { ge->EndRender(pt, rcScreen, m_ssSettings.bOSDAlwaysUp, &_bmInfo); } } } // Display should be shown for xx seconds, then hidden if (!bUpdateOnly) { if (!m_ssSettings.bOSDAlwaysUp) { if (NULL != _hDisplayTimer) DeleteTimerQueueTimer(_hTimerQueue, _hDisplayTimer, INVALID_HANDLE_VALUE); _hDisplayTimer = NULL; CreateTimerQueueTimer(&_hDisplayTimer, _hTimerQueue, DisplayTimerCallback, (PVOID)this, display_time, 0, WT_EXECUTEDEFAULT | WT_EXECUTEONLYONCE); } DisplayShow(); } LeaveCriticalSection(&_csCreateDisplay); return; }
void GraphicsInterface::DisplayTimerCallback() { RECT rcScreen; CMonitors cm; POINT pt = { 0, 0 }; if (0 == TryEnterCriticalSection(&_csCreateDisplay)) return; DeleteTimerQueueTimer(_hTimerQueue, _hDisplayTimer, NULL); _hDisplayTimer = NULL; if (m_ssSettings.bOSDAlwaysUp && _nDisplayType == 1 && !_override_always_up) { // Position display if (!cm.GetMonitorRect(m_ssSettings.nOSDMonitor, rcScreen)) SystemParametersInfo(SPI_GETWORKAREA, 0, &rcScreen, 0); pt.x = rcScreen.left + (LONG)ceilf((m_ssSettings.nOSDHoriz / 100.0f) * (rcScreen.right - rcScreen.left)); pt.y = rcScreen.top + (LONG)ceilf((m_ssSettings.nOSDVert / 100.0f) * (rcScreen.bottom - rcScreen.top)); // Restore old info screen if (NULL == wcsstr(m_ssSettings.wcOSDFormat, L"%track_position%")) { for (const auto& ge : _ges) { ge->BeginRender(); } if (m_ssSettings.bOSDAllMonitors) { int monitor = 1; for (const auto& ge : _ges) { // Position display cm.GetMonitorRect(monitor, rcScreen); pt.x = rcScreen.left + (LONG)ceilf((m_ssSettings.nOSDHoriz / 100.0f) * (rcScreen.right - rcScreen.left)); pt.y = rcScreen.top + (LONG)ceilf((m_ssSettings.nOSDVert / 100.0f) * (rcScreen.bottom - rcScreen.top)); ge->EndRender(pt, _bmInfo, rcScreen); ++monitor; } } else { for (const auto& ge : _ges) { ge->EndRender(pt, _bmInfo, rcScreen); } } DisplayShow(); } _nDisplayType = 0; } else DisplayHide(); LeaveCriticalSection(&_csCreateDisplay); return; }
void GraphicsInterface::DisplayStatus(wstring wstrText, int display_time) { GraphicsEngineOptions geo; RECT rcScreen; CMonitors cm; POINT pt = { 0, 0 }; Color cNull = Color(0, 0, 0, 0); Color cTemp; Color cOutline; Color cDropShadow; REAL rTemp; if (!m_ssSettings.bVisualFeedback) return; if (m_ssSettings.bNoDisplayWhenActive && m_ITCom->IsActiveWindow()) return; EnterCriticalSection(&_csCreateDisplay); _nDisplayType = 1; // Configure geo.nDisplayAlpha = m_ssSettings.nOSDAlpha; geo.bDisplayTopMost = m_ssSettings.bOSDTopMost; geo.nMaxWidth = m_ssSettings.nOSDMaxWidth; geo.nArtScaleMode = m_ssSettings.nArtMode == 3 ? ART_SCALEMODEHEIGHT : ART_SCALEMODESIZE; geo.saAlign = (Gdiplus::StringAlignment)m_ssSettings.nOSDTextJustify; geo.bForceToWidth = m_ssSettings.bOSDForceWidth; for (const auto& ge : _ges) { ge->SetOptions(geo); // Begin render process ge->BeginRender(5); } // Set background and borders rTemp = (REAL)m_ssSettings.nOSDBorderSize; cOutline = Color(GetRValue(m_ssSettings.lOSDBorderColor), GetGValue(m_ssSettings.lOSDBorderColor), GetBValue(m_ssSettings.lOSDBorderColor)); cTemp = Color(GetRValue(m_ssSettings.lOSDBkColorRef), GetGValue(m_ssSettings.lOSDBkColorRef), GetBValue(m_ssSettings.lOSDBkColorRef)); cDropShadow = Color(GetRValue(m_ssSettings.lDropShadowColor), GetGValue(m_ssSettings.lDropShadowColor), GetBValue(m_ssSettings.lDropShadowColor)); for (const auto& ge : _ges) { ge->SetDisplayBorder(m_ssSettings.bOSDOutlineMode ? cNull : cOutline, rTemp); ge->SetDisplayBackground(m_ssSettings.bOSDOutlineMode ? cNull : cTemp); } // Cache text height for shapes REAL text_height = _ges.at(0)->GetTextHeight(m_ssSettings.wcFontFace, (float)m_ssSettings.nOSDFontPoint, m_ssSettings.nOSDFontStyle); // Break string into lines, add to display wchar_t *lpToken = NULL; wchar_t *lpContext = NULL; wchar_t *lpRating = NULL; wchar_t *lpVolume = NULL; wchar_t *lpBeforeRating = NULL; cTemp = Color(GetRValue(m_ssSettings.lOSDColorRef), GetGValue(m_ssSettings.lOSDColorRef), GetBValue(m_ssSettings.lOSDColorRef)); Color cShapeFill = Color(GetRValue(m_ssSettings.lRatingShapeFill), GetGValue(m_ssSettings.lRatingShapeFill), GetBValue(m_ssSettings.lRatingShapeFill)); Color cShapeOutline = Color(GetRValue(m_ssSettings.lRatingShapeOutline), GetGValue(m_ssSettings.lRatingShapeOutline), GetBValue(m_ssSettings.lRatingShapeOutline)); lpToken = wcstok_s(const_cast<wchar_t*>(wstrText.c_str()), L"\n", &lpContext); while (NULL != lpToken && m_ssSettings.nDisplayLayout != 4) { for (const auto& ge : _ges) { ge->BeginLine(); } // check for %rating% in string, replace with img rating lpRating = wcsstr(lpToken, L"%rating%"); lpVolume = wcsstr(lpToken, L"%volume%"); if (NULL != lpVolume) { // Break up line lpBeforeRating = new wchar_t[lpVolume - lpToken + 1]; wcsncpy_s(lpBeforeRating, lpVolume - lpToken + 1, lpToken, lpVolume - lpToken); // Add text before rating for (const auto& ge : _ges) { ge->AddString(lpBeforeRating, false, m_ssSettings.nOSDFontStyle, (float)m_ssSettings.nOSDFontPoint, cTemp, m_ssSettings.wcFontFace, m_ssSettings.bOSDOutlineMode ? cOutline : cNull, 1.5f, m_ssSettings.bUseDropShadow ? m_ssSettings.fDropShadowOffset : 0.0f, cDropShadow); } // Add rating unsigned int lVolume = m_ITCom->GetVolumeLevel(); RectF rfShape = RectF(0, 0, text_height*10.0f, text_height*1.5f); for (const auto& ge : _ges) { ge->AddShape(ShapeVolume, FillCustom, rfShape, false, cShapeOutline, 3.0, cShapeFill, lVolume); // Add text after rating ge->AddString(lpVolume + 8, false, m_ssSettings.nOSDFontStyle, (float)m_ssSettings.nOSDFontPoint, cTemp, m_ssSettings.wcFontFace, m_ssSettings.bOSDOutlineMode ? cOutline : cNull, 1.5f, m_ssSettings.bUseDropShadow ? m_ssSettings.fDropShadowOffset : 0.0f, cDropShadow); } delete[] lpBeforeRating; } else if (NULL != lpRating) { // Break up line lpBeforeRating = new wchar_t[lpRating - lpToken + 1]; wcsncpy_s(lpBeforeRating, lpRating - lpToken + 1, lpToken, lpRating - lpToken); // Add text before rating for (const auto& ge : _ges) { ge->AddString(lpBeforeRating, false, m_ssSettings.nOSDFontStyle, (float)m_ssSettings.nOSDFontPoint, cTemp, m_ssSettings.wcFontFace, m_ssSettings.bOSDOutlineMode ? cOutline : cNull, 1.5f, m_ssSettings.bUseDropShadow ? m_ssSettings.fDropShadowOffset : 0.0f, cDropShadow); } // Add rating long lRating = m_ITCom->GetTrackRating(); long lWhole = (lRating - (lRating % 20)) / 20; lRating = lRating - lWhole * 20; long lHalf = (lRating - (lRating % 10)) / 10; long lEmpty = 5 - lWhole - lHalf; RectF rfShape = RectF(0, 0, text_height, text_height); for (int i = 0; i < lWhole; i++) { for (const auto& ge : _ges) { if (m_ssSettings.nRatingType == 1) ge->AddImage(m_ssSettings.wcRatingFullPath); else ge->AddShape((ShapeType)m_ssSettings.nRatingShapeType, FillAll, rfShape, false, cShapeOutline, 3.0, cShapeFill); } } for (int i = 0; i < lHalf; i++) { for (const auto& ge : _ges) { if (m_ssSettings.nRatingType == 1) ge->AddImage(m_ssSettings.wcRatingHalfPath); else ge->AddShape((ShapeType)m_ssSettings.nRatingShapeType, (ShapeStyle)(m_ssSettings.nRatingShapeStyle + 2), rfShape, false, cShapeOutline, 3.0, cShapeFill); } } for (int i = 0; i < lEmpty; i++) { for (const auto& ge : _ges) { if (m_ssSettings.nRatingType == 1) ge->AddImage(m_ssSettings.wcRatingEmptyPath); else ge->AddShape((ShapeType)m_ssSettings.nRatingShapeType, FillNone, rfShape, false, cShapeOutline, 3.0, cShapeFill); } } // Add text after rating for (const auto& ge : _ges) { ge->AddString(lpRating + 8, false, m_ssSettings.nOSDFontStyle, (float)m_ssSettings.nOSDFontPoint, cTemp, m_ssSettings.wcFontFace, m_ssSettings.bOSDOutlineMode ? cOutline : cNull, 1.5f, m_ssSettings.bUseDropShadow ? m_ssSettings.fDropShadowOffset : 0.0f, cDropShadow); } delete[] lpBeforeRating; } else { for (const auto& ge : _ges) { ge->AddString(lpToken, false, m_ssSettings.nOSDFontStyle, (float)m_ssSettings.nOSDFontPoint, cTemp, m_ssSettings.wcFontFace, m_ssSettings.bOSDOutlineMode ? cOutline : cNull, 1.5f, m_ssSettings.bUseDropShadow ? m_ssSettings.fDropShadowOffset : 0.0f, cDropShadow); } } for (const auto& ge : _ges) { ge->EndLine(); } lpToken = wcstok_s(NULL, L"\n", &lpContext); } // Position display if (!cm.GetMonitorRect(m_ssSettings.nOSDMonitor, rcScreen)) SystemParametersInfo(SPI_GETWORKAREA, 0, &rcScreen, 0); pt.x = rcScreen.left + (LONG)ceilf((m_ssSettings.nOSDHoriz / 100.0f) * (rcScreen.right - rcScreen.left)); pt.y = rcScreen.top + (LONG)ceilf((m_ssSettings.nOSDVert / 100.0f) * (rcScreen.bottom - rcScreen.top)); // Show display, start timer if (m_ssSettings.bOSDAllMonitors) { int monitor = 1; for (const auto& ge : _ges) { // Position display cm.GetMonitorRect(monitor, rcScreen); pt.x = rcScreen.left + (LONG)ceilf((m_ssSettings.nOSDHoriz / 100.0f) * (rcScreen.right - rcScreen.left)); pt.y = rcScreen.top + (LONG)ceilf((m_ssSettings.nOSDVert / 100.0f) * (rcScreen.bottom - rcScreen.top)); ge->EndRender(pt, rcScreen); ++monitor; } } else { for (const auto& ge : _ges) { ge->EndRender(pt, rcScreen); } } // Display should be shown for xx seconds, then hidden if (NULL != _hDisplayTimer) DeleteTimerQueueTimer(_hTimerQueue, _hDisplayTimer, INVALID_HANDLE_VALUE); _hDisplayTimer = NULL; CreateTimerQueueTimer(&_hDisplayTimer, _hTimerQueue, DisplayTimerCallback, (PVOID)this, display_time, 0, WT_EXECUTEDEFAULT | WT_EXECUTEONLYONCE); DisplayShow(); LeaveCriticalSection(&_csCreateDisplay); return; }
BOOL CPPageFullscreen::OnInitDialog() { __super::OnInitDialog(); SetHandCursor(m_hWnd, IDC_COMBO1); AppSettings& s = AfxGetAppSettings(); m_launchfullscreen = s.fLaunchfullscreen; m_AutoChangeFullscrRes = s.AutoChangeFullscrRes; m_fSetDefault = s.AutoChangeFullscrRes.bApplyDefault; m_f_hmonitor = s.strFullScreenMonitor; m_iShowBarsWhenFullScreen = s.fShowBarsWhenFullScreen; m_nShowBarsWhenFullScreenTimeOut = s.nShowBarsWhenFullScreenTimeOut; m_nTimeOutCtrl.SetRange(-1, 10); m_fExitFullScreenAtTheEnd = s.fExitFullScreenAtTheEnd; m_fRestoreResAfterExit = s.fRestoreResAfterExit; CString str; m_iMonitorType = 0; CMonitor monitor; CMonitors monitors; CString strCurMon; monitor = monitors.GetNearestMonitor(AfxGetApp()->m_pMainWnd); monitor.GetName(strCurMon); m_iMonitorTypeCtrl.AddString(ResStr(IDS_FULLSCREENMONITOR_CURRENT)); m_MonitorDisplayNames.Add(_T("Current")); if (m_f_hmonitor == _T("Current")) { m_iMonitorType = m_iMonitorTypeCtrl.GetCount()-1; } for ( int i = 0; i < monitors.GetCount(); i++ ) { monitor = monitors.GetMonitor( i ); monitor.GetName(str); if (monitor.IsMonitor()) { DISPLAY_DEVICE displayDevice; ZeroMemory(&displayDevice, sizeof(displayDevice)); displayDevice.cb = sizeof(displayDevice); VERIFY(EnumDisplayDevices(str, 0, &displayDevice, 0)); if (str == strCurMon) { m_iMonitorTypeCtrl.AddString(str+_T(" - [") + ResStr(IDS_FULLSCREENMONITOR_CURRENT) +_T("] - ")+ displayDevice.DeviceString); } else { m_iMonitorTypeCtrl.AddString(str+_T(" - ")+ displayDevice.DeviceString); } m_MonitorDisplayNames.Add(str); if (m_f_hmonitor == str && m_iMonitorType == 0) { m_iMonitorType = m_iMonitorTypeCtrl.GetCount()-1; } } } if (m_iMonitorTypeCtrl.GetCount() > 2) { GetDlgItem(IDC_COMBO1)->EnableWindow(TRUE); } else { m_iMonitorType = 0; GetDlgItem(IDC_COMBO1)->EnableWindow(FALSE); } m_list.SetExtendedStyle(m_list.GetExtendedStyle()|LVS_EX_FULLROWSELECT|LVS_EX_DOUBLEBUFFER |LVS_EX_GRIDLINES|LVS_EX_BORDERSELECT|LVS_EX_ONECLICKACTIVATE|LVS_EX_CHECKBOXES|LVS_EX_FLATSB); m_list.InsertColumn(COL_Z, ResStr(IDS_PPAGE_FS_CLN_ON_OFF), LVCFMT_LEFT, 60); m_list.InsertColumn(COL_VFR_F, ResStr(IDS_PPAGE_FS_CLN_FROM_FPS), LVCFMT_RIGHT, 60); m_list.InsertColumn(COL_VFR_T, ResStr(IDS_PPAGE_FS_CLN_TO_FPS), LVCFMT_RIGHT, 60); m_list.InsertColumn(COL_SRR, ResStr(IDS_PPAGE_FS_CLN_DISPLAY_MODE), LVCFMT_LEFT, 135); ModesUpdate(); UpdateData(FALSE); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
BOOL CPPageFullscreen::OnApply() { UpdateData(); AppSettings& s = AfxGetAppSettings(); m_AutoChangeFullscrRes.bEnabled = !!m_fSetFullscreenRes; if (m_fSetFullscreenRes == 2) m_AutoChangeFullscrRes.bEnabled = 2; for (int i = 0; i < MaxFpsCount; i++) { int n = m_iSeldm[i]; if (n >= 0 && (size_t)n < m_dms.GetCount() && i < m_list.GetItemCount()) { m_AutoChangeFullscrRes.dmFullscreenRes[i].dmFSRes = m_dms[n]; m_AutoChangeFullscrRes.dmFullscreenRes[i].fChecked = !!m_list.GetCheck(i); m_AutoChangeFullscrRes.dmFullscreenRes[i].fIsData = true; m_AutoChangeFullscrRes.dmFullscreenRes[i].vfr_from = wcstod(m_list.GetItemText(i, COL_VFR_F), NULL); m_AutoChangeFullscrRes.dmFullscreenRes[i].vfr_to = wcstod(m_list.GetItemText(i, COL_VFR_T), NULL); } else { m_AutoChangeFullscrRes.dmFullscreenRes[i].fIsData = false; m_AutoChangeFullscrRes.dmFullscreenRes[i].vfr_from = 0; m_AutoChangeFullscrRes.dmFullscreenRes[i].vfr_to = 0; m_AutoChangeFullscrRes.dmFullscreenRes[i].fChecked = 0; m_AutoChangeFullscrRes.dmFullscreenRes[i].dmFSRes.bpp = 0; m_AutoChangeFullscrRes.dmFullscreenRes[i].dmFSRes.dmDisplayFlags = 0; m_AutoChangeFullscrRes.dmFullscreenRes[i].dmFSRes.freq = 0; m_AutoChangeFullscrRes.dmFullscreenRes[i].dmFSRes.fValid = 0; m_AutoChangeFullscrRes.dmFullscreenRes[i].dmFSRes.size = 0; } } m_AutoChangeFullscrRes.bApplyDefault = !!m_fSetDefault; m_AutoChangeFullscrRes.bSetGlobal = !!m_fSetGlobal; s.AutoChangeFullscrRes = m_AutoChangeFullscrRes; s.fLaunchfullscreen = !!m_launchfullscreen; CString str; CString strCurFSMonID; CString strCurMon; str = m_MonitorDisplayNames[m_iMonitorType]; if (str.GetLength() == 14) { m_f_hmonitor = str.Left(7); } if (str.GetLength() == 19) { m_f_hmonitor = str.Left(12); } m_f_hmonitorID = str.Right(7); if (m_AutoChangeFullscrRes.bEnabled > 0 && m_f_hmonitor == _T("Current")) { CMonitors monitors; CMonitor curmonitor; curmonitor = monitors.GetNearestMonitor(AfxGetApp()->m_pMainWnd); curmonitor.GetName(strCurMon); m_f_hmonitor = strCurMon; } if (m_AutoChangeFullscrRes.bEnabled == false && m_f_hmonitor == _T("Current")) { m_f_hmonitor = _T("Current"); } s.strFullScreenMonitor = m_f_hmonitor; s.strFullScreenMonitorID = m_f_hmonitorID; s.fShowBarsWhenFullScreen = !!m_iShowBarsWhenFullScreen; s.nShowBarsWhenFullScreenTimeOut = m_nShowBarsWhenFullScreenTimeOut; s.fExitFullScreenAtTheEnd = !!m_fExitFullScreenAtTheEnd; s.fExitFullScreenAtFocusLost = !!m_fExitFullScreenAtFocusLost; s.fRestoreResAfterExit = !!m_fRestoreResAfterExit; return __super::OnApply(); }
BOOL CPPageFullscreen::OnInitDialog() { __super::OnInitDialog(); SetHandCursor(m_hWnd, IDC_COMBO1); AppSettings& s = AfxGetAppSettings(); m_launchfullscreen = s.fLaunchfullscreen; m_AutoChangeFullscrRes = s.AutoChangeFullscrRes; m_fSetDefault = s.AutoChangeFullscrRes.bApplyDefault; m_fSetGlobal = s.AutoChangeFullscrRes.bSetGlobal; m_f_hmonitor = s.strFullScreenMonitor; m_f_hmonitorID = s.strFullScreenMonitorID; m_iShowBarsWhenFullScreen = s.fShowBarsWhenFullScreen; m_nShowBarsWhenFullScreenTimeOut = s.nShowBarsWhenFullScreenTimeOut; m_nTimeOutCtrl.SetRange(-1, 10); m_fExitFullScreenAtTheEnd = s.fExitFullScreenAtTheEnd; m_fExitFullScreenAtFocusLost = s.fExitFullScreenAtFocusLost; m_fRestoreResAfterExit = s.fRestoreResAfterExit; CString str; m_iMonitorType = 0; CMonitor curmonitor; CMonitors monitors; CString strCurMon; m_iMonitorTypeCtrl.AddString(ResStr(IDS_FULLSCREENMONITOR_CURRENT)); m_MonitorDisplayNames.Add(_T("Current")); m_MonitorDeviceName.Add(_T("Current")); curmonitor = monitors.GetNearestMonitor(AfxGetApp()->m_pMainWnd); curmonitor.GetName(strCurMon); if(m_f_hmonitor.IsEmpty()) { m_f_hmonitor = _T("Current"); m_iMonitorType = 0; } DISPLAY_DEVICE dd; dd.cb = sizeof(dd); DWORD dev = 0; // device index int id = 0; CString str2; CString DeviceID; CString strMonID; while (EnumDisplayDevices(0, dev, &dd, 0)) { DISPLAY_DEVICE ddMon; ZeroMemory(&ddMon, sizeof(ddMon)); ddMon.cb = sizeof(ddMon); DWORD devMon = 0; while (EnumDisplayDevices(dd.DeviceName, devMon, &ddMon, 0)) { if (ddMon.StateFlags & DISPLAY_DEVICE_ACTIVE && !(ddMon.StateFlags & DISPLAY_DEVICE_MIRRORING_DRIVER)) { DeviceID.Format (L"%s", ddMon.DeviceID); strMonID = DeviceID = DeviceID.Mid (8, DeviceID.Find (L"\\", 9) - 8); str.Format(L"%s", ddMon.DeviceName); str = str.Left(12); if (str == strCurMon) { m_iMonitorTypeCtrl.AddString(str.Mid(4, 7) + _T("( ") + str.Right(1) + _T(" ) ") + _T("- [id: ") + DeviceID + _T(" *") + ResStr(IDS_FULLSCREENMONITOR_CURRENT) + _T("] - ") + ddMon.DeviceString); m_MonitorDisplayNames[0] = _T("Current") + strMonID; m_MonitorDeviceName[0] = str; if(m_f_hmonitor == _T("Current") && m_AutoChangeFullscrRes.bEnabled > 0) { m_iMonitorType = m_iMonitorTypeCtrl.GetCount()-1; m_f_hmonitor = strCurMon; } iCurMon = m_iMonitorTypeCtrl.GetCount()-1; } else { m_iMonitorTypeCtrl.AddString(str.Mid(4, 7) + _T("( ") + str.Right(1) + _T(" ) ") + _T("- [id: ") + DeviceID + _T("] - ") + ddMon.DeviceString); } m_MonitorDisplayNames.Add(str + strMonID); m_MonitorDeviceName.Add(str); if(m_iMonitorType == 0 && m_f_hmonitor == str) { m_iMonitorType = m_iMonitorTypeCtrl.GetCount()-1; } if (m_f_hmonitorID == strMonID && m_f_hmonitor != _T("Current")) { id = m_iMonitorType = m_iMonitorTypeCtrl.GetCount()-1; str2 = str; } } devMon++; ZeroMemory(&ddMon, sizeof(ddMon)); ddMon.cb = sizeof(ddMon); } ZeroMemory(&dd, sizeof(dd)); dd.cb = sizeof(dd); dev++; } if(m_iMonitorTypeCtrl.GetCount() > 2) { if (m_MonitorDisplayNames[m_iMonitorType] != m_f_hmonitor + m_f_hmonitorID) { if ( id > 0 ) { m_iMonitorType = id; m_f_hmonitor = str2; } } GetDlgItem(IDC_COMBO1)->EnableWindow(TRUE); } else { if(m_AutoChangeFullscrRes.bEnabled == false) { m_iMonitorType = 0; } else { m_iMonitorType = 1; } GetDlgItem(IDC_COMBO1)->EnableWindow(FALSE); } if (m_AutoChangeFullscrRes.bEnabled == false && (m_MonitorDisplayNames[m_iMonitorType]).Left(7) == _T("Current")){ m_f_hmonitor = _T("Current"); } m_list.SetExtendedStyle(m_list.GetExtendedStyle()|LVS_EX_FULLROWSELECT|LVS_EX_DOUBLEBUFFER |LVS_EX_GRIDLINES|LVS_EX_BORDERSELECT|LVS_EX_ONECLICKACTIVATE|LVS_EX_CHECKBOXES|LVS_EX_FLATSB); m_list.InsertColumn(COL_Z, ResStr(IDS_PPAGE_FS_CLN_ON_OFF), LVCFMT_LEFT, 60); m_list.InsertColumn(COL_VFR_F, ResStr(IDS_PPAGE_FS_CLN_FROM_FPS), LVCFMT_RIGHT, 60); m_list.InsertColumn(COL_VFR_T, ResStr(IDS_PPAGE_FS_CLN_TO_FPS), LVCFMT_RIGHT, 60); m_list.InsertColumn(COL_SRR, ResStr(IDS_PPAGE_FS_CLN_DISPLAY_MODE), LVCFMT_LEFT, 135); ModesUpdate(); UpdateData(FALSE); return TRUE; }
BOOL CPPageOutput::OnInitDialog() { __super::OnInitDialog(); AppSettings& s = AfxGetAppSettings(); m_iDSVideoRendererType = s.iDSVideoRendererType; m_iRMVideoRendererType = s.iRMVideoRendererType; m_iQTVideoRendererType = s.iQTVideoRendererType; m_iAPSurfaceUsage = s.iAPSurfaceUsage; m_fVMRSyncFix = s.fVMRSyncFix; m_iDX9Resizer = s.iDX9Resizer; m_fVMR9MixerMode = s.fVMR9MixerMode; m_fVMR9MixerYUV = s.fVMR9MixerYUV; m_fD3DFullscreen = s.fD3DFullscreen; m_iEvrBuffers = s.iEvrBuffers-3; // Multi-Monitor code CString str; m_iMonitorType = 0; CMonitor monitor; CMonitors monitors; m_iMonitorTypeCtrl.AddString(ResStr(IDS_FULLSCREENMONITOR_CURRENT)); m_MonitorDisplayNames.Add(_T("Current")); if(s.f_hmonitor == _T("Current")) { m_iMonitorType = m_iMonitorTypeCtrl.GetCount()-1; } for ( int i = 0; i < monitors.GetCount(); i++ ) { monitor = monitors.GetMonitor( i ); monitor.GetName(str); if(monitor.IsMonitor()) { DISPLAY_DEVICE displayDevice; ZeroMemory(&displayDevice, sizeof(displayDevice)); displayDevice.cb = sizeof(displayDevice); VERIFY(EnumDisplayDevices(str, 0, &displayDevice, 0)); m_iMonitorTypeCtrl.AddString(str+_T(" - ")+displayDevice.DeviceString); m_MonitorDisplayNames.Add(str); if(s.f_hmonitor == str && m_iMonitorType == 0) { m_iMonitorType = m_iMonitorTypeCtrl.GetCount()-1; } } } //(m_iMonitorTypeCtrl.GetCount() > 2) ? {GetDlgItem(IDC_COMBO2)->EnableWindow(TRUE)} : GetDlgItem(IDC_COMBO2)->EnableWindow(FALSE); if(m_iMonitorTypeCtrl.GetCount() > 2) { GetDlgItem(IDC_COMBO2)->EnableWindow(TRUE); } else { m_iMonitorType = 0; GetDlgItem(IDC_COMBO2)->EnableWindow(FALSE); } m_AudioRendererDisplayNames.Add(_T("")); m_iAudioRendererTypeCtrl.AddString(_T("System Default")); m_iAudioRendererType = 0; BeginEnumSysDev(CLSID_AudioRendererCategory, pMoniker) { LPOLESTR olestr = NULL; if(FAILED(pMoniker->GetDisplayName(0, 0, &olestr))) continue; CStringW str(olestr); CoTaskMemFree(olestr); m_AudioRendererDisplayNames.Add(CString(str)); CComPtr<IPropertyBag> pPB; if(SUCCEEDED(pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)&pPB))) { CComVariant var; pPB->Read(CComBSTR(_T("FriendlyName")), &var, NULL); CString fstr(var.bstrVal); var.Clear(); if(SUCCEEDED(pPB->Read(CComBSTR(_T("FilterData")), &var, NULL))) { BSTR* pbstr; if(SUCCEEDED(SafeArrayAccessData(var.parray, (void**)&pbstr))) { fstr.Format(_T("%s (%08x)"), CString(fstr), *((DWORD*)pbstr + 1)); SafeArrayUnaccessData(var.parray); } } m_iAudioRendererTypeCtrl.AddString(fstr); } else { m_iAudioRendererTypeCtrl.AddString(CString(str)); } if(s.AudioRendererDisplayName == str && m_iAudioRendererType == 0) { m_iAudioRendererType = m_iAudioRendererTypeCtrl.GetCount()-1; } }