예제 #1
0
void CQueueListCtrl::ShowSelectedUserDetails()
{
	POINT point;

	::GetCursorPos(&point);

	CPoint p = point;

    ScreenToClient(&p);

    int it = HitTest(p);

    if (it == -1)
	{
		return;
	}
	SetSelectionMark(it);

	CUpDownClient* pClient = reinterpret_cast<CUpDownClient*>(GetItemData(GetSelectionMark()));

	if (pClient != NULL)
	{
			CClientDetails dialog(IDS_CD_TITLE, pClient, this, 0);
			dialog.DoModal();
	}
}
예제 #2
0
void CEasySkinListCtrl::OnLButtonDown( UINT nFlags, CPoint point )
{
	if (m_pCheckImg != NULL && !m_pCheckImg->IsNull())
	{
		CRect rcSubItem,rcIcon;
		for (int i=0;i<GetItemCount();i++)
		{
			GetItemRect(i,rcSubItem,LVIR_BOUNDS);

			rcIcon.left = rcSubItem.left+7;
			rcIcon.top = rcSubItem.top+(rcSubItem.Height()-m_pCheckImg->GetHeight())/2;
			rcIcon.right = rcIcon.left + m_pCheckImg->GetWidth();
			rcIcon.bottom = rcIcon.top + m_pCheckImg->GetHeight();

			if ( PtInRect(&rcIcon,point) )
			{
 				SetCheck(i,!GetCheck(i));

				SetItemState(i, LVIS_FOCUSED | LVIS_SELECTED,LVIS_FOCUSED | LVIS_SELECTED);
				SetSelectionMark(i);

				Invalidate(FALSE);
				break;
			}
		}
	}


	__super::OnLButtonDown(nFlags, point);
}
예제 #3
0
void CInstrumentList::SelectInstrument(int Index)
{
	// Highlight a specified instrument (Index = instrument number)	
	int ListIndex = FindInstrument(Index);
	SetSelectionMark(ListIndex);
	SetItemState(ListIndex, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
	EnsureVisible(ListIndex, FALSE);
}
예제 #4
0
BOOL CGitProgressList::PreTranslateMessage(MSG* pMsg)
{
	if (pMsg->message == WM_KEYDOWN)
	{
		if (pMsg->wParam == 'A')
		{
			if (GetKeyState(VK_CONTROL)&0x8000)
			{
				// Ctrl-A -> select all
				SetSelectionMark(0);
				for (int i=0; i<GetItemCount(); ++i)
				{
					SetItemState(i, LVIS_SELECTED, LVIS_SELECTED);
				}
			}
		}
		if ((pMsg->wParam == 'C')||(pMsg->wParam == VK_INSERT))
		{
			int selIndex = GetSelectionMark();
			if (selIndex >= 0)
			{
				if (GetKeyState(VK_CONTROL)&0x8000)
				{
					//Ctrl-C -> copy to clipboard
					CString sClipdata;
					POSITION pos = GetFirstSelectedItemPosition();
					if (pos != NULL)
					{
						while (pos)
						{
							int nItem = GetNextSelectedItem(pos);
							CString sAction = GetItemText(nItem, 0);
							CString sPath = GetItemText(nItem, 1);
							CString sMime = GetItemText(nItem, 2);
							CString sLogCopyText;
							sLogCopyText.Format(_T("%s: %s  %s\r\n"),
								(LPCTSTR)sAction, (LPCTSTR)sPath, (LPCTSTR)sMime);
							sClipdata +=  sLogCopyText;
						}
						CStringUtils::WriteAsciiStringToClipboard(sClipdata);
					}
				}
			}
		}
	} // if (pMsg->message == WM_KEYDOWN)
	return CListCtrl::PreTranslateMessage(pMsg);
}
예제 #5
0
void CDownloads_Deleted::SelectDownload(vmsDownloadSmartPtr dld)
{
	int iItem = FindDownload (dld);

	if (iItem == -1)
		return;

	POSITION pos = GetFirstSelectedItemPosition ();
	
	while (pos)
		SetItemState (GetNextSelectedItem (pos), 0, LVIS_SELECTED | LVIS_FOCUSED);

	
	SetItemState (iItem, LVIS_FOCUSED | LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED);
	SetSelectionMark (iItem);
	EnsureVisible (iItem, FALSE);
}
예제 #6
0
void CDownloads_History::SelectRecord(fsDLHistoryRecord *rec)
{
	int iItem = FindRecord (rec);

	if (iItem == -1)
		return;

	POSITION pos = GetFirstSelectedItemPosition ();
	
	while (pos)
		SetItemState (GetNextSelectedItem (pos), 0, LVIS_SELECTED | LVIS_FOCUSED);

	
	SetItemState (iItem, LVIS_FOCUSED | LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED);
	SetSelectionMark (iItem);
	EnsureVisible (iItem, FALSE);
}
void CDownloadClientsCtrl::ShowSelectedUserDetails(){
	POINT point;
	::GetCursorPos(&point);
	CPoint p = point; 
    ScreenToClient(&p); 
    int it = HitTest(p); 
    if (it == -1)
		return;

	SetItemState(-1, 0, LVIS_SELECTED);
	SetItemState(it, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
	SetSelectionMark(it);   // display selection mark correctly!

	CUpDownClient* client = (CUpDownClient*)GetItemData(GetSelectionMark());
	if (client){
		CClientDetailDialog dialog(client, this);
		dialog.DoModal();
	}
}
예제 #8
0
void CFolderListCtrl::OnRButtonDown(UINT nFlags, CPoint point) 
{
	CListCtrl::OnRButtonDown(nFlags, point);

	POSITION selPos = GetFirstSelectedItemPosition();
	int nItemPos = -1;

	if( selPos )
		nItemPos = GetNextSelectedItem( selPos );
	if( nItemPos >= 0 )
	{
		SetSelectionMark( nItemPos );

		CMenu m_ListPopup;
		m_ListPopup.LoadMenu( IDR_FOLDER_LIST );
		CMenu * pListMenu = m_ListPopup.GetSubMenu( 0 );
		pListMenu->SetDefaultItem(ID_FILE_EDIT);
		ClientToScreen( &point );
		pListMenu->TrackPopupMenu( TPM_LEFTALIGN |TPM_RIGHTBUTTON, point.x, point.y, AfxGetMainWnd() );
	}
}
void CFileBrowserListCtrl::SetSort(int Col, int Dir)
{
	if (Col == m_SortCol && Dir == m_SortDir)	// if same column and direction
		return;	// nothing to do
	if (Col != m_SortCol && m_SortCol >= 0)	// if different column has arrow
		DrawSortArrow(m_SortCol, -1);	// remove arrow from previous column
	if (Col >= 0) {	// if valid sort column
		int	items = m_DirList.GetCount();
		int	selcnt = GetSelectedCount();
		int	selmark = GetSelectionMark();
		if (selcnt || selmark >= 0) {	// if there's a selection
			// save item states and selection mark in list user data
			for (int i = 0; i < items; i++) {
				CDirItem&	item = m_DirList.GetItem(i);
				item.SetData(GetItemState(i, LVIS_SELECTED | LVIS_FOCUSED));
			}
			if (selmark >= 0) {
				CDirItem&	item = m_DirList.GetItem(selmark);
				// repurpose an item state bit to indicate selection mark
				item.SetData(item.GetData() | LVIS_ACTIVATING);
			}
		}
		DrawSortArrow(Col, Dir);	// draw appropriate arrow on new column
		m_DirList.Sort(Col, Dir);	// sort directory list
		if (selcnt || selmark >= 0) {	// if there's a selection
			// restore item states and selection mark from list user data
			for (int i = 0; i < items; i++) {
				const CDirItem&	item = m_DirList.GetItem(i);
				DWORD	state = item.GetData();
				SetItemState(i, state, LVIS_SELECTED | LVIS_FOCUSED);
				if (state & LVIS_ACTIVATING)	// if item has selection mark
					SetSelectionMark(i);
			}
		}
		Invalidate();
	}
	m_SortCol = Col;
	m_SortDir = Dir;
}
예제 #10
0
BOOL CFolderListCtrl::SetCurFolder( const CSCADString& sFolderPath, bool bForce)
{
	if( !bForce && !m_sFolderPath.CompareNoCase( sFolderPath ) )
		return TRUE;
	Timer.Start();
	m_DirChangeListener.SetDir(sFolderPath, m_hWnd);
/*
	SCDefProjInfo proj_info;

	SCADDefProj::GetInfo( m_Properties.m_DefProj, proj_info );
	SCMdl3DSetCameraPos( proj_info.m_ptViewDir, proj_info.m_ptUpOrient );
*/
	// ReSharper disable once CppEntityAssignedButNoRead
	extern SCDefProjType ThumbProjection;
	ThumbProjection = m_Properties.m_DefProj;
	if(CSCAD3DMdlSettings::Get3DS())
	{
		CSCAD3DMdlSettings::Get3DS()->CancelDraw();
		CSCAD3DMdlSettings::Get3DS()->SetStartDrawPos( 0 );
	}

	CreateImageList();
	DeleteAllItemsData();
	DeleteAllItems();
	m_sFolderPath = sFolderPath;
	m_nItemCount = 0;
	m_nImageBalance = 0;
	m_nSelectedItem = -1;
	SetSelectionMark( 0 );
	
	int i;

	for( i = m_imlLargeIcons.GetImageCount() - 1; i >= 0; i-- )
		m_imlLargeIcons.Remove( i );
	for( i = m_imlSmallIcons.GetImageCount() - 1; i >= 0; i-- )
		m_imlSmallIcons.Remove( i );

	if( _taccess( sFolderPath, 0 ) == -1 )
		return TRUE;

	SCStringVector::iterator itExt = m_Properties.m_vsExt.begin();
	CSCADString sPath;

	struct _tfinddata_t fd;

	int nLargeIconInd = 0;
	int nSmallIconInd = 0;

	for( ; itExt != m_Properties.m_vsExt.end(); ++itExt )
	{
		sPath = m_sFolderPath + _T("\\") + *itExt;

		intptr_t hFindHandle = _tfindfirst( sPath, &fd );

		if( hFindHandle == -1 )
			continue;

		AddFileTypeIcons(fd, nLargeIconInd, nSmallIconInd);

		do
		{
			AddFileItem(fd, nLargeIconInd, nSmallIconInd, *itExt);
		} while( _tfindnext( hFindHandle, &fd ) != -1 );
		_findclose( hFindHandle );
	}
	SortItems( m_flciColumns[m_nCurColumn].m_fnCmp, m_bSortAscending );
	m_nImageBalance = m_nItemCount;
	SetRedrawItemPos( 0, true );
	if( AfxGetMainWnd() )
	{
		CSCADViewerStatBar &theStatusBar = static_cast<CScadViewerFrame*>(AfxGetMainWnd())->GetStatusBar();
		theStatusBar.SetFileCount( m_nItemCount );
	}
	UpdateFileCount();		

	return TRUE;
}
예제 #11
0
BOOL CFriendListCtrl::OnCommand(WPARAM wParam, LPARAM /*lParam*/)
{
	wParam = LOWORD(wParam);

	CFriend* cur_friend = NULL;
	int iSel = GetNextItem(-1, LVIS_SELECTED | LVIS_FOCUSED);
	if (iSel != -1) 
		cur_friend = (CFriend*)GetItemData(iSel);
	
	switch (wParam)
	{
		case MP_MESSAGE:
			if (cur_friend)
			{
				theApp.emuledlg->chatwnd->StartSession(cur_friend->GetClientForChatSession());
			}
			break;
		case MP_REMOVEFRIEND:
			if (cur_friend)
			{
				theApp.friendlist->RemoveFriend(cur_friend);
				// auto select next item after deleted one.
				if (iSel < GetItemCount()) {
					SetSelectionMark(iSel);
					SetItemState(iSel, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
				}
				theApp.emuledlg->chatwnd->UpdateSelectedFriendMsgDetails();
			}
			break;
		case MP_ADDFRIEND:{
			CAddFriend dialog2; 
			dialog2.DoModal();
			break;
		}
		case MP_DETAIL:
		case MPG_ALTENTER:
		case IDA_ENTER:
			if (cur_friend)
				ShowFriendDetails(cur_friend);
			break;
		case MP_SHOWLIST:
			if (cur_friend)
			{
				if (cur_friend->GetLinkedClient(true))
					cur_friend->GetLinkedClient()->RequestSharedFileList();
				else
				{
					CUpDownClient* newclient = new CUpDownClient(0, cur_friend->m_nLastUsedPort, cur_friend->m_dwLastUsedIP, 0, 0, true);
					newclient->SetUserName(cur_friend->m_strName);
					//Xman Code Improvement don't search new generated clients in lists
					/*
					theApp.clientlist->AddClient(newclient);
					*/
					theApp.clientlist->AddClient(newclient,true);
					//Xman end
					newclient->RequestSharedFileList();
				}
			}
			break;
		case MP_FRIENDSLOT:
			if (cur_friend)
			{
				bool bIsAlready = cur_friend->GetFriendSlot();
				theApp.friendlist->RemoveAllFriendSlots();
				if (!bIsAlready)
				{ //Xman
					cur_friend->SetFriendSlot(true);
					//Xman friend visualization
					UpdateFriend(iSel,cur_friend);
					//Xman end
				} //Xman
			}
			break;
		// - show requested files (sivka/Xman)
		case MP_LIST_REQUESTED_FILES:
			{ 
				if (cur_friend && cur_friend->GetLinkedClient())
				{
					cur_friend->GetLinkedClient()->ShowRequestedFiles(); 
				}
				break;
			}
		//Xman end
		// MORPH START - Added by Commander, Friendlinks [emulEspaa] - added by zz_fly
		case MP_PASTE:
		{
			CString link = theApp.CopyTextFromClipboard();
			link.Trim();
			if ( link.IsEmpty() )
				break;
			try{
				CED2KLink* pLink = CED2KLink::CreateLinkFromUrl(link);
		
				if (pLink && pLink->GetKind() == CED2KLink::kFriend )
				{
					// Better with dynamic_cast, but no RTTI enabled in the project
					CED2KFriendLink* pFriendLink = static_cast<CED2KFriendLink*>(pLink);
					uchar userHash[16];
					pFriendLink->GetUserHash(userHash);

					if ( ! theApp.friendlist->IsAlreadyFriend(userHash) )
						theApp.friendlist->AddFriend(userHash, 0U, 0U, 0U, 0U, pFriendLink->GetUserName(), 1U);
					else
					{
						CString msg;
						msg.Format(GetResString(IDS_USER_ALREADY_FRIEND), pFriendLink->GetUserName());
						AddLogLine(true, msg);
					}
				}
				if(pLink) delete pLink; //zz_fly :: memleak :: thanks DolphinX
			}
			catch(CString strError){
				AfxMessageBox(strError);
			}
		}
			break;
        case MP_GETFRIENDED2KLINK:
		{
			CString sCompleteLink;
			if ( cur_friend && cur_friend->HasUserhash() )
			{
				CString sLink;
				CED2KFriendLink friendLink(cur_friend->m_strName, cur_friend->m_abyUserhash);
				friendLink.GetLink(sLink);
				if ( !sCompleteLink.IsEmpty() )
					sCompleteLink.Append(_T("\r\n"));
				sCompleteLink.Append(sLink);
			}

			if ( !sCompleteLink.IsEmpty() )
				theApp.CopyTextToClipboard(sCompleteLink);
		}
			break;
		case MP_GETHTMLFRIENDED2KLINK:
		{
			CString sCompleteLink;
			
			if ( cur_friend && cur_friend->HasUserhash() )
			{
				CString sLink;
				CED2KFriendLink friendLink(cur_friend->m_strName, cur_friend->m_abyUserhash);
				friendLink.GetLink(sLink);
				sLink = _T("<a href=\"") + sLink + _T("\">") + StripInvalidFilenameChars(cur_friend->m_strName) + _T("</a>");
				if ( !sCompleteLink.IsEmpty() )
					sCompleteLink.Append(_T("\r\n"));
				sCompleteLink.Append(sLink);
			}
			
			if ( !sCompleteLink.IsEmpty() )
				theApp.CopyTextToClipboard(sCompleteLink);
		}
			break;
		// MORPH END - Added by Commander, Friendlinks [emulEspaa]

		case MP_FIND:
			OnFindStart();
			break;
	}
	return true;
}