Exemplo n.º 1
0
void CPPageFullscreen::OnMoveDown()
{
	if (POSITION pos = m_list.GetFirstSelectedItemPosition()) {
		int nItem = m_list.GetNextSelectedItem(pos);
		if (nItem < 0 || nItem >= m_list.GetItemCount()-1) {
			return;
		}

		DWORD_PTR data = m_list.GetItemData(nItem);
		int nCheckCur = m_list.GetCheck(nItem);
		CString strN = m_list.GetItemText(nItem, 0);
		CString strF = m_list.GetItemText(nItem, 1);
		CString strT = m_list.GetItemText(nItem, 2);
		CString strDM = m_list.GetItemText(nItem, 3);
		m_list.DeleteItem(nItem);

		nItem++;

		m_list.InsertItem(nItem, strN);
		m_list.SetItemData(nItem, data);
		m_list.SetItemText(nItem, 1, strF);
		m_list.SetItemText(nItem, 2, strT);
		m_list.SetItemText(nItem, 3, strDM);
		m_list.SetCheck(nItem, nCheckCur);
		m_list.SetFocus();
		m_list.SetSelectionMark(nItem);
		m_list.SetItemState(nItem, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
		ReindexList();
		ReindexListSubItem();

		SetModified();
	}
}
Exemplo n.º 2
0
void CPPageFullscreen::OnRemove()
{
	if (POSITION pos = m_list.GetFirstSelectedItemPosition()) {
		int nItem = m_list.GetNextSelectedItem(pos);
		if (nItem <= 0 || nItem >= m_list.GetItemCount()) {
			return;
		}
		m_list.DeleteItem(nItem);
		nItem = min(nItem, m_list.GetItemCount()-1);
		m_list.SetSelectionMark(nItem);
		m_list.SetFocus();
		m_list.SetItemState(nItem,LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
		ReindexList();
		ReindexListSubItem();

		SetModified();
	}
}
Exemplo n.º 3
0
void CPPageFullscreen::OnAdd()
{
	POSITION pos = m_list.GetFirstSelectedItemPosition();
	int i = m_list.GetNextSelectedItem(pos)+1;
	if (i<=0) {
		i = m_list.GetItemCount();
	}
	if (m_list.GetItemCount() <= MaxFpsCount) {
		CString str, strCur;
		(i<10) ? str.Format(_T("0%d"), i) : str.Format(_T("%d"), i);
		m_list.InsertItem(i, str);
		m_list.SetItemText(i, COL_VFR_F, _T("1.000"));
		m_list.SetItemText(i, COL_VFR_T, _T("1.000"));
		GetCurDispModeString(strCur);
		m_list.SetItemText(i, COL_SRR, strCur);
		m_list.SetCheck(i,0);
		m_list.SetFocus();
		m_list.SetItemState(i,LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
		ReindexList();
		ReindexListSubItem();

		SetModified();
	}
}
Exemplo n.º 4
0
void CPPageFullscreen::ModesUpdate()
{
	AppSettings& s = AfxGetAppSettings();
	CMonitors monitors;

	m_fSetFullscreenRes = m_AutoChangeFullscrRes.bEnabled;
	if (m_AutoChangeFullscrRes.bEnabled == 2) m_fSetFullscreenRes = 2;
	CString sl2[MaxFpsCount];
	dispmode dm,  dmtoset[MaxFpsCount];

	int i0;

	CString str, strCurMon, strModes;
	CString strCur;
	GetCurDispModeString(strCur);

	//CString strDevice = m_MonitorDeviceName[m_iMonitorType];
	//CString MonitorName;
	//UINT16 MonitorHorRes, MonitorVerRes;
	//ReadDisplay(strDevice, &MonitorName, &MonitorHorRes, &MonitorVerRes);

	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 ( s.strFullScreenMonitorID != m_f_hmonitorID) {
		m_AutoChangeFullscrRes.bEnabled = false;
	}

	int iNoData = 0;
	for (int i=0; i<MaxFpsCount; i++) {
		dmtoset[i] = m_AutoChangeFullscrRes.dmFullscreenRes[i].dmFSRes;
		if (m_AutoChangeFullscrRes.dmFullscreenRes[i].fIsData == true) {
			iNoData++;
		}
	}

	//if (!m_AutoChangeFullscrRes.bEnabled
	if (s.strFullScreenMonitorID != m_f_hmonitorID
			|| m_AutoChangeFullscrRes.dmFullscreenRes[0].dmFSRes.freq <0
			|| m_AutoChangeFullscrRes.dmFullscreenRes[0].fIsData == false) {
		GetCurDispMode(dmtoset[0],m_f_hmonitor);
		for (int i=1; i<MaxFpsCount; i++) {
			dmtoset[i] = dmtoset[0];
		}
	}
	m_list.DeleteAllItems();
	m_dms.RemoveAll();
	sl.RemoveAll();
	for (int i=1; i<MaxFpsCount; i++) {
		sl2[i] = _T("");
	}
	memset(m_iSeldm, -1, sizeof(m_iSeldm));
	m_iSel=-1;

	for (int i = 0, m = 0, ModeExist = true;  ; i++) {
		ModeExist = GetDispMode(i, dm, m_f_hmonitor);
		if (!ModeExist) {
			break;
		}
		if (dm.bpp != 32 || dm.size.cx < 720 || dm.size.cx < 480) {
			continue; // skip low resolution and non 32bpp mode
		}

		int j = 0;
		while (j < m) {
			if (dm.bpp                == m_dms[j].bpp &&
					dm.dmDisplayFlags == m_dms[j].dmDisplayFlags &&
					dm.freq           == m_dms[j].freq &&
					dm.fValid         == m_dms[j].fValid &&
					dm.size           == m_dms[j].size) {
				break;
			}
			j++;
		}
		if (j < m) {
			continue;
		}
		m_dms.Add(dm);
		m++;
	}

	// sort display modes
	for (unsigned int j, i = 1; i < m_dms.GetCount(); i++) {
		dm = m_dms[i];
		j = i - 1;
		while (j != -1 && m_dms[j].size.cx >= dm.size.cx &&
				m_dms[j].size.cy >= dm.size.cy &&
				m_dms[j].freq > dm.freq) {
			m_dms[j+1] = m_dms[j];
			j--;
		}
		m_dms[j+1] = dm;
	}

	for (int i=0;  (size_t) i<m_dms.GetCount(); i++) {
		strModes.Format(_T("[ %d ]  @ %dx%d "), m_dms[i].freq, m_dms[i].size.cx, m_dms[i].size.cy);
		if (m_dms[i].dmDisplayFlags == DM_INTERLACED) {
			strModes += _T("i");
		} else {
			strModes += _T("p");
		}

		sl.Add(strModes);
		for (int n=0; n<MaxFpsCount; n++) {
			if (m_iSeldm[n] < 0
					&& dmtoset[n].fValid
					&& m_dms[i].size            == dmtoset[n].size
					&& m_dms[i].bpp             == dmtoset[n].bpp
					&& m_dms[i].freq            == dmtoset[n].freq
					&& m_dms[i].dmDisplayFlags  == dmtoset[n].dmDisplayFlags) {
				m_iSeldm[n]=i;
				sl2[n] = sl[i];
				if (strCur == strModes) {
					i0 = i;
				}
			}
		}
	}

	for (int n=0; n<MaxFpsCount; n++) {
		if (m_AutoChangeFullscrRes.dmFullscreenRes[n].fIsData == true) {
			m_list.InsertItem(n, _T(""));
			CString ss = sl2[n];
			m_list.SetItemText(n, COL_SRR, ss);
			m_list.SetCheck(n, m_AutoChangeFullscrRes.dmFullscreenRes[n].fChecked);
			n+1>9 ? ss.Format(_T("%d"), n+1) : ss.Format(_T("0%d"), n+1);
			m_list.SetItemText(n, COL_Z, ss);
			ss.Format(_T("%.3f"), m_AutoChangeFullscrRes.dmFullscreenRes[n].vfr_from) ;
			m_list.SetItemText(n, COL_VFR_F, ss);
			ss.Format(_T("%.3f"), m_AutoChangeFullscrRes.dmFullscreenRes[n].vfr_to) ;
			m_list.SetItemText(n, COL_VFR_T, ss);
		}
	}
	if (m_list.GetItemCount() < 1 || iNoData == 0) {
		strModes.Format(_T("[ %d ]  @ %dx%d "), dmtoset[0].freq, dmtoset[0].size.cx, dmtoset[0].size.cy);
		(dmtoset[0].dmDisplayFlags == DM_INTERLACED) ? strModes += _T("i") : strModes += _T("p");

		int idx = 0;
		m_list.InsertItem(idx, _T("01"));
		m_list.SetItemText(idx, COL_VFR_F, _T("23.500"));
		m_list.SetItemText(idx, COL_VFR_T, _T("23.981"));
		m_list.SetItemText(idx, COL_SRR, strModes);
		m_iSeldm[idx] = i0;
		m_list.SetCheck(idx, 1);
		idx++;
		m_list.InsertItem(idx, _T("02"));
		m_list.SetItemText(idx, COL_VFR_F, _T("23.982"));
		m_list.SetItemText(idx, COL_VFR_T, _T("24.499"));
		m_list.SetItemText(idx, COL_SRR, strModes);
		m_iSeldm[idx] = i0;
		m_list.SetCheck(idx, 1);
		idx++;
		m_list.InsertItem(idx, _T("03"));
		m_list.SetItemText(idx, COL_VFR_F, _T("24.500"));
		m_list.SetItemText(idx, COL_VFR_T, _T("25.499"));
		m_list.SetItemText(idx, COL_SRR, strModes);
		m_iSeldm[idx] = i0;
		m_list.SetCheck(idx, 1);
		idx++;
		m_list.InsertItem(idx, _T("04"));
		m_list.SetItemText(idx, COL_VFR_F, _T("29.500"));
		m_list.SetItemText(idx, COL_VFR_T, _T("29.981"));
		m_list.SetItemText(idx, COL_SRR, strModes);
		m_iSeldm[idx] = i0;
		m_list.SetCheck(idx, 1);
		idx++;
		m_list.InsertItem(idx, _T("05"));
		m_list.SetItemText(idx, COL_VFR_F, _T("29.982"));
		m_list.SetItemText(idx, COL_VFR_T, _T("30.499"));
		m_list.SetItemText(idx, COL_SRR, strModes);
		m_iSeldm[idx] = i0;
		m_list.SetCheck(idx, 1);
		idx++;
		m_list.InsertItem(idx, _T("06"));
		m_list.SetItemText(idx, COL_VFR_F, _T("49.500"));
		m_list.SetItemText(idx, COL_VFR_T, _T("50.499"));
		m_list.SetItemText(idx, COL_SRR, strModes);
		m_iSeldm[idx] = i0;
		m_list.SetCheck(idx, 1);
		idx++;
		m_list.InsertItem(idx, _T("07"));
		m_list.SetItemText(idx, COL_VFR_F, _T("59.500"));
		m_list.SetItemText(idx, COL_VFR_T, _T("59.945"));
		m_list.SetItemText(idx, COL_SRR, strModes);
		m_iSeldm[idx] = i0;
		m_list.SetCheck(idx, 1);
		idx++;
		m_list.InsertItem(idx, _T("08"));
		m_list.SetItemText(idx, COL_VFR_F, _T("59.946"));
		m_list.SetItemText(idx, COL_VFR_T, _T("60.499"));
		m_list.SetItemText(idx, COL_SRR, strModes);
		m_iSeldm[idx] = i0;
		m_list.SetCheck(idx, 1);
	}
	ReindexListSubItem();
}