Make mfcembed build in unicode when BUILD_UNICODE_MFCEMBED is defined. b=154426 r=yokoyama@netscape.com sr=blizzard@mozilla.org

This commit is contained in:
locka%iol.ie 2003-03-06 23:15:55 +00:00
Родитель 20117a7edc
Коммит 62d2069df4
22 изменённых файлов: 359 добавлений и 227 удалений

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

@ -64,13 +64,8 @@
void CBrowserFrame::BrowserFrameGlueObj::UpdateStatusBarText(const PRUnichar *aMessage)
{
METHOD_PROLOGUE(CBrowserFrame, BrowserFrameGlueObj)
nsCString strStatus;
if(aMessage)
strStatus.AssignWithConversion(aMessage);
pThis->m_wndStatusBar.SetPaneText(0, strStatus.get());
USES_CONVERSION;
pThis->m_wndStatusBar.SetPaneText(0, aMessage ? W2CT(aMessage) : _T(""));
}
void CBrowserFrame::BrowserFrameGlueObj::UpdateProgress(PRInt32 aCurrent, PRInt32 aMax)
@ -103,10 +98,10 @@ void CBrowserFrame::BrowserFrameGlueObj::UpdateCurrentURI(nsIURI *aLocation)
if(aLocation)
{
USES_CONVERSION;
nsCAutoString uriString;
aLocation->GetSpec(uriString);
pThis->m_wndUrlBar.SetCurrentURL(uriString.get());
pThis->m_wndUrlBar.SetCurrentURL(A2CT(uriString.get()));
}
}
@ -119,9 +114,9 @@ void CBrowserFrame::BrowserFrameGlueObj::GetBrowserFrameTitle(PRUnichar **aTitle
if(!title.IsEmpty())
{
USES_CONVERSION;
nsString nsTitle;
nsTitle.AssignWithConversion(title.GetBuffer(0));
nsTitle.Assign(T2CW(title.GetBuffer(0)));
*aTitle = ToNewUnicode(nsTitle);
}
}
@ -130,21 +125,20 @@ void CBrowserFrame::BrowserFrameGlueObj::SetBrowserFrameTitle(const PRUnichar *a
{
METHOD_PROLOGUE(CBrowserFrame, BrowserFrameGlueObj)
USES_CONVERSION;
if(W2T(aTitle))
CString title;
if (aTitle)
{
pThis->SetWindowText(W2T(aTitle));
USES_CONVERSION;
title = W2CT(aTitle);
}
else
{
// Use the AppName i.e. mfcembed as the title if we
// do not get one from GetBrowserWindowTitle()
//
CString cs;
cs.LoadString(AFX_IDS_APP_TITLE);
pThis->SetWindowText(cs);
title.LoadString(AFX_IDS_APP_TITLE);
}
pThis->SetWindowText(title);
}
void CBrowserFrame::BrowserFrameGlueObj::SetBrowserFrameSize(PRInt32 aCX, PRInt32 aCY)

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

@ -195,7 +195,7 @@ int CBrowserFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
m_wndReBar.AddBar(&m_wndToolBar);
if (!mIsEditor)
m_wndReBar.AddBar(&m_wndUrlBar, "Enter URL:");
m_wndReBar.AddBar(&m_wndUrlBar, _T("Enter URL:"));
// Create the status bar with two panes - one pane for actual status
// text msgs. and the other for the progress control

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

@ -59,18 +59,20 @@ public:
SetWindowText(pUrl);
}
inline void AddURLToList(CString& url, bool bAddToMRUList = true) {
USES_CONVERSION;
COMBOBOXEXITEM ci;
ci.mask = CBEIF_TEXT; ci.iItem = -1;
ci.pszText = (LPTSTR)(LPCTSTR)url;
ci.pszText = const_cast<TCHAR *>((LPCTSTR)url);
InsertItem(&ci);
if(bAddToMRUList)
m_MRUList.AddURL((LPTSTR)(LPCTSTR)url);
m_MRUList.AddURL(T2CA(url));
}
inline void LoadMRUList() {
for (int i=0;i<m_MRUList.GetNumURLs();i++)
{
CString urlStr(_T(m_MRUList.GetURL(i)));
USES_CONVERSION;
CString urlStr(A2CT(m_MRUList.GetURL(i)));
AddURLToList(urlStr, false);
}
}

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

