Browse Source

Add command openImageInNewTab,openImageInBackgroundTab

Updated viewImage for tabs
master
Dorian 7 years ago
parent
commit
d85111e31e
  1. 35
      k-meleon/app/BrowserFrmTab.cpp
  2. 3
      k-meleon/app/BrowserFrmTab.h
  3. 2
      k-meleon/app/KmCommand.cpp
  4. 2
      k-meleon/app/resource.h

35
k-meleon/app/BrowserFrmTab.cpp

@ -866,6 +866,9 @@ BEGIN_MESSAGE_MAP(CBrowserTab, CBrowserView)
ON_COMMAND(ID_OPEN_LINK_IN_BACKGROUNDTAB, OnOpenLinkInBackgroundTab)
ON_COMMAND(ID_OPEN_FRAME_IN_NEW_TAB, OnOpenFrameInNewTab)
ON_COMMAND(ID_OPEN_FRAME_IN_BACKGROUNDTAB, OnOpenFrameInBackgroundTab)
ON_COMMAND(ID_OPEN_IMAGE_IN_NEW_TAB, OnOpenImageInNewTab)
ON_COMMAND(ID_OPEN_IMAGE_IN_BACKGROUNDTAB, OnOpenImageInBackgroundTab)
ON_COMMAND(ID_VIEW_IMAGE, OnViewImageInNewWindow)
ON_WM_KEYDOWN()
ON_WM_KEYUP()
END_MESSAGE_MAP()
@ -940,6 +943,38 @@ void CBrowserTab::OnOpenFrameInBackgroundTab()
OpenURLInNewTab(url, GetCurrentURI(), TRUE);
}
void CBrowserTab::OnOpenImageInNewTab()
{
CString imgSrc;
if (!::GetImageSrc(m_contextNode, imgSrc))
if (!::GetBackgroundImageSrc(m_contextNode, imgSrc))
return;
OpenURLInNewTab(imgSrc, GetCurrentURI(), FALSE);
}
void CBrowserTab::OnOpenImageInBackgroundTab()
{
CString imgSrc;
if (!::GetImageSrc(m_contextNode, imgSrc))
if (!::GetBackgroundImageSrc(m_contextNode, imgSrc))
return;
OpenURLInNewTab(imgSrc, GetCurrentURI(), TRUE);
}
void CBrowserTab::OnViewImageInNewWindow()
{
CString imgSrc;
if (!::GetImageSrc(m_contextNode, imgSrc))
if (!::GetBackgroundImageSrc(m_contextNode, imgSrc))
return;
if (theApp.preferences.GetInt("browser.link.open_newwindow", 1) == 3)
OpenURLInNewTab(imgSrc, m_pWindow->GetDocURL(m_contextNode), FALSE);
else
OpenURLInNewWindow(imgSrc, m_pWindow->GetDocURL(m_contextNode), FALSE);
}
void CBrowserFrmTab::OnSysCommand(UINT nID, LPARAM lParam)
{
CBrowserFrame::OnSysCommand(nID, lParam);

3
k-meleon/app/BrowserFrmTab.h

@ -99,6 +99,9 @@ protected:
afx_msg void OnOpenFrameInBackgroundTab();
afx_msg void OnOpenLinkInNewTab();
afx_msg void OnOpenLinkInBackgroundTab();
afx_msg void OnOpenImageInNewTab();
afx_msg void OnOpenImageInBackgroundTab();
afx_msg void OnViewImageInNewWindow();
DECLARE_MESSAGE_MAP()
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);

2
k-meleon/app/KmCommand.cpp

@ -240,6 +240,8 @@ void KmCmdService::InitDefaultCmd()
ADD_DEFCMD(openLinkInBackgroundTab, ID_OPEN_LINK_IN_BACKGROUNDTAB);
ADD_DEFCMD(openFrameInNewTab, ID_OPEN_FRAME_IN_NEW_TAB);
ADD_DEFCMD(openFrameInBackgroundTab, ID_OPEN_FRAME_IN_BACKGROUNDTAB);
ADD_DEFCMD(openImageInNewTab, ID_OPEN_IMAGE_IN_NEW_TAB);
ADD_DEFCMD(openImageInBackgroundTab, ID_OPEN_IMAGE_IN_BACKGROUNDTAB);
ADD_DEFCMD(goHome, ID_LINK_KMELEON_HOME);
ADD_DEFCMD(goForum, ID_LINK_KMELEON_FORUM);

2
k-meleon/app/resource.h

@ -487,6 +487,8 @@
#define ID_PAGE_TOGGLE_JS 32924
#define ID_APP_RESTART 32925
#define ID_COPY_LINK_TEXT 32926
#define ID_OPEN_IMAGE_IN_NEW_TAB 32927
#define ID_OPEN_IMAGE_IN_BACKGROUNDTAB 32928
#define ID_CLOSE_FINDBAR 33822
#define IDS_FAILED_TO_CREATE_BROWSER 61204

Loading…
Cancel
Save