Fixed right-mouse popup memu bugs, added Insert object submenu and jump to internal target

This commit is contained in:
cmanske%netscape.com 1998-10-07 04:55:11 +00:00
Родитель 0e9bf888fc
Коммит bc39840b55
5 изменённых файлов: 62 добавлений и 37 удалений

Просмотреть файл

@ -447,7 +447,7 @@ BEGIN
IDS_POPUP_TABLE_CELL_PROPS "Table C&ell Properties"
IDS_MERGE_NEXT_CELL "&Join with Cell to the Right"
IDS_SUBMENU_SELECT_TABLE "&Select"
IDS_SUBMENU_INSERT_TABLE "&Insert"
IDS_SUBMENU_INSERT_TABLE "Table &Insert"
IDS_SUBMENU_DELETE_TABLE "&Delete"
IDS_SUBMENU_PASTE_TABLE "Paste into &Table"
IDS_REPLACE_SELECTED_CELLS "Replace &Selected Cells"
@ -528,7 +528,6 @@ BEGIN
ID_INSERT_BREAK_BOTH "Insert break to continue text below images to the left and the right"
ID_INSERT_TARGET "Insert a Target\nInsert Target\nTarget"
ID_INSERT_TAG "Insert an arbitrary HTML Tag at the insertion location\nInsert HTML Tag"
IDS_POPUP_CREATE_LINK "Create &Link Using Selected..."
END
STRINGTABLE PRELOAD DISCARDABLE
@ -554,6 +553,8 @@ END
STRINGTABLE DISCARDABLE
BEGIN
IDS_POPUP_INSERT "&Insert"
IDS_POPUP_CREATE_LINK "Create &Link Using Selected..."
IDS_POPUP_INSERT_LINK "Insert New &Link..."
IDS_CAPTION_NONE "None"
IDS_CAPTION_ABOVE "Above table"
@ -600,6 +601,7 @@ BEGIN
IDS_POPUP_LOAD_LINK_EDT "&Browse to: "
IDS_POPUP_LOADLINKNEWWINDOW_EDT "Open Link in &New Navigator Window"
IDS_POPUP_COPYLINKCLIPBOARD_EDT "&Copy Link to Clipboard"
IDS_EDIT_JUMP_TARGET "&Jump to Target in this page"
IDS_POPUP_EDIT_LINK "Open Link in Compos&er"
END

Просмотреть файл

