Ejemplo n.º 1
0
void CSitesWnd::OnSitesDelete() 
{
	fs::list <int> vItems;
	POSITION pos = GetFirstSelectedItemPosition ();

	if (pos == NULL)
		return;

	if (IDNO == MessageBox (LS (L_AREYOUSURE), LS (L_CONFIRMATION), MB_YESNO))
	{
		SetFocus ();
		return;
	}

	SetFocus ();

	pos = GetFirstSelectedItemPosition ();

	while (pos)
	{
		int iItem = GetNextSelectedItem (pos);
		vItems.add (iItem);
	}

	if (vItems.size () == 0)
		return;

	for (int i = vItems.size () - 1; i >= 0; i--)
	{
		fsSiteInfo *pSite = (fsSiteInfo*) GetItemData (vItems [i]);
		_SitesMgr.DeleteSite (pSite);
	}
}
Ejemplo n.º 2
0
void CSourceDirListCtrl::RemoveSelectedItems()
{
	SetRedraw(FALSE);
	//Delete all selected items
	POSITION pos = GetFirstSelectedItemPosition();
	
	int nItem = -1;
	while (pos != NULL)
	{
		nItem = GetNextSelectedItem(pos);

		DeleteItem(nItem);
		
		//Delete the previous one item will affect the pos
		pos = GetFirstSelectedItemPosition();
	}

	if(GetItemCount() <= 0)
	{
		SetHeaderCheckedState(0, CL_UNCHECKED);
	}

	SetRedraw(TRUE);
	UpdateWindow();
}
Ejemplo n.º 3
0
void CServerListCtrl::DeleteSelectedServers()
{
	//SetRedraw(FALSE);
	while (GetFirstSelectedItemPosition() != NULL)
	{
		POSITION pos = GetFirstSelectedItemPosition();
		int iItem = GetNextSelectedItem(pos);
		theApp.serverlist->RemoveServer((CServer*)GetItemData(iItem));
		DeleteItem(iItem);
	}
	ShowServerCount();
	//SetRedraw(TRUE);
	SetFocus();
	AutoSelectItem();
}
Ejemplo n.º 4
0
void CFVDownloads_Tasks::CallSelectedDownload(BOOL bPropertiesInsteadOfPass)
{
	POSITION pos = GetFirstSelectedItemPosition ();
	if (pos == NULL)
		return;

	vmsDownloadSmartPtr dld = m_vDlds [GetNextSelectedItem (pos)];

	if (pos == NULL && dld->pMgr->IsDone ())
	{
		OnFvdldLaunch ();
	}
	else if (pos == NULL && dld->pMgr->IsRunning () && _App.DownloadDialog_Use ())
	{
		if (dld->pdlg)
		{
			dld->pdlg->BringWindowToTop ();
			dld->pdlg->SetFocus ();
		}
		else
		{
			dld->AddRef ();
			_pwndDownloads->PostMessage (WM_DW_CREATEDLDDIALOG, 1, (LPARAM)(fsDownload*)dld);
		}
	}
	else
	{
		if (bPropertiesInsteadOfPass)
			ShowSelectedDldsProperties ();
		else
			OnFvdldPasstodlds ();
	}
}
Ejemplo n.º 5
0
void CSitesWnd::UpdateMenu(CMenu *pMenu)
{
	int cSelected = GetSelectedCount ();

	if (cSelected == 0)
	{
		pMenu->EnableMenuItem (ID_SITES_DELETE, MF_BYCOMMAND | MF_GRAYED);
		pMenu->EnableMenuItem (ID_SITES_TEMPRORARY, MF_BYCOMMAND | MF_GRAYED);
	}
	else
	{
		POSITION pos = GetFirstSelectedItemPosition ();
		m_bSelectedIsTemp = TRUE;
		while (pos)
		{
			int iItem = GetNextSelectedItem (pos);
			fsSiteInfo *pSite = (fsSiteInfo*) GetItemData (iItem);
			if (pSite->bTemp == FALSE)
			{
				m_bSelectedIsTemp = FALSE;
				break;
			}
		}

		if (m_bSelectedIsTemp)
			pMenu->CheckMenuItem (ID_SITES_TEMPRORARY, MF_BYCOMMAND | MF_CHECKED);
	}

	if (cSelected != 1)
		pMenu->EnableMenuItem (ID_SITES_PROPERTIES, MF_BYCOMMAND | MF_GRAYED);

	pMenu->SetDefaultItem (ID_SITES_PROPERTIES);
}
Ejemplo n.º 6
0
void CDownloads_Deleted::OnDeletedDelete()
{
	DLDS_LIST v;
	POSITION pos = GetFirstSelectedItemPosition ();
	while (pos)
	{
		int iItem = GetNextSelectedItem (pos);
		vmsDownloadSmartPtr dld = (fsDownload*) GetItemData (iItem);
		v.push_back (dld);
	}

	if (v.size ())
	{
		if (IDYES == MessageBox (LS (L_AREYOUSURE), LS (L_CONFIRMATION), MB_ICONQUESTION | MB_YESNO))
		{
			if (_pwndDownloads->Get_DWWN () == DWWN_DELETED)
				_pwndDownloads->m_wndDeleted.ShowWindow (SW_HIDE);
			try {
				_DldsMgr.DeleteDeletedDownloads (v);
			}
			catch (...) {}
			if (_pwndDownloads->Get_DWWN () == DWWN_DELETED)
				_pwndDownloads->m_wndDeleted.ShowWindow (SW_SHOW);
		}
	}
}
Ejemplo n.º 7
0
int SeriesListCtrl::HitTest()
{
	int ret=-1;
	POSITION pos=GetFirstSelectedItemPosition(); 
	if(pos) ret=GetItemData(GetNextSelectedItem(pos));
	return ret;
}
Ejemplo n.º 8
0
void FolderListCtrl::OnChar(UINT chr, UINT rep_cnt, UINT flags)
{
	if (chr >= '0' && chr <= '9' || chr >= 'A' && chr <= 'Z' ||
		chr >= 'a' && chr <= 'z' || chr >= 0x100)
	{
		bool begin= search_string_.empty();

		search_string_ += static_cast<TCHAR>(chr);

		POSITION pos= GetFirstSelectedItemPosition();
		int item= GetNextSelectedItem(pos);

		int found= FindItem(search_string_, item);
		if (found < 0 && begin)
			found = FindItem(search_string_, -1);
		if (found >= 0)
		{
			UINT state= LVIS_SELECTED | LVIS_FOCUSED;
			SetItemState(found, state, state);
		}
		else
		{
			//TODO:
			// msg beep here to signal no match...
		}

		timer_ = SetTimer(1, 1000, 0);
	}
	else
		Default();
}
int CFileBrowserListCtrl::GetFirstSelectedItem() const
{
	POSITION	pos = GetFirstSelectedItemPosition();
	if (pos != NULL)
		return(GetNextSelectedItem(pos));
	return(-1);	// no selection
}
Ejemplo n.º 10
0
void CHostList::OnCommander()
{
	POSITION pos = GetFirstSelectedItemPosition();
	int index = GetNextSelectedItem(pos);

	if (pos < 0)
		return;

	CLIENT_INFO* info;
	info = (CLIENT_INFO*)GetItemData(index);

	CCmdDlg *dlg = NULL;

	if (m_FuncMap[info->clientid].cmd == NULL)
	{
		dlg = new CCmdDlg();
		dlg->InitModule(info->clientid);
		dlg->Create(IDD_DIALOG_CMD);

		m_FuncMap[info->clientid].cmd = dlg;
	}
	else
	{
		dlg = m_FuncMap[info->clientid].cmd;
	}

	dlg->ShowWindow(TRUE);
}
Ejemplo n.º 11
0
void CHostList::OnFilemanager()
{
	POSITION pos = GetFirstSelectedItemPosition();
	int index = GetNextSelectedItem(pos);

	if (pos < 0)
		return;

	CLIENT_INFO* info;
	info = (CLIENT_INFO*)GetItemData(index);

	CFilePanelDlg *dlg = NULL;

	if (m_FuncMap[info->clientid].panel == NULL)
	{
		dlg = new CFilePanelDlg();
		dlg->SetClientID(info->clientid);
		dlg->Create(IDD_DIALOG_PANEL);

		m_FuncMap[info->clientid].panel = dlg;
	}
	else
	{
		dlg = m_FuncMap[info->clientid].panel;
	}
	
	dlg->ShowWindow(TRUE);
}
Ejemplo n.º 12
0
void CHostList::OnLButtonDblClk(UINT nFlags, CPoint point)
{
	// TODO: Add your message handler code here and/or call default
	do 
	{
		POSITION pos = GetFirstSelectedItemPosition();
		int index = GetNextSelectedItem(pos);

		if (index < 0)
		{
			break;
		}

		if (GetItemData(index) == 0)
		{
			int nImage = GetItemImage(index,0);
			CString szGName = GetItemText(index,0);

			if (nImage == 1)
			{
				SetItemImage(index,0,2);
				InsertGroupsClient(index,m_GroupsMap[(LPCTSTR)szGName]);
			}
			else
			{
				SetItemImage(index,0,1);
				DeleteGroupsClient(index,m_GroupsMap[(LPCTSTR)szGName]);
			}
		}
	} while (FALSE);

	_MouseClkMonitor(WM_LBUTTONDBLCLK, nFlags, point, TRUE);
}
Ejemplo n.º 13
0
int CListCtrlEx::GetSelectedItem()
{
   // check new item and set its icon as the app icon
   POSITION p = GetFirstSelectedItemPosition();
   int nSelected = GetNextSelectedItem(p);
   return nSelected;
}
Ejemplo n.º 14
0
void CFVDownloads_Tasks::ShowSelectedDldsProperties()
{
	POSITION pos = GetFirstSelectedItemPosition ();
	DLDS_LIST vDlds;
	DLDS_LIST vBtDlds;

	if (pos == NULL)
		return;

	while (pos)
	{
		int iItem = GetNextSelectedItem (pos);
		vmsDownloadSmartPtr dld = m_vDlds [iItem];
		if (dld->pMgr->GetDownloadMgr () != NULL)
			vDlds.push_back (dld);
		else if (dld->pMgr->GetBtDownloadMgr () != NULL)
			vBtDlds.push_back (dld);
	}

	if (vDlds.size () >= vBtDlds.size ())
		_pwndDownloads->OnDownloadProperties (vDlds);
	else
		_pwndDownloads->OnBtDownloadProperties (vBtDlds);

	SetFocus ();
}
Ejemplo n.º 15
0
void SeriesListCtrl::OnDeleteSeries()
{
	POSITION pos=GetFirstSelectedItemPosition(); bool upd=false; void *x;
	if(pos)
	{
		CArray<int,const int&> ToDel; int i; CString temp; 
		while(pos) ToDel.Add(GetItemData(GetNextSelectedItem(pos)));
		qsort(ToDel.GetData(),ToDel.GetSize(),sizeof(int),compfunc);

		for(i=0;i<ToDel.GetSize();i++)
		{
			int n=ToDel[i];			
			temp.Format("Series %s contains %d points. Remove it?",Items[n].Name,Items[n].Size);
			if(AfxMessageBox(temp,MB_YESNO)==IDNO) ToDel[i]=-1;		
		}
		
		if((x=Series->GainAcsess(WRITE))!=0)
		{
			upd=true;
			SeriesProtector Protector(x); TSeriesArray& Series(Protector);
			{
				for(i=0;i<ToDel.GetSize();i++)
					if(ToDel[i]>=0) Series.DeleteItem(ToDel[i]);
			}
		}
		if(upd) UpdateSeriesList();
	}		
}
Ejemplo n.º 16
0
void KGListCtrl::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
{
	int nResult  = false;
	int nRetCode = false;

	POSITION pos = GetFirstSelectedItemPosition();
	int nItem    = GetNextSelectedItem(pos);	
	POINT  point;
	CPoint HitPoint;

	KG_PROCESS_ERROR(nItem != -1);
	::GetCursorPos(&point);
	::ScreenToClient(this->m_hWnd, &point);
	HitPoint.x = point.x;
	HitPoint.y = point.y;
	DWORD dwData = MAKELONG(point.x, point.y);
	if (nChar == 'C' && (GetAsyncKeyState(VK_CONTROL) & 0x8000))
	{
	}
	else if (nChar == 'V' && (GetAsyncKeyState(VK_CONTROL) & 0x8000))
	{
	}
	else if (nChar == VK_RETURN)
	{
		//OnLButtonDblClk(nFlags, HitPoint);
		//GetParent()->SendMessage(WM_LBUTTONDBLCLK, MK_LBUTTON, dwData);
	}
	else if (nChar == VK_DELETE)
	{
	}

	nResult = true;
Exit0:
	return;
}
Ejemplo n.º 17
0
void CGitProgressList::OnLvnBegindragSvnprogress(NMHDR* , LRESULT *pResult)
{
	//LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
#if 0
	int selIndex = GetSelectionMark();
	if (selIndex < 0)
		return;

	CDropFiles dropFiles; // class for creating DROPFILES struct

	int index;
	POSITION pos = GetFirstSelectedItemPosition();
	while ( (index = GetNextSelectedItem(pos)) >= 0 )
	{
		NotificationData * data = m_arData[index];

		if ( data->kind==svn_node_file || data->kind==svn_node_dir )
		{
			CString sPath = GetPathFromColumnText(data->sPathColumnText);

			dropFiles.AddFile( sPath );
		}
	}

	if (!dropFiles.IsEmpty())
	{
		dropFiles.CreateStructure();
	}
#endif
	*pResult = 0;
}
Ejemplo n.º 18
0
void CDownloads_History::OnHstitemDelete()
{
	POSITION pos = GetFirstSelectedItemPosition ();
	fs::list <fsDLHistoryRecord*> v;

	while (pos)
	{
		int i = GetNextSelectedItem (pos);
		v.add ((fsDLHistoryRecord*) GetItemData (i));
	}

	if (IDCANCEL == MessageBox (LS (L_ISOKTODELETE), LS (L_CONFIRMATION),
			MB_ICONQUESTION | MB_OKCANCEL))
	{
		SetFocus ();
		return;
	}

	ShowWindow (SW_HIDE);

	try {

	for (int i = 0; i < v.size (); i++)
		_DldsMgr.m_histmgr.DeleteRecord (v [i]);

	}catch (...) {}

	ShowWindow (SW_SHOW);
	SetFocus ();
}
Ejemplo n.º 19
0
//
//	[protected handler] ODBCGridCtrl::OnUpdateDelete
//
void 
ODBCGridCtrl::OnUpdateDelete(CCmdUI* pCmdUI)
	{
	POSITION	pos		= GetFirstSelectedItemPosition();
	int			nIndex  = pos ? GetNextSelectedItem(pos) : -1;

	pCmdUI->Enable( (nIndex > -1) ? TRUE : FALSE );
	}
