From 25d6faea8b7ef98214b02c530da34e09ccb3c10c Mon Sep 17 00:00:00 2001 From: "cmanske%netscape.com" Date: Thu, 13 Aug 1998 23:14:59 +0000 Subject: [PATCH] Fixed lots of Composer bugs. Implemented drag/drop/paste cells into existing table. Fixed Reload problems in Navigator (must reload from net to show doc color changes) - permission by blythe --- cmd/winfe/cxabstra.cpp | 14 +++ cmd/winfe/cxdc.cpp | 4 +- cmd/winfe/cxwin.cpp | 2 + cmd/winfe/eddialog.cpp | 9 +- cmd/winfe/eddialog.h | 10 -- cmd/winfe/edframe.cpp | 4 + cmd/winfe/editor.rc | 40 ++++--- cmd/winfe/edlayout.cpp | 20 +++- cmd/winfe/edprops.cpp | 106 ++++-------------- cmd/winfe/edprops.h | 4 +- cmd/winfe/edres2.h | 5 +- cmd/winfe/edtrcdll/src/edtrcdll.rc | 23 +++- cmd/winfe/edtrcdll/src/resource.h | 9 +- cmd/winfe/edview.cpp | 171 +++++++++++++++++------------ cmd/winfe/edview.h | 4 +- cmd/winfe/edview2.cpp | 48 +++----- cmd/winfe/feorphan.cpp | 4 + cmd/winfe/genfram2.cpp | 14 +-- cmd/winfe/genframe.cpp | 16 --- cmd/winfe/intlwin.cpp | 2 +- cmd/winfe/prefinfo.cpp | 28 +---- cmd/winfe/prefinfo.h | 6 +- cmd/winfe/prefs.cpp | 36 ++++-- cmd/winfe/prefs.h | 28 ----- cmd/winfe/res/editor.rc2 | 15 ++- cmd/winfe/resource.h | 31 +++--- 26 files changed, 304 insertions(+), 349 deletions(-) diff --git a/cmd/winfe/cxabstra.cpp b/cmd/winfe/cxabstra.cpp index 1ecdfe336af..31630b8e990 100755 --- a/cmd/winfe/cxabstra.cpp +++ b/cmd/winfe/cxabstra.cpp @@ -744,6 +744,20 @@ void CAbstractCX::Reload(NET_ReloadMethod iReloadType) { // Returns: void // Comments: Standard stuff. +#ifdef EDITOR + if( EDT_IS_EDITOR(GetContext()) ) + { + if( iReloadType == NET_RESIZE_RELOAD) + { + // Edit has its own refresh mechanism + EDT_RefreshLayout(GetContext()); + return; + } + // For all other types of reload, Editor must use this: + iReloadType = NET_NORMAL_RELOAD; + } +#endif // EDITOR + if(CanCreateUrlFromHist()) { URL_Struct *pUrl = CreateUrlFromHist(FALSE, NULL, iReloadType == NET_RESIZE_RELOAD); diff --git a/cmd/winfe/cxdc.cpp b/cmd/winfe/cxdc.cpp index 46cc466e930..307817383a1 100644 --- a/cmd/winfe/cxdc.cpp +++ b/cmd/winfe/cxdc.cpp @@ -1775,9 +1775,9 @@ void CDCCX::EditorDisplayZeroWidthBorder(LTRB& Rect, BOOL bSelected){ // Use dotted line if not selected, or solid if selecting HPEN pPen = ::CreatePen(bSelected ? PS_SOLID : PS_DOT, 1, rgbColor); HPEN pOldPen = (HPEN)::SelectObject(hdc, pPen); - + HBRUSH hOldBrush = (HBRUSH) ::SelectObject(hdc, ::GetStockObject(NULL_BRUSH)); ::Rectangle(hdc, Rect.left, Rect.top, Rect.right, Rect.bottom); - + ::SelectObject(hdc, hOldBrush); ::SelectObject(hdc, pOldPen); ReleaseContextDC(hdc); VERIFY(::DeleteObject(pPen)); diff --git a/cmd/winfe/cxwin.cpp b/cmd/winfe/cxwin.cpp index cea6dbcd1ff..3a7d14bddb3 100644 --- a/cmd/winfe/cxwin.cpp +++ b/cmd/winfe/cxwin.cpp @@ -1058,6 +1058,8 @@ void CWinCX::AftWMSize(PaneMessage *pMessage) #ifdef EDITOR if( EDT_IS_EDITOR(GetContext()) ){ EDT_RefreshLayout( GetContext() ); + m_crWindowRect = crNewRect; + return; } else #endif // EDITOR diff --git a/cmd/winfe/eddialog.cpp b/cmd/winfe/eddialog.cpp index ace134adbff..9dec492bf45 100644 --- a/cmd/winfe/eddialog.cpp +++ b/cmd/winfe/eddialog.cpp @@ -1423,6 +1423,11 @@ void CPageTitleDlg::OnOK() } } +ED_PasteType FE_GetTablePasteType(MWContext *pMWContext, intn iRows, intn iCols, XP_Bool bInTable, XP_Bool bCellIsSelected) +{ + return ED_PASTE_NORMAL; +} + CPasteSpecialDlg::CPasteSpecialDlg(CWnd* pParent) : CDialog(CPasteSpecialDlg::IDD, pParent), m_iResult(0) @@ -1431,8 +1436,6 @@ CPasteSpecialDlg::CPasteSpecialDlg(CWnd* pParent) BEGIN_MESSAGE_MAP(CPasteSpecialDlg, CDialog) //{{AFX_MSG_MAP(CPasteSpecialDlg) - ON_BN_CLICKED(IDC_PASTE_TEXT, OnPasteText) - ON_BN_CLICKED(IDC_PASTE_IMAGE, OnPasteImage) //}}AFX_MSG_MAP END_MESSAGE_MAP() @@ -1443,6 +1446,7 @@ BOOL CPasteSpecialDlg::OnInitDialog() return TRUE; } +#if 0 void CPasteSpecialDlg::OnPasteImage() { m_iResult = ED_PASTE_IMAGE; @@ -1454,6 +1458,7 @@ void CPasteSpecialDlg::OnPasteText() m_iResult = ED_PASTE_TEXT; CDialog::OnOK(); } +#endif ///////////////////////////////////////////////////////////////////////////// // CGetColumnsDlg dialog diff --git a/cmd/winfe/eddialog.h b/cmd/winfe/eddialog.h index 41223f93b68..83de295ac55 100644 --- a/cmd/winfe/eddialog.h +++ b/cmd/winfe/eddialog.h @@ -480,13 +480,6 @@ protected: DECLARE_MESSAGE_MAP() }; -// CPasteSpecialDlg::m_iResult values -enum { - ED_PASTE_CANCEL, - ED_PASTE_TEXT, - ED_PASTE_IMAGE -}; - ///////////////////////////////////////////////////////////////////////////// // CPasteSpecialDlg dialog // Called for user feedback when saving remote images @@ -512,10 +505,7 @@ private: // Implementation protected: - // Generated message map functions //{{AFX_MSG(CSaveFileOverwriteDlg) - afx_msg void OnPasteText(); - afx_msg void OnPasteImage(); virtual BOOL OnInitDialog(); //}}AFX_MSG DECLARE_MESSAGE_MAP() diff --git a/cmd/winfe/edframe.cpp b/cmd/winfe/edframe.cpp index 0b8344d6418..7d7fac8e6db 100644 --- a/cmd/winfe/edframe.cpp +++ b/cmd/winfe/edframe.cpp @@ -497,6 +497,10 @@ BOOL CEditToolBarController::CreateEditBars(MWContext *pMWContext, unsigned ett) } } } + // Add some list-type items to the combobox: + csTemp = "_Blockquote"; + m_ParagraphCombo.AddString((LPCTSTR)csTemp); + // String used to get width of FontSize combobox csTemp = "55"; cSize = CIntlWin::GetTextExtent(wincsid, pDC->GetSafeHdc(), csTemp, csTemp.GetLength()); diff --git a/cmd/winfe/editor.rc b/cmd/winfe/editor.rc index fd35dcda8fd..fb1f3d9bf3b 100644 --- a/cmd/winfe/editor.rc +++ b/cmd/winfe/editor.rc @@ -333,11 +333,6 @@ BEGIN ID_COPY_STYLE "Copy character and paragraph styles to the next-selected item" END -STRINGTABLE PRELOAD DISCARDABLE -BEGIN - IDS_MERGE_NEXT_CELL "&Join to the Cell to the Right" -END - STRINGTABLE PRELOAD DISCARDABLE BEGIN ID_COMBO_FONTSIZE "Change font size\nFont Size" @@ -447,25 +442,28 @@ END STRINGTABLE PRELOAD DISCARDABLE BEGIN - IDS_PERCENT_PARENT_CELL "% of parent cell" - IDS_PROPS_TABLE_CAPTION "Table Properties" - IDS_POPUP_TABLE_PROPS "T&able Properties" - IDS_POPUP_TABLE_CELL_PROPS "Table Cell Pr&operties" - IDS_SUBMENU_SELECT_TABLE "&Select" - IDS_SUBMENU_INSERT_TABLE "&Insert" - IDS_SUBMENU_DELETE_TABLE "&Delete" - IDS_CHANGE_SELECTED_CELL "Change Selected Cell " + IDS_PROPS_TABLE_CAPTION "Table Properties" + IDS_POPUP_TABLE_PROPS "T&able Properties" + IDS_POPUP_TABLE_CELL_PROPS "Table Cell Pr&operties" + IDS_MERGE_NEXT_CELL "&Join with Cell to the Right" + IDS_SUBMENU_SELECT_TABLE "&Select" + IDS_SUBMENU_INSERT_TABLE "&Insert" + IDS_SUBMENU_DELETE_TABLE "&Delete" + IDS_SUBMENU_PASTE_TABLE "&Paste Table or Cells" + IDS_REPLACE_SELECTED_CELLS "Replace &Selected Cells" END - + STRINGTABLE PRELOAD DISCARDABLE BEGIN - IDS_CHANGE_SELECTED_ROW "Change Selected Row " - IDS_CHANGE_SELECTED_COL "Change Selected Column " - IDS_ROW "Row" - IDS_COLUMN "Column" - IDS_CELL "Cell" - IDS_PERCENT_TABLE "% of table" - IDS_SMALL_ROMAN "i, ii, iii..." + IDS_CHANGE_SELECTED_CELL "Change Selected Cell " + IDS_CHANGE_SELECTED_ROW "Change Selected Row " + IDS_CHANGE_SELECTED_COL "Change Selected Column " + IDS_ROW "Row" + IDS_COLUMN "Column" + IDS_CELL "Cell" + IDS_PERCENT_TABLE "% of table" + IDS_PERCENT_PARENT_CELL "% of parent cell" + IDS_SMALL_ROMAN "i, ii, iii..." END STRINGTABLE PRELOAD DISCARDABLE diff --git a/cmd/winfe/edlayout.cpp b/cmd/winfe/edlayout.cpp index 33e913f1106..53cc1c09a43 100644 --- a/cmd/winfe/edlayout.cpp +++ b/cmd/winfe/edlayout.cpp @@ -680,18 +680,26 @@ void FE_DisplayDropTableFeedback(MWContext * pMWContext, EDT_DragTableData *pDra CNetscapeEditView * pView = (CNetscapeEditView *)pWinCX->GetView(); if( pView ) { - if( pDragData->iDropType == ED_DROP_REPLACE_CELL ) + if( pDragData->iDropType != ED_DROP_REPLACE_CELLS ) { - //TODO: FEEDBACK WHEN REPLACING - // THIS MAY BE DONE IN XP CODE BY SETTING LO_ELE_SELECTED_SPECIAL - // THEN JUST REDRAWING THE TABLE - } else { + // Figure out X and Y coords of the cell in the View's coordinate system + CWinCX *pWinCX = VOID2CX(pMWContext->fe.cx, CWinCX); + int32 xVal = pDragData->X + pDragData->pDragOverCell->lo_cell.x_offset + - pWinCX->GetOriginX(); + int32 yVal = pDragData->Y + pDragData->pDragOverCell->lo_cell.y_offset + - pWinCX->GetOriginY(); + // Use caret to show inserting between cells pView->CreateSolidCaret(pDragData->iWidth, pDragData->iHeight); - pView->SetCaretPos(CPoint(pDragData->X, pDragData->Y)); + pView->SetCaretPos(CPoint(xVal, yVal)); pView->m_caret.cShown = 1; pView->m_caret.bEnabled = TRUE; pView->ShowCaret(); } + // Note that feedback for ED_DROP_REPLACE_CELLS is marking cells to + // be replaced with the "special selection" + // XP code handles this, calling FE_DisplayEntireTableOrCell for + // each cell marked as "special" + } } diff --git a/cmd/winfe/edprops.cpp b/cmd/winfe/edprops.cpp index da76e360b7a..88062d54e6d 100644 --- a/cmd/winfe/edprops.cpp +++ b/cmd/winfe/edprops.cpp @@ -161,8 +161,7 @@ void wfe_FreeTrueTypeArray() wfe_iTrueTypeFontCount = 0; } -char pSepFont1[128] = "_"; -char pSepFont2[128] = "_"; +static char pSepFont1[128] = "_"; int wfe_FillFontComboBox(CComboBox * pCombo, int * pMaxWidth) { @@ -753,41 +752,6 @@ BOOL CNSComboBox::PreTranslateMessage(MSG* pMsg) return CComboBox::PreTranslateMessage(pMsg); } -///////////////////////////////////////////////////////////////////////////////////// -// Netscape Color string for Default Text color -char pDefaultFontColorString[256] = ""; -// COLORREF equivalent -COLORREF crDefaultColor; - -char pDefaultNoColorString[256] = ""; - -char * wfe_GetDefaultColorString(COLORREF crColor) -{ - if( crColor == NO_COLORREF){ - if( *pDefaultNoColorString == '\0' ){ - strcpy(pDefaultNoColorString, szLoadString(IDS_DEFAULT_NOCOLOR)); - } - crDefaultColor = RGB(255,255,255); - return pDefaultNoColorString; - } - - if( crColor == DEFAULT_COLORREF ){ - // Get default text color - PREF_GetDefaultColorPrefDWord("browser.foreground_color", &crDefaultColor); - } else { - // Use the supplied color - crDefaultColor = crColor; - } - - sprintf(pDefaultFontColorString,"%d,%d%,%d,%s", - GetRValue(crDefaultColor), - GetGValue(crDefaultColor), - GetBValue(crDefaultColor), - szLoadString(IDS_DEFAULT)); - - return pDefaultFontColorString; -} - ///////////////////////////////////////////////////////////////////////////// // Custom Combobox - containing colors @@ -964,7 +928,7 @@ int CColorComboBox::SetColor(COLORREF cr) m_crColor = RGB(255,255,255); }else if( cr == DEFAULT_COLORREF ) { - m_crColor = crDefaultColor; + m_crColor = prefInfo.m_rgbForegroundColor; iIndex = 0; } else { m_crColor = cr; @@ -1050,12 +1014,7 @@ CColorPicker::CColorPicker(CWnd * pParent, if( crDefColor == DEFAULT_COLORREF || crDefColor == MIXED_COLORREF ) { // Get the "Default" color used by the Browser - COLORREF tmpColor,defColor; - XP_Bool bCust; - PREF_GetColorPrefDWord("browser.foreground_color",&tmpColor); - PREF_GetDefaultColorPrefDWord("browser.foreground_color",&defColor); - PREF_GetBoolPref("browser.custom_text_color",&bCust); - m_crCurrentColor = bCust ? tmpColor : defColor; + m_crCurrentColor = prefInfo.m_rgbForegroundColor; } else if( crDefColor == BACKGROUND_COLORREF ) { // Get current page's background color @@ -3462,25 +3421,10 @@ BOOL CDocColorPage::OnSetActive() pSchemeListBox->AddString(pColorData->pSchemeName); } - COLORREF tmpColor,defColor; - XP_Bool bCust; // Get Browser preference colors - PREF_GetColorPrefDWord("browser.foreground_color",&tmpColor); - PREF_GetDefaultColorPrefDWord("browser.foreground_color",&defColor); - PREF_GetBoolPref("browser.custom_text_color",&bCust); - m_crBrowserText = bCust ? tmpColor : defColor; - - PREF_GetColorPrefDWord("browser.anchor_color",&tmpColor); - PREF_GetDefaultColorPrefDWord("browser.anchor_color",&defColor); - PREF_GetBoolPref("browser.custom_link_color",&bCust); - m_crBrowserLink = bCust ? tmpColor : defColor; - - - PREF_GetColorPrefDWord("browser.visited_color",&tmpColor); - PREF_GetDefaultColorPrefDWord("browser.visited_color",&defColor); - PREF_GetBoolPref("browser.custom_visited_color",&bCust); - m_crBrowserFollowedLink = bCust ? tmpColor : defColor; - + m_crBrowserText = prefInfo.m_rgbForegroundColor; + m_crBrowserLink = prefInfo.m_rgbAnchorColor; + m_crBrowserFollowedLink = prefInfo.m_rgbVisitedColor; m_crBrowserBackground = prefInfo.m_rgbBackgroundColor; // m_pPageData may be NULL if we are not an Editor @@ -4593,12 +4537,7 @@ BOOL CCharacterPage::OnSetActive() } // Get the "Default" color used by the Browser - COLORREF tmpColor,defColor; - XP_Bool bCust; - PREF_GetColorPrefDWord("browser.foreground_color",&tmpColor); - PREF_GetDefaultColorPrefDWord("browser.foreground_color",&defColor); - PREF_GetBoolPref("browser.custom_text_color",&bCust); - m_crDefault = bCust ? tmpColor : defColor; + m_crDefault = prefInfo.m_rgbForegroundColor; // Get current color at cursor or selection m_crColor = WFE_GetCurrentFontColor(m_pMWContext); @@ -6761,6 +6700,8 @@ void CImagePage::OnImageFile() wfe_ValidateImage( m_pMWContext, m_csImage ); XP_FREE( szFilename ); SetModified(TRUE); + // Supply a default AltText = image filename + AutoFillAltText(); UpdateData(FALSE); m_bValidImage = TRUE; m_csLastValidImage = m_csImage; @@ -6788,10 +6729,25 @@ void CImagePage::OnKillfocusImage() { wfe_ValidateImage( m_pMWContext, m_csImage ); m_bValidImage = TRUE; + AutoFillAltText(); UpdateData(FALSE); } } + // Automatically fill in the ALT text string if none currently +void CImagePage::AutoFillAltText() +{ + CleanupString(m_csAltText); + if( m_csAltText.IsEmpty() ) + { + char *pName = EDT_GetFilename(CHAR_STR(m_csImage), FALSE); + if( pName ) + { + m_csAltText = XP_STRDUP(pName); + XP_FREE(pName); + } + } +} void CImagePage::OnEditImage() { UpdateData(TRUE); @@ -7343,20 +7299,6 @@ BOOL CLinkPage::OnKillActive() if ( !m_bValidHref ){ ValidateHref(); } - if( m_csHref.IsEmpty() ) - { - // Notify user they must have a URL filled in - MessageBox(szLoadString(IDS_MISSING_LINK), - szLoadString(IDS_LINK_PROPS_CAPTION), - MB_ICONEXCLAMATION | MB_OK); - - // Put focus in the offending control - // And select all text, just like DDV functions - CEdit *pEdit = (CEdit*)GetDlgItem(IDC_HREF_URL); - pEdit->SetFocus(); - pEdit->SetSel(0, -1, TRUE); - return FALSE; - } return CPropertyPage::OnKillActive(); } diff --git a/cmd/winfe/edprops.h b/cmd/winfe/edprops.h index eb73f8c3a3e..65359c3d021 100644 --- a/cmd/winfe/edprops.h +++ b/cmd/winfe/edprops.h @@ -122,8 +122,6 @@ extern COLORREF wfe_crLastBkgrndColorPicked; // or don't draw a color swatch or button #define NO_COLORREF MIXED_COLORREF -char * wfe_GetDefaultColorString(COLORREF crDefColor); - /*convert image p_file (in URLFORM) and return the resultant filename, or null if failure/cancel*/ char * wfe_ConvertImage(char *p_fileurl,void *p_parentwindow,MWContext *p_pMWContext); @@ -144,7 +142,6 @@ private: COLORREF * m_pColorRef; // If we set focus to ourselves, return the color here COLORREF * m_pSetFocusColor; - COLORREF m_crDefaultColor; HPALETTE m_hPal; BOOL m_bColorSwatchMode; char m_pTipText[80]; @@ -1253,6 +1250,7 @@ public: protected: void SetLockAspectEnable(); + void AutoFillAltText(); // Controls common to Image, Java, Plugin property pages CAlignControls m_AlignControls; diff --git a/cmd/winfe/edres2.h b/cmd/winfe/edres2.h index 077a95a4470..c529c0a4720 100644 --- a/cmd/winfe/edres2.h +++ b/cmd/winfe/edres2.h @@ -75,5 +75,8 @@ #define ID_EDIT_HISTORY_BASE (ID_TOOLS_MENU_BASE+MAX_EDITOR_PLUGINS+10+105) // RESERVE MAX_EDIT_HISTORY_LOCATIONS (Currently 10) items here -#define ID_EDIT_LAST_ID (ID_EDIT_HISTORY_BASE + 10) + +#define ID_PASTE_TABLE_BASE (ID_EDIT_HISTORY_BASE + 10) + +#define ID_EDIT_LAST_ID (ID_PASTE_TABLE_BASE + 10) #endif diff --git a/cmd/winfe/edtrcdll/src/edtrcdll.rc b/cmd/winfe/edtrcdll/src/edtrcdll.rc index 3f325bb9022..293f63b809f 100644 --- a/cmd/winfe/edtrcdll/src/edtrcdll.rc +++ b/cmd/winfe/edtrcdll/src/edtrcdll.rc @@ -822,15 +822,18 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,84,133,50,14 END -IDD_PASTE_SPECIAL DIALOG DISCARDABLE 0, 0, 142, 81 +IDD_PASTE_SPECIAL DIALOG DISCARDABLE 0, 0, 199, 111 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Paste Special" +CAPTION "Select Paste Format" +MENU Image","Text","Table FONT 8, "MS Sans Serif" BEGIN - PUSHBUTTON "Paste &Text",IDC_PASTE_TEXT,36,40,69,14 - PUSHBUTTON "Paste &Image",IDC_PASTE_IMAGE,36,60,69,14 - LTEXT "The clipboard contains both text and image versions of the same data.\nSelect which type to paste:", - IDC_STATIC,7,7,127,29 + LTEXT "The clipboard contains multiple formats of the same data.\nSelect which type to paste:", + IDC_STATIC,8,7,182,21 + LISTBOX IDC_PASTE_FORMAT_LIST,8,34,182,47,LBS_NOINTEGRALHEIGHT | + WS_VSCROLL | WS_TABSTOP + DEFPUSHBUTTON "OK",IDOK,46,89,50,14,WS_GROUP + PUSHBUTTON "Cancel",IDCANCEL,103,89,50,14 END IDD_GET_TABLE_COLUMNS DIALOG DISCARDABLE 0, 0, 153, 73 @@ -1007,6 +1010,14 @@ BEGIN BOTTOMMARGIN, 147 END + IDD_PASTE_SPECIAL, DIALOG + BEGIN + RIGHTMARGIN, 190 + VERTGUIDE, 8 + VERTGUIDE, 190 + BOTTOMMARGIN, 103 + END + IDD_GET_TABLE_COLUMNS, DIALOG BEGIN LEFTMARGIN, 7 diff --git a/cmd/winfe/edtrcdll/src/resource.h b/cmd/winfe/edtrcdll/src/resource.h index 458844ec80c..c1938596d42 100644 --- a/cmd/winfe/edtrcdll/src/resource.h +++ b/cmd/winfe/edtrcdll/src/resource.h @@ -355,8 +355,7 @@ #define IDD_PAGE_TABLE_CELL 2269 #define IDD_FEJPEGOPTIONS 2270 #define IDC_APPLY 2272 -#define IDC_PASTE_TEXT 2401 -#define IDC_PASTE_IMAGE 2402 +#define IDC_PASTE_FORMAT_LIST 2401 #define IDS_HREF_OTHER_ATTRIBS 42271 #define IDS_HREF_OTHER_ATTRIBS_CAPTION 42272 #define IDS_ERROR_HTML_CAPTION 42296 @@ -418,6 +417,10 @@ #define IDS_SPELL_COULD_NOT_LOAD 59458 #define IDS_SPELL_CORRUPT 59459 #define IDS_CORRECT_SPELLING 59460 +#define IDS_PASTE_IMAGE 59461 +#define IDS_PASTE_TEXT_PLAIN 59462 +#define IDS_PASTE_TEXT_NEW_TABLE 59463 +#define IDS_PASTE_TEXT_REPLACE_CELLS 59464 // Next default values for new objects // @@ -425,7 +428,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 137 #define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 1079 +#define _APS_NEXT_CONTROL_VALUE 1081 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/cmd/winfe/edview.cpp b/cmd/winfe/edview.cpp index d67a03b25f1..c0a63131f54 100644 --- a/cmd/winfe/edview.cpp +++ b/cmd/winfe/edview.cpp @@ -326,8 +326,8 @@ BEGIN_MESSAGE_MAP(CNetscapeEditView, CNetscapeView) ON_COMMAND(ID_SELECT_NEXT_NONTEXT, OnSelectNextNonTextObject) //}}AFX_MSG_MAP // Put update commands here so we can remove them temporarily for overhead assesments - ON_UPDATE_COMMAND_UI(ID_FORMAT_INCREASE_FONTSIZE, OnUpdateIncreaseFontSize) - ON_UPDATE_COMMAND_UI(ID_FORMAT_DECREASE_FONTSIZE, OnUpdateDecreaseFontSize) + ON_UPDATE_COMMAND_UI(ID_FORMAT_INCREASE_FONTSIZE, OnCanInteractInText) + ON_UPDATE_COMMAND_UI(ID_FORMAT_DECREASE_FONTSIZE, OnCanInteractInText) ON_UPDATE_COMMAND_UI(ID_COMBO_PARA, OnUpdateParagraphComboBox) ON_UPDATE_COMMAND_UI(ID_COMBO_FONTFACE, OnUpdateFontFaceComboBox) ON_UPDATE_COMMAND_UI(ID_COMBO_FONTSIZE, OnUpdateFontSizeComboBox) @@ -349,7 +349,7 @@ BEGIN_MESSAGE_MAP(CNetscapeEditView, CNetscapeView) ON_UPDATE_COMMAND_UI(ID_PROPS_PARAGRAPH, HaveEditContext) ON_UPDATE_COMMAND_UI(ID_PROPS_CHARACTER, HaveEditContext) ON_UPDATE_COMMAND_UI(ID_PROPS_DOC_COLOR, HaveEditContext) - ON_UPDATE_COMMAND_UI(ID_FORMAT_CHAR_NONE, OnCanInteract) + ON_UPDATE_COMMAND_UI(ID_FORMAT_CHAR_NONE, OnCanInteractInText) ON_UPDATE_COMMAND_UI(ID_FORMAT_INDENT, HaveEditContext) ON_UPDATE_COMMAND_UI(ID_FORMAT_OUTDENT, HaveEditContext) ON_UPDATE_COMMAND_UI(ID_ALIGN_POPUP, HaveEditContext) @@ -1339,10 +1339,12 @@ void CNetscapeEditView::OnChar(UINT nChar, UINT nRepCnt, UINT nflags) MWContext * pMWContext = GET_MWCONTEXT; - // Any kepress except Ctrl+[ (for decrease font size) - // should clear a table selection - if( !(nChar == 27 && bControl) ) - EDT_ClearTableAndCellSelection(pMWContext); + // Any kepress except when holding Ctrl + // should clear a table selection??? + // Allows Ctrl+[ for decrease font size, + // and Ctrl+C, X, and V for copy/cut/paste +// if( !bControl ) +// EDT_ClearTableAndCellSelection(pMWContext); // Ignore keys if we can't interact INTL_CharSetInfo csi = LO_GetDocumentCharacterSetInfo(pMWContext); @@ -2088,6 +2090,13 @@ void CNetscapeEditView::OnCanInteract(CCmdUI* pCmdUI) pCmdUI->Enable(CAN_INTERACT); } +// XP call checks same things as CAN_INTERACT, and we must be +// in some text (or mixed selection) as well +void CNetscapeEditView::OnCanInteractInText(CCmdUI* pCmdUI) +{ + pCmdUI->Enable( EDT_CanSetCharacterAttribute(GET_MWCONTEXT) ); +} + // Gets data from bookmark item - returns TRUE if found BOOL wfe_GetBookmarkData( COleDataObject* pDataObject, char ** ppURL, char ** ppTitle ) { HGLOBAL h = pDataObject->GetGlobalData(RegisterClipboardFormat(NETSCAPE_BOOKMARK_FORMAT)); @@ -2174,15 +2183,20 @@ BOOL CNetscapeEditView::DoPasteItem(COleDataObject* pDataObject, HGLOBAL hString = NULL; char * pString = NULL; - + char * pConvertedString = NULL; + BOOL bHaveText = FALSE; + BOOL bHaveHTML = pDataObject->IsDataAvailable(m_cfEditorFormat); + // Get any string data if ( pDataObject->IsDataAvailable(CF_TEXT) ) { hString = pDataObject->GetGlobalData(CF_TEXT); // get a pointer to the actual bytes if ( hString ) { - pString = (char *) GlobalLock(hString); - } + pString = (char *) GlobalLock(hString); + if( pString && *pString ) + bHaveText = TRUE; + } } if ( m_bIsEditor ) @@ -2196,36 +2210,84 @@ BOOL CNetscapeEditView::DoPasteItem(COleDataObject* pDataObject, EDT_BeginBatchChanges(pMWContext); - BOOL bHaveText = pDataObject->IsDataAvailable(CF_TEXT); - BOOL bHaveUnicode = FALSE; BOOL bHaveImage = FALSE; -#ifdef XP_WIN32 - bHaveUnicode = pDataObject->IsDataAvailable(CF_UNICODETEXT) && - (CS_USER_DEFINED_ENCODING != INTL_GetCSIWinCSID(LO_GetDocumentCharacterSetInfo(pMWContext))); -#endif -#ifdef EDITOR -#ifdef _IMAGE_CONVERT - bHaveImage = pDataObject->IsDataAvailable(CF_DIB); - if( bHaveImage && (bHaveText || bHaveUnicode) ) + if( !bHaveHTML ) // HTML overrides image and text formats { - //TODO: POPUP DIALOG TO - CPasteSpecialDlg dlg(this); - if( IDOK == dlg.DoModal() || dlg.m_iResult > 0) +#ifdef XP_WIN32 + if( pDataObject->IsDataAvailable(CF_UNICODETEXT) && + (CS_USER_DEFINED_ENCODING != INTL_GetCSIWinCSID(LO_GetDocumentCharacterSetInfo(pMWContext))) ) { - if( dlg.m_iResult == ED_PASTE_IMAGE ) + int datacsid = + INTL_GetCSIWinCSID(LO_GetDocumentCharacterSetInfo(pMWContext)) & ~CS_AUTO; + HGLOBAL hUnicodeStr = NULL; + char * pUnicodeString = NULL; + + // Get any string data + if ( pDataObject->IsDataAvailable(CF_UNICODETEXT) ) { + hUnicodeStr = pDataObject->GetGlobalData(CF_UNICODETEXT); + + // get a pointer to the actual bytes + if ( hUnicodeStr ) { + pUnicodeString = (char *) GlobalLock(hUnicodeStr); + + // Now, let's convert the Unicode text into the datacsid encoding + int ucs2len = CASTINT(INTL_UnicodeLen((INTL_Unicode*)pUnicodeString)); + int mbbufneeded = CASTINT(INTL_UnicodeToStrLen(datacsid, + (INTL_Unicode*)pUnicodeString, + ucs2len)); + if(NULL != (pConvertedString = (char*)XP_ALLOC(mbbufneeded + 1))) + { + INTL_UnicodeToStr(datacsid, (INTL_Unicode*)pUnicodeString, ucs2len, + (unsigned char*) pConvertedString, mbbufneeded + 1); + + // The UNICODE string will be used instead of the regular string data + if( pConvertedString && *pConvertedString ) + { + pString = pConvertedString; + bHaveText = TRUE; + } + } + GlobalUnlock(hUnicodeStr); + } + } + } +#endif // XP_WIN32 +#ifdef EDITOR + + // Check if text data is a tab-delimited spreadsheet format + +#ifdef _IMAGE_CONVERT + bHaveImage = pDataObject->IsDataAvailable(CF_DIB); +#endif + intn iRows, iCols; + XP_Bool bInTable = FALSE; + + if( bHaveText && + (bHaveImage || + EDT_CanPasteTextAsTable(pMWContext, pString, &iRows, &iCols, &bInTable)) ) + { + CPasteSpecialDlg dlg(this); + if( IDOK == dlg.DoModal() && dlg.m_iResult > 0 ) { - bHaveText = bHaveUnicode = FALSE; - } else if( dlg.m_iResult == ED_PASTE_TEXT ) - { - bHaveImage = FALSE; - } - } else { - goto NO_PASTE; +#if 0 +// TODO: FINISH NEW DIALOG + if( dlg.m_iResult == ED_PASTE_IMAGE ) + { + // Paste the image - ignore the text + bHaveText = FALSE; + } else { + // Ignore the image + bHaveImage = FALSE; + if( dlg.m_iResult == ED_PASTE_TEXT ) + } +#endif + } else { + goto NO_PASTE; + } } } -#endif -#endif +#endif // EDITOR if( bDeleteSource ){ // This deletes current selection and sets @@ -2283,16 +2345,16 @@ BOOL CNetscapeEditView::DoPasteItem(COleDataObject* pDataObject, } if( pURL) XP_FREE(pURL); XP_FREE(pTitle); - } else if ( pDataObject->IsDataAvailable(m_cfEditorFormat) ) { + } else if ( bHaveHTML ) { h = pDataObject->GetGlobalData(m_cfEditorFormat); if( h ){ char * pHTML = (char*) GlobalLock( h ); - EDT_PasteHTML( pMWContext, pHTML ); + EDT_PasteHTML( pMWContext, pHTML, ED_PASTE_NORMAL ); GlobalUnlock( h ); } } #ifdef EDITOR - else if(pDataObject->IsDataAvailable(m_cfImageFormat) ) { + else if( pDataObject->IsDataAvailable(m_cfImageFormat) ) { h = pDataObject->GetGlobalData(m_cfImageFormat); WFE_DragDropImage(h, pMWContext); } @@ -2307,44 +2369,11 @@ BOOL CNetscapeEditView::DoPasteItem(COleDataObject* pDataObject, DropFiles(handle, FALSE); } // **** Test for other formats here - } - else if ( bHaveUnicode ) - { - int datacsid = - INTL_GetCSIWinCSID(LO_GetDocumentCharacterSetInfo(pMWContext)) & ~CS_AUTO; - HGLOBAL hUnicodeStr = NULL; - char * pUnicodeString = NULL; - char * pConvertedString = NULL; - - // Get any string data - if ( pDataObject->IsDataAvailable(CF_UNICODETEXT) ) { - hUnicodeStr = pDataObject->GetGlobalData(CF_UNICODETEXT); - - // get a pointer to the actual bytes - if ( hUnicodeStr ) { - pUnicodeString = (char *) GlobalLock(hUnicodeStr); - - // Now, let's convert the Unicode text into the datacsid encoding - int ucs2len = CASTINT(INTL_UnicodeLen((INTL_Unicode*)pUnicodeString)); - int mbbufneeded = CASTINT(INTL_UnicodeToStrLen(datacsid, - (INTL_Unicode*)pUnicodeString, - ucs2len)); - if(NULL != (pConvertedString = (char*)XP_ALLOC(mbbufneeded + 1))) - { - INTL_UnicodeToStr(datacsid, (INTL_Unicode*)pUnicodeString, ucs2len, - (unsigned char*) pConvertedString, mbbufneeded + 1); - - EDT_PasteText( pMWContext, pConvertedString ); - XP_FREE(pConvertedString); - } - GlobalUnlock(hUnicodeStr); - } - } } #endif //XP_WIN32 else if ( bHaveText ) { if( pString ) { - // *** TODO: Analyze string: + // *** TODO: Analyze string? // Check if its a valid local filename (use XP_STAT). If yes, pop-up menu: // 1. If over selected text: Create a link to // Pop-up menu: Create Link or paste filename or load file @@ -2403,6 +2432,8 @@ NO_PASTE: if ( m_bIsEditor ) EDT_EndBatchChanges(pMWContext); + XP_FREEIF(pConvertedString); + SetCursor(theApp.LoadStandardCursor(IDC_ARROW)); return(TRUE); diff --git a/cmd/winfe/edview.h b/cmd/winfe/edview.h index cc11f17f8a4..1d9201b9717 100644 --- a/cmd/winfe/edview.h +++ b/cmd/winfe/edview.h @@ -314,8 +314,6 @@ protected: afx_msg void OnCancelComboBox(); afx_msg void OnIncreaseFontSize(); afx_msg void OnDecreaseFontSize(); - afx_msg void OnUpdateIncreaseFontSize(CCmdUI* pCmdUI); - afx_msg void OnUpdateDecreaseFontSize(CCmdUI* pCmdUI); afx_msg void OnUpdateFontSizeMenu(CCmdUI* pCmdUI); afx_msg void OnSelendokFontSizeCombo(); afx_msg void OnUpdateParagraphComboBox(CCmdUI* pCmdUI); @@ -478,7 +476,7 @@ protected: afx_msg void OnUpdateEditCopy(CCmdUI* pCmdUI); afx_msg void OnUpdateEditPaste(CCmdUI* pCmdUI); afx_msg void OnCanInteract(CCmdUI* pCmdUI); -// afx_msg void OnEditFindAgain(); + afx_msg void OnCanInteractInText(CCmdUI* pCmdUI); afx_msg void OnFileOpen(); afx_msg void OnFileOpenURL(); afx_msg void OnSetImageAsBackground(); diff --git a/cmd/winfe/edview2.cpp b/cmd/winfe/edview2.cpp index e31840af807..2e6e68b4ad7 100644 --- a/cmd/winfe/edview2.cpp +++ b/cmd/winfe/edview2.cpp @@ -737,7 +737,7 @@ void CNetscapeEditView::OnUpdateParagraphComboBox(CCmdUI* pCmdUI) } m_EditState.bParaFormatMaybeChanged = FALSE; } - pCmdUI->Enable( CAN_INTERACT ); // Should we do this: !EDT_IsJavaScript(GET_MWCONTEXT) ); + pCmdUI->Enable( EDT_CanSetCharacterAttribute(GET_MWCONTEXT) ); } ///////////////////////////////////////////////////////////////////////// @@ -786,7 +786,7 @@ void CNetscapeEditView::OnUpdateFontFaceComboBox(CCmdUI* pCmdUI) } } } - pCmdUI->Enable( CAN_INTERACT ); // Should we do this: !EDT_IsJavaScript(GET_MWCONTEXT) ); + pCmdUI->Enable( EDT_CanSetCharacterAttribute(GET_MWCONTEXT) ); } void CNetscapeEditView::OnSelendokFontFaceCombo() @@ -1056,16 +1056,6 @@ void CNetscapeEditView::OnDecreaseFontSize() m_EditState.bFontSizeMaybeChanged = TRUE; } -void CNetscapeEditView::OnUpdateIncreaseFontSize(CCmdUI* pCmdUI) -{ - pCmdUI->Enable( EDT_CanSetCharacterAttribute(GET_MWCONTEXT) ); -} - -void CNetscapeEditView::OnUpdateDecreaseFontSize(CCmdUI* pCmdUI) -{ - pCmdUI->Enable( EDT_CanSetCharacterAttribute(GET_MWCONTEXT) ); -} - ///////////////////////////////////////////////////////////////////////// // Font Color controls @@ -1120,11 +1110,11 @@ void CNetscapeEditView::OnUpdateFontColorComboBox(CCmdUI* pCmdUI) m_EditState.bFontColorMaybeChanged = FALSE; } } - pCmdUI->Enable( CAN_INTERACT ); // Should we do this: !EDT_IsJavaScript(GET_MWCONTEXT) ); + // We can allow this to be active if not in text because + // we allow access to background color as well + pCmdUI->Enable(CAN_INTERACT); } -extern COLORREF crDefaultColor; - ////////////////////////////////////////////////////////////////// // Insert Objects and Properties @@ -1677,7 +1667,6 @@ void CNetscapeEditView::OnRButtonDown(UINT uFlags, CPoint cpPoint) PREF_CopyCharPref("editor.image_editor",&pImageEditor); // Add "Edit Image..." if editor was designated - // TODO: USE IDS_EDIT_IMAGE FOR VERSION 5.0 (String is missing for 4.0x) if( pImageEditor && XP_STRLEN(pImageEditor) > 0 ) { cmPopup.AppendMenu(MF_ENABLED, ID_POPUP_EDIT_IMAGE, @@ -3208,7 +3197,7 @@ void CNetscapeEditView::OnUpdateInsertTableRow(CCmdUI* pCmdUI) void CNetscapeEditView::OnDeleteTableRow() { - EDT_DeleteTableRows(GET_MWCONTEXT, 1); + EDT_DeleteTableRows(GET_MWCONTEXT, 0); } void CNetscapeEditView::OnUpdateInTableRow(CCmdUI* pCmdUI) @@ -3288,7 +3277,7 @@ void CNetscapeEditView::OnUpdateInsertTableColumn(CCmdUI* pCmdUI) void CNetscapeEditView::OnDeleteTableColumn() { - EDT_DeleteTableColumns(GET_MWCONTEXT, 1); + EDT_DeleteTableColumns(GET_MWCONTEXT, 0); } void CNetscapeEditView::OnUpdateInTableColumn(CCmdUI* pCmdUI) @@ -4403,11 +4392,16 @@ void CNetscapeEditView::BuildEditHistoryMenu(HMENU hMenu, int iStartItem) CString csMenuString = pUrl; WFE_CondenseURL(csMenuString, MAX_MENU_ITEM_LENGTH, FALSE); - // Add 1 - 9 as first character menu accelerator if (i < 9) - pMenuItem = PR_smprintf("&%d %s", i+1, csMenuString); - else - pMenuItem = PR_smprintf(" %s", csMenuString); + // Add 1 - 9 as first character menu accelerator + pMenuItem = PR_smprintf(" &%d %s", i+1, csMenuString); + else if (i == 9) + // Use "0" as accelerator for tenth file + pMenuItem = PR_smprintf("1&%d %s", 10, csMenuString); + else + // This isn't used with our current maximum of 10 files, + // but keep in case we increase MAX_EDIT_HISTORY_LOCATIONS + pMenuItem = PR_smprintf(" %s", csMenuString); if( pMenuItem ) { @@ -4660,18 +4654,10 @@ DROPEFFECT CEditViewDropTarget::OnDragOver(CWnd* pWnd, case FE_DRAG_HTML: case FE_DRAG_TABLE: case FE_DRAG_IMAGE: - // If no selected text, fall through to allow inserting bookmark anywhere case FE_DRAG_TEXT: int32 xVal, yVal; pView->ClientToDocXY( cPoint, &xVal, &yVal ); -#if 0 -// Let back-end destroy caret if it needs to - // This should be destroyed (bEnabled = FALSE) if we don't have focus? - if ( pView->m_caret.bEnabled && pView->m_caret.cShown ) - { - FE_DestroyCaret(pMWContext); - } -#endif + // Note: This will also handle feedback for where to drop table/cells if( EDT_PositionDropCaret(pMWContext, xVal, yVal) ) { diff --git a/cmd/winfe/feorphan.cpp b/cmd/winfe/feorphan.cpp index b59859ef892..59d995b51b6 100644 --- a/cmd/winfe/feorphan.cpp +++ b/cmd/winfe/feorphan.cpp @@ -31,6 +31,7 @@ #ifdef EDITOR //#include "edview.h" #endif +#include "prefs.h" //To access g_bReloadChangeColor; #ifdef NSPR20 #include "private/prpriv.h" @@ -108,6 +109,9 @@ wfe_SetLayoutColor(int type, COLORREF color) uint8 blue = GetBValue(color); LO_SetDefaultColor(type, red, green, blue); + if( type != LO_COLOR_BG ) + g_bReloadChangeColor = TRUE; + #endif /* MOZ_NGLAYOUT */ } diff --git a/cmd/winfe/genfram2.cpp b/cmd/winfe/genfram2.cpp index 95662bb3a5f..91231662169 100644 --- a/cmd/winfe/genfram2.cpp +++ b/cmd/winfe/genfram2.cpp @@ -365,10 +365,7 @@ void CGenericFrame::OnSysColorChange() // We'll need to do a reload to handle the current // colors internal to the document. -//#ifdef GOLD - // This fixes critical bug 27239 - // put in ifdef GOLD to minizize impact on non-gold version - TEMPORARY: - // TODO: MERGE THIS TO REMOVE IFDEF GOLD + if(GetMainContext()) { CWinCX *pContext = GetMainWinContext(); if( pContext && pContext->GetContext()){ @@ -379,15 +376,12 @@ void CGenericFrame::OnSysColorChange() } else #endif // EDITOR { - pContext->NiceReload(); + /* Must use NET_NORMAL_RELOAD else reload uses NET_RESIZE_RELOAD + and the window colors are not updated */ + pContext->NiceReload(NET_NORMAL_RELOAD); } } } -//#else -// if(GetMainContext()) { -// GetMainContext()->NiceReload(); -// } -//#endif // Hopfully they'll redraw us so that the frame takes // on the new colors. diff --git a/cmd/winfe/genframe.cpp b/cmd/winfe/genframe.cpp index e0bd4cf179e..b6ff831b455 100644 --- a/cmd/winfe/genframe.cpp +++ b/cmd/winfe/genframe.cpp @@ -2531,22 +2531,6 @@ void CGenericFrame::OnUpdateViewLocationToolbar(CCmdUI *pCmdUI) } } -static void -NiceReloadAllWindows() -{ - for(CGenericFrame *f = theApp.m_pFrameList; f; f= f->m_pNext){ - CWinCX *pContext = f->GetMainWinContext(); - if(pContext && pContext->GetContext()) { -#ifdef EDITOR - if( EDT_IS_EDITOR(pContext->GetContext())) - EDT_RefreshLayout(pContext->GetContext()); - else -#endif // EDITOR - pContext->NiceReload(); - } - } -} - void CGenericFrame::OnIncreaseFont() { CWinCX *pWinCX = GetActiveWinContext(); diff --git a/cmd/winfe/intlwin.cpp b/cmd/winfe/intlwin.cpp index a83553f4205..877839051d0 100755 --- a/cmd/winfe/intlwin.cpp +++ b/cmd/winfe/intlwin.cpp @@ -653,7 +653,7 @@ extern void INTL_Relayout(MWContext * pContext) // more immediate effect: Reload(NET_SUPER_RELOAD) // but that is not nice to the cache, or the user if working // offline, etc. -#ifdef EDITOR +#if 0 //#ifdef EDITOR if(EDT_IS_EDITOR(pContext)){ EDT_RefreshLayout(pContext); } else diff --git a/cmd/winfe/prefinfo.cpp b/cmd/winfe/prefinfo.cpp index 60d142aa194..06bce9e538c 100644 --- a/cmd/winfe/prefinfo.cpp +++ b/cmd/winfe/prefinfo.cpp @@ -25,6 +25,8 @@ #include "statbar.h" #endif //MOZ_OFFLINE +extern void wfe_ReloadAllWindows(); + int PR_CALLBACK prefWatcher(const char *pPrefName, void *pData) { BOOL bReload = FALSE; @@ -165,27 +167,6 @@ CPrefInfo::CPrefInfo() m_bAutoLoadImages = TRUE; } -void CPrefInfo::UpdateAllWindows() -{ - // Update layout in all current windows - for (CGenericFrame *f = theApp.m_pFrameList; f; f = f->m_pNext) { - CWinCX *pContext = f->GetMainWinContext(); - - if (pContext && pContext->GetContext()) { -#ifdef EDITOR - if (EDT_IS_EDITOR(pContext->GetContext())) { - // Edit can relayout page without having to do NET_GetURL - EDT_RefreshLayout(pContext->GetContext()); - - } else -#endif // EDITOR - { - pContext->NiceReload(); - } - } - } -} - void CPrefInfo::SysColorChange() { if (m_bUseWindowsColors) { @@ -207,7 +188,10 @@ void CPrefInfo::SysColorChange() } if (bReload) - UpdateAllWindows(); + { + g_bReloadChangeColor = TRUE; + wfe_ReloadAllWindows(); + } } } diff --git a/cmd/winfe/prefinfo.h b/cmd/winfe/prefinfo.h index 1416c4188b3..f2125211db1 100644 --- a/cmd/winfe/prefinfo.h +++ b/cmd/winfe/prefinfo.h @@ -39,16 +39,14 @@ public: public: COLORREF m_rgbBackgroundColor; COLORREF m_rgbForegroundColor; + COLORREF m_rgbAnchorColor; + COLORREF m_rgbVisitedColor; XP_Bool m_bUnderlineAnchors; private: - COLORREF m_rgbAnchorColor; - COLORREF m_rgbVisitedColor; XP_Bool m_bUseWindowsColors; XP_Bool m_bUseDocumentColors; - void UpdateAllWindows(); - friend int PR_CALLBACK prefWatcher(LPCSTR lpszPrefName, LPVOID lpvData); friend int PR_CALLBACK SetToolbarButtonStyle(const char *newPref, void *data); diff --git a/cmd/winfe/prefs.cpp b/cmd/winfe/prefs.cpp index 135be8d0ed2..1c71b006582 100644 --- a/cmd/winfe/prefs.cpp +++ b/cmd/winfe/prefs.cpp @@ -80,8 +80,10 @@ extern int MK_MSG_REMOVE_MAILHOST_CONFIRM; }; #include "nethelp.h" #include "ngdwtrst.h" +#include "prefinfo.h" //cmanske: for access to global prefInfo struct BOOL g_bReloadAllWindows; +BOOL g_bReloadChangeColor; #ifdef MOZ_MAIL_NEWS extern "C" void GetFolderServerNames @@ -2013,26 +2015,37 @@ CAdvancedPrefs::Release() return m_uRef; } - -static void -ReloadAllWindows() +void wfe_ReloadAllWindows() { - for (CGenericFrame *f = theApp.m_pFrameList; f; f = f->m_pNext) { + for (CGenericFrame *f = theApp.m_pFrameList; f; f = f->m_pNext) + { CWinCX *pContext = f->GetMainWinContext(); - - if (pContext && pContext->GetContext()) { + MWContext *pMWContext = pContext ? pContext->GetContext() : 0; + if( pMWContext ) + { #ifdef EDITOR - if (EDT_IS_EDITOR(pContext->GetContext())) { + if (EDT_IS_EDITOR(pMWContext)) + { // Edit can relayout page without having to do NET_GetURL - EDT_RefreshLayout(pContext->GetContext()); + EDT_RefreshLayout(pMWContext); } else #endif // EDITOR { - pContext->NiceReload(); + /* Must use NET_NORMAL_RELOAD when changing colors. + Default reload now uses NET_RESIZE_RELOAD + and the window colors are not updated. + Note: if we ever change layout to be able to determine which + elements are using the default color, we could use NET_RESIZE_RELOAD, + but we would have to set the changed colors here first. + */ + pContext->NiceReload(g_bReloadChangeColor ? + NET_NORMAL_RELOAD : NET_RESIZE_RELOAD); } } } + g_bReloadChangeColor = FALSE; + g_bReloadAllWindows = FALSE; } static BOOL @@ -2388,6 +2401,7 @@ wfe_DisplayPreferences(CGenericFrame *pFrame) // changes we'll get several callbacks (we don't have a way to do batch changes) // and we'll reload the windows multiple times which is very sloppy... g_bReloadAllWindows = FALSE; + g_bReloadChangeColor = FALSE; // Figure out what the initial category we display should be if (pFrame && pFrame->IsEditFrame()) { @@ -2420,11 +2434,11 @@ wfe_DisplayPreferences(CGenericFrame *pFrame) // See if we need to reload the windows if (g_bReloadAllWindows) { - ReloadAllWindows(); + wfe_ReloadAllWindows(); g_bReloadAllWindows = FALSE; } - // Save out the preferences + // Save out the preferences PREF_SavePrefFile(); } else { diff --git a/cmd/winfe/prefs.h b/cmd/winfe/prefs.h index 76a768f2190..e69de29bb2d 100644 --- a/cmd/winfe/prefs.h +++ b/cmd/winfe/prefs.h @@ -1,28 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * - * The contents of this file are subject to the Netscape Public License - * Version 1.0 (the "NPL"); you may not use this file except in - * compliance with the NPL. You may obtain a copy of the NPL at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the NPL is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL - * for the specific language governing rights and limitations under the - * NPL. - * - * The Initial Developer of this code under the NPL is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights - * Reserved. - */ - -#ifndef _PREFS_H -#define _PREFS_H - -extern BOOL g_bReloadAllWindows; - -void -wfe_DisplayPreferences(CGenericFrame *); - -#endif - diff --git a/cmd/winfe/res/editor.rc2 b/cmd/winfe/res/editor.rc2 index 851cb727762..208def102ea 100644 --- a/cmd/winfe/res/editor.rc2 +++ b/cmd/winfe/res/editor.rc2 @@ -353,8 +353,6 @@ BEGIN MENUITEM SEPARATOR MENUITEM "&Close\tCtrl+W", ID_FILE_CLOSE MENUITEM "E&xit\tCtrl+Q", ID_APP_EXIT - // Use this when we it is followed by most-recently-used-file list - //MENUITEM SEPARATOR END POPUP "&Edit" BEGIN @@ -624,6 +622,19 @@ BEGIN MENUITEM "C&ell After" ID_INSERT_TABLE_CELL END +IDM_COMPOSER_TABLE_PASTEMENU MENU DISCARDABLE +BEGIN + MENUITEM "Nested &Table..." ID_PASTE_TABLE_BASE + MENUITEM SEPARATOR + MENUITEM "Above current &Row" ID_PASTE_TABLE_BASE+1 + MENUITEM "&Below current Row" ID_PASTE_TABLE_BASE+2 + MENUITEM SEPARATOR + MENUITEM "Before current C&olumn" ID_PASTE_TABLE_BASE+3 + MENUITEM "After current Co&lumn" ID_PASTE_TABLE_BASE+4 + MENUITEM SEPARATOR + MENUITEM "&Replace cells" ID_PASTE_TABLE_BASE+5 +END + IDM_COMPOSER_TABLE_DELETEMENU MENU DISCARDABLE BEGIN diff --git a/cmd/winfe/resource.h b/cmd/winfe/resource.h index 39c5fd11a7a..aa73634870e 100755 --- a/cmd/winfe/resource.h +++ b/cmd/winfe/resource.h @@ -41,6 +41,7 @@ #define IDM_COMPOSER_TABLE_SELECTMENU 70 #define IDM_COMPOSER_TABLE_INSERTMENU 71 #define IDM_COMPOSER_TABLE_DELETEMENU 72 +#define IDM_COMPOSER_TABLE_PASTEMENU 73 #define VK_APPS 0x5D #define IDD_ABOUTBOX 100 #define HOTLIST1_DIALOG 101 @@ -1619,7 +1620,6 @@ #define IDC_COPY_STYLE 1580 #define IDC_TABLE_COPY 1581 #define IDC_TABLE_MOVE 1582 -#define IDS_MERGE_NEXT_CELL 1583 #define IDD_NETPROFILE_LOGIN 1599 #define IDC_CONFIRM1 1600 #define IDC_CONFIRM2 1601 @@ -2016,8 +2016,7 @@ #define IDD_NETINST_MULTIINST_WARN 2305 #define IDD_UNAME_EMAIL_NO_WIZARD 2306 #define IDC_PROFILENAME_TEXT 2400 -#define IDC_PASTE_TEXT 2401 -#define IDC_PASTE_IMAGE 2402 +#define IDC_PASTE_FORMAT_LIST 2401 #define IDC_HEADER_HELP 2500 #define IDC_OFFLINE_SELECT_HELP 2655 #define IDC_TEMP_OUTLINER_BOX 2656 @@ -2860,7 +2859,6 @@ #define IDC_HEIGHT_PIXELS 42335 #define IDC_HEIGHT_PERCENT 42336 #define IDC_TABLE_CELL_ALIGN 42339 -#define IDS_PERCENT_PARENT_CELL 42339 #define IDC_TABLE_CELL_VALIGN 42340 #define ID_POPUP_DELETE_TABLE 42340 #define ID_POPUP_INSERT_TABLE 42341 @@ -2870,17 +2868,20 @@ #define IDS_PROPS_TABLE_CAPTION 42345 #define IDS_POPUP_TABLE_PROPS 42346 #define IDS_POPUP_TABLE_CELL_PROPS 42347 -#define IDS_SUBMENU_SELECT_TABLE 42348 -#define IDS_SUBMENU_INSERT_TABLE 42349 -#define IDS_SUBMENU_DELETE_TABLE 42350 -#define IDS_CHANGE_SELECTED_CELL 42351 -#define IDS_CHANGE_SELECTED_ROW 42352 -#define IDS_CHANGE_SELECTED_COL 42353 -#define IDS_ROW 42355 -#define IDS_COLUMN 42356 -#define IDS_CELL 42357 -#define IDS_TABLE 42358 -#define IDS_PERCENT_TABLE 42359 +#define IDS_MERGE_NEXT_CELL 42348 +#define IDS_SUBMENU_SELECT_TABLE 42349 +#define IDS_SUBMENU_INSERT_TABLE 42350 +#define IDS_SUBMENU_DELETE_TABLE 42351 +#define IDS_SUBMENU_PASTE_TABLE 42352 +#define IDS_REPLACE_SELECTED_CELLS 42353 +#define IDS_CHANGE_SELECTED_CELL 42355 +#define IDS_CHANGE_SELECTED_ROW 42356 +#define IDS_CHANGE_SELECTED_COL 42357 +#define IDS_ROW 42358 +#define IDS_COLUMN 42359 +#define IDS_CELL 42360 +#define IDS_PERCENT_TABLE 42361 +#define IDS_PERCENT_PARENT_CELL 42362 #define IDS_SMALL_ROMAN 42363 #define ID_NAVIGATE_CONTINUE 42365 #define ID_DISPLAY_TABLES 42366