Added dialog for changing encoding in Composer

This commit is contained in:
cmanske%netscape.com 1998-09-03 21:33:18 +00:00
parent b482dcf265
commit 512f9fa4f6
8 changed files with 185 additions and 34 deletions

View File

@ -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();
}

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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);
}
}
}

View File

@ -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