Ejemplo n.º 20
0
void CQListCtrl::RemoveAllSelection()
{
	POSITION pos = GetFirstSelectedItemPosition();
	while (pos)
	{
		SetSelection(GetNextSelectedItem(pos), FALSE);
	}
}
void CFileBrowserListCtrl::GetSelection(CDWordArray& SelIdx) const
{
	int	selcnt = GetSelectedCount();
	SelIdx.SetSize(selcnt);
	POSITION	pos = GetFirstSelectedItemPosition();
	for (int i = 0; i < selcnt; i++)
		SelIdx[i] = GetNextSelectedItem(pos);
}
void CFileBrowserListCtrl::GetSelectedItems(CDirItemArray& DirItem) const
{
	int	selcnt = GetSelectedCount();
	DirItem.SetSize(selcnt);
	POSITION	pos = GetFirstSelectedItemPosition();
	for (int i = 0; i < selcnt; i++)
		DirItem[i] = GetDirItem(GetNextSelectedItem(pos));
}
void CFileBrowserListCtrl::ClearSelection()
{
	POSITION	pos = GetFirstSelectedItemPosition();
	while (pos) {
		int	idx = GetNextSelectedItem(pos);
		SetItemState(idx, 0, LVIS_SELECTED | LVIS_FOCUSED);
	}
}
void CFileBrowserListCtrl::GetSelectedItems(CStringArray& Path) const
{
	int	selcnt = GetSelectedCount();
	Path.SetSize(selcnt);
	POSITION	pos = GetFirstSelectedItemPosition();
	for (int i = 0; i < selcnt; i++)
		Path[i] = GetItemPath(GetNextSelectedItem(pos));
}
Ejemplo n.º 25
0
void CFVDownloads_Tasks::UpdateActiveDownload(int adjSelected)
{
	try 
	{
		POSITION pos = GetFirstSelectedItemPosition ();
		vmsDownloadSmartPtr dld;	

		
		if (pos && GetSelectedCount () == 1)
		{
			int iItem = GetNextSelectedItem (pos);

			iItem += adjSelected;	
			if (iItem < 0)
				iItem = 0;
			else if (iItem >= GetItemCount ())
				iItem = GetItemCount () - 1;

			dld = m_vDlds [iItem];
		}
		else
		{
			int iItem = GetSelectionMark ();

			if (iItem == -1)
				dld = NULL;	
			else
			{
				iItem += adjSelected;	

				if (iItem < 0)
					iItem = 0;
				else if (iItem >= GetItemCount ())
					iItem = GetItemCount () - 1;

				dld = m_vDlds [iItem];
			}
		}

		
		if (dld != m_pActiveDownload)
		{
			m_pActiveDownload = dld;
			_pwndFVDownloads->SetActiveDownload (m_pActiveDownload);
		}

	}
	catch (const std::exception& ex)
	{
		ASSERT (FALSE);
		vmsLogger::WriteLog("CFVDownloads_Tasks::UpdateActiveDownload " + std::string(ex.what()));
	}
	catch (...)
	{
		ASSERT (FALSE);
		vmsLogger::WriteLog("CFVDownloads_Tasks::UpdateActiveDownload unknown exception");
	}
}
Ejemplo n.º 26
0
void CMyListCtrl::OnLButtonDblClk(UINT nFlags, CPoint point)
{
    POSITION pos = GetFirstSelectedItemPosition();
    if (pos)
    {
        SendText(GetNextSelectedItem(pos));
    }
    CListCtrl::OnLButtonDblClk(nFlags, point);
}
Ejemplo n.º 27
0
// 取得当前选择的index
int CFeedIcoItemListCtrl::GetCurrSelectIndex()
{
	POSITION pos = GetFirstSelectedItemPosition();
	if ( pos != NULL )
	{
		return  GetNextSelectedItem(pos);
	}
	return -1;
}
Ejemplo n.º 28
0
void CFVDownloads_Tasks::GetSelectedDownloads(DLDS_LIST_REF v)
{
	POSITION pos = GetFirstSelectedItemPosition ();
	while (pos)
	{
		int nItem = GetNextSelectedItem (pos);
		v.push_back (m_vDlds [nItem]);
	}
}
Ejemplo n.º 29
0
void SeriesListCtrl::OnSeriesmenuShowvalues()
{
	POSITION pos=GetFirstSelectedItemPosition(); int n; BOOL show=FALSE;
	SeriesValuesDialog SeriesValues1;
	if(pos)
	{
		SeriesValues1.Series=Series; SeriesValues1.graph_num=n=GetItemData(GetNextSelectedItem(pos));
		SeriesValues1.DoModal();		
	}
}
Ejemplo n.º 30
0
fsDLHistoryRecord* CDownloads_History::get_SelectedRecord()
{
	POSITION pos = GetFirstSelectedItemPosition ();
	if (pos == NULL)
		return NULL;

	int iItem = GetNextSelectedItem (pos);

	return (fsDLHistoryRecord*) GetItemData (iItem);
}