コード例 #1
0
// 删除探头
void CConfigZoneDlg::OnBnClickedButton4()
{
	int ndx = m_list.GetCurSel(); if (ndx < 0)return;
	int zone_value = m_list.GetItemData(ndx);
	if (0 < zone_value && zone_value < 8) {
		EnableWindows(0);
		return;
	}

	CAlarmMachineConfigToolDlg* mainWnd = static_cast<CAlarmMachineConfigToolDlg*>(AfxGetApp()->GetMainWnd()); assert(mainWnd);
	if (!mainWnd)return;
	ResponceData rdHundred, rdDecade, rdSingle;
	rdHundred = rdDecade = rdSingle = RD_MAX;
	rdHundred = DecToRd(GetHundred(zone_value));
	rdDecade = DecToRd(GetDecade(zone_value));
	rdSingle = DecToRd(GetSingle(zone_value));
	char cmd[] = { rdHundred, rdDecade, rdSingle, RD_SIGN, RD_SIGN };
	for (auto c : cmd) {
		mainWnd->Input(c);
	}
	CString txt;
	txt.Format(L"防区%03d ---- 未对码", g_zoneInfo[zone_value].zone);
	m_list.DeleteString(ndx);
	int new_ndx = m_list.InsertString(ndx, txt); assert(ndx == new_ndx);
	m_list.SetItemData(new_ndx, g_zoneInfo[zone_value].zone);
	g_zoneInfo[zone_value].type = ZT_NULL;
	g_zoneInfo[zone_value].status_or_property = ZSOP_INVALID;
	g_zoneInfo[zone_value].addr = 0xFFFF;
	m_list.SetCurSel(new_ndx);
	OnLbnSelchangeList1();
}
コード例 #2
0
ファイル: KSceneEditorRiver.cpp プロジェクト: viticm/pap2
void KSceneEditorRiver::SinkFunc2(INT nSinkID,INT nsubSinkID,DWORD dwValue,PVOID pPoint)
{
	if(nSinkID==EVENT_RIVERNODE_SELECTED)
	{
		m_List.SetCurSel(dwValue);
		UpdateData(FALSE);
		OnLbnSelchangeList1();
	}
}
コード例 #3
0
ファイル: KSceneEditorRiver.cpp プロジェクト: viticm/pap2
void KSceneEditorRiver::OnBnClickedNewriver()
{
	// TODO: Add your control notification handler code here
	if (!m_lpRiverMgr)
		return;
	m_lpRiverMgr->AddNewOne();
	FillList();
	int nIndex = m_List.GetCount()-1;
	m_List.SetCurSel(nIndex);
	OnLbnSelchangeList1();
}
コード例 #4
0
ファイル: KSceneEditorRiver.cpp プロジェクト: viticm/pap2
void KSceneEditorRiver::OnBnClickedDelriver()
{
	if(!m_lpEditor)
		return;

	m_lpEditor->DeleteNodeFromScene(NODETYPE_RIVER);
	int nIndex = m_List.GetCurSel();
	m_lpRiverMgr->DeleteOne(nIndex);
	FillList();
	if(nIndex >= m_List.GetCount() && m_List.GetCount()>0)
		nIndex = m_List.GetCount()-1;
	if (m_List.GetCount()>0)
	{
		m_List.SetCurSel(nIndex);
		OnLbnSelchangeList1();
	}
}
コード例 #5
0
BOOL CPnSPresetsDlg::OnInitDialog()
{
	__super::OnInitDialog();

	for (int i = 0, j = m_pnspresets.GetCount(); i < j; i++) {
		CString label;
		double PosX, PosY, ZoomX, ZoomY;
		StringToParams(m_pnspresets[i], label, PosX, PosY, ZoomX, ZoomY);

		m_list.AddString(label);

		if (i == 0) {
			m_list.SetCurSel(0);
			OnLbnSelchangeList1();
		}
	}

	return TRUE;
}
コード例 #6
0
void Dlg_SET_OPT_Epoxy::OnBnClickedButtonDelSetting()
{
	int index=m_List_Settings.GetCurSel();
	Command_Set_Optimize* command=Command_Set_Optimize::getCommand();
	Settings_Optimize_Turbulence* settings=command->get_Opt_Turbulence();
	std::set<CString>::iterator it=(settings->motors).begin();
	
	if(index>=4)
	{
		while(index-4>0)
		{
			it++;
			index--;
		}
		(settings->motors).erase(it);
	}
	OnBnClickedButtonResetSettings();
	OnLbnSelchangeList1();
	UpdateData(FALSE);
}
コード例 #7
0
ファイル: PnSPresetsDlg.cpp プロジェクト: Fluffiest/splayer
BOOL CPnSPresetsDlg::OnInitDialog()
{
	__super::OnInitDialog();

	for(int i = 0, j = m_pnspresets.GetCount(); i < j; i++)
	{
		CString label;
		double PosX, PosY, ZoomX, ZoomY;
		StringToParams(m_pnspresets[i], label, PosX, PosY, ZoomX, ZoomY);

		m_list.AddString(label);

		if(i == 0)
		{
			m_list.SetCurSel(0);
			OnLbnSelchangeList1();
		}
	}

	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
コード例 #8
0
// 对码/写入
void CConfigZoneDlg::OnBnClickedButton1()
{
	int ndx = m_list.GetCurSel(); if (ndx < 0)return;
	int zone_value = m_list.GetItemData(ndx);
	if (0 < zone_value && zone_value < 8) {
		EnableWindows(0);
		return;
	}
	BOOL b = m_chkDuimaByEmmitDetector.GetCheck();
	if (b) { // 触发探测器
		CAlarmMachineConfigToolDlg* mainWnd = static_cast<CAlarmMachineConfigToolDlg*>(AfxGetApp()->GetMainWnd()); assert(mainWnd);
		if (!mainWnd)return;
		mainWnd->Duima(zone_value);
	} else { // 手动写入
		ZoneInfo zoneInfo;
		zoneInfo.zone = zone_value;
		int type_ndx = m_cmbType.GetCurSel(); assert(type_ndx >= 0);
		if (type_ndx == 0) { // direct zone
			zoneInfo.type = ZT_ZONE;
		} else if (type_ndx == 1) {// submachine
			zoneInfo.type = ZT_SUBMACHINE;
		} else { assert(0); }

		if (zoneInfo.type == ZT_SUBMACHINE) {
			zoneInfo.status_or_property = ZS_DISARM;
		} else {
			int property_ndx = m_cmbProperty.GetCurSel(); assert(property_ndx >= 0);
			if (property_ndx == 0) { // burglar
				int burglar_ndx = m_cmbBurglarZoneProperty.GetCurSel(); assert(burglar_ndx >= 0);
				ZoneStatusOrProperty p = static_cast<ZoneStatusOrProperty>(m_cmbBurglarZoneProperty.GetItemData(burglar_ndx));
				int bProperty[] = {
					ZP_GLOBAL,
					ZP_HALF,
					ZP_EMERGE,
					ZP_SHIELD,
					ZP_DOOR,
				};
				assert([&]()->bool {
					bool in = false;
					for (auto b : bProperty) { if (b == p) { in = true; break; } }
					return in;
				}());
				zoneInfo.status_or_property = p;
			} else {
				ZoneStatusOrProperty p = static_cast<ZoneStatusOrProperty>(m_cmbProperty.GetItemData(property_ndx));
				int aProperty[] = {
					ZP_FIRE,
					ZP_DURESS,
					ZP_GAS,
					ZP_WATER
				};
				assert([&]()->bool {
					bool in = false;
					for (auto b : aProperty) { if (b == p) { in = true; break; } }
					return in;
				}());
				zoneInfo.status_or_property = p;
			}
		}

		CString saddr;
		m_addr.GetWindowTextW(saddr);
		if (saddr.GetLength() != 4) {
			MessageBox(L"无线地址码长度为4位!");
			m_addr.SetFocus();
			return;
		}

		USES_CONVERSION;
		const char* addr = W2A(saddr);
		WORD waddr = 0;
		try {
			waddr = ademco::HexCharArrayToDec(addr, 4) & 0xFFFF;
		} catch (...) {
			MessageBox(L"非法的无线地址码!");
			m_addr.SetFocus();
			return;
		}

		if (!unique_addr(zone_value, waddr)) {
			MessageBox(L"该无线地址码已被使用!");
			return;
		}

		zoneInfo.addr = waddr;

		// 写入
		CAlarmMachineConfigToolDlg* mainWnd = static_cast<CAlarmMachineConfigToolDlg*>(AfxGetApp()->GetMainWnd()); assert(mainWnd);
		if (!mainWnd)return;
		mainWnd->Duima2(zoneInfo);
	} 

	CDuimaProgressDlg dlg;
	dlg.m_bduima_or_write = b;
	int ret = dlg.DoModal();
	if (ret == IDOK) {
		CString txt;
		if (g_zoneInfo[zone_value].type == ZT_ZONE) {
			txt.Format(L"防区%03d ---- 直属防区 ---- %s", g_zoneInfo[zone_value].zone, GetStringOfZoneStatusOrProperty(g_zoneInfo[zone_value].status_or_property));
		} else if (g_zoneInfo[zone_value].type == ZT_SUBMACHINE) {
			txt.Format(L"防区%03d ---- 分机防区 ---- %s", g_zoneInfo[zone_value].zone, GetStringOfZoneStatusOrProperty(g_zoneInfo[zone_value].status_or_property));
		} else { assert(0); }
		m_list.DeleteString(ndx);
		int new_ndx = m_list.InsertString(ndx, txt); assert(ndx == new_ndx);
		m_list.SetItemData(new_ndx, g_zoneInfo[zone_value].zone);
		m_list.SetCurSel(new_ndx);
		OnLbnSelchangeList1();
	}
}