diff --git a/cmd/winfe/eddialog.cpp b/cmd/winfe/eddialog.cpp index 60c9eac6d9f4..fdad70a88c41 100644 --- a/cmd/winfe/eddialog.cpp +++ b/cmd/winfe/eddialog.cpp @@ -35,6 +35,13 @@ #undef THIS_FILE static char BASED_CODE THIS_FILE[] = __FILE__; #endif +// For XP Strings +extern "C" { +#include "xpgetstr.h" +#define WANT_ENUM_STRING_IDS +#include "allxpstr.h" +#undef WANT_ENUM_STRING_IDS +} extern char *EDT_NEW_DOC_NAME; @@ -1462,8 +1469,106 @@ void CGetColumnsDlg::DoDataExchange(CDataExchange* pDX) //}}AFX_DATA_MAP } -ED_CharsetEncode FE_EncodingDialog(MWContext* pMWContext) +// Global XP interface to the encoding/charset dialog +// Replaces previous FE_Confirm dialog to give option +// of NOT converting characters, but just changing the "charset" +// value in the Content-Type metatag +// (easier for user than using MetaTag editing property page (CDocMetaPage) in edprops.cpp) +ED_CharsetEncode FE_EncodingDialog(MWContext* pMWContext, char *pCharSet) { - // TODO: Implement this! - return ED_ENCODE_CANCEL; + ED_CharsetEncode result = ED_ENCODE_CANCEL; + CNetscapeEditView* pView = (CNetscapeEditView*)WINCX(pMWContext)->GetView(); + if( pView ) + { + CEncodeDlg dlg(GET_DLG_PARENT(pView), pCharSet); + + if( dlg.DoModal() == IDOK ) + { + // Radio button value determines the result + result = dlg.m_iEncode == 0 ? ED_ENCODE_CHANGE_CHARSET :ED_ENCODE_CHANGE_METATAG; + } + } + return result; } + +///////////////////////////////////////////////////////////////////////////// +// CEncodeDlg dialog + + +CEncodeDlg::CEncodeDlg(CWnd* pParent, + char *pCharSet ) + : CDialog(CEncodeDlg::IDD, pParent), + m_pCharSet(pCharSet) +{ + //{{AFX_DATA_INIT(CEncodeDlg) + m_iEncode = 0; + //}}AFX_DATA_INIT +} + + +void CEncodeDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CEncodeDlg) + DDX_Radio(pDX, IDC_CONVERT_CHARSET, m_iEncode); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CEncodeDlg, CDialog) + //{{AFX_MSG_MAP(CEncodeDlg) + ON_BN_CLICKED(ID_HELP, OnHelp) + //}}AFX_MSG_MAP +#ifdef XP_WIN32 + ON_WM_HELPINFO() +#endif //XP_WIN32 +END_MESSAGE_MAP() + +BOOL CEncodeDlg::OnInitDialog() +{ + m_ResourceSwitcher.Reset(); + // Set the text for the radio buttons + CString csTemp; + csTemp.Format(szLoadString(IDS_CONVERT_CHARSET), m_pCharSet); + GetDlgItem(IDC_CONVERT_CHARSET)->SetWindowText(csTemp); + + csTemp.Format(szLoadString(IDS_CHANGE_METATAG), m_pCharSet); + GetDlgItem(IDC_CHANGE_METATAG)->SetWindowText(csTemp); + + // Extra descriptive text under each radio button - use XP strings + GetDlgItem(IDC_CONVERT_CHARSET_EXTRA)->SetWindowText(XP_GetString(XP_EDT_CHARSET_CONVERT_PAGE)); + GetDlgItem(IDC_CHANGE_METATAG_EXTRA)->SetWindowText(XP_GetString(XP_EDT_CHARSET_SET_METATAG)); + + UpdateData(FALSE); + + CDialog::OnInitDialog(); + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void CEncodeDlg::OnHelp() +{ + // TODO: NEED NEW HELP ID FOR THIS DIALOG + //NetHelp(HELP_CHANGE_CHARSET); +} + + + +#ifdef XP_WIN32 +BOOL CEncodeDlg::OnHelpInfo(HELPINFO *)//32bit messagemapping. +{ + OnHelp(); + return TRUE; +} +#endif//XP_WIN32 + + + +void CEncodeDlg::OnOK() +{ + if( !UpdateData(TRUE) ) + return; + + CDialog::OnOK(); +} + diff --git a/cmd/winfe/eddialog.h b/cmd/winfe/eddialog.h index 0b57f77e74b7..1fbc1663bf55 100644 --- a/cmd/winfe/eddialog.h +++ b/cmd/winfe/eddialog.h @@ -524,4 +524,45 @@ protected: }; +///////////////////////////////////////////////////////////////////////////// +// CEncodeDlg dialog + +class CEncodeDlg : public CDialog +{ +// Construction +public: + CEncodeDlg(CWnd* pParent, char *pCharSet ); +// Dialog Data + //{{AFX_DATA(CEncodeDlg) + enum { IDD = IDD_CHANGE_ENCODING }; + int m_iEncode; + //}}AFX_DATA + +private: + // This will change resource hInstance to Editor dll (in constructor) + CEditorResourceSwitcher m_ResourceSwitcher; + char *m_pCharSet; + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CEncodeDlg) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CEncodeDlg) + virtual BOOL OnInitDialog(); + virtual void OnOK(); + afx_msg void OnHelp(); + //}}AFX_MSG +#ifdef XP_WIN32 + afx_msg BOOL OnHelpInfo(HELPINFO *); +#endif + DECLARE_MESSAGE_MAP() +}; + #endif // EDDIALOG_H diff --git a/cmd/winfe/edframe.cpp b/cmd/winfe/edframe.cpp index 35c2fbd524e0..4942c35e5a8f 100644 --- a/cmd/winfe/edframe.cpp +++ b/cmd/winfe/edframe.cpp @@ -1836,9 +1836,9 @@ void CGenericFrame::LoadUrlEditor(char * pUrl, // Call Editor Plugin to possibly replace the supplied URL // or do source file locking - //EDT_PreOpen(GetMainContext()->GetContext(), (char*)(LPCSTR(csURL)), &FinishLoadUrlEditor, pData); + EDT_PreOpen(GetMainContext()->GetContext(), (char*)(LPCSTR(csURL)), &FinishLoadUrlEditor, pData); //TODO: REMOVE THIS - TEMP - SKIP PLUGIN TO AVOID NSPR20 PROBLEMS???? - FinishLoadUrlEditor(FALSE, (char*)(LPCSTR(csURL)), pData); + //FinishLoadUrlEditor(FALSE, (char*)(LPCSTR(csURL)), pData); } else { // No URL address given - Don't go through plugin FinishLoadUrlEditor(FALSE, NULL, pData); diff --git a/cmd/winfe/editor.rc b/cmd/winfe/editor.rc index 1dace13f93cd..c45da2fa613a 100644 --- a/cmd/winfe/editor.rc +++ b/cmd/winfe/editor.rc @@ -323,6 +323,8 @@ IDC_ARROW_RIGHT CURSOR DISCARDABLE "res\\arrow_rt.cur" STRINGTABLE PRELOAD DISCARDABLE BEGIN ID_MERGE_TABLE_CELLS "Join the boundaries and contents of cells into one larger cell" + IDS_CONVERT_CHARSET "&Convert the current page to '%s'" + IDS_CHANGE_METATAG "C&hange the character set label to '%s'" END STRINGTABLE PRELOAD DISCARDABLE diff --git a/cmd/winfe/edtrcdll/src/edtrcdll.rc b/cmd/winfe/edtrcdll/src/edtrcdll.rc index 288cefd1024f..6e26fe4584fc 100644 --- a/cmd/winfe/edtrcdll/src/edtrcdll.rc +++ b/cmd/winfe/edtrcdll/src/edtrcdll.rc @@ -797,29 +797,22 @@ BEGIN LTEXT "&Words:",IDC_STATIC,7,39,24,8 END -IDD_TABLE_INSERT DIALOG DISCARDABLE 0, 0, 156, 154 +IDD_CHANGE_ENCODING DIALOG DISCARDABLE 0, 0, 288, 127 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Insert into Table" +CAPTION "Change Character Set" FONT 8, "MS Sans Serif" BEGIN - LTEXT "Number to insert:",IDC_STATIC,7,10,57,8 - EDITTEXT IDC_INSERT_COUNT,69,7,26,14,ES_AUTOHSCROLL - GROUPBOX "Type ",IDC_STATIC,7,22,142,79,WS_GROUP - CONTROL "&Columns",IDC_COLUMNS,"Button",BS_AUTORADIOBUTTON | - WS_GROUP | WS_TABSTOP,35,31,68,10 - CONTROL "&Rows",IDC_ROWS,"Button",BS_AUTORADIOBUTTON,35,43,68,10 - CONTROL "Cells (shift others right)",IDC_CELLS_SHIFT_LEFT, - "Button",BS_AUTORADIOBUTTON,35,55,100,10 - CONTROL "Cells (shift others down)",IDC_CELLS_SHIFT_LEFT2, - "Button",BS_AUTORADIOBUTTON,35,69,104,10 - CONTROL "Insert extra cells at end",IDC_TABLE_PAD,"Button", - BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,47,81,95,10 - CONTROL "{Above/Before}",IDC_BEFORE,"Button",BS_AUTORADIOBUTTON | - WS_GROUP | WS_TABSTOP,35,105,104,10 - CONTROL "{Below/After}",IDC_AFTER,"Button",BS_AUTORADIOBUTTON,35, - 117,103,10 - DEFPUSHBUTTON "OK",IDOK,21,133,50,14,WS_GROUP - PUSHBUTTON "Cancel",IDCANCEL,84,133,50,14 + CONTROL "{&C IDS_CONVERT_CHARSET}",IDC_CONVERT_CHARSET,"Button", + BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,19,12,262,10 + CONTROL "{&h IDS_CHANGE_METATAG}",IDC_CHANGE_METATAG,"Button", + BS_AUTORADIOBUTTON,19,60,262,10 + LTEXT "{XP_EDT_CHARSET_CONVERT_PAGE}", + IDC_CONVERT_CHARSET_EXTRA,32,23,249,27 + LTEXT "{XP_EDT_CHARSET_SET_METATAG}",IDC_CHANGE_METATAG_EXTRA, + 32,71,249,27 + DEFPUSHBUTTON "OK",IDOK,55,106,50,14,WS_GROUP + PUSHBUTTON "Cancel",IDCANCEL,119,106,50,14 + PUSHBUTTON "&Help",ID_HELP,183,106,50,14 END IDD_GET_TABLE_COLUMNS DIALOG DISCARDABLE 0, 0, 153, 73 @@ -988,12 +981,11 @@ BEGIN BOTTOMMARGIN, 200 END - IDD_TABLE_INSERT, DIALOG + IDD_CHANGE_ENCODING, DIALOG BEGIN LEFTMARGIN, 7 - RIGHTMARGIN, 149 - TOPMARGIN, 7 - BOTTOMMARGIN, 147 + RIGHTMARGIN, 281 + BOTTOMMARGIN, 120 END IDD_GET_TABLE_COLUMNS, DIALOG diff --git a/cmd/winfe/edtrcdll/src/resource.h b/cmd/winfe/edtrcdll/src/resource.h index 0c42923d0cd4..5df26d37fa2a 100644 --- a/cmd/winfe/edtrcdll/src/resource.h +++ b/cmd/winfe/edtrcdll/src/resource.h @@ -25,7 +25,6 @@ #define IDD_FECONVERTIMAGE 103 #define IDD_LOCATION_DLG 104 #define IDD_PAGE_TITLE 105 -#define IDD_TABLE_INSERT 136 #define IDC_FONTFACE_COMBO 213 #define IDC_AUTO_SAVE_MINUTES 214 #define IDC_PUBLISH_USER_NAME 217 @@ -48,6 +47,7 @@ #define IDC_HR_SAVE_DEFAULT 630 #define IDC_AUTO_SAVE 630 #define ID_LIST_FONTCOLOR 640 +#define IDD_CHANGE_ENCODING 670 #define IDC_ROWS 1000 #define IDC_ERROR_WORD 1000 #define IDC_CONVERTLIST 1000 @@ -102,6 +102,10 @@ #define IDC_CHANGE_SEL_CAPTION 1068 #define IDC_INSERT_COUNT 1076 #define IDC_TABLE_PAD 1077 +#define IDC_CONVERT_CHARSET 1081 +#define IDC_CHANGE_METATAG 1082 +#define IDC_CONVERT_CHARSET_EXTRA 1083 +#define IDC_CHANGE_METATAG_EXTRA 1084 #define IDC_DEFAULT_COLOR 1100 #define IDC_COLOR_1 1101 #define IDC_COLOR_2 1102 @@ -178,8 +182,8 @@ #define IDC_TABLE_COLUMNS 2007 #define IDD_PREF_EDITOR 2008 #define IDD_HINT_DLG 2022 -#define IDC_HREF_FILE 2023 #define IDD_GET_TABLE_COLUMNS 2023 +#define IDC_HREF_FILE 2023 #define IDD_PROPS_HRULE 2024 #define IDC_ANCHOR_EDIT 2026 #define IDC_HREF_UNLINK 2036 @@ -420,14 +424,16 @@ #define IDS_PASTE_TEXT_PLAIN 59462 #define IDS_PASTE_TEXT_NEW_TABLE 59463 #define IDS_PASTE_TEXT_REPLACE_CELLS 59464 +#define IDS_CONVERT_CHARSET 62111 +#define IDS_CHANGE_METATAG 62112 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 137 +#define _APS_NEXT_RESOURCE_VALUE 138 #define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 1081 +#define _APS_NEXT_CONTROL_VALUE 1085 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/cmd/winfe/mainfrm.cpp b/cmd/winfe/mainfrm.cpp index ee8aa1f77683..225482f8d4c4 100644 --- a/cmd/winfe/mainfrm.cpp +++ b/cmd/winfe/mainfrm.cpp @@ -329,7 +329,9 @@ void CMainFrame::RefreshNewEncoding(int16 csid, BOOL bIgnore) else #endif /* EDITOR */ { - GetMainContext()->NiceReload(); + // Must use NET_NORMAL_RELOAD else reload uses NET_RESIZE_RELOAD + // and the text is not updated + GetMainContext()->NiceReload(NET_NORMAL_RELOAD); } } } diff --git a/cmd/winfe/resource.h b/cmd/winfe/resource.h index 41236a11a293..2645fcda7132 100755 --- a/cmd/winfe/resource.h +++ b/cmd/winfe/resource.h @@ -726,6 +726,7 @@ #define IDC_TIMELEFT 661 #define IDC_CHECK4 662 #define IDC_CHECK4_BY_DATE 662 +#define IDD_CHANGE_ENCODING 670 #define IDB_TREEITEM 700 #define IDB_TREEFOLDERCLOSED 701 #define IDB_TREEFOLDEROPEN 702 @@ -3478,6 +3479,8 @@ #define IDS_OLE_CANTUSE_VIEWER 62095 #define IDS_OLE_CANTUSE_HANDLER 62096 #define IDS_OLE_CANTUSE_VIEWER2 62110 +#define IDS_CONVERT_CHARSET 62111 +#define IDS_CHANGE_METATAG 62112 #define IDS_LANGUAGE_THAI 62120 #define IDS_LANGUAGE_VIETNAMESE_VIQR 62121 #define IDS_LANGUAGE_VIETNAMESE_VISCII 62122