@ -1232,13 +1232,12 @@ void CNetscapeEditView::OnUpdateDisplayTables(CCmdUI* pCmdUI)
}
void CNetscapeEditView::OnRButtonDown(UINT uFlags, CPoint cpPoint)
// Purpose: Bring up the popup menu.
// Purpose: Bring up the popup menu - extremely state-dependent on: element type, selection, clipboard, is in table, etc
// Arguments: uFlags What meta keys are currently pressed, ignored.
// cpPoint The point at which the mouse was clicked in relative to the upper left corner of the window.
// Returns: void
// Comments: Saves the point in a class member, so other handling can occur through messages generated in the popup.
// Revision History:
// 11-03-95 created CLM
// --> today One of the most revised pieces of code in Composer!
//
{
MWContext *pMWContext = GET_MWCONTEXT;
@ -1383,6 +1382,7 @@ void CNetscapeEditView::OnRButtonDown(UINT uFlags, CPoint cpPoint)
BOOL bHaveText, bHaveLink, bHaveImage, bHaveTable;
BOOL bCanPaste = wfe_GetClipboardTypes(pMWContext, bHaveText, bHaveImage, bHaveLink, bHaveTable );
BOOL bIsLink = !m_csRBLink.IsEmpty();
char *pLinkURL = bIsLink ? (char*)LPCSTR(m_csRBLink) : 0;
// Pasting a table in a table offers a submenu of options
BOOL bCanPasteTableInTable = bInTable ? bHaveTable : FALSE;
@ -1542,6 +1542,7 @@ void CNetscapeEditView::OnRButtonDown(UINT uFlags, CPoint cpPoint)
}
HMENU hSelectMenu = 0;
HMENU hInsertMenu = 0;
HMENU hInsertTableMenu = 0;
HMENU hDeleteMenu = 0;
HMENU hPasteTableMenu = 0;
HMENU hPasteMenu = 0;
@ -1565,11 +1566,11 @@ void CNetscapeEditView::OnRButtonDown(UINT uFlags, CPoint cpPoint)
// We are in a cell, so we can do Select, Insert and Delete table commands,
// Use menus shared with Frame's Table Menu
hInsertMenu = ::LoadMenu(AfxGetResourceHandle(), MAKEINTRESOURCE(IDM_COMPOSER_TABLE_INSERTMENU));
hInsertTableMenu = ::LoadMenu(AfxGetResourceHandle(), MAKEINTRESOURCE(IDM_COMPOSER_TABLE_INSERTMENU));
hDeleteMenu = ::LoadMenu(AfxGetResourceHandle(), MAKEINTRESOURCE(IDM_COMPOSER_TABLE_DELETEMENU));
hSelectMenu = ::LoadMenu(AfxGetResourceHandle(), MAKEINTRESOURCE(IDM_COMPOSER_TABLE_SELECTMENU));
if( hInsertMenu )
cmPopup.AppendMenu(MF_POPUP, (UINT)hInsertMenu, szLoadString(IDS_SUBMENU_INSERT_TABLE));
if( hInsertTableMenu )
cmPopup.AppendMenu(MF_POPUP, (UINT)hInsertTableMenu, szLoadString(IDS_SUBMENU_INSERT_TABLE));
if( hDeleteMenu )
cmPopup.AppendMenu(MF_POPUP, (UINT)hDeleteMenu, szLoadString(IDS_SUBMENU_DELETE_TABLE));
if( hSelectMenu )
@ -1606,30 +1607,17 @@ void CNetscapeEditView::OnRButtonDown(UINT uFlags, CPoint cpPoint)
// Open link into a browse window
cmPopup.AppendMenu(uMailtoState, ID_POPUP_LOADLINKNEWWINDOW, csEntry);
// Open link into an edit window
cmPopup.AppendMenu(uMailtoState,ID_POPUP_EDIT_LINK,
szLoadString(IDS_POPUP_EDIT_LINK));
// Jump to internal Target or open link into an edit window
cmPopup.AppendMenu(uMailtoState, ID_POPUP_EDIT_LINK,
szLoadString(EDT_IsInternalLink(pMWContext, pLinkURL) ?
IDS_EDIT_JUMP_TARGET : IDS_POPUP_EDIT_LINK));
bLinkPopup = TRUE;
}
nIDS = 0;
if ( bCanSetHREF )
if ( bCanSetHREF && bIsSelected && bNoLinks )
{
if( bIsSelected && bNoLinks ){
// We have selection and no current link
nIDS = IDS_POPUP_CREATE_LINK;
}
} else if( !bSelectTableOrCell )
{
// We are in non-link text and don't have a selection
nIDS = IDS_POPUP_INSERT_LINK;
}
if(nIDS)
{
// Why on earth does ID_PROPS_LINK get disabled if used here???
cmPopup.AppendMenu(MF_ENABLED, ID_MAKE_LINK /*ID_POPUP_PROPS_LINK*/, szLoadString(nIDS));
cmPopup.AppendMenu(MF_ENABLED, ID_MAKE_LINK, szLoadString(IDS_POPUP_CREATE_LINK));
bLinkPopup = TRUE;
}
if( (type == ED_ELEMENT_TEXT ||
type == ED_ELEMENT_SELECTION) )
{
@ -1692,12 +1680,24 @@ void CNetscapeEditView::OnRButtonDown(UINT uFlags, CPoint cpPoint)
XP_FREEIF(pImageEditor);
}
if ( bIsSelected )
{
cmPopup.AppendMenu(MF_ENABLED, ID_EDIT_CUT, szLoadString(IDS_EDIT_CUT));
cmPopup.AppendMenu(MF_ENABLED, ID_EDIT_COPY, szLoadString(IDS_EDIT_COPY));
}
else
{
hInsertMenu = ::LoadMenu(AfxGetResourceHandle(), MAKEINTRESOURCE(IDM_COMPOSER_INSERTMENU));
if( hInsertMenu )
{
cmPopup.AppendMenu(MF_POPUP, (UINT)hInsertMenu, szLoadString(IDS_POPUP_INSERT));
// Should we do this? If we don't then insert Table is on 2 submenus
// Delete the "Table" item -- its already in the Table Insert submenu
// if( hInsertTableMenu )
// ::DeleteMenu(hInsertMenu, ID_INSERT_TABLE, MF_BYCOMMAND);
}
}
if( bHaveText && bHaveImage )
{
if( bCanPasteTableInTable || !bHaveTable )
@ -1725,7 +1725,8 @@ void CNetscapeEditView::OnRButtonDown(UINT uFlags, CPoint cpPoint)
}
if( EDT_CanPasteStyle(pMWContext) )
{
cmPopup.AppendMenu(MF_ENABLED, ID_PASTE_CHARACTER_STYLE, szLoadString(IDS_PASTE_CHARACTER_SYLE_POPUP));
cmPopup.AppendMenu(MF_ENABLED, ID_PASTE_CHARACTER_STYLE,
szLoadString(IDS_PASTE_CHARACTER_SYLE_POPUP));
}
// Remove last item if its a separator
int iLastItem = cmPopup.GetMenuItemCount() - 1;
@ -1747,9 +1748,10 @@ void CNetscapeEditView::OnRButtonDown(UINT uFlags, CPoint cpPoint)
GetContext()->m_bInPopupMenu = FALSE;
if( hSelectMenu) ::DestroyMenu(hSelectMenu);
if( hInsertMenu) ::DestroyMenu(hInsertMenu);
if( hInsertTableMenu) ::DestroyMenu(hInsertTableMenu);
if( hDeleteMenu) ::DestroyMenu(hDeleteMenu);
if( hPasteTableMenu) ::DestroyMenu(hPasteTableMenu);
if( hInsertMenu) ::DestroyMenu(hInsertMenu);
if( hPasteMenu) ::DestroyMenu(hPasteMenu);
if( pCharData ) EDT_FreeCharacterData(pCharData);
}

