Browse Source

Add copy link text command

master
Dorian 7 years ago
parent
commit
99be230cd9
  1. 13
      k-meleon/BrowserView.cpp
  2. 1
      k-meleon/BrowserView.h
  3. 3
      k-meleon/KmCommand.cpp
  4. 3
      k-meleon/defineMap.cpp
  5. 1
      k-meleon/resource.h

13
k-meleon/BrowserView.cpp

@ -124,6 +124,7 @@ BEGIN_MESSAGE_MAP(CBrowserView, CWnd)
ON_COMMAND(ID_OPEN_LINK_IN_BACKGROUND, OnOpenLinkInBackground)
ON_COMMAND(ID_VIEW_IMAGE, OnViewImageInNewWindow)
ON_COMMAND(ID_COPY_LINK_LOCATION, OnCopyLinkLocation)
ON_COMMAND(ID_COPY_LINK_TEXT, OnCopyLinkText)
ON_COMMAND(ID_COPY_IMAGE_LOCATION, OnCopyImageLocation)
ON_COMMAND(ID_COPY_IMAGE_CONTENT, OnCopyImageContent)
ON_COMMAND(ID_OPEN_LINK, OnOpenLink)
@ -614,6 +615,18 @@ void CBrowserView::OnCopyLinkLocation()
SetClipboardTextData(m_hWnd, href);
}
void CBrowserView::OnCopyLinkText()
{
CString href, title;
if (!::GetLinkTitleAndHref(m_contextNode, href, title))
return;
if (!OpenClipboard())
return;
SetClipboardTextData(m_hWnd, title);
}
void CBrowserView::OnOpenLink()
{
CString url, title;

1
k-meleon/BrowserView.h

@ -277,6 +277,7 @@ protected:
afx_msg void OnSelectAll();
afx_msg void OnSelectNone();
afx_msg void OnCopyLinkLocation();
afx_msg void OnCopyLinkText();
afx_msg void OnCopyImageLocation();
afx_msg void OnCopyImageContent();
afx_msg void OnOpenLink();

3
k-meleon/KmCommand.cpp

@ -23,6 +23,8 @@
UINT KmCmdService::RegisterCommand(LPCTSTR name, LPCTSTR desc, LPCTSTR icon)
{
ASSERT(*name);
if (!name || !*name) return 0;
UINT id = AllocateId();
mCommandList[name] = KmCommand(id, desc);
if (icon) theApp.skin.mImages->AddIcon(icon, 0, 0, id);
@ -189,6 +191,7 @@ void KmCmdService::InitDefaultCmd()
ADD_DEFCMD(editFindMatchCase, ID_MATCH_CASE)
ADD_DEFCMD(editFindHighlight, ID_HIGHLIGHT)
ADD_DEFCMD(editCopyLinkLocation, ID_COPY_LINK_LOCATION);
ADD_DEFCMD(editCopyLinkText, ID_COPY_LINK_TEXT);
ADD_DEFCMD(editCopyImageLocation, ID_COPY_IMAGE_LOCATION);
ADD_DEFCMD(editCopyImage, ID_COPY_IMAGE_CONTENT);
ADD_DEFCMD(editSelectUrl, ID_SELECT_URL);

3
k-meleon/defineMap.cpp

@ -99,4 +99,5 @@ DEFINEMAP_ADD(ID_PAGE_TOGGLE_JS)
DEFINEMAP_ADD(ID_ENABLE_JS)
DEFINEMAP_ADD(ID_DISABLE_JS)
DEFINEMAP_ADD(ID_TOGGLE_JS)
DEFINEMAP_ADD(ID_APP_RESTART)
DEFINEMAP_ADD(ID_APP_RESTART)
DEFINEMAP_ADD(ID_COPY_LINK_TEXT)

1
k-meleon/resource.h

@ -486,6 +486,7 @@
#define ID_TOGGLE_JS 32923
#define ID_PAGE_TOGGLE_JS 32924
#define ID_APP_RESTART 32925
#define ID_COPY_LINK_TEXT 32926
#define ID_CLOSE_FINDBAR 33822
#define IDS_FAILED_TO_CREATE_BROWSER 61204

Loading…
Cancel
Save