// CUploadListCtrl message handlers void CUploadListCtrl::OnContextMenu(CWnd* pWnd, CPoint point) { int iSel = GetNextItem(-1, LVIS_SELECTED | LVIS_FOCUSED); const CUpDownClient* client = (iSel != -1) ? (CUpDownClient*)GetItemData(iSel) : NULL; CTitleMenu ClientMenu; ClientMenu.CreatePopupMenu(); ClientMenu.AddMenuTitle(GetResString(IDS_CLIENTS), true); ClientMenu.AppendMenu(MF_STRING | (client ? MF_ENABLED : MF_GRAYED), MP_DETAIL, GetResString(IDS_SHOWDETAILS), _T("CLIENTDETAILS")); ClientMenu.SetDefaultItem(MP_DETAIL); ClientMenu.AppendMenu(MF_STRING | ((client && client->IsEd2kClient() && !client->IsFriend()) ? MF_ENABLED : MF_GRAYED), MP_ADDFRIEND, GetResString(IDS_ADDFRIEND), _T("ADDFRIEND")); ClientMenu.AppendMenu(MF_STRING | ((client && client->IsEd2kClient()) ? MF_ENABLED : MF_GRAYED), MP_MESSAGE, GetResString(IDS_SEND_MSG), _T("SENDMESSAGE")); ClientMenu.AppendMenu(MF_STRING | ((client && client->IsEd2kClient() && client->GetViewSharedFilesSupport()) ? MF_ENABLED : MF_GRAYED), MP_SHOWLIST, GetResString(IDS_VIEWFILES), _T("VIEWFILES")); if (Kademlia::CKademlia::isRunning() && !Kademlia::CKademlia::isConnected()) ClientMenu.AppendMenu(MF_STRING | ((client && client->IsEd2kClient() && client->GetKadPort()!=0) ? MF_ENABLED : MF_GRAYED), MP_BOOT, GetResString(IDS_BOOTSTRAP)); GetPopupMenuPos(*this, point); ClientMenu.TrackPopupMenu(TPM_LEFTALIGN |TPM_RIGHTBUTTON, point.x, point.y, this); }
void CFileDetailDialogName::OnNmRClickList(NMHDR* /*pNMHDR*/, LRESULT* pResult) { UINT flag = MF_STRING; if (m_listFileNames.GetNextItem(-1, LVIS_SELECTED | LVIS_FOCUSED) == -1) flag = MF_GRAYED; POINT point; ::GetCursorPos(&point); CTitleMenu popupMenu; popupMenu.CreatePopupMenu(); popupMenu.AppendMenu(flag,MP_MESSAGE, GetResString(IDS_TAKEOVER)); popupMenu.AppendMenu(flag,MP_COPYSELECTED, GetResString(IDS_COPY)); popupMenu.AppendMenu(MF_STRING,MP_RESTORE, GetResString(IDS_SV_UPDATE)); popupMenu.SetDefaultItem(MP_MESSAGE); popupMenu.TrackPopupMenu(TPM_LEFTALIGN |TPM_RIGHTBUTTON, point.x, point.y, this); VERIFY( popupMenu.DestroyMenu() ); *pResult = 0; }
void CDownloadClientsCtrl::OnContextMenu(CWnd* /*pWnd*/, CPoint point) { int iSel = GetNextItem(-1, LVIS_SELECTED | LVIS_FOCUSED); const CUpDownClient* client = (iSel != -1) ? (CUpDownClient*)GetItemData(iSel) : NULL; CTitleMenu ClientMenu; ClientMenu.CreatePopupMenu(); ClientMenu.AddMenuTitle(GetResString(IDS_CLIENTS), true); ClientMenu.AppendMenu(MF_STRING | (client ? MF_ENABLED : MF_GRAYED), MP_DETAIL, GetResString(IDS_SHOWDETAILS), _T("CLIENTDETAILS")); ClientMenu.SetDefaultItem(MP_DETAIL); //Xman Xtreme Downloadmanager if (client && client->GetDownloadState() == DS_DOWNLOADING) ClientMenu.AppendMenu(MF_STRING,MP_STOP_CLIENT,GetResString(IDS_STOP_CLIENT), _T("EXIT")); //Xman end //Xman friendhandling ClientMenu.AppendMenu(MF_SEPARATOR); //Xman end ClientMenu.AppendMenu(MF_STRING | ((client && client->IsEd2kClient() && !client->IsFriend()) ? MF_ENABLED : MF_GRAYED), MP_ADDFRIEND, GetResString(IDS_ADDFRIEND), _T("ADDFRIEND")); //Xman friendhandling ClientMenu.AppendMenu(MF_STRING | (client && client->IsFriend() ? MF_ENABLED : MF_GRAYED), MP_REMOVEFRIEND, GetResString(IDS_REMOVEFRIEND), _T("DELETEFRIEND")); ClientMenu.AppendMenu(MF_STRING | (client && client->IsFriend() ? MF_ENABLED : MF_GRAYED), MP_FRIENDSLOT, GetResString(IDS_FRIENDSLOT), _T("FRIENDSLOT")); ClientMenu.CheckMenuItem(MP_FRIENDSLOT, (client && client->GetFriendSlot()) ? MF_CHECKED : MF_UNCHECKED); ClientMenu.AppendMenu(MF_SEPARATOR); //Xman end ClientMenu.AppendMenu(MF_STRING | ((client && client->IsEd2kClient()) ? MF_ENABLED : MF_GRAYED), MP_MESSAGE, GetResString(IDS_SEND_MSG), _T("SENDMESSAGE")); ClientMenu.AppendMenu(MF_STRING | ((client && client->IsEd2kClient() && client->GetViewSharedFilesSupport()) ? MF_ENABLED : MF_GRAYED), MP_SHOWLIST, GetResString(IDS_VIEWFILES), _T("VIEWFILES")); if (Kademlia::CKademlia::IsRunning() && !Kademlia::CKademlia::IsConnected()) ClientMenu.AppendMenu(MF_STRING | ((client && client->IsEd2kClient() && client->GetKadPort()!=0 && client->GetKadVersion() > 1) ? MF_ENABLED : MF_GRAYED), MP_BOOT, GetResString(IDS_BOOTSTRAP)); ClientMenu.AppendMenu(MF_STRING | (GetItemCount() > 0 ? MF_ENABLED : MF_GRAYED), MP_FIND, GetResString(IDS_FIND), _T("Search")); // - show requested files (sivka/Xman) ClientMenu.AppendMenu(MF_SEPARATOR); ClientMenu.AppendMenu(MF_STRING | (GetItemCount() > 0 ? MF_ENABLED : MF_GRAYED),MP_LIST_REQUESTED_FILES, GetResString(IDS_LISTREQUESTED), _T("FILEREQUESTED")); //Xman end GetPopupMenuPos(*this, point); ClientMenu.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this); }
void CFriendListCtrl::OnContextMenu(CWnd* /*pWnd*/, CPoint point) { CTitleMenu ClientMenu; ClientMenu.CreatePopupMenu(); ClientMenu.AddMenuTitle(GetResString(IDS_FRIENDLIST), true); const CFriend* cur_friend = NULL; int iSel = GetNextItem(-1, LVIS_SELECTED | LVIS_FOCUSED); if (iSel != -1) { cur_friend = (CFriend*)GetItemData(iSel); ClientMenu.AppendMenu(MF_STRING,MP_DETAIL, GetResString(IDS_SHOWDETAILS), _T("CLIENTDETAILS")); ClientMenu.SetDefaultItem(MP_DETAIL); } ClientMenu.AppendMenu(MF_STRING, MP_ADDFRIEND, GetResString(IDS_ADDAFRIEND), _T("ADDFRIEND")); ClientMenu.AppendMenu(MF_STRING | (cur_friend ? MF_ENABLED : MF_GRAYED), MP_REMOVEFRIEND, GetResString(IDS_REMOVEFRIEND), _T("DELETEFRIEND")); ClientMenu.AppendMenu(MF_STRING | (cur_friend ? MF_ENABLED : MF_GRAYED), MP_MESSAGE, GetResString(IDS_SEND_MSG), _T("SENDMESSAGE")); ClientMenu.AppendMenu(MF_STRING | ((cur_friend==NULL || (cur_friend && cur_friend->GetLinkedClient(true) && !cur_friend->GetLinkedClient(true)->GetViewSharedFilesSupport())) ? MF_GRAYED : MF_ENABLED), MP_SHOWLIST, GetResString(IDS_VIEWFILES) , _T("VIEWFILES")); ClientMenu.AppendMenu(MF_STRING, MP_FRIENDSLOT, GetResString(IDS_FRIENDSLOT), _T("FRIENDSLOT")); ClientMenu.AppendMenu(MF_STRING | (GetItemCount() > 0 ? MF_ENABLED : MF_GRAYED), MP_FIND, GetResString(IDS_FIND), _T("Search")); ClientMenu.EnableMenuItem(MP_FRIENDSLOT, (cur_friend)?MF_ENABLED : MF_GRAYED); ClientMenu.CheckMenuItem(MP_FRIENDSLOT, (cur_friend && cur_friend->GetFriendSlot()) ? MF_CHECKED : MF_UNCHECKED); // MORPH START - Modified by Commander, Friendlinks [emulEspaa] - added by zz_fly ClientMenu.AppendMenu(MF_SEPARATOR); ClientMenu.AppendMenu(MF_STRING | (theApp.IsEd2kFriendLinkInClipboard() ? MF_ENABLED : MF_GRAYED), MP_PASTE, GetResString(IDS_PASTE), _T("PASTELINK")); ClientMenu.AppendMenu(MF_STRING | (cur_friend ? MF_ENABLED : MF_GRAYED), MP_GETFRIENDED2KLINK, GetResString(IDS_GETFRIENDED2KLINK), _T("ED2KLINK")); ClientMenu.AppendMenu(MF_STRING | (cur_friend ? MF_ENABLED : MF_GRAYED), MP_GETHTMLFRIENDED2KLINK, GetResString(IDS_GETHTMLFRIENDED2KLINK), _T("ED2KLINK")); // MORPH END - Modified by Commander, Friendlinks [emulEspaa] // - show requested files (sivka/Xman) ClientMenu.AppendMenu(MF_SEPARATOR); ClientMenu.AppendMenu(MF_STRING | (cur_friend && cur_friend->GetLinkedClient() ? MF_ENABLED : MF_GRAYED),MP_LIST_REQUESTED_FILES, GetResString(IDS_LISTREQUESTED), _T("FILEREQUESTED")); //Xman end GetPopupMenuPos(*this, point); ClientMenu.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this); VERIFY( ClientMenu.DestroyMenu() ); // XP Style Menu [Xanatos] - Stulle }
void CUploadListCtrl::OnContextMenu(CWnd* /*pWnd*/, CPoint point) { int iSel = GetNextItem(-1, LVIS_SELECTED | LVIS_FOCUSED); const CUpDownClient* client = (iSel != -1) ? (CUpDownClient*)GetItemData(iSel) : NULL; CTitleMenu ClientMenu; ClientMenu.CreatePopupMenu(); //ClientMenu.AddMenuTitle(GetResString(IDS_CLIENTS), true); ClientMenu.AppendMenu(MF_STRING | (client ? MF_ENABLED : MF_GRAYED), MP_DETAIL, GetResString(IDS_SHOWDETAILS), _T("CLIENTDETAILS")); if( thePrefs.IsExtControlsEnabled() ) { ClientMenu.AppendMenu(MF_STRING | MF_ENABLED , MP_SHOWUPQUEUE, GetResString(IDS_SHOWUPQUEUE), NULL); if( thePrefs.GetDebugUpQueue()!=0 ) ClientMenu.AppendMenu(MF_STRING | (client ? MF_ENABLED : MF_GRAYED) , MP_REMOVECLIENT, _T("Remove Client") , NULL); } //VC-dgkang 2008年7月10日 ClientMenu.AppendMenu(MF_STRING | ((client && client->IsEd2kClient() && client->GetViewSharedFilesSupport()) ? MF_ENABLED : MF_GRAYED), MP_SHOWLIST, GetResString(IDS_VIEWFILES), _T("VIEWFILES")); ClientMenu.SetDefaultItem(MP_DETAIL); //ClientMenu.AppendMenu(MF_STRING | ((client && client->IsEd2kClient() && !client->IsFriend()) ? MF_ENABLED : MF_GRAYED), MP_ADDFRIEND, GetResString(IDS_ADDFRIEND), _T("ADDFRIEND")); //ClientMenu.AppendMenu(MF_STRING | ((client && client->IsEd2kClient()) ? MF_ENABLED : MF_GRAYED), MP_MESSAGE, GetResString(IDS_SEND_MSG), _T("SENDMESSAGE")); //if (Kademlia::CKademlia::IsRunning() && !Kademlia::CKademlia::IsConnected()) // ClientMenu.AppendMenu(MF_STRING | ((client && client->IsEd2kClient() && client->GetKadPort()!=0) ? MF_ENABLED : MF_GRAYED), MP_BOOT, GetResString(IDS_BOOTSTRAP)); //ClientMenu.AppendMenu(MF_STRING | (GetItemCount() > 0 ? MF_ENABLED : MF_GRAYED), MP_FIND, GetResString(IDS_FIND), _T("Search")); GetPopupMenuPos(*this, point); m_pMenuXP = new CMenuXP(); m_pMenuXP->AddMenu(&ClientMenu, TRUE); ClientMenu.TrackPopupMenu(TPM_LEFTALIGN |TPM_RIGHTBUTTON, point.x, point.y, this); delete m_pMenuXP; m_pMenuXP = NULL; }
void CServerListCtrl::OnContextMenu(CWnd* pWnd, CPoint point) { // get merged settings bool bFirstItem = true; int iSelectedItems = GetSelectedCount(); int iStaticServers = 0; UINT uPrioMenuItem = 0; POSITION pos = GetFirstSelectedItemPosition(); while (pos) { const CServer* pServer = (CServer*)GetItemData(GetNextSelectedItem(pos)); iStaticServers += pServer->IsStaticMember() ? 1 : 0; UINT uCurPrioMenuItem = 0; if (pServer->GetPreferences() == SRV_PR_LOW) uCurPrioMenuItem = MP_PRIOLOW; else if (pServer->GetPreferences() == SRV_PR_NORMAL) uCurPrioMenuItem = MP_PRIONORMAL; else if (pServer->GetPreferences() == SRV_PR_HIGH) uCurPrioMenuItem = MP_PRIOHIGH; else ASSERT(0); if (bFirstItem) uPrioMenuItem = uCurPrioMenuItem; else if (uPrioMenuItem != uCurPrioMenuItem) uPrioMenuItem = 0; bFirstItem = false; } CTitleMenu ServerMenu; ServerMenu.CreatePopupMenu(); ServerMenu.AddMenuTitle(GetResString(IDS_EM_SERVER), true); ServerMenu.AppendMenu(MF_STRING | (iSelectedItems > 0 ? MF_ENABLED : MF_GRAYED), MP_CONNECTTO, GetResString(IDS_CONNECTTHIS), _T("CONNECT")); ServerMenu.SetDefaultItem(iSelectedItems > 0 ? MP_CONNECTTO : -1); CMenu ServerPrioMenu; ServerPrioMenu.CreateMenu(); if (iSelectedItems > 0){ ServerPrioMenu.AppendMenu(MF_STRING, MP_PRIOLOW, GetResString(IDS_PRIOLOW)); ServerPrioMenu.AppendMenu(MF_STRING, MP_PRIONORMAL, GetResString(IDS_PRIONORMAL)); ServerPrioMenu.AppendMenu(MF_STRING, MP_PRIOHIGH, GetResString(IDS_PRIOHIGH)); ServerPrioMenu.CheckMenuRadioItem(MP_PRIOLOW, MP_PRIOHIGH, uPrioMenuItem, 0); } ServerMenu.AppendMenu(MF_POPUP | (iSelectedItems > 0 ? MF_ENABLED : MF_GRAYED), (UINT_PTR)ServerPrioMenu.m_hMenu, GetResString(IDS_PRIORITY), _T("PRIORITY")); // enable add/remove from static server list, if there is at least one selected server which can be used for the action ServerMenu.AppendMenu(MF_STRING | (iStaticServers < iSelectedItems ? MF_ENABLED : MF_GRAYED), MP_ADDTOSTATIC, GetResString(IDS_ADDTOSTATIC), _T("ListAdd")); ServerMenu.AppendMenu(MF_STRING | (iStaticServers > 0 ? MF_ENABLED : MF_GRAYED), MP_REMOVEFROMSTATIC, GetResString(IDS_REMOVEFROMSTATIC), _T("ListRemove")); ServerMenu.AppendMenu(MF_SEPARATOR); ServerMenu.AppendMenu(MF_STRING | (iSelectedItems > 0 ? MF_ENABLED : MF_GRAYED), MP_REMOVE, GetResString(IDS_REMOVETHIS), _T("DELETESELECTED")); ServerMenu.AppendMenu(MF_STRING | (GetItemCount() > 0 ? MF_ENABLED : MF_GRAYED), MP_REMOVEALL, GetResString(IDS_REMOVEALL), _T("DELETE")); ServerMenu.AppendMenu(MF_STRING | (iSelectedItems > 0 ? MF_ENABLED : MF_GRAYED), MP_GETED2KLINK, GetResString(IDS_DL_LINK1), _T("ED2KLINK")); ServerMenu.AppendMenu(MF_STRING | (theApp.IsEd2kServerLinkInClipboard() ? MF_ENABLED : MF_GRAYED), MP_PASTE, GetResString(IDS_PASTE), _T("PASTELINK")); ServerMenu.AppendMenu(MF_SEPARATOR); ServerMenu.AppendMenu(MF_ENABLED | (GetItemCount() > 0 ? MF_ENABLED : MF_GRAYED), MP_FIND, GetResString(IDS_FIND), _T("Search")); GetPopupMenuPos(*this, point); ServerMenu.TrackPopupMenu(TPM_LEFTALIGN |TPM_RIGHTBUTTON, point.x, point.y, this); VERIFY( ServerPrioMenu.DestroyMenu() ); VERIFY( ServerMenu.DestroyMenu() ); }