Просмотреть файл

@ -30,6 +30,7 @@
#include "prefInfo.h"
#include "mailmisc.h"
#include "libi18n.h"
#include "edt.h"
//
// If the mouse is over a link or an image, allow the user to copy the URL
@ -1061,8 +1062,14 @@ void CNetscapeView::OnPopupLoadFrameNewWindow()
// Load link location in a Composer window
void CNetscapeView::OnPopupLoadLinkInEditor()
{
if ( GetContext()->GetContext() && !m_csRBLink.IsEmpty() ) {
FE_LoadUrl((char*)LPCSTR(m_csRBLink), LOAD_URL_COMPOSER);
MWContext *pMWContext = GetContext()->GetContext();
if( pMWContext && !m_csRBLink.IsEmpty() )
{
char *pURL = (char*)LPCSTR(m_csRBLink);
// Jump to internal Target tag within Composer if possible,
// else edit link in Composer window
if( !EDT_IS_EDITOR(pMWContext) || !EDT_ScrollToTarget(pMWContext, pURL) )
FE_LoadUrl(pURL, LOAD_URL_COMPOSER);
}
}

Просмотреть файл

@ -392,6 +392,17 @@ BEGIN
MENUITEM "&Cell" ID_DELETE_TABLE_CELL
END
// A clone of some items from the Insert Menu to put on right-mouse popup
IDM_COMPOSER_INSERTMENU MENU DISCARDABLE
BEGIN
MENUITEM "&Link...\tCtrl+Shift+L", ID_INSERT_LINK
MENUITEM "T&arget...", ID_INSERT_TARGET
MENUITEM "&Image...", ID_INSERT_IMAGE
MENUITEM "&Table..." ID_INSERT_TABLE
MENUITEM "H&orizontal Line", ID_INSERT_HRULE
MENUITEM "&HTML Tag...", ID_INSERT_TAG
END
//////////////////////////////////////////////////////////////////////////////
//
// Message Composer Menu

Просмотреть файл

@ -43,6 +43,7 @@
#define IDM_COMPOSER_TABLE_DELETEMENU 72
#define IDM_COMPOSER_TABLE_PASTEMENU 73
#define IDM_COMPOSER_PASTEMENU 74
#define IDM_COMPOSER_INSERTMENU 75
#define VK_APPS 0x5D
#define IDD_ABOUTBOX 100
#define HOTLIST1_DIALOG 101
@ -2671,9 +2672,10 @@
#define ID_INSERT_BREAK_LEFT 42103
#define ID_INSERT_BREAK_RIGHT 42104
#define ID_INSERT_BREAK_BOTH 42105
#define ID_INSERT_TARGET 42108
#define ID_INSERT_TAG 42109
#define IDS_CREATE_LINK 42110
#define ID_INSERT_TARGET 42106
#define ID_INSERT_TAG 42107
#define IDS_CREATE_LINK 42109
#define IDS_POPUP_INSERT 42110
#define IDS_POPUP_CREATE_LINK 42111
#define IDS_POPUP_INSERT_LINK 42112
#define IDS_CAPTION_NONE 42113
@ -2717,8 +2719,9 @@
#define ID_POPUP_EDIT_IMAGE 42156
#define IDS_POPUP_LOADLINKNEWWINDOW_EDT 42157
#define IDS_POPUP_COPYLINKCLIPBOARD_EDT 42158
#define IDS_POPUP_EDIT_LINK 42159
#define IDS_POPUP_SAVELINKCONTENTS_EDT 42160
#define IDS_EDIT_JUMP_TARGET 42159
#define IDS_POPUP_EDIT_LINK 42160
#define IDS_POPUP_SAVELINKCONTENTS_EDT 42161
#define IDS_POPUP_ADDLINK2BOOKMARKS_EDT 42162
#define IDS_TEXT 42163
#define IDS_LINK_TEXT 42164