Fixed lack of scrolling when selecting table and dragging, fixed scrolling bugs. Cleaned up font size message handlers and bugs

This commit is contained in:
cmanske%netscape.com 1998-10-09 22:06:36 +00:00
parent eebfe781f9
commit 5fda8b050b
10 changed files with 200 additions and 251 deletions

View File

@ -3238,10 +3238,10 @@ CWinCX::OnMouseMoveForLayerCX(UINT uFlags, CPoint& cpPoint,
XP_ASSERT(0);
#else
MWContext * context = GetContext();
MWContext * pMWContext = GetContext();
BOOL bTextSet = FALSE;
BOOL bIsEditor = EDT_IS_EDITOR(context);
BOOL bIsEditor = EDT_IS_EDITOR(pMWContext);
LO_Element *pElement = GetLayoutElement(xyPoint, layer);
if (pElement && (pElement->type == LO_IMAGE)) {
@ -3257,7 +3257,7 @@ CWinCX::OnMouseMoveForLayerCX(UINT uFlags, CPoint& cpPoint,
// don't do anything if we are waiting for the netlib to get
// into gear
if (context->waitingMode) {
if (pMWContext->waitingMode) {
// Change cursor only if not doing internal drag
if( !m_bDragging ){
SetCursor(theApp.LoadStandardCursor(IDC_WAIT));
@ -3278,7 +3278,8 @@ CWinCX::OnMouseMoveForLayerCX(UINT uFlags, CPoint& cpPoint,
// We must fire an event to setup CLOSURE struct
// and call mouse_closure_callback
FireMouseOverEvent(NULL, xVal, yVal, layer);
goto MOUSE_TIMER;
// Allow autoscrolling when mouse leaves window
goto CHECK_SCROLL_WINDOW;
}
if( EDT_IS_SIZING )
{
@ -3286,7 +3287,7 @@ CWinCX::OnMouseMoveForLayerCX(UINT uFlags, CPoint& cpPoint,
BOOL bLock = !(BOOL)(uFlags & MK_CONTROL);
XP_Rect new_rect;
if( EDT_GetSizingRect(context, xVal, yVal, bLock, &new_rect) )
if( EDT_GetSizingRect(pMWContext, xVal, yVal, bLock, &new_rect) )
{
// Remove last sizing feedback
DisplaySelectionFeedback(LO_ELE_SELECTED, m_rectSizing);
@ -3301,17 +3302,19 @@ CWinCX::OnMouseMoveForLayerCX(UINT uFlags, CPoint& cpPoint,
}
// Status text was set by XP code, so set flag here
bTextSet = TRUE;
//TODO: If we can figure out how to do rubber-banding
// while scrolling the window, we can jump to CHECK_SCROLL_WINDOW;
goto MOUSE_TIMER;
}
// Check for cell selection only if not starting drag of table cells
if( !EDT_IsDraggingTable(context) )
if( !EDT_IsDraggingTable(pMWContext) )
{
// We are not currently selecting cells, so get the cell we may be over
// Note: This will return cell and ED_HIT_SIZE_COL if inbetween columns,
// so check that because we don't want to select cell if just before the left edge
LO_Element *pCellElement = NULL;
// Mouse move test with left button down - extend selection to other cells
ED_HitType iTableHit = EDT_GetTableHitRegion(context, xVal, yVal, &pCellElement, FALSE);
ED_HitType iTableHit = EDT_GetTableHitRegion(pMWContext, xVal, yVal, &pCellElement, FALSE);
if( m_pStartSelectionCell && pCellElement &&
(iTableHit != ED_HIT_SIZE_COL) &&
pCellElement->type == LO_CELL && (pCellElement != m_pStartSelectionCell) )
@ -3323,14 +3326,14 @@ CWinCX::OnMouseMoveForLayerCX(UINT uFlags, CPoint& cpPoint,
// So switch to cell-selection mode.
// 1st FALSE param means clear any other selection (shouldn't be any)
// (last param is used to extend selection)
EDT_SelectTableElement(context, m_pStartSelectionCell->lo_any.x, m_pStartSelectionCell->lo_any.y,
EDT_SelectTableElement(pMWContext, m_pStartSelectionCell->lo_any.x, m_pStartSelectionCell->lo_any.y,
m_pStartSelectionCell, ED_HIT_SEL_CELL, FALSE, FALSE);
}
// Select new cell as well: If previously selecting, last param = TRUE
// and we append this cell
EDT_SelectTableElement(context, xVal, yVal, pCellElement, ED_HIT_SEL_CELL,
EDT_SelectTableElement(pMWContext, xVal, yVal, pCellElement, ED_HIT_SEL_CELL,
FALSE, m_pStartSelectionCell != NULL);
goto MOUSE_TIMER;
goto CHECK_SCROLL_WINDOW; //MOUSE_TIMER;
}
}
#endif // EDITOR
@ -3353,6 +3356,8 @@ CWinCX::OnMouseMoveForLayerCX(UINT uFlags, CPoint& cpPoint,
// Get and drag the selection
DragSelection();
// Unfortunately, the Window doesn't scroll
// during dragging
// Don't do anything else if we are dragging!
goto MOUSE_TIMER;
}
@ -3362,7 +3367,7 @@ CWinCX::OnMouseMoveForLayerCX(UINT uFlags, CPoint& cpPoint,
{
// TODO: There's a bug in extending the selection:
// It looses the selection on an object, such as an image
EDT_ExtendSelection(context, xVal, yVal);
EDT_ExtendSelection(pMWContext, xVal, yVal);
} else
#endif // EDITOR
{
@ -3371,52 +3376,10 @@ CWinCX::OnMouseMoveForLayerCX(UINT uFlags, CPoint& cpPoint,
}
}
int32 lYPos = GetOriginY();
int32 lXPos = GetOriginX();
int32 xCur = xVal;
int32 yCur = yVal;
#ifdef LAYERS
if (layer)
{
int32 layer_x_offset = CL_GetLayerXOrigin(layer);
int32 layer_y_offset = CL_GetLayerYOrigin(layer);
xCur += layer_x_offset;
yCur += layer_y_offset;
}
#endif // LAYERS
if(xCur < GetOriginX()) {
lXPos = xCur;
}
else if(xCur > GetWidth() + GetOriginX()) {
lXPos = xCur - GetWidth();
}
if(yCur < GetOriginY()) {
lYPos = yCur;
}
else if(yVal > GetHeight() + GetOriginY()) {
lYPos = yCur - GetHeight();
}
// Validate position recommendations, and reposition if necessary.
if(lXPos > GetDocumentWidth() - GetWidth()) {
lXPos = GetDocumentWidth() - GetWidth();
}
if(lXPos < 0) {
lXPos = GetOriginX();
}
if(lYPos > GetDocumentHeight() - GetHeight()) {
lYPos = GetDocumentHeight() - GetHeight();
}
if(lYPos < 0) {
lYPos = GetOriginY();
}
if(lYPos != GetOriginY() || lXPos != GetOriginX()) {
// Reposition.
SetDocPosition(context, FE_VIEW, lXPos, lYPos);
}
CHECK_SCROLL_WINDOW:
// The last param is distance from edge of client area where scrolling will start.
// Set to 0 (or remove to use 0 default) for 4.x behavior
CheckAndScrollWindow(xVal, yVal, layer);
// We need to unhighlight an anchor if we highlighted it on buttonDown
// The anchor element is held within the last_armed_xref global
@ -3515,15 +3478,15 @@ CWinCX::OnMouseMoveForLayerCX(UINT uFlags, CPoint& cpPoint,
m_pLastImageObject = NULL;
// This prevents closing source frame during drag and drop
BOOL bWaitingMode = context->waitingMode;
context->waitingMode = TRUE;
BOOL bWaitingMode = pMWContext->waitingMode;
pMWContext->waitingMode = TRUE;
// We supply the DropSource object instead of default behavior
// (we don't need return value, do we?)
pDataSource->DoDragDrop(DROPEFFECT_COPY | DROPEFFECT_LINK | DROPEFFECT_MOVE | DROPEFFECT_SCROLL,
NULL, pDropSource);
context->waitingMode = bWaitingMode;
pMWContext->waitingMode = bWaitingMode;
m_bDragging = FALSE;
// After dragging, moving mouse in browser acts like button is down,
@ -3548,7 +3511,7 @@ CWinCX::OnMouseMoveForLayerCX(UINT uFlags, CPoint& cpPoint,
LO_ImageStruct *pImage = (LO_ImageStruct *)m_pLastImageObject;
char *pImageURL = NULL;
HGLOBAL hImageData = WFE_CreateCopyImageData(context, pImage);
HGLOBAL hImageData = WFE_CreateCopyImageData(pMWContext, pImage);
if ( hImageData ) {
// make sure we have a clipboard format defined
@ -3577,13 +3540,13 @@ CWinCX::OnMouseMoveForLayerCX(UINT uFlags, CPoint& cpPoint,
HCURSOR hCursor = GetCursor();
// This prevents closing source frame during drag and drop
BOOL bWaitingMode = context->waitingMode;
context->waitingMode = TRUE;
BOOL bWaitingMode = pMWContext->waitingMode;
pMWContext->waitingMode = TRUE;
pDataSource->DoDragDrop(DROPEFFECT_COPY | DROPEFFECT_MOVE | DROPEFFECT_SCROLL,
NULL, pDropSource);
context->waitingMode = bWaitingMode;
pMWContext->waitingMode = bWaitingMode;
SetCursor(hCursor);
m_bDragging = FALSE;
@ -3604,7 +3567,7 @@ CWinCX::OnMouseMoveForLayerCX(UINT uFlags, CPoint& cpPoint,
// If there are connections being initiated (i.e. the watch
// cursor is up) don't blow away the text so that the netlib
// messages persist in the status bar
if(context->waitingMode)
if(pMWContext->waitingMode)
goto MOUSE_TIMER;
#ifdef LAYERS
@ -3628,7 +3591,7 @@ MOUSE_TIMER:
// Have the mouse timer handler do some dirty work.
// Please don't return in the above code, I'd like this to get called
// in all cases with the state of the buttons set correctly.
MouseTimerData mt(context);
MouseTimerData mt(pMWContext);
FEU_MouseTimer(&mt);
#endif /* MOZ_NGLAYOUT */
}
@ -4902,6 +4865,80 @@ void CWinCX::SetDocDimension(MWContext *pContext, int iLocation, int32 lWidth, i
#endif /* EDITOR */
}
// Formerly within OnMouseMoveForLayerCX. Moved out for reuse when dragging a selection in Editor
// iBorderThresshold allows scrolling to occur when cursor is within that distance of a border,
// rather than having to be outside the client area (needed to work during dragNdrop)
BOOL CWinCX::CheckAndScrollWindow(int32 xVal, int32 yVal, CL_Layer *layer, int32 iBorderThreshhold)
{
int32 iCurrentOriginY = GetOriginY();
int32 iCurrentOriginX = GetOriginX();
int32 iNewOriginY = iCurrentOriginY;
int32 iNewOriginX = iCurrentOriginX;
int32 xCur = xVal;
int32 yCur = yVal;
// Must use actual client dimensions
// (should be same as GetClientRect results)
int32 iHeight = GetHeight();
int32 iWidth = GetWidth();
if( IsHScrollBarOn() )
iWidth -= sysInfo.m_iScrollWidth;
if( IsVScrollBarOn() )
iHeight -= sysInfo.m_iScrollHeight;
#if 0
// Use this to confirm that our current sizes are correct
RECT rectClient;
CGenericView *pView = GetView();
if(!pView)
return FALSE;
pView->GetClientRect(&rectClient);
XP_ASSERT(iHeight == rectClient.bottom - rectClient.top);
XP_ASSERT(iWidth == rectClient.right - rectClient.left);
#endif
#ifdef LAYERS
if (layer)
{
int32 layer_x_offset = CL_GetLayerXOrigin(layer);
int32 layer_y_offset = CL_GetLayerYOrigin(layer);
xCur += layer_x_offset;
yCur += layer_y_offset;
}
#endif // LAYERS
if(xCur < iCurrentOriginX + iBorderThreshhold)
iNewOriginX = xCur - iBorderThreshhold;
else if(xCur > iWidth + iCurrentOriginX - iBorderThreshhold)
iNewOriginX = xCur - iWidth + iBorderThreshhold;
if(yCur < iCurrentOriginY + iBorderThreshhold)
iNewOriginY = yCur - iBorderThreshhold;
else if(yVal > iHeight + iCurrentOriginY - iBorderThreshhold)
iNewOriginY = yCur - iHeight + iBorderThreshhold;
int32 iDocWidth = GetDocumentWidth();
int32 iDocHeight = GetDocumentHeight();
// Validate position recommendations for limits
if(iNewOriginX > iDocWidth - iWidth)
iNewOriginX = iDocWidth - iWidth;
if(iNewOriginX < 0)
iNewOriginX = iCurrentOriginX;
if(iNewOriginY > iDocHeight - iHeight)
iNewOriginY = iDocHeight - iHeight;
if(iNewOriginY < 0)
iNewOriginY = iCurrentOriginY;
if(iNewOriginY != iCurrentOriginY || iNewOriginX != iCurrentOriginX)
{
// Reposition.
MWContext *pMWContext = GetContext();
SetDocPosition(GetContext(), FE_VIEW, iNewOriginX, iNewOriginY);
// Return TRUE only if we really scrolled
return (GetOriginY() != iCurrentOriginY) || (GetOriginX() != iCurrentOriginX);
}
return FALSE;
}
//
// Fake scroll messages so that we use scrollwindowex() to move the window
// so that our form elements actually move
@ -4918,6 +4955,13 @@ void CWinCX::SetDocPosition(MWContext *pContext, int iLocation, int32 lX, int32
int32 lRemY = GetOriginY();
int32 lRemX = GetOriginX();
// cmanske: We must use the width MINUS any scrollbars!
int32 iWidth = m_lWidth;
int32 iHeight = m_lHeight;
if( IsHScrollBarOn() )
iWidth -= sysInfo.m_iScrollWidth;
if( IsVScrollBarOn() )
iHeight -= sysInfo.m_iScrollHeight;
// Call the base.
CDCCX::SetDocPosition(pContext, iLocation, lX, lY);
@ -4930,13 +4974,13 @@ void CWinCX::SetDocPosition(MWContext *pContext, int iLocation, int32 lX, int32
// Make sure there is a need to scroll before attempting to scroll.
// scroll to the correct Y location
if((m_lDocHeight - m_lHeight > 0) && lRemY != lY) {
iPos = (int) ((double) lY * (double) GetPageY() / (double) (m_lDocHeight - m_lHeight));
if((m_lDocHeight - iHeight > 0) && lRemY != lY) {
iPos = (int) ((double) lY * (double) GetPageY() / (double) (m_lDocHeight - iHeight));
Scroll(SB_VERT, SB_THUMBTRACK, iPos, NULL);
}
else if ( EDT_IS_EDITOR( pContext ) ){
if((m_lDocHeight - m_lHeight > 0)) {
iPos = (int) ((double) lY * (double) GetPageY() / (double) (m_lDocHeight - m_lHeight));
if((m_lDocHeight - iHeight > 0)) {
iPos = (int) ((double) lY * (double) GetPageY() / (double) (m_lDocHeight - iHeight));
Scroll(SB_VERT, SB_THUMBTRACK, iPos, NULL);
}
else {
@ -4946,13 +4990,13 @@ void CWinCX::SetDocPosition(MWContext *pContext, int iLocation, int32 lX, int32
// now do X
if((m_lDocWidth - m_lWidth > 0) && lRemX != lX) {
iPos = (int) ((double) lX * (double) GetPageX() / (double) (m_lDocWidth - m_lWidth));
if((m_lDocWidth - iWidth > 0) && lRemX != lX) {
iPos = (int) ((double) lX * (double) GetPageX() / (double) (m_lDocWidth - iWidth));
Scroll(SB_HORZ, SB_THUMBTRACK, iPos, NULL);
}
else if( EDT_IS_EDITOR(pContext) ){
if((m_lDocWidth - m_lWidth > 0)) {
iPos = (int) ((double) lX * (double) GetPageX() / (double) (m_lDocWidth - m_lWidth));
if((m_lDocWidth - iWidth > 0)) {
iPos = (int) ((double) lX * (double) GetPageX() / (double) (m_lDocWidth - iWidth));
Scroll(SB_HORZ, SB_THUMBTRACK, iPos, NULL);
}
else {

View File

@ -475,6 +475,10 @@ public:
// Helper for erasing text structures
BOOL EraseTextBkgnd(HDC pDC, RECT&, LO_TextStruct*);
// Break out code in OnMouseMove handler so it can be used
// during dragging in the Editor
BOOL CheckAndScrollWindow(int32 xVal, int32 yVal, CL_Layer *layer, int32 iBorderThreshhold = 0);
};
// Global variables

View File

@ -27,9 +27,6 @@
#include "edprops.h"
#include "edtrccln.h"
// Matches size of custom colors in Windows color picker
#define MAX_FONT_COLOR 16
// Global for app - called during startup
BOOL FE_FindPreviousInstance(LPCSTR szURL, BOOL bStartEditor);

View File

@ -340,7 +340,7 @@ BEGIN
ID_COMBO_FONTFACE "Change font face\nFont"
ID_COMBO_FONTCOLOR "Change font color. Press Alt to change Background Color\nFont Color [+Alt for Background]"
ID_COMBO_PARA "Change paragraph or heading style\nParagraph style"
ID_OPEN_NAV_WINDOW "Display current page in a new Browser window\nDisplay page in Browser\nBrowse"
ID_OPEN_NAV_WINDOW "Display current page in a Browser window\nPreview page in Browser\nPreview"
IDS_LINK_TO_FILE "Link to File"
IDS_ANCHOR_IMAGE_FILE "Select Anchor Image File"
IDS_ANCHOR_IMAGE "Linked image:"

View File

@ -62,6 +62,10 @@ char * wfe_GetFontSizeString(MWContext * pMWContext, int iSize, BOOL bFixedWidt
#define MAX_TRUETYPE_FONTS 100
// Matches size of custom colors in Windows color picker
#define MAX_FONT_COLOR 16
#define MAX_FONT_POINTSIZE_COUNT 14
// Currently 10 columns of 7 colors each
// Now defined in edttypes.h
//#define MAX_NS_COLORS 70

View File

@ -26,12 +26,6 @@
#include "edtrccln.h"
#include "edprops.h" // For CColorButton
// Limits on table parameters
#define MAX_TABLE_ROWS 100
#define MAX_TABLE_COLUMNS 100
// This is also limit used for cell size, padding, and borders
#define MAX_TABLE_PIXELS 10000
////////////////////////////////////////////////////
// Property Pages for Tabbed Table dialogs
class CTablePage : public CNetscapePropertyPage

View File

@ -312,8 +312,6 @@ BEGIN_MESSAGE_MAP(CNetscapeEditView, CNetscapeView)
ON_COMMAND(ID_DELETE_TABLE_COLUMN,OnDeleteTableColumn)
ON_COMMAND(ID_DELETE_TABLE_CELL,OnDeleteTableCell)
ON_COMMAND(ID_DELETE_TABLE_CAPTION,OnDeleteTableCaption)
ON_COMMAND(ID_TOGGLE_TABLE_BORDER,OnToggleTableBorder)
ON_COMMAND(ID_TOGGLE_HEADER_CELL,OnToggleHeaderCell)
ON_COMMAND(ID_PROPS_TABLE,OnPropsTable)
ON_COMMAND(ID_PROPS_TABLE_ROW,OnPropsTableRow)
ON_COMMAND(ID_PROPS_TABLE_COLUMN,OnPropsTableColumn)
@ -396,8 +394,8 @@ BEGIN_MESSAGE_MAP(CNetscapeEditView, CNetscapeView)
ON_UPDATE_COMMAND_UI(ID_INSERT_TABLE, OnUpdateInsertTable)
ON_UPDATE_COMMAND_UI(ID_INSERT_TABLE_ROW, OnUpdateInsertTableRow)
ON_UPDATE_COMMAND_UI(ID_INSERT_TABLE_ROW_ABOVE, OnUpdateInsertTableRow)
ON_UPDATE_COMMAND_UI(ID_INSERT_TABLE_CELL, OnUpdateInsertTableCell)
ON_UPDATE_COMMAND_UI(ID_INSERT_TABLE_CELL_BEFORE, OnUpdateInsertTableCell)
ON_UPDATE_COMMAND_UI(ID_INSERT_TABLE_CELL, OnUpdateInsertTableColumn)
ON_UPDATE_COMMAND_UI(ID_INSERT_TABLE_CELL_BEFORE, OnUpdateInsertTableColumn)
ON_UPDATE_COMMAND_UI(ID_INSERT_TABLE_COLUMN, OnUpdateInsertTableColumn)
ON_UPDATE_COMMAND_UI(ID_INSERT_TABLE_COLUMN_BEFORE, OnUpdateInsertTableColumn)
ON_UPDATE_COMMAND_UI(ID_INSERT_TABLE_CAPTION, OnUpdateInsertTableCaption)
@ -406,8 +404,6 @@ BEGIN_MESSAGE_MAP(CNetscapeEditView, CNetscapeView)
ON_UPDATE_COMMAND_UI(ID_DELETE_TABLE_COLUMN, OnUpdateInTableColumn)
ON_UPDATE_COMMAND_UI(ID_DELETE_TABLE_CELL, OnUpdateInTableCell)
ON_UPDATE_COMMAND_UI(ID_DELETE_TABLE_CAPTION, OnUpdateInTableCaption)
ON_UPDATE_COMMAND_UI(ID_TOGGLE_TABLE_BORDER, OnUpdateToggleTableBorder)
ON_UPDATE_COMMAND_UI(ID_TOGGLE_HEADER_CELL, OnUpdateToggleHeaderCell)
ON_UPDATE_COMMAND_UI(ID_PROPS_TABLE, OnUpdateInTable)
ON_UPDATE_COMMAND_UI(ID_PROPS_TABLE_ROW, OnUpdateInTableRow)
ON_UPDATE_COMMAND_UI(ID_PROPS_TABLE_COLUMN, OnUpdateInTableColumn)
@ -420,28 +416,6 @@ BEGIN_MESSAGE_MAP(CNetscapeEditView, CNetscapeView)
ON_UPDATE_COMMAND_UI(ID_LOCAL_POPUP, OnCanInteract)
ON_UPDATE_COMMAND_UI(ID_FILE_EDITSOURCE, OnCanInteract)
ON_UPDATE_COMMAND_UI(ID_GO_PUBLISH_LOCATION, OnCanInteract)
// Paragraph tags cover whole range starting from P_TEXT (=0),
// but "Normal" is first menu item (tag = P_PARAGRAPH)
ON_UPDATE_COMMAND_UI((ID_FORMAT_PARAGRAPH_BASE+P_NSDT), OnUpdateParagraphMenu)
ON_UPDATE_COMMAND_UI((ID_FORMAT_PARAGRAPH_BASE+P_HEADER_1), OnUpdateParagraphMenu)
ON_UPDATE_COMMAND_UI((ID_FORMAT_PARAGRAPH_BASE+P_HEADER_2), OnUpdateParagraphMenu)
ON_UPDATE_COMMAND_UI((ID_FORMAT_PARAGRAPH_BASE+P_HEADER_3), OnUpdateParagraphMenu)
ON_UPDATE_COMMAND_UI((ID_FORMAT_PARAGRAPH_BASE+P_HEADER_4), OnUpdateParagraphMenu)
ON_UPDATE_COMMAND_UI((ID_FORMAT_PARAGRAPH_BASE+P_HEADER_5), OnUpdateParagraphMenu)
ON_UPDATE_COMMAND_UI((ID_FORMAT_PARAGRAPH_BASE+P_HEADER_6), OnUpdateParagraphMenu)
ON_UPDATE_COMMAND_UI((ID_FORMAT_PARAGRAPH_BASE+P_PARAGRAPH), OnUpdateParagraphMenu)
ON_UPDATE_COMMAND_UI((ID_FORMAT_PARAGRAPH_BASE+P_DESC_TEXT), OnUpdateParagraphMenu)
ON_UPDATE_COMMAND_UI((ID_FORMAT_PARAGRAPH_BASE+P_ADDRESS), OnUpdateParagraphMenu)
ON_UPDATE_COMMAND_UI((ID_FORMAT_PARAGRAPH_BASE+P_PREFORMAT), OnUpdateParagraphMenu)
ON_UPDATE_COMMAND_UI((ID_FORMAT_PARAGRAPH_BASE+P_DESC_TITLE), OnUpdateParagraphMenu)
ON_UPDATE_COMMAND_UI((ID_FORMAT_PARAGRAPH_BASE+P_BLOCKQUOTE), OnUpdateParagraphMenu)
ON_UPDATE_COMMAND_UI((ID_FORMAT_FONTSIZE_BASE), OnUpdateFontSizeMenu)
ON_UPDATE_COMMAND_UI((ID_FORMAT_FONTSIZE_BASE+1), OnUpdateFontSizeMenu)
ON_UPDATE_COMMAND_UI((ID_FORMAT_FONTSIZE_BASE+2), OnUpdateFontSizeMenu)
ON_UPDATE_COMMAND_UI((ID_FORMAT_FONTSIZE_BASE+3), OnUpdateFontSizeMenu)
ON_UPDATE_COMMAND_UI((ID_FORMAT_FONTSIZE_BASE+4), OnUpdateFontSizeMenu)
ON_UPDATE_COMMAND_UI((ID_FORMAT_FONTSIZE_BASE+5), OnUpdateFontSizeMenu)
ON_UPDATE_COMMAND_UI((ID_FORMAT_FONTSIZE_BASE+6), OnUpdateFontSizeMenu)
#ifdef _IME_COMPOSITION
ON_WM_LBUTTONDOWN()
#ifdef WIN32
@ -1032,8 +1006,6 @@ void CNetscapeEditView::OnKillFocus(CWnd *pOldWin)
CNetscapeView::OnKillFocus(pOldWin);
}
BOOL CNetscapeEditView::ShouldParentHandle(UINT nID, int nCode)
{
LPARAM t_param(0);
@ -1046,10 +1018,10 @@ BOOL CNetscapeEditView::ShouldParentHandle(UINT nID, int nCode)
return FALSE;
}
BOOL CNetscapeEditView::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
{
MWContext *pMWContext = GET_MWCONTEXT;
// was this a windows menu selection ?
switch (nCode)
{
@ -1059,7 +1031,7 @@ BOOL CNetscapeEditView::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDL
uint32 CategoryId, PluginId;
if (GetPluginInfo(nID, &CategoryId, &PluginId))
{
if (!EDT_PerformPlugin(GET_MWCONTEXT, CategoryId, PluginId, NULL, NULL))
if (!EDT_PerformPlugin(pMWContext, CategoryId, PluginId, NULL, NULL))
MessageBox(szLoadString(IDS_ERR_LAUNCH_EDITOR_PLUGIN), NULL, MB_ICONSTOP);
return TRUE; // the message was handled here
@ -1069,7 +1041,7 @@ BOOL CNetscapeEditView::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDL
else if(nID >= ID_EDIT_HISTORY_BASE && nID <= (ID_EDIT_HISTORY_BASE + MAX_EDIT_HISTORY_LOCATIONS))
{
char * pURL = NULL;
if( EDT_GetEditHistory(GET_MWCONTEXT, nID-ID_EDIT_HISTORY_BASE, &pURL, NULL) )
if( EDT_GetEditHistory(pMWContext, nID-ID_EDIT_HISTORY_BASE, &pURL, NULL) )
{
FE_LoadUrl(pURL, LOAD_URL_COMPOSER);
return TRUE;
@ -1077,7 +1049,7 @@ BOOL CNetscapeEditView::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDL
}
else if (nID == ID_STOP_EDITOR_PLUGIN)
{
EDT_StopPlugin(GET_MWCONTEXT);
EDT_StopPlugin(pMWContext);
return TRUE;
}
// Dynamically-built font face menu items
@ -1092,7 +1064,7 @@ BOOL CNetscapeEditView::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDL
pFace = wfe_ppTrueTypeFonts[nID - ID_FORMAT_FONTFACE_BASE-2];
}
// Change the font face
EDT_SetFontFace(GET_MWCONTEXT, NULL, iIndex, pFace);
EDT_SetFontFace(pMWContext, NULL, iIndex, pFace);
// Trigger update of toolbar combobox
m_EditState.bFontFaceMaybeChanged = TRUE;
return TRUE;
@ -1104,7 +1076,7 @@ BOOL CNetscapeEditView::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDL
t == P_UNUM_LIST ||
t == P_NUM_LIST ||
t == P_DESC_LIST ){
EDT_ToggleList(GET_MWCONTEXT, t);
EDT_ToggleList(pMWContext, t);
return TRUE;
}
OnFormatParagraph(nID);
@ -1115,12 +1087,12 @@ BOOL CNetscapeEditView::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDL
OnCharacterStyle(nID);
return TRUE;
}
else if( nID >= ID_FORMAT_FONTSIZE_BASE && nID <= ID_FORMAT_FONTSIZE_BASE+6)
else if( nID >= ID_FORMAT_FONTSIZE_BASE && nID < ID_FORMAT_FONTSIZE_BASE+MAX_FONT_SIZE)
{
OnFontSize(nID);
return TRUE;
}
else if( nID >= ID_FORMAT_POINTSIZE_BASE && nID <= ID_FORMAT_POINTSIZE_BASE+14)
else if( nID >= ID_FORMAT_POINTSIZE_BASE && nID <= ID_FORMAT_POINTSIZE_BASE+MAX_FONT_POINTSIZE_COUNT)
{
OnPointSize(nID);
return TRUE;
@ -1148,7 +1120,7 @@ BOOL CNetscapeEditView::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDL
if (nID >= ID_EDITOR_PLUGINS_BASE && nID < ID_EDITOR_PLUGINS_BASE + MAX_EDITOR_PLUGINS)
{
pCmdUI->Enable(CAN_INTERACT && !EDT_IsPluginActive(GET_MWCONTEXT));
pCmdUI->Enable(CAN_INTERACT && !EDT_IsPluginActive(pMWContext));
return TRUE;
}
else if(nID >= ID_EDIT_HISTORY_BASE && nID <= (ID_EDIT_HISTORY_BASE + MAX_EDIT_HISTORY_LOCATIONS))
@ -1158,7 +1130,7 @@ BOOL CNetscapeEditView::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDL
}
else if (nID == ID_STOP_EDITOR_PLUGIN)
{
pCmdUI->Enable(EDT_IsPluginActive(GET_MWCONTEXT));
pCmdUI->Enable(EDT_IsPluginActive(pMWContext));
return TRUE;
}
else if (IsEncodingMenu(nID))
@ -1174,21 +1146,52 @@ BOOL CNetscapeEditView::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDL
else if (nID >= ID_FORMAT_FONTFACE_BASE && nID < (ID_FORMAT_FONTFACE_BASE+MAX_TRUETYPE_FONTS+3))
{
// Hopefully, the cached index is up to date!
//pCmdUI->SetCheck(nID == (UINT)ID_FORMAT_FONTSIZE_BASE(m_EditState.iFontIndex + ID_FORMAT_FONTFACE_BASE));
pCmdUI->SetCheck(nID == (UINT)(m_EditState.iFontIndex + ID_FORMAT_FONTFACE_BASE));
pCmdUI->Enable(CAN_INTERACT);
pCmdUI->Enable(CAN_INTERACT && EDT_CanSetCharacterAttribute(pMWContext));
return TRUE;
}
else if (nID >= ID_FORMAT_FONTSIZE_BASE && nID < (ID_FORMAT_FONTSIZE_BASE+MAX_FONT_SIZE))
{
EDT_CharacterData * pData = EDT_GetCharacterData(pMWContext);
// Don't check an HTML size item if we actually have a POINT-SIZE value
if(pData && (pData->iPointSize == 0 || (pData->mask & TF_FONT_POINT_SIZE) == 0) )
{
int iFontSizeIndex = EDT_GetFontSize(pMWContext) - 1;
pCmdUI->SetCheck((UINT)(pData->iSize-1) == (nID - ID_FORMAT_FONTSIZE_BASE));
}
pCmdUI->Enable(CAN_INTERACT && EDT_CanSetCharacterAttribute(pMWContext));
return TRUE;
}
else if (pCmdUI->m_pMenu && nID >= ID_FORMAT_POINTSIZE_BASE && nID <= (ID_FORMAT_POINTSIZE_BASE+MAX_FONT_POINTSIZE_COUNT))
{
EDT_CharacterData * pData = EDT_GetCharacterData(pMWContext);
if(pData && pData->iPointSize && (pData->mask & TF_FONT_SIZE) && (pData->mask & TF_FONT_POINT_SIZE))
{
// Get the size from the menu item
char pMenuItem[16];
pCmdUI->m_pMenu->GetMenuString(nID, pMenuItem, 16, MF_BYCOMMAND);
int iMenuSize = atoi(pMenuItem);
pCmdUI->SetCheck(iMenuSize == pData->iPointSize);
}
pCmdUI->Enable(CAN_INTERACT && EDT_CanSetCharacterAttribute(pMWContext));
return TRUE;
}
else if( nID > ID_FORMAT_PARAGRAPH_BASE && nID <= ID_FORMAT_PARAGRAPH_END )
{
TagType t = TagType(nID - ID_FORMAT_PARAGRAPH_BASE);
if( t == P_BLOCKQUOTE ||
t == P_UNUM_LIST || //P_DIRECTORY ||
t == P_NUM_LIST || //P_MENU ||
t == P_UNUM_LIST ||
t == P_NUM_LIST ||
t == P_DESC_LIST)
{
UpdateListMenuItem(pCmdUI, t);
return TRUE;
}
TagType nParagraphFormat = EDT_GetParagraphFormatting(pMWContext);
pCmdUI->SetCheck(nParagraphFormat == (TagType)(pCmdUI->m_nID - ID_FORMAT_PARAGRAPH_BASE));
pCmdUI->Enable(CAN_INTERACT && !EDT_IsJavaScript(pMWContext));
return TRUE;
}
else if( nID >= ID_FORMAT_CHAR_BOLD && nID <= ID_FORMAT_CHAR_BLINK )
{
@ -2121,17 +2124,6 @@ void CNetscapeEditView::OnEditDelete()
}
}
void CNetscapeEditView::OnCopyStyle()
{
EDT_CopyStyle(GET_MWCONTEXT);
}
void CNetscapeEditView::OnUpdateCopyStyle(CCmdUI* pCmdUI)
{
//TODO: CHECK FOR TEXT ELEMENT?
pCmdUI->Enable(CAN_INTERACT);
}
// Use this for any commands that are enabled most of the time
void CNetscapeEditView::OnCanInteract(CCmdUI* pCmdUI)
{

View File

@ -322,7 +322,6 @@ protected:
afx_msg void OnCancelComboBox();
afx_msg void OnIncreaseFontSize();
afx_msg void OnDecreaseFontSize();
afx_msg void OnUpdateFontSizeMenu(CCmdUI* pCmdUI);
afx_msg void OnSelendokFontSizeCombo();
afx_msg void OnUpdateParagraphComboBox(CCmdUI* pCmdUI);
afx_msg void OnUpdateFontFaceComboBox(CCmdUI* pCmdUI);
@ -425,17 +424,12 @@ protected:
afx_msg void OnUpdateInTableColumn(CCmdUI* pCmdUI);
afx_msg void OnInsertTableCell();
afx_msg void OnInsertTableCellBefore();
afx_msg void OnUpdateInsertTableCell(CCmdUI* pCmdUI);
afx_msg void OnDeleteTableCell();
afx_msg void OnUpdateInTableCell(CCmdUI* pCmdUI);
afx_msg void OnInsertTableCaption();
afx_msg void OnUpdateInsertTableCaption(CCmdUI* pCmdUI);
afx_msg void OnDeleteTableCaption();
afx_msg void OnUpdateInTableCaption(CCmdUI* pCmdUI);
afx_msg void OnToggleTableBorder();
afx_msg void OnUpdateToggleTableBorder(CCmdUI* pCmdUI);
afx_msg void OnToggleHeaderCell();
afx_msg void OnUpdateToggleHeaderCell(CCmdUI* pCmdUI);
afx_msg void OnPropsTable();
afx_msg void OnPropsTableRow();
afx_msg void OnPropsTableColumn();
@ -472,8 +466,6 @@ protected:
afx_msg void OnUpdatePasteCharacterStyle(CCmdUI* pCmdUI);
afx_msg void OnGoToDefaultPublishLocation();
afx_msg void OnEditCopy();
afx_msg void OnCopyStyle();
afx_msg void OnUpdateCopyStyle(CCmdUI* pCmdUI);
afx_msg void OnEditCut();
afx_msg void OnEditDelete();
afx_msg void OnEditPaste();
@ -508,9 +500,6 @@ protected:
// Keep these outside of AFX_MSG - they use calculated
// or use a range of IDs and are not understood by App/Class wizards
afx_msg void OnFormatParagraph( UINT nID );
afx_msg void OnUpdateParagraphMenu(CCmdUI* pCmdUI);
afx_msg void OnUpdateParagraphControls(CCmdUI* pCmdUI);
afx_msg void OnUpdateCharacterControls(CCmdUI* pCmdUI);
afx_msg void OnFontColorMenu(UINT nID);
//afx_msg void OnUpdateFontSize(CCmdUI* pCmdUI);
afx_msg void OnUpdateInsertMenu(CCmdUI* pCmdUI);

View File

@ -707,16 +707,6 @@ void CNetscapeEditView::OnSelendokParagraphCombo()
}
// No paragraph buttons on toolbar -- just in menu
void CNetscapeEditView::OnUpdateParagraphMenu(CCmdUI* pCmdUI)
{
TagType nParagraphFormat = EDT_GetParagraphFormatting( GET_MWCONTEXT );
pCmdUI->SetCheck(nParagraphFormat == (TagType)(pCmdUI->m_nID - ID_FORMAT_PARAGRAPH_BASE));
pCmdUI->Enable(CAN_INTERACT && !EDT_IsJavaScript(GET_MWCONTEXT));
}
void CNetscapeEditView::OnUpdateParagraphComboBox(CCmdUI* pCmdUI)
{
if ( m_EditState.bParaFormatMaybeChanged &&
@ -869,13 +859,6 @@ void CNetscapeEditView::OnFontSize(UINT nID)
}
// Menu only:
void CNetscapeEditView::OnUpdateFontSizeMenu(CCmdUI* pCmdUI)
{
int iFontSizeIndex = EDT_GetFontSize( GET_MWCONTEXT ) - 1;
pCmdUI->SetCheck((UINT)iFontSizeIndex == (pCmdUI->m_nID - ID_FORMAT_FONTSIZE_BASE));
pCmdUI->Enable(CAN_INTERACT && EDT_CanSetCharacterAttribute(GET_MWCONTEXT));
}
void CNetscapeEditView::OnSelendokFontSizeCombo()
{
MWContext *pMWContext = GET_MWCONTEXT;
@ -959,6 +942,9 @@ void CNetscapeEditView::OnUpdateFontSizeComboBox(CCmdUI* pCmdUI)
int iFontSize = 0;
if( pMWContext )
{
char * pSize = NULL;
char pSizeNotInList[16];
EDT_CharacterData * pData = EDT_GetCharacterData(pMWContext);
if(pData)
{
@ -3309,21 +3295,6 @@ void CNetscapeEditView::OnInsertTableCellBefore()
}
}
void CNetscapeEditView::OnUpdateInsertTableCell(CCmdUI* pCmdUI)
{
if( EDT_IsInsertPointInTableRow(GET_MWCONTEXT) )
{
EDT_TableData* pData = EDT_GetTableData( GET_MWCONTEXT );
if(pData){
pCmdUI->Enable(pData->iRows < MAX_TABLE_ROWS &&
pData->iColumns < MAX_TABLE_COLUMNS);
EDT_FreeTableData(pData);
return;
}
}
pCmdUI->Enable(FALSE);
}
// DeleteTableCell
void CNetscapeEditView::OnDeleteTableCell()
@ -3336,71 +3307,6 @@ void CNetscapeEditView::OnUpdateInTableCell(CCmdUI* pCmdUI)
pCmdUI->Enable(EDT_IsInsertPointInTableRow(GET_MWCONTEXT));
}
// ToggleTableBorder
void CNetscapeEditView::OnToggleTableBorder()
{
Bool bInTable = EDT_IsInsertPointInTable(GET_MWCONTEXT);
Bool bCheck = FALSE;
if ( bInTable ) {
EDT_TableData* pData = EDT_GetTableData(GET_MWCONTEXT);
if ( pData ) {
bCheck = pData->iBorderWidth > 0;
intn iNewBorder = 1;
if ( bCheck ) {
iNewBorder = 0;
}
pData->iBorderWidth = iNewBorder;
EDT_SetTableData(GET_MWCONTEXT, pData);
EDT_FreeTableData(pData);
}
}
}
void CNetscapeEditView::OnUpdateToggleTableBorder(CCmdUI* pCmdUI)
{
Bool bInTable = EDT_IsInsertPointInTable(GET_MWCONTEXT);
Bool bCheck = FALSE;
if ( bInTable ) {
EDT_TableData* pData = EDT_GetTableData(GET_MWCONTEXT);
if ( pData ) {
bCheck = pData->iBorderWidth > 0;
EDT_FreeTableData(pData);
}
}
pCmdUI->SetCheck(bCheck );
pCmdUI->Enable(bInTable);
}
void CNetscapeEditView::OnToggleHeaderCell()
{
Bool bInTableCell = EDT_IsInsertPointInTableCell(GET_MWCONTEXT);
Bool bCheck = FALSE;
if ( bInTableCell ) {
EDT_TableCellData* pData = EDT_GetTableCellData(GET_MWCONTEXT);
if ( pData ) {
pData->bHeader = ! pData->bHeader;
EDT_SetTableCellData(GET_MWCONTEXT, pData);
EDT_FreeTableCellData(pData);
}
}
}
void CNetscapeEditView::OnUpdateToggleHeaderCell(CCmdUI* pCmdUI)
{
Bool bInTableCell = EDT_IsInsertPointInTableCell(GET_MWCONTEXT);
Bool bCheck = FALSE;
if ( bInTableCell ) {
EDT_TableCellData* pData = EDT_GetTableCellData(GET_MWCONTEXT);
if ( pData ) {
bCheck = pData->bHeader;
EDT_FreeTableCellData(pData);
}
}
pCmdUI->SetCheck(bCheck );
pCmdUI->Enable(bInTableCell);
}
// Table Properties
void CNetscapeEditView::OnPropsTable()
{
@ -4661,7 +4567,24 @@ DROPEFFECT CEditViewDropTarget::OnDragOver(CWnd* pWnd,
case FE_DRAG_IMAGE:
case FE_DRAG_TEXT:
int32 xVal, yVal;
pView->ClientToDocXY( cPoint, &xVal, &yVal );
pView->ClientToDocXY( cPoint, &xVal, &yVal );
// Check if near a border (within 10 pixels) and we should scroll the window
while( pContext->CheckAndScrollWindow(xVal, yVal, 0, 10) )
{
// Get current mouse location and convert to doc coordinates
POINT point;
GetCursorPos(&point);
pView->ScreenToClient(&point);
cPoint.x = point.x;
cPoint.y = point.y;
pView->ClientToDocXY( cPoint, &xVal, &yVal );
EDT_PositionDropCaret(pMWContext, xVal, yVal);
// Delay 20 millisecs between each cycle so it doesn't scroll too fast
DWORD startTime = timeGetTime();
do { FEU_StayingAlive(); }
while( timeGetTime() - startTime < 20 );
}
// Note: This will also handle feedback for where to drop table/cells
if( EDT_PositionDropCaret(pMWContext, xVal, yVal) )

View File

@ -61,7 +61,7 @@ BEGIN
MENUITEM "P&ublish...", ID_FILE_PUBLISH
MENUITEM SEPARATOR
MENUITEM "Sen&d Page", ID_FILE_MAILTO
MENUITEM "&Browse Page" ID_OPEN_NAV_WINDOW
MENUITEM "Preview in &Browser" ID_OPEN_NAV_WINDOW
MENUITEM SEPARATOR
MENUITEM "Page Se&tup...", ID_FILE_PAGE_SETUP
MENUITEM "Print Pre&view", ID_FILE_PRINT_PREVIEW
@ -250,8 +250,9 @@ BEGIN
MENUITEM "&Right", ID_ALIGN_TABLE_RIGHT
END
MENUITEM SEPARATOR
// "&Join..." or "Spli&t Cell"
// Join selected cells or with cell to the right
MENUITEM "{&J}" ID_MERGE_TABLE_CELLS
MENUITEM "Spli&t Cell" ID_SPLIT_TABLE_CELL
// "&Convert Text To Table" or "&Convert Table To Text"
MENUITEM "{&C}" ID_TABLE_TEXT_CONVERT
MENUITEM SEPARATOR
@ -635,8 +636,9 @@ BEGIN
MENUITEM "&Right", ID_ALIGN_TABLE_RIGHT
END
MENUITEM SEPARATOR
// "&Join..." or "Spli&t Cell"
// Join selected cells or with cell to the right
MENUITEM "{&J}" ID_MERGE_TABLE_CELLS
MENUITEM "Spli&t Cell" ID_SPLIT_TABLE_CELL
// "&Convert Text To Table" or "&Convert Table To Text"
MENUITEM "{&C}" ID_TABLE_TEXT_CONVERT
MENUITEM SEPARATOR