@ -328,7 +328,7 @@ void CBrowserView::OnNewUrlEnteredInUrlBar()
OpenViewSourceWindow(strUrl.GetBuffer(0));
else
// Navigate to that URL
OpenURL(strUrl.GetBuffer(0));
OpenURL(strUrl.GetBuffer(0));
// Add what was just entered into the UrlBar
mpBrowserFrame->m_wndUrlBar.AddURLToList(strUrl);
@ -350,10 +350,15 @@ void CBrowserView::OnUrlSelectedInUrlBar()
BOOL CBrowserView::IsViewSourceUrl(CString& strUrl)
{
return (strUrl.Find("view-source:", 0) != -1) ? TRUE : FALSE;
return (strUrl.Find(_T("view-source:"), 0) != -1) ? TRUE : FALSE;
}
BOOL CBrowserView::OpenViewSourceWindow(const char* pUrl)
{
return OpenViewSourceWindow(NS_ConvertASCIItoUCS2(pUrl).get());
}
BOOL CBrowserView::OpenViewSourceWindow(const PRUnichar* pUrl)
{
// Create a new browser frame in which we'll show the document source
// Note that we're getting rid of the toolbars etc. by specifying
@ -392,16 +397,15 @@ void CBrowserView::OnViewSource()
return;
// Build the view-source: url
nsCAutoString viewSrcUrl;
viewSrcUrl.Append("view-source:");
viewSrcUrl.Append(uriString);
nsAutoString viewSrcUrl(L"view-source:");
viewSrcUrl.AppendWithConversion(uriString.get());
OpenViewSourceWindow(viewSrcUrl.get());
}
void CBrowserView::OnViewInfo()
{
AfxMessageBox("To Be Done...");
AfxMessageBox(_T("To Be Done..."));
}
void CBrowserView::OnNavBack()
@ -604,9 +608,9 @@ void CBrowserView::OnSelectNone()
void CBrowserView::OnFileOpen()
{
char *lpszFilter =
"HTML Files Only (*.htm;*.html)|*.htm;*.html|"
"All Files (*.*)|*.*||";
TCHAR *lpszFilter =
_T("HTML Files Only (*.htm;*.html)|*.htm;*.html|")
_T("All Files (*.*)|*.*||");
CFileDialog cf(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
lpszFilter, this);
@ -617,43 +621,45 @@ void CBrowserView::OnFileOpen()
}
}
void CBrowserView::GetBrowserWindowTitle(nsCString& title)
void CBrowserView::GetBrowserWindowTitle(nsAString& title)
{
nsXPIDLString idlStrTitle;
if(mBaseWindow)
mBaseWindow->GetTitle(getter_Copies(idlStrTitle));
title.AssignWithConversion(idlStrTitle);
// Sanitize the title of all illegal characters
title.CompressWhitespace(); // Remove whitespace from the ends
title.StripChars("\\*|:\"><?"); // Strip illegal characters
title.ReplaceChar('.', L'_'); // Dots become underscores
title.ReplaceChar('/', L'-'); // Forward slashes become hyphens
title = idlStrTitle;
}
void CBrowserView::OnFileSaveAs()
{
nsCString fileName;
nsAutoString fileName;
GetBrowserWindowTitle(fileName); // Suggest the window title as the filename
char *lpszFilter =
"Web Page, HTML Only (*.htm;*.html)|*.htm;*.html|"
"Web Page, Complete (*.htm;*.html)|*.htm;*.html|"
"Text File (*.txt)|*.txt||";
// Sanitize the file name of all illegal characters
CFileDialog cf(FALSE, "htm", fileName.get(), OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
USES_CONVERSION;
fileName.CompressWhitespace(); // Remove whitespace from the ends
fileName.StripChars("\\*|:\"><?"); // Strip illegal characters
fileName.ReplaceChar('.', L'_'); // Dots become underscores
fileName.ReplaceChar('/', L'-'); // Forward slashes become hyphens
TCHAR *lpszFilter =
_T("Web Page, HTML Only (*.htm;*.html)|*.htm;*.html|")
_T("Web Page, Complete (*.htm;*.html)|*.htm;*.html|")
_T("Text File (*.txt)|*.txt||");
CFileDialog cf(FALSE, _T("htm"), W2CT(fileName.get()), OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
lpszFilter, this);
if(cf.DoModal() == IDOK)
{
CString strFullPath = cf.GetPathName(); // Will be like: c:\tmp\junk.htm
char *pStrFullPath = strFullPath.GetBuffer(0); // Get char * for later use
TCHAR *pStrFullPath = strFullPath.GetBuffer(0); // Get char * for later use
BOOL bSaveAll = FALSE;
CString strDataPath;
char *pStrDataPath = NULL;
TCHAR *pStrDataPath = NULL;
if(cf.m_ofn.nFilterIndex == 2)
{
// cf.m_ofn.nFilterIndex == 2 indicates
@ -679,17 +685,19 @@ void CBrowserView::OnFileSaveAs()
nsCOMPtr<nsIWebBrowserPersist> persist(do_QueryInterface(mWebBrowser));
if(persist)
{
nsCAutoString fullPath(T2CA(pStrFullPath));
nsCOMPtr<nsILocalFile> file;
NS_NewNativeLocalFile(nsDependentCString(T2A(pStrFullPath)), TRUE, getter_AddRefs(file));
NS_NewNativeLocalFile(fullPath, TRUE, getter_AddRefs(file));
nsCOMPtr<nsILocalFile> dataPath;
nsCOMPtr<nsILocalFile> data;
if (pStrDataPath)
{
NS_NewNativeLocalFile(nsDependentCString(pStrDataPath), TRUE, getter_AddRefs(dataPath));
nsCAutoString dataPath(T2CA(pStrDataPath));
NS_NewNativeLocalFile(dataPath, TRUE, getter_AddRefs(data));
}
if(bSaveAll)
persist->SaveDocument(nsnull, file, dataPath, nsnull, 0, 0);
persist->SaveDocument(nsnull, file, data, nsnull, 0, 0);
else
persist->SaveURI(nsnull, nsnull, nsnull, nsnull, nsnull, file);
}
@ -814,24 +822,24 @@ void CBrowserView::OnSaveLinkAs()
// Now, use this file name in a File Save As dlg...
char *lpszFilter =
"HTML Files (*.htm;*.html)|*.htm;*.html|"
"Text Files (*.txt)|*.txt|"
"All Files (*.*)|*.*||";
TCHAR *lpszFilter =
_T("HTML Files (*.htm;*.html)|*.htm;*.html|")
_T("Text Files (*.txt)|*.txt|")
_T("All Files (*.*)|*.*||");
const char *pFileName = fileName.Length() ? fileName.get() : NULL;
CString strFilename = fileName.get();
CFileDialog cf(FALSE, "htm", pFileName, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
CFileDialog cf(FALSE, _T("htm"), strFilename, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
lpszFilter, this);
if(cf.DoModal() == IDOK)
{
CString strFullPath = cf.GetPathName();
USES_CONVERSION;
nsCAutoString fullPath; fullPath.Assign(T2CA(cf.GetPathName()));
nsCOMPtr<nsIWebBrowserPersist> persist(do_QueryInterface(mWebBrowser));
if(persist)
{
nsCOMPtr<nsILocalFile> file;
NS_NewNativeLocalFile(nsDependentCString(strFullPath.GetBuffer(0)), TRUE, getter_AddRefs(file));
NS_NewNativeLocalFile(fullPath, TRUE, getter_AddRefs(file));
persist->SaveURI(linkURI, nsnull, nsnull, nsnull, nsnull, file);
}
}
@ -864,20 +872,21 @@ void CBrowserView::OnSaveImageAs()
// Now, use this file name in a File Save As dlg...
char *lpszFilter = "All Files (*.*)|*.*||";
const char *pFileName = fileName.Length() ? fileName.get() : NULL;
TCHAR *lpszFilter = _T("All Files (*.*)|*.*||");
CString strFilename = fileName.get();
CFileDialog cf(FALSE, NULL, pFileName, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
CFileDialog cf(FALSE, NULL, strFilename, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
lpszFilter, this);
if(cf.DoModal() == IDOK)
{
CString strFullPath = cf.GetPathName();
USES_CONVERSION;
nsCAutoString fullPath; fullPath.Assign(T2CA(cf.GetPathName()));
nsCOMPtr<nsIWebBrowserPersist> persist(do_QueryInterface(mWebBrowser));
if(persist)
{
nsCOMPtr<nsILocalFile> file;
NS_NewNativeLocalFile(nsDependentCString(strFullPath.GetBuffer(0)), TRUE, getter_AddRefs(file));
NS_NewNativeLocalFile(fullPath, TRUE, getter_AddRefs(file));
persist->SaveURI(linkURI, nsnull, nsnull, nsnull, nsnull, file);
}
}
@ -1142,11 +1151,11 @@ void CBrowserView::ShowSecurityInfo()
if(m_SecurityState == SECURITY_STATE_INSECURE) {
CString csMsg;
csMsg.LoadString(IDS_NOSECURITY_INFO);
::MessageBox(hParent, csMsg, "MfcEmbed", MB_OK);
::MessageBox(hParent, csMsg, _T("MfcEmbed"), MB_OK);
return;
}
::MessageBox(hParent, "To Be Done..........", "MfcEmbed", MB_OK);
::MessageBox(hParent, _T("To Be Done.........."), _T("MfcEmbed"), MB_OK);
}
// Determintes if the currently loaded document
@ -1181,13 +1190,11 @@ BOOL CBrowserView::ViewContentContainsFrames()
void CBrowserView::OnViewFrameSource()
{
USES_CONVERSION;
// Build the view-source: url
//
nsCAutoString viewSrcUrl;
viewSrcUrl.Append("view-source:");
viewSrcUrl.Append(W2T(mCtxMenuCurrentFrameURL.get()));
nsAutoString viewSrcUrl;
viewSrcUrl.Append(L"view-source:");
viewSrcUrl.Append(mCtxMenuCurrentFrameURL);
OpenViewSourceWindow(viewSrcUrl.get());
}

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

@ -70,7 +70,7 @@ public:
void OpenURLInNewWindow(const PRUnichar* pUrl);
void LoadHomePage();
void GetBrowserWindowTitle(nsCString& title);
void GetBrowserWindowTitle(nsAString& title);
// Called by the CBrowserFrame after it creates the view
// Essentially a back pointer to the BrowserFrame
@ -108,7 +108,7 @@ public:
inline void ClearFindDialog() { m_pFindDlg = NULL; }
CFindDialog* m_pFindDlg;
CPrintProgressDialog* m_pPrintProgressDlg;
CPrintProgressDialog* m_pPrintProgressDlg;
// When set to TRUE...
// indicates that the clipboard operation needs to be
// performed on the UrlBar rather than on
@ -121,6 +121,7 @@ public:
void Activate(UINT nState, CWnd* pWndOther, BOOL bMinimized);
BOOL OpenViewSourceWindow(const PRUnichar* pUrl);
BOOL OpenViewSourceWindow(const char* pUrl);
BOOL IsViewSourceUrl(CString& strUrl);

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

@ -15,7 +15,7 @@ const int kMinScaleRange = 30;
/////////////////////////////////////////////////////////////////////////////
typedef struct {
char* mDesc;
TCHAR* mDesc;
short mUnit;
double mWidth;
double mHeight;
@ -23,10 +23,10 @@ typedef struct {
} PaperSizes;
static const PaperSizes gPaperSize[] = {
{"Letter (8.5 x 11.0)", nsIPrintSettings::kPaperSizeInches, 8.5, 11.0, FALSE},
{"Legal (8.5 x 14.0)", nsIPrintSettings::kPaperSizeInches, 8.5, 14.0, FALSE},
{"A4 (210 x 297mm)", nsIPrintSettings::kPaperSizeMillimeters, 210.0, 297.0, FALSE},
{"User Defined", nsIPrintSettings::kPaperSizeInches, 8.5, 11.0, TRUE}
{_T("Letter (8.5 x 11.0)"), nsIPrintSettings::kPaperSizeInches, 8.5, 11.0, FALSE},
{_T("Legal (8.5 x 14.0)"), nsIPrintSettings::kPaperSizeInches, 8.5, 14.0, FALSE},
{_T("A4 (210 x 297mm)"), nsIPrintSettings::kPaperSizeMillimeters, 210.0, 297.0, FALSE},
{_T("User Defined"), nsIPrintSettings::kPaperSizeInches, 8.5, 11.0, TRUE}
};
static const int gNumPaperSizes = 4;
@ -130,14 +130,14 @@ BOOL CFormatOptionTab::OnInitDialog()
CString hStr;
if (unit == nsIPrintSettings::kPaperSizeInches)
{
wStr.Format("%6.2f", paperWidth);
hStr.Format("%6.2f", paperHeight);
wStr.Format(_T("%6.2f"), paperWidth);
hStr.Format(_T("%6.2f"), paperHeight);
CheckRadioButton(IDC_INCHES_RD, IDC_MILLI_RD, IDC_INCHES_RD);
}
else
{
wStr.Format("%d", int(paperWidth));
hStr.Format("%d", int(paperHeight));
wStr.Format(_T("%d"), int(paperWidth));
hStr.Format(_T("%d"), int(paperHeight));
CheckRadioButton(IDC_INCHES_RD, IDC_MILLI_RD, IDC_MILLI_RD);
}
CWnd* widthTxt = GetDlgItem(IDC_UD_PAPER_WDTH);
@ -162,17 +162,17 @@ void CFormatOptionTab::OnCustomdrawScale(NMHDR* pNMHDR, LRESULT* pResult)
if (scale != NULL && scaleTxt != NULL)
{
CString str;
str.Format("%d", scale->GetPos());
str.Format(_T("%d"), scale->GetPos());
scaleTxt->SetWindowText(str);
}
*pResult = 0;
}
static int GetIntFromStr(const char* aStr, int aMinVal = kMinScaleRange, int aMaxVal = 100)
static int GetIntFromStr(const TCHAR * aStr, int aMinVal = kMinScaleRange, int aMaxVal = 100)
{
int val = aMinVal;
sscanf(aStr, "%d", &val);
_stscanf(aStr, _T("%d"), &val);
if (val < aMinVal)
{
return aMinVal;

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

@ -12,8 +12,11 @@
static char THIS_FILE[] = __FILE__;
#endif
static char* sCBXTitles[] = {"--Blank--", "Title", "URL", "Date/Time", "Page #", "Page # of #", "Custom...", NULL};
static char* sCBXValues[] = {"", "&T", "&U", "&D", "&P", "&PT", "", NULL};
static TCHAR* sCBXTitles[] = {
_T("--Blank--"), _T("Title"), _T("URL"), _T("Date/Time"), _T("Page #"),
_T("Page # of #"), _T("Custom..."), NULL};
static TCHAR* sCBXValues[] = {
_T(""), _T("&T"), _T("&U"), _T("&D"), _T("&P"), _T("&PT"), _T(""), NULL};
/////////////////////////////////////////////////////////////////////////////
// CMarginHeaderFooter property page
@ -67,7 +70,7 @@ END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMarginHeaderFooter message handlers
void CMarginHeaderFooter::SetComboboxValue(int aId, const char* aItem)
void CMarginHeaderFooter::SetComboboxValue(int aId, const TCHAR *aItem)
{
CComboBox* cbx = (CComboBox*)GetDlgItem(aId);
if (cbx)
@ -75,7 +78,7 @@ void CMarginHeaderFooter::SetComboboxValue(int aId, const char* aItem)
int inx = 0;
while (sCBXValues[inx] != NULL)
{
if (!strcmp(sCBXValues[inx], aItem))
if (!_tcscmp(sCBXValues[inx], aItem))
{
cbx->SetCurSel(inx);
return;
@ -86,7 +89,7 @@ void CMarginHeaderFooter::SetComboboxValue(int aId, const char* aItem)
}
}
void CMarginHeaderFooter::AddCBXItem(int aId, const char* aItem)
void CMarginHeaderFooter::AddCBXItem(int aId, const TCHAR * aItem)
{
CComboBox* cbx = (CComboBox*)GetDlgItem(aId);
if (cbx)
@ -97,7 +100,7 @@ void CMarginHeaderFooter::AddCBXItem(int aId, const char* aItem)
BOOL CMarginHeaderFooter::OnInitDialog()
{
CDialog::OnInitDialog();
CDialog::OnInitDialog();
int inx = 0;
while (sCBXTitles[inx] != NULL)
@ -110,12 +113,12 @@ BOOL CMarginHeaderFooter::OnInitDialog()
AddCBXItem(IDC_FTR_RIGHT_CMBX, sCBXTitles[inx]);
inx++;
}
SetComboboxValue(IDC_HDR_LEFT_CMBX, LPCSTR(m_HeaderLeftText));
SetComboboxValue(IDC_HDR_CENTER_CMBX, LPCSTR(m_HeaderCenterText));
SetComboboxValue(IDC_HDR_RIGHT_CMBX, LPCSTR(m_HeaderRightText));
SetComboboxValue(IDC_FTR_LEFT_CMBX, LPCSTR(m_FooterLeftText));
SetComboboxValue(IDC_FTR_CENTER_CMBX, LPCSTR(m_FooterCenterText));
SetComboboxValue(IDC_FTR_RIGHT_CMBX, LPCSTR(m_FooterRightText));
SetComboboxValue(IDC_HDR_LEFT_CMBX, m_HeaderLeftText);
SetComboboxValue(IDC_HDR_CENTER_CMBX, m_HeaderCenterText);
SetComboboxValue(IDC_HDR_RIGHT_CMBX, m_HeaderRightText);
SetComboboxValue(IDC_FTR_LEFT_CMBX, m_FooterLeftText);
SetComboboxValue(IDC_FTR_CENTER_CMBX, m_FooterCenterText);
SetComboboxValue(IDC_FTR_RIGHT_CMBX, m_FooterRightText);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE

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

@ -76,8 +76,8 @@ public:
// Implementation
protected:
void SetCombobox(int aId, CString& aText);
void SetComboboxValue(int aId, const char* aValue);
void AddCBXItem(int aId, const char* aItem);
void SetComboboxValue(int aId, const TCHAR * aValue);
void AddCBXItem(int aId, const TCHAR * aItem);
// Generated message map functions
//{{AFX_MSG(CMarginHeaderFooter)

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

@ -82,10 +82,10 @@ void CPageSetupPropSheet::AddControlPages()
}
/////////////////////////////////////////////////////////////////////////////
static float GetFloatFromStr(const char* aStr, float aMaxVal = 1.0)
static float GetFloatFromStr(const TCHAR * aStr, float aMaxVal = 1.0)
{
float val;
sscanf(aStr, "%f", &val);
_stscanf(aStr, _T("%f"), &val);
if (val <= aMaxVal)
{
return val;
@ -99,8 +99,11 @@ static float GetFloatFromStr(const char* aStr, float aMaxVal = 1.0)
/////////////////////////////////////////////////////////////////////////////
static PRUnichar* GetUnicodeFromCString(const CString& aStr)
{
nsString str;
str.AssignWithConversion(LPCSTR(aStr));
#ifdef _UNICODE
nsString str(aStr);
#else
nsString str; str.AssignWithConversion(aStr);
#endif
return ToNewUnicode(str);
}

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

@ -148,7 +148,7 @@ void CLinkPropertiesDlg::OnOK()
if (m_LinkLocation.IsEmpty() || (m_LinkText.IsEmpty() && m_LinkLocation.IsEmpty()))
{
MessageBox("Please enter a Link Location");
MessageBox(_T("Please enter a Link Location"));
return;
}

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

@ -495,7 +495,11 @@ void CEditorFrame::InsertLink(CString& linkText, CString& linkLocation)
void CEditorFrame::InsertHTML(CString& str)
{
nsString htmlToInsert;
#ifdef _UNICODE
htmlToInsert.Assign(str.GetBuffer(0));
#else
htmlToInsert.AssignWithConversion(str.GetBuffer(0));
#endif
nsCOMPtr<nsIHTMLEditor> htmlEditor;
GetHTMLEditor(getter_AddRefs(htmlEditor));
@ -560,8 +564,8 @@ BOOL CEditorFrame::GetCurrentLinkInfo(CString& strLinkText, CString& strLinkLoca
if (NS_FAILED(rv))
return FALSE;
strLinkText = W2T(linkText.get());
strLinkLocation = W2T(linkLocation.get());
strLinkText = W2CT(linkText.get());
strLinkLocation = W2CT(linkLocation.get());
*anchorElement = linkElement;
NS_ADDREF(*anchorElement);

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

@ -81,7 +81,7 @@ CPPSRCS = \
BrowserImpl.cpp \
BrowserImplWebPrgrsLstnr.cpp \
BrowserImplCtxMenuLstnr.cpp \
BrowserToolTip.cpp \
BrowserToolTip.cpp \
Dialogs.cpp \
ProfileMgr.cpp \
ProfilesDlg.cpp \
@ -152,9 +152,14 @@ ifdef BUILD_STATIC_LIBS
include $(topsrcdir)/config/static-rules.mk
endif # BUILD_STATIC_LIBS
# UNICODE
ifdef BUILD_UNICODE_MFCEMBED
CXXFLAGS += /D "_UNICODE"
LDFLAGS += /ENTRY:wWinMainCRTStartup
endif
CXXFLAGS += /D "_AFXDLL" /D "USE_SINGLE_SIGN_ON" -DMOZILLA_VERSION=\"$(MOZILLA_VERSION)\"
LDFLAGS += -SUBSYSTEM:windows
LDFLAGS += /SUBSYSTEM:windows
libs:: mfcembed.htm
$(INSTALL) $^ $(DIST)/bin

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

@ -79,7 +79,7 @@ static char THIS_FILE[] = __FILE__;
// this is for overriding the Mozilla default PromptService component
#include "PromptService.h"
#define kComponentsLibname "mfcEmbedComponents.dll"
#define kComponentsLibname _T("mfcEmbedComponents.dll")
#define NS_PROMPTSERVICE_CID \
{0xa2112d6a, 0x0e28, 0x421f, {0xb4, 0x6a, 0x25, 0xc0, 0xb3, 0x8, 0xcb, 0xd0}}
static NS_DEFINE_CID(kPromptServiceCID, NS_PROMPTSERVICE_CID);
@ -136,15 +136,22 @@ public:
}
// handle flag-based parameters
void HandleFlag(const nsACString& flag, const char* param=nsnull)
#ifdef _UNICODE
void HandleFlag(const nsAString& flag, const TCHAR * param = nsnull)
#else
void HandleFlag(const nsACString& flag, const TCHAR * param = nsnull)
#endif
{
if (flag.Equals("console"))
if (flag.Equals(_T("console")))
DoConsole();
else if (flag.Equals("chrome"))
else if (flag.Equals(_T("chrome")))
DoChrome();
#ifdef NS_TRACE_MALLOC
else if (flag.Equals("trace-malloc"))
DoTraceMalloc(flag, param);
else if (flag.Equals(_T("trace-malloc")))
{
USES_CONVERSION;
DoTraceMalloc(flag, T2CA(param));
}
#endif
// add new flag handlers here (please add a DoFoo() method below!)
}
@ -180,7 +187,11 @@ public:
private:
// autostring is fine, this is a stack based object anyway
#ifdef _UNICODE
nsAutoString mLastFlag;
#else
nsCAutoString mLastFlag;
#endif
CMfcEmbedApp& mApp;
};
@ -373,11 +384,12 @@ BOOL CMfcEmbedApp::InitInstance()
// Please see http://www.mozilla.org/projects/embedding/MRE.html
// for more info. on GRE
char curDir[_MAX_PATH+1];
TCHAR curDir[_MAX_PATH+1];
::GetCurrentDirectory(_MAX_PATH, curDir);
USES_CONVERSION;
nsresult rv;
nsCOMPtr<nsILocalFile> mreAppDir;
rv = NS_NewNativeLocalFile(nsDependentCString(curDir), TRUE, getter_AddRefs(mreAppDir));
rv = NS_NewNativeLocalFile(nsDependentCString(T2A(curDir)), TRUE, getter_AddRefs(mreAppDir));
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to create mreAppDir localfile");
// Take a look at
@ -587,8 +599,9 @@ void CMfcEmbedApp::OnEditPreferences()
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
if (NS_SUCCEEDED(rv))
{
USES_CONVERSION;
prefs->SetIntPref("browser.startup.page", m_iStartupPage);
rv = prefs->SetCharPref("browser.startup.homepage", m_strHomePage);
rv = prefs->SetCharPref("browser.startup.homepage", T2CA(m_strHomePage));
if (NS_SUCCEEDED(rv))
rv = prefs->SavePrefFile(nsnull);
}
@ -627,7 +640,7 @@ BOOL CMfcEmbedApp::CreateHiddenWindow()
return FALSE;
RECT bounds = { -10010, -10010, -10000, -10000 };
hiddenWnd->Create(NULL, "main", WS_DISABLED, bounds, NULL, NULL, 0, NULL);
hiddenWnd->Create(NULL, _T("main"), WS_DISABLED, bounds, NULL, NULL, 0, NULL);
m_pMainWnd = hiddenWnd;
return TRUE;
@ -647,11 +660,12 @@ nsresult CMfcEmbedApp::InitializePrefs()
rv = prefs->GetBoolPref("mfcbrowser.prefs_inited", &inited);
if (NS_FAILED(rv) || !inited)
{
USES_CONVERSION;
m_iStartupPage = 1;
m_strHomePage = "http://www.mozilla.org/projects/embedding";
prefs->SetIntPref("browser.startup.page", m_iStartupPage);
prefs->SetCharPref("browser.startup.homepage", m_strHomePage);
prefs->SetCharPref("browser.startup.homepage", T2CA(m_strHomePage));
prefs->SetIntPref("font.size.variable.x-western", 16);
prefs->SetIntPref("font.size.fixed.x-western", 13);
rv = prefs->SetBoolPref("mfcbrowser.prefs_inited", PR_TRUE);
@ -664,12 +678,17 @@ nsresult CMfcEmbedApp::InitializePrefs()
prefs->GetIntPref("browser.startup.page", &m_iStartupPage);
CString strBuf;
char *pBuf = strBuf.GetBuffer(_MAX_PATH);
prefs->CopyCharPref("browser.startup.homepage", &pBuf);
strBuf.ReleaseBuffer(-1);
if(pBuf)
m_strHomePage = pBuf;
nsXPIDLCString str;
prefs->GetCharPref("browser.startup.homepage", getter_Copies(str));
if (!str.IsEmpty())
{
USES_CONVERSION;
m_strHomePage = A2CT(str.get());
}
else
{
m_strHomePage.Empty();
}
}
}
else
@ -718,7 +737,9 @@ NS_IMETHODIMP CMfcEmbedApp::Observe(nsISupports *aSubject, const char *aTopic, c
if (nsCRT::strcmp(aTopic, "profile-approve-change") == 0)
{
// Ask the user if they want to
int result = MessageBox(NULL, "Do you want to close all windows in order to switch the profile?", "Confirm", MB_YESNO | MB_ICONQUESTION);
int result = MessageBox(NULL,
_T("Do you want to close all windows in order to switch the profile?"),
_T("Confirm"), MB_YESNO | MB_ICONQUESTION);
if (result != IDYES)
{
nsCOMPtr<nsIProfileChangeStatus> status = do_QueryInterface(aSubject);

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

@ -110,8 +110,9 @@ char * CMostRecentUrls::GetURL(int aInx)
void CMostRecentUrls::AddURL(const char * aURL)
{
TCHAR szTemp[512];
strcpy(szTemp, aURL);
char szTemp[512];
strncpy(szTemp, aURL, sizeof(szTemp));
szTemp[sizeof(szTemp) - 1] = '\0';
// check to see if an existing url matches the one passed in
for (int i=0; i<MAX_URLS-1; i++)

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

@ -57,20 +57,19 @@ static void ValidateProfileName(const CString& profileName, CDataExchange* pDX)
{
nsCOMPtr<nsIProfile> profileService =
do_GetService(NS_PROFILE_CONTRACTID, &rv);
rv = profileService->ProfileExists(T2W(profileName), &exists);
rv = profileService->ProfileExists(T2CW(profileName), &exists);
}
if (NS_SUCCEEDED(rv) && exists)
{
CString errMsg;
errMsg.Format(_T("Error: A profile named \"%s\" already exists."), (const char *)profileName);
errMsg.Format(_T("Error: A profile named \"%s\" already exists."), profileName);
AfxMessageBox( errMsg, MB_ICONEXCLAMATION );
errMsg.Empty();
pDX->Fail();
}
if (profileName.FindOneOf("\\/") != -1)
if (profileName.FindOneOf(_T("\\/")) != -1)
{
AfxMessageBox( _T("Error: A profile name cannot contain the characters \"\\\" or \"/\"."), MB_ICONEXCLAMATION );
pDX->Fail();
@ -186,7 +185,7 @@ void CProfilesDlg::DoDataExchange(CDataExchange* pDX)
{
CString itemText;
m_ProfileList.GetText(itemIndex, itemText);
m_SelectedProfile.Assign(T2W(itemText));
m_SelectedProfile.Assign(T2CW(itemText));
}
}
}
@ -258,7 +257,7 @@ void CProfilesDlg::OnNewProfile()
{
USES_CONVERSION;
rv = profileService->CreateNewProfile(T2W(dialog.m_Name), nsnull, nsnull, PR_FALSE);
rv = profileService->CreateNewProfile(T2CW(dialog.m_Name), nsnull, nsnull, PR_FALSE);
ASSERT(NS_SUCCEEDED(rv));
if (NS_SUCCEEDED(rv))
{
@ -292,7 +291,7 @@ void CProfilesDlg::OnRenameProfile()
ASSERT(NS_SUCCEEDED(rv));
if (NS_SUCCEEDED(rv))
{
rv = profileService->RenameProfile(T2W(dialog.m_CurrentName), T2W(dialog.m_NewName));
rv = profileService->RenameProfile(T2CW(dialog.m_CurrentName), T2CW(dialog.m_NewName));
ASSERT(NS_SUCCEEDED(rv));
}
}
@ -316,7 +315,7 @@ void CProfilesDlg::OnDeleteProfile()
{
USES_CONVERSION;
rv = profileService->DeleteProfile(T2W(selectedProfile), PR_TRUE);
rv = profileService->DeleteProfile(T2CW(selectedProfile), PR_TRUE);
ASSERT(NS_SUCCEEDED(rv));
if (NS_SUCCEEDED(rv))
{

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

@ -42,9 +42,9 @@
// CPromptDialog Stuff
//--------------------------------------------------------------------------//
CPromptDialog::CPromptDialog(CWnd* pParent, const char* pTitle, const char* pText,
const char* pInitPromptText,
BOOL bHasCheck, const char* pCheckText, int initCheckVal)
CPromptDialog::CPromptDialog(CWnd* pParent, const TCHAR* pTitle, const TCHAR* pText,
const TCHAR* pInitPromptText,
BOOL bHasCheck, const TCHAR* pCheckText, int initCheckVal)
: CDialog(CPromptDialog::IDD, pParent),
m_bHasCheckBox(bHasCheck)
{
@ -115,9 +115,9 @@ int CPromptDialog::OnInitDialog()
// CPromptPasswordDialog Stuff
//--------------------------------------------------------------------------//
CPromptPasswordDialog::CPromptPasswordDialog(CWnd* pParent, const char* pTitle, const char* pText,
const char* pInitPasswordText,
BOOL bHasCheck, const char* pCheckText, int initCheckVal)
CPromptPasswordDialog::CPromptPasswordDialog(CWnd* pParent, const TCHAR* pTitle, const TCHAR* pText,
const TCHAR* pInitPasswordText,
BOOL bHasCheck, const TCHAR* pCheckText, int initCheckVal)
: CDialog(CPromptPasswordDialog::IDD, pParent),
m_bHasCheckBox(bHasCheck), m_bCheckBoxValue(initCheckVal)
{
@ -186,9 +186,9 @@ int CPromptPasswordDialog::OnInitDialog()
// CPromptUsernamePasswordDialog Stuff
//--------------------------------------------------------------------------//
CPromptUsernamePasswordDialog::CPromptUsernamePasswordDialog(CWnd* pParent, const char* pTitle, const char* pText,
const char* pInitUsername, const char* pInitPassword,
BOOL bHasCheck, const char* pCheckText, int initCheckVal)
CPromptUsernamePasswordDialog::CPromptUsernamePasswordDialog(CWnd* pParent, const TCHAR* pTitle, const TCHAR* pText,
const TCHAR* pInitUsername, const TCHAR* pInitPassword,
BOOL bHasCheck, const TCHAR* pCheckText, int initCheckVal)
: CDialog(CPromptUsernamePasswordDialog::IDD, pParent),
m_bHasCheckBox(bHasCheck), m_bCheckBoxValue(initCheckVal)
{
@ -267,8 +267,8 @@ int CPromptUsernamePasswordDialog::OnInitDialog()
// CAlertCheckDialog Stuff
//--------------------------------------------------------------------------//
CAlertCheckDialog::CAlertCheckDialog(CWnd* pParent, const char* pTitle, const char* pText,
const char* pCheckText, int initCheckVal)
CAlertCheckDialog::CAlertCheckDialog(CWnd* pParent, const TCHAR* pTitle, const TCHAR* pText,
const TCHAR* pCheckText, int initCheckVal)
: CDialog(CAlertCheckDialog::IDD, pParent)
{
if(pTitle)
@ -317,10 +317,10 @@ int CAlertCheckDialog::OnInitDialog()
// CConfirmCheckDialog Stuff
//--------------------------------------------------------------------------//
CConfirmCheckDialog::CConfirmCheckDialog(CWnd* pParent, const char* pTitle, const char* pText,
const char* pCheckText, int initCheckVal,
const char *pBtn1Text, const char *pBtn2Text,
const char *pBtn3Text)
CConfirmCheckDialog::CConfirmCheckDialog(CWnd* pParent, const TCHAR* pTitle, const TCHAR* pText,
const TCHAR* pCheckText, int initCheckVal,
const TCHAR *pBtn1Text, const TCHAR *pBtn2Text,
const TCHAR *pBtn3Text)
: CDialog(CConfirmCheckDialog::IDD, pParent)
{
if(pTitle)

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

@ -37,9 +37,9 @@
class CPromptDialog : public CDialog
{
public:
CPromptDialog(CWnd* pParent, const char* pTitle, const char* pText,
const char* pInitPromptText,
BOOL bHasCheck, const char* pCheckText, int initCheckVal);
CPromptDialog(CWnd* pParent, const TCHAR* pTitle, const TCHAR* pText,
const TCHAR* pInitPromptText,
BOOL bHasCheck, const TCHAR* pCheckText, int initCheckVal);
// Dialog Data
enum { IDD = IDD_PROMPT_DIALOG };
@ -66,9 +66,9 @@ public:
class CPromptPasswordDialog : public CDialog
{
public:
CPromptPasswordDialog(CWnd* pParent, const char* pTitle, const char* pText,
const char* pInitPasswordText,
BOOL bHasCheck, const char* pCheckText, int initCheckVal);
CPromptPasswordDialog(CWnd* pParent, const TCHAR* pTitle, const TCHAR* pText,
const TCHAR* pInitPasswordText,
BOOL bHasCheck, const TCHAR* pCheckText, int initCheckVal);
// Dialog Data
enum { IDD = IDD_PROMPT_PASSWORD_DIALOG };
@ -95,9 +95,9 @@ public:
class CPromptUsernamePasswordDialog : public CDialog
{
public:
CPromptUsernamePasswordDialog(CWnd* pParent, const char* pTitle, const char* pText,
const char* pInitUsername, const char* pInitPassword,
BOOL bHasCheck, const char* pCheckText, int initCheckVal);
CPromptUsernamePasswordDialog(CWnd* pParent, const TCHAR* pTitle, const TCHAR* pText,
const TCHAR* pInitUsername, const TCHAR* pInitPassword,
BOOL bHasCheck, const TCHAR* pCheckText, int initCheckVal);
// Dialog Data
enum { IDD = IDD_PROMPT_USERPASS_DIALOG };
@ -128,8 +128,8 @@ public:
class CAlertCheckDialog : public CDialog
{
public:
CAlertCheckDialog(CWnd* pParent, const char* pTitle, const char* pText,
const char* pCheckText, int initCheckVal);
CAlertCheckDialog(CWnd* pParent, const TCHAR* pTitle, const TCHAR* pText,
const TCHAR* pCheckText, int initCheckVal);
// Dialog Data
enum { IDD = IDD_ALERT_CHECK_DIALOG };
@ -155,10 +155,10 @@ public:
class CConfirmCheckDialog : public CDialog
{
public:
CConfirmCheckDialog(CWnd* pParent, const char* pTitle, const char* pText,
const char* pCheckText, int initCheckVal,
const char *pBtn1Text, const char *pBtn2Text,
const char *pBtn3Text);
CConfirmCheckDialog(CWnd* pParent, const TCHAR* pTitle, const TCHAR* pText,
const TCHAR* pCheckText, int initCheckVal,
const TCHAR *pBtn1Text, const TCHAR *pBtn2Text,
const TCHAR *pBtn3Text);
// Dialog Data
enum { IDD = IDD_CONFIRM_CHECK_DIALOG };

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

@ -239,8 +239,11 @@ NS_IMETHODIMP CHelperAppLauncherDialog::Show(nsIHelperAppLauncher *aLauncher,
m_FileName = dlg.m_OpenWithAppName;
USES_CONVERSION;
nsCAutoString fileName(T2CA(m_FileName));
nsCOMPtr<nsILocalFile> openWith;
nsresult rv = NS_NewNativeLocalFile(nsDependentCString(m_FileName), PR_FALSE, getter_AddRefs(openWith));
nsresult rv = NS_NewNativeLocalFile(fileName, PR_FALSE, getter_AddRefs(openWith));
if (NS_FAILED(rv))
return aLauncher->LaunchWithApplication(nsnull, PR_FALSE);
else
@ -261,15 +264,16 @@ NS_IMETHODIMP CHelperAppLauncherDialog::PromptForSaveToFile(nsISupports *aWindow
NS_ENSURE_ARG_POINTER(_retval);
char *lpszFilter = "All Files (*.*)|*.*||";
CFileDialog cf(FALSE, W2T(aSuggestedFileExtension), W2T(aDefaultFile),
TCHAR *lpszFilter = _T("All Files (*.*)|*.*||");
CFileDialog cf(FALSE, W2CT(aSuggestedFileExtension), W2CT(aDefaultFile),
OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
lpszFilter, GetParentFromContext(aWindowContext));
if(cf.DoModal() == IDOK)
{
m_FileName = cf.GetPathName(); // Will be like: c:\tmp\junk.exe
return NS_NewNativeLocalFile(nsDependentCString(m_FileName), PR_FALSE, _retval);
USES_CONVERSION;
nsCAutoString fileName(T2CA(m_FileName));
return NS_NewNativeLocalFile(fileName, PR_FALSE, _retval);
}
else
return NS_ERROR_FAILURE;
@ -335,7 +339,10 @@ BOOL CChooseActionDlg::OnInitDialog()
{
CStatic *pMimeType = (CStatic *)GetDlgItem(IDC_CONTENT_TYPE);
if(pMimeType)
pMimeType->SetWindowText(mimeType.get());
{
USES_CONVERSION;
pMimeType->SetWindowText(A2CT(mimeType.get()));
}
}
// See if we can get the preferred action from the mime info
@ -376,7 +383,7 @@ void CChooseActionDlg::InitWithPreferredAction(nsIMIMEInfo* aMimeInfo)
if(NS_SUCCEEDED(rv))
{
USES_CONVERSION;
m_OpenWithAppName = W2T(appDesc.get());
m_OpenWithAppName = W2CT(appDesc.get());
// Update with the app name
//
@ -449,9 +456,9 @@ void CChooseActionDlg::OnSaveToDiskRadioBtnClicked()
void CChooseActionDlg::OnChooseAppClicked()
{
char *lpszFilter =
"EXE Files Only (*.exe)|*.exe|"
"All Files (*.*)|*.*||";
TCHAR *lpszFilter =
_T("EXE Files Only (*.exe)|*.exe|")
_T("All Files (*.*)|*.*||");
CFileDialog cf(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
lpszFilter, this);
@ -474,8 +481,9 @@ void CChooseActionDlg::OnOK()
//
if(m_OpenWithAppName.IsEmpty())
{
::MessageBox(this->m_hWnd, "You have chosen to open the content with an external application, but,\nno application has been specified.\n\nPlease click the Choose... button to select an application",
"MfcEmbed", MB_OK);
::MessageBox(this->m_hWnd,
_T("You have chosen to open the content with an external application, but,\nno application has been specified.\n\nPlease click the Choose... button to select an application"),
_T("MfcEmbed"), MB_OK);
return;
}
else
@ -582,16 +590,16 @@ BOOL CProgressDlg::OnInitDialog()
{
nsCAutoString uriString;
srcUri->GetSpec(uriString);
m_SavingFrom.SetWindowText(uriString.get());
USES_CONVERSION;
m_SavingFrom.SetWindowText(A2CT(uriString.get()));
}
}
// Set the "Action" field
if(m_HandleContentOp == CONTENT_SAVE_TO_DISK)
m_Action.SetWindowText("[Saving file to:] " + m_FileName);
m_Action.SetWindowText(_T("[Saving file to:] ") + m_FileName);
else if(m_HandleContentOp == CONTENT_LAUNCH_WITH_APP)
m_Action.SetWindowText("[Opening file with:] " + m_FileName);
m_Action.SetWindowText(_T("[Opening file with:] ") + m_FileName);
return TRUE;
}

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

@ -78,8 +78,13 @@ FORCE_SHARED_LIB = 1
include $(topsrcdir)/config/rules.mk
# UNICODE
ifdef BUILD_UNICODE_MFCEMBED
CXXFLAGS += /D "_UNICODE"
endif
CXXFLAGS += /D "_AFXDLL" /D "USE_SINGLE_SIGN_ON" /D "_WINDLL"
LDFLAGS += -SUBSYSTEM:windows
LDFLAGS += /SUBSYSTEM:windows
Dialogs.res: Dialogs.rc resource.h

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

@ -155,7 +155,7 @@ BOOL CPrintProgressDialog::OnInitDialog()
cancelBtn->EnableWindow(FALSE);
} else {
cancelBtn->ShowWindow(SW_HIDE);
SetWindowText("Print Preview");
SetWindowText(_T("Print Preview"));
}
}

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

@ -131,9 +131,9 @@ NS_IMETHODIMP CPromptService::Alert(nsIDOMWindow *parent, const PRUnichar *dialo
USES_CONVERSION;
CWnd *wnd = CWndForDOMWindow(parent);
if (wnd)
wnd->MessageBox(W2T(text), W2T(dialogTitle), MB_OK | MB_ICONEXCLAMATION);
wnd->MessageBox(W2CT(text), W2CT(dialogTitle), MB_OK | MB_ICONEXCLAMATION);
else
::MessageBox(0, W2T(text), W2T(dialogTitle), MB_OK | MB_ICONEXCLAMATION);
::MessageBox(0, W2CT(text), W2CT(dialogTitle), MB_OK | MB_ICONEXCLAMATION);
return NS_OK;
}
@ -148,8 +148,8 @@ NS_IMETHODIMP CPromptService::AlertCheck(nsIDOMWindow *parent,
USES_CONVERSION;
CWnd *wnd = CWndForDOMWindow(parent);
CAlertCheckDialog dlg(wnd, W2T(dialogTitle), W2T(text),
W2T(checkboxMsg), checkValue ? *checkValue : 0);
CAlertCheckDialog dlg(wnd, W2CT(dialogTitle), W2CT(text),
W2CT(checkboxMsg), checkValue ? *checkValue : 0);
dlg.DoModal();
@ -168,10 +168,10 @@ NS_IMETHODIMP CPromptService::Confirm(nsIDOMWindow *parent,
int choice;
if (wnd)
choice = wnd->MessageBox(W2T(text), W2T(dialogTitle),
choice = wnd->MessageBox(W2CT(text), W2CT(dialogTitle),
MB_YESNO | MB_ICONEXCLAMATION);
else
choice = ::MessageBox(0, W2T(text), W2T(dialogTitle),
choice = ::MessageBox(0, W2CT(text), W2CT(dialogTitle),
MB_YESNO | MB_ICONEXCLAMATION);
*_retval = choice == IDYES ? PR_TRUE : PR_FALSE;
@ -190,9 +190,9 @@ NS_IMETHODIMP CPromptService::ConfirmCheck(nsIDOMWindow *parent,
USES_CONVERSION;
CWnd *wnd = CWndForDOMWindow(parent);
CConfirmCheckDialog dlg(wnd, W2T(dialogTitle), W2T(text),
W2T(checkboxMsg), checkValue ? *checkValue : 0,
"Yes", "No", NULL);
CConfirmCheckDialog dlg(wnd, W2CT(dialogTitle), W2CT(text),
W2CT(checkboxMsg), checkValue ? *checkValue : 0,
_T("Yes"), _T("No"), NULL);
int iBtnClicked = dlg.DoModal();
@ -215,9 +215,9 @@ NS_IMETHODIMP CPromptService::Prompt(nsIDOMWindow *parent,
USES_CONVERSION;
CWnd *wnd = CWndForDOMWindow(parent);
CPromptDialog dlg(wnd, W2T(dialogTitle), W2T(text),
text && *text ? W2T(text) : 0,
checkValue != nsnull, W2T(checkboxMsg),
CPromptDialog dlg(wnd, W2CT(dialogTitle), W2CT(text),
text && *text ? W2CT(text) : 0,
checkValue != nsnull, W2CT(checkboxMsg),
checkValue ? *checkValue : 0);
if(dlg.DoModal() == IDOK) {
// Get the value entered in the editbox of the PromptDlg
@ -225,8 +225,9 @@ NS_IMETHODIMP CPromptService::Prompt(nsIDOMWindow *parent,
nsMemory::Free(*value);
*value = nsnull;
}
USES_CONVERSION;
nsString csPromptEditValue;
csPromptEditValue.AssignWithConversion(dlg.m_csPromptAnswer.GetBuffer(0));
csPromptEditValue.Assign(T2CW(dlg.m_csPromptAnswer.GetBuffer(0)));
*value = ToNewUnicode(csPromptEditValue);
@ -250,10 +251,10 @@ NS_IMETHODIMP CPromptService::PromptUsernameAndPassword(nsIDOMWindow *parent,
USES_CONVERSION;
CWnd *wnd = CWndForDOMWindow(parent);
CPromptUsernamePasswordDialog dlg(wnd, W2T(dialogTitle), W2T(text),
username && *username ? W2T(*username) : 0,
password && *password ? W2T(*password) : 0,
checkValue != nsnull, W2T(checkboxMsg),
CPromptUsernamePasswordDialog dlg(wnd, W2CT(dialogTitle), W2CT(text),
username && *username ? W2CT(*username) : 0,
password && *password ? W2CT(*password) : 0,
checkValue != nsnull, W2CT(checkboxMsg),
checkValue ? *checkValue : 0);
if (dlg.DoModal() == IDOK) {
@ -262,8 +263,9 @@ NS_IMETHODIMP CPromptService::PromptUsernameAndPassword(nsIDOMWindow *parent,
nsMemory::Free(*username);
*username = nsnull;
}
USES_CONVERSION;
nsString csUserName;
csUserName.AssignWithConversion(dlg.m_csUserName.GetBuffer(0));
csUserName.Assign(T2CW(dlg.m_csUserName.GetBuffer(0)));
*username = ToNewUnicode(csUserName);
// Get the password entered
@ -272,7 +274,7 @@ NS_IMETHODIMP CPromptService::PromptUsernameAndPassword(nsIDOMWindow *parent,
*password = nsnull;
}
nsString csPassword;
csPassword.AssignWithConversion(dlg.m_csPassword.GetBuffer(0));
csPassword.Assign(T2CW(dlg.m_csPassword.GetBuffer(0)));
*password = ToNewUnicode(csPassword);
if(checkValue)
@ -297,9 +299,9 @@ NS_IMETHODIMP CPromptService::PromptPassword(nsIDOMWindow *parent,
USES_CONVERSION;
CWnd *wnd = CWndForDOMWindow(parent);
CPromptPasswordDialog dlg(wnd, W2T(dialogTitle), W2T(text),
password && *password ? W2T(*password) : 0,
checkValue != nsnull, W2T(checkboxMsg),
CPromptPasswordDialog dlg(wnd, W2CT(dialogTitle), W2CT(text),
password && *password ? W2CT(*password) : 0,
checkValue != nsnull, W2CT(checkboxMsg),
checkValue ? *checkValue : 0);
if(dlg.DoModal() == IDOK) {
// Get the password entered
@ -307,8 +309,9 @@ NS_IMETHODIMP CPromptService::PromptPassword(nsIDOMWindow *parent,
nsMemory::Free(*password);
*password = nsnull;
}
USES_CONVERSION;
nsString csPassword;
csPassword.AssignWithConversion(dlg.m_csPassword.GetBuffer(0));
csPassword.Assign(T2CW(dlg.m_csPassword.GetBuffer(0)));
*password = ToNewUnicode(csPassword);
if(checkValue)
@ -374,7 +377,7 @@ NS_IMETHODIMP CPromptService::ConfirmEx(nsIDOMWindow *parent,
csBtnTitles[i] = "Revert";
break;
case BUTTON_TITLE_IS_STRING:
csBtnTitles[i] = W2T(buttonStrings[i]);
csBtnTitles[i] = W2CT(buttonStrings[i]);
break;
}
@ -382,8 +385,8 @@ NS_IMETHODIMP CPromptService::ConfirmEx(nsIDOMWindow *parent,
}
CWnd *wnd = CWndForDOMWindow(parent);
CConfirmCheckDialog dlg(wnd, W2T(dialogTitle), W2T(text),
checkMsg ? W2T(checkMsg) : NULL, checkValue ? *checkValue : 0,
CConfirmCheckDialog dlg(wnd, W2CT(dialogTitle), W2CT(text),
checkMsg ? W2CT(checkMsg) : NULL, checkValue ? *checkValue : 0,
csBtnTitles[0].IsEmpty() ? NULL : (LPCTSTR)csBtnTitles[0],
csBtnTitles[1].IsEmpty() ? NULL : (LPCTSTR)csBtnTitles[1],
csBtnTitles[2].IsEmpty() ? NULL : (LPCTSTR)csBtnTitles[2]);

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

@ -118,6 +118,18 @@ SOURCE=.\BrowserView.cpp
# End Source File
# Begin Source File
SOURCE=.\CFormatOptionTab.cpp
# End Source File
# Begin Source File
SOURCE=.\CMarginHeaderFooter.cpp
# End Source File
# Begin Source File
SOURCE=.\CPageSetupPropSheet.cpp
# End Source File
# Begin Source File
SOURCE=.\Dialogs.cpp
# End Source File
# Begin Source File
@ -142,14 +154,6 @@ SOURCE=.\Preferences.cpp
# End Source File
# Begin Source File
SOURCE=.\PrintProgressDialog.cpp
# End Source File
# Begin Source File
SOURCE=.\PrintSetupDialog.cpp
# End Source File
# Begin Source File
SOURCE=.\ProfileMgr.cpp
# End Source File
# Begin Source File
@ -186,6 +190,10 @@ SOURCE=.\BrowserView.h
# End Source File
# Begin Source File
SOURCE=.\CMarginHeaderFooter.h
# End Source File
# Begin Source File
SOURCE=.\Dialogs.h
# End Source File
# Begin Source File
@ -210,14 +218,6 @@ SOURCE=.\Preferences.h
# End Source File
# Begin Source File
SOURCE=.\PrintProgressDialog.h
# End Source File
# Begin Source File
SOURCE=.\PrintSetupDialog.h
# End Source File
# Begin Source File
SOURCE=.\ProfileMgr.h
# End Source File
# Begin Source File
@ -309,5 +309,81 @@ SOURCE=..\..\..\editor\composer\src\nsComposerCommands.cpp
SOURCE=..\..\components\commandhandler\src\nsControllerCommandManager.cpp
# End Source File
# End Group
# Begin Group "Component Source Files"
# PROP Default_Filter "*.cpp"
# Begin Source File
SOURCE=.\components\Dialogs.cpp
# End Source File
# Begin Source File
SOURCE=.\components\HelperAppDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\components\nsPrintDialogUtil.cpp
# End Source File
# Begin Source File
SOURCE=.\components\nsPrintProgressParams.cpp
# End Source File
# Begin Source File
SOURCE=.\components\PrintingPromptService.cpp
# End Source File
# Begin Source File
SOURCE=.\components\PrintProgressDialog.cpp
# End Source File
# Begin Source File
SOURCE=.\components\PromptService.cpp
# End Source File
# End Group
# Begin Group "Component Header Files"
# PROP Default_Filter "*.h"
# Begin Source File
SOURCE=.\components\Dialogs.h
# End Source File
# Begin Source File
SOURCE=.\components\HelperAppDlg.h
# End Source File
# Begin Source File
SOURCE=.\components\HelperAppService.h
# End Source File
# Begin Source File
SOURCE=.\components\nsPrintDialogUtil.h
# End Source File
# Begin Source File
SOURCE=.\components\nsPrintProgressParams.h
# End Source File
# Begin Source File
SOURCE=.\components\PrintingPromptService.h
# End Source File
# Begin Source File
SOURCE=.\components\PrintProgressDialog.h
# End Source File
# Begin Source File
SOURCE=.\components\PromptService.h
# End Source File
# Begin Source File
SOURCE=.\components\resource.h
# End Source File
# Begin Source File
SOURCE=.\components\stdafx.h
# End Source File
# End Group
# End Target
# End Project