зеркало из https://github.com/mozilla/pjs.git
Support VC6 compiler
This commit is contained in:
Родитель
a2d1127af7
Коммит
325b6d1a6c
|
@ -1,350 +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.
|
||||
*/
|
||||
|
||||
// cntritem.cpp : implementation of the CNetscapeCntrItem class
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "cntritem.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
static char BASED_CODE THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
#ifndef XP_WIN32
|
||||
#include "olenls.h"
|
||||
#define OLESTR(str) str
|
||||
#endif
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CNetscapeCntrItem implementation
|
||||
|
||||
#ifndef _AFXDLL
|
||||
#undef new
|
||||
#endif
|
||||
IMPLEMENT_SERIAL(CNetscapeCntrItem, COleClientItem, 0)
|
||||
#ifndef _AFXDLL
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
extern void FE_ConvertSpace(char *newName);
|
||||
|
||||
CNetscapeCntrItem::CNetscapeCntrItem(CGenericDoc* pContainer)
|
||||
: COleClientItem(pContainer)
|
||||
{
|
||||
m_bLoading = FALSE; // Not loading.
|
||||
m_bBroken = FALSE; // Not broken.
|
||||
m_bDelayed = FALSE; // Not delayed.
|
||||
m_iLock = 0; // No one is referencing us.
|
||||
m_pOriginalItem = NULL;
|
||||
m_isFullPage = FALSE;
|
||||
m_isDirty = FALSE;
|
||||
m_bIsOleItem = FALSE;
|
||||
m_bSetExtents = FALSE;
|
||||
m_bCanSavedByOLE = FALSE;
|
||||
m_idSavedAs =DISPID_UNKNOWN;
|
||||
|
||||
}
|
||||
|
||||
CNetscapeCntrItem::~CNetscapeCntrItem()
|
||||
{
|
||||
// If we've something loaded, then release it.
|
||||
if(m_bLoading == FALSE && m_bBroken == FALSE && m_bDelayed == FALSE) {
|
||||
// Assuming we're valid.
|
||||
Release(OLECLOSE_SAVEIFDIRTY);
|
||||
}
|
||||
}
|
||||
void CNetscapeCntrItem::OnActivate()
|
||||
{
|
||||
char * pSource = NULL;
|
||||
const char* ptr;
|
||||
LPDISPATCH pdisp;
|
||||
HRESULT hr;
|
||||
int _convert;
|
||||
if (m_lpObject->QueryInterface(IID_IDispatch, (void**)&pdisp) == S_OK){
|
||||
#ifdef XP_WIN32
|
||||
LPCOLESTR lpOleStr = T2COLE("SaveAs");
|
||||
hr = pdisp->GetIDsOfNames(IID_NULL, (unsigned short **)&lpOleStr, 1, LOCALE_USER_DEFAULT, &m_idSavedAs);
|
||||
pdisp->Release();
|
||||
if (hr == S_OK)
|
||||
m_bCanSavedByOLE = TRUE;
|
||||
else
|
||||
m_idSavedAs = DISPID_UNKNOWN;
|
||||
#else
|
||||
m_idSavedAs = DISPID_UNKNOWN;
|
||||
#endif
|
||||
}
|
||||
|
||||
const char* ptr1 = m_csAddress;
|
||||
if (NET_IsLocalFileURL((char*)ptr1)) {
|
||||
XP_ConvertUrlToLocalFile(m_csAddress, &pSource);
|
||||
m_csDosName = *pSource; // pick up the drive name.
|
||||
m_csDosName += ":";
|
||||
m_csDosName += strchr(pSource, '\\'); // pick up the real file name.
|
||||
ptr = m_csDosName;
|
||||
FE_ConvertSpace((char*)ptr);
|
||||
XP_FREE(pSource);
|
||||
}
|
||||
|
||||
// the object does not support ole automation, try to find out if this is a storagefile, so
|
||||
// we can use OLESave().
|
||||
if (!m_bCanSavedByOLE) {
|
||||
#ifdef XP_WIN32 // we will only want to handle saving when the object had storage file.
|
||||
int _convert;
|
||||
LPCOLESTR lpsz = A2CW(m_csDosName);
|
||||
if (StgIsStorageFile(lpsz) == S_OK)
|
||||
m_bCanSavedByOLE = TRUE;
|
||||
#else
|
||||
HRESULT sc1 = StgIsStorageFile(m_csDosName);
|
||||
if (GetScode(sc1) == S_OK)
|
||||
m_bCanSavedByOLE = TRUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
CGenericView* pView = GetActiveView();
|
||||
CFrameGlue *pFrameGlue = pView->GetFrame();
|
||||
if(pFrameGlue != NULL) {
|
||||
m_bLocationBarShowing = pFrameGlue->GetChrome()->GetToolbarVisible(ID_LOCATION_TOOLBAR);
|
||||
}
|
||||
|
||||
COleClientItem::OnActivate();
|
||||
}
|
||||
|
||||
void CNetscapeCntrItem::OnChange(OLE_NOTIFICATION nCode, DWORD dwParam)
|
||||
{
|
||||
#ifdef MOZ_NGLAYOUT
|
||||
XP_ASSERT(0);
|
||||
#else
|
||||
COleClientItem::OnChange(nCode, dwParam);
|
||||
|
||||
// this is a hack to test if we need to ask user to save the file or not.
|
||||
// since I can not get lpPersistStorage->IsDirty() to give me the correct
|
||||
// answer.
|
||||
if (nCode == OLE_CLOSED)
|
||||
m_isDirty = FALSE;
|
||||
|
||||
if (nCode == OLE_CHANGED && dwParam == DVASPECT_CONTENT)
|
||||
m_isDirty = TRUE;
|
||||
|
||||
// Update all references to the item manually.
|
||||
MWContext *pContext = GetDocument()->GetContext()->GetContext();
|
||||
POSITION rIndex = m_cplElements.GetHeadPosition();
|
||||
LO_EmbedStruct *pLayoutData;
|
||||
while(rIndex != NULL) {
|
||||
pLayoutData = (LO_EmbedStruct *)m_cplElements.GetNext(rIndex);
|
||||
if (pContext->compositor) {
|
||||
XP_Rect rect;
|
||||
|
||||
CL_GetLayerBbox(pLayoutData->objTag.layer, &rect);
|
||||
CL_UpdateLayerRect(CL_GetLayerCompositor(pLayoutData->objTag.layer),
|
||||
pLayoutData->objTag.layer, &rect, PR_FALSE);
|
||||
}
|
||||
else
|
||||
pContext->funcs->DisplayEmbed(pContext, FE_VIEW, pLayoutData);
|
||||
}
|
||||
#endif /* MOZ_NGLAYOUT */
|
||||
}
|
||||
|
||||
BOOL CNetscapeCntrItem::OnChangeItemPosition(const CRect& rectPos)
|
||||
{
|
||||
// Change the position of the item.
|
||||
// Let this happen for them, we won't change layout, and we'll see how it goes.
|
||||
if(FALSE == COleClientItem::OnChangeItemPosition(rectPos)) {
|
||||
return(FALSE);
|
||||
}
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
void CNetscapeCntrItem::OnGetItemPosition(CRect& rectPos) {
|
||||
// Give them coordinates to the position of the in place activated item.
|
||||
// So, which item was selected? We need layout data.
|
||||
CGenericDoc *pDoc = GetDocument();
|
||||
if(!pDoc) {
|
||||
return;
|
||||
}
|
||||
CDCCX *pContextCX = pDoc->GetContext();
|
||||
if(!pContextCX || pContextCX->IsFrameContext() == FALSE) {
|
||||
return;
|
||||
}
|
||||
|
||||
CWinCX *pWinCX = VOID2CX(pContextCX, CWinCX);
|
||||
if(pWinCX->m_pSelected == NULL) {
|
||||
// Don't do anything, we don't know of any selection.
|
||||
return;
|
||||
}
|
||||
|
||||
// Okay, we know about the selected item.
|
||||
// Now, we need to figure out where it is located in the view.
|
||||
HDC hdc = pWinCX->GetContextDC();
|
||||
|
||||
long lLeft = pWinCX->m_pSelected->objTag.x + pWinCX->m_pSelected->objTag.x_offset - pWinCX->GetOriginX();
|
||||
long lRight = lLeft + pWinCX->m_pSelected->objTag.width;
|
||||
|
||||
long lTop = pWinCX->m_pSelected->objTag.y + pWinCX->m_pSelected->objTag.y_offset - pWinCX->GetOriginY();
|
||||
long lBottom = lTop + pWinCX->m_pSelected->objTag.height;
|
||||
|
||||
// Convert our twips into pixels.
|
||||
RECT crConvert;
|
||||
::SetRect(&crConvert, CASTINT(lLeft), CASTINT(lTop), CASTINT(lRight), CASTINT(lBottom));
|
||||
::LPtoDP(hdc, (POINT*) &crConvert, 2);
|
||||
|
||||
rectPos = crConvert;
|
||||
|
||||
pWinCX->ReleaseContextDC(hdc);
|
||||
}
|
||||
|
||||
void CNetscapeCntrItem::OnDeactivateUI(BOOL bUndoable)
|
||||
{
|
||||
|
||||
COleClientItem::OnDeactivateUI(bUndoable);
|
||||
// Close an in-place active item whenever it removes the user
|
||||
// interface. The action here should match as closely as possible
|
||||
// to the handling of the escape key in the view.
|
||||
if( IsInPlaceActive() == TRUE) {
|
||||
TRY {
|
||||
Deactivate();
|
||||
|
||||
}
|
||||
CATCH(CException, e) {
|
||||
// Something went wrong in OLE (other app down).
|
||||
// No complicated handling here, just keep running.
|
||||
}
|
||||
END_CATCH
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: We can remove this check once everyone moves to MSVC 4.0
|
||||
#if _MSC_VER >= 1000
|
||||
BOOL CNetscapeCntrItem::OnUpdateFrameTitle() {
|
||||
// Nothing doing. We stay the same.
|
||||
// This ASSERTs anyhow, if it continues on down.
|
||||
return FALSE;
|
||||
}
|
||||
#else
|
||||
void CNetscapeCntrItem::OnUpdateFrameTitle() {
|
||||
// Nothing doing. We stay the same.
|
||||
// This ASSERTs anyhow, if it continues on down.
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
BOOL CNetscapeCntrItem::OnGetWindowContext(CFrameWnd **ppMainFrame, CFrameWnd **ppDocFrame, LPOLEINPLACEFRAMEINFO lpFrameInfo) {
|
||||
// First call the base.
|
||||
BOOL bRetval = COleClientItem::OnGetWindowContext(ppMainFrame, ppDocFrame, lpFrameInfo);
|
||||
|
||||
// Now, override the values with ones that make sense to us.
|
||||
CGenericDoc *pDoc = GetDocument();
|
||||
CDCCX *pCX = pDoc->GetContext();
|
||||
if(pCX != NULL && pCX->IsFrameContext() == TRUE) {
|
||||
// Get the frame from the window context.
|
||||
CWinCX *pWinCX = (CWinCX *)pCX;
|
||||
*ppMainFrame = pWinCX->GetFrame()->GetFrameWnd();
|
||||
*ppDocFrame = NULL; // Act like SDI.
|
||||
|
||||
// It's possible that there is no frame.
|
||||
// In which case we should do what? Fail.
|
||||
if(pWinCX->GetFrame()->GetFrameWnd() == NULL) {
|
||||
bRetval = FALSE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
bRetval = FALSE;
|
||||
*ppMainFrame = NULL;
|
||||
*ppDocFrame = NULL;
|
||||
}
|
||||
|
||||
return(bRetval);
|
||||
}
|
||||
|
||||
BOOL CNetscapeCntrItem::OnShowControlBars(CFrameWnd *pFrameWnd, BOOL bShow) {
|
||||
// Call the base, they'll at least handle our normal control bar.
|
||||
BOOL bToolBarChanged = FALSE;
|
||||
// Get the frame glue.
|
||||
CFrameGlue *pFrameGlue = CFrameGlue::GetFrameGlue(pFrameWnd);
|
||||
if(pFrameGlue != NULL) {
|
||||
if(bShow == FALSE) {
|
||||
// Hide our stuff.
|
||||
if(m_bLocationBarShowing){
|
||||
pFrameGlue->GetChrome()->ShowToolbar(ID_LOCATION_TOOLBAR, FALSE);
|
||||
bToolBarChanged = TRUE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Show our stuff.
|
||||
// Assuming that we'll always be called to hide before we're called to show.
|
||||
if(m_bLocationBarShowing){
|
||||
pFrameGlue->GetChrome()->ShowToolbar(ID_LOCATION_TOOLBAR, m_bLocationBarShowing);
|
||||
bToolBarChanged = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
BOOL bToolBarChanged1 = COleClientItem::OnShowControlBars(pFrameWnd, bShow);
|
||||
return(bToolBarChanged || bToolBarChanged1);
|
||||
}
|
||||
|
||||
void CNetscapeCntrItem::Serialize(CArchive& ar)
|
||||
{
|
||||
ASSERT_VALID(this);
|
||||
|
||||
// Call base class first to read in COleClientItem data.
|
||||
// Since this sets up the m_pDocument pointer returned from
|
||||
// CNetscapeCntrItem::GetDocument, it is a good idea to call
|
||||
// the base class Serialize first.
|
||||
COleClientItem::Serialize(ar);
|
||||
|
||||
// now store/retrieve data specific to CNetscapeCntrItem
|
||||
if (ar.IsStoring())
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
BOOL CNetscapeCntrItem::CanActivate() {
|
||||
// Can't activate if the document itself is inplace active.
|
||||
CGenericDoc *pDoc = GetDocument();
|
||||
ASSERT_VALID(pDoc);
|
||||
ASSERT(pDoc->IsKindOf(RUNTIME_CLASS(COleServerDoc)));
|
||||
|
||||
if(pDoc->IsInPlaceActive()) {
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
return(COleClientItem::CanActivate());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CNetscapeCntrItem diagnostics
|
||||
|
||||
#ifdef _DEBUG
|
||||
void CNetscapeCntrItem::AssertValid() const
|
||||
{
|
||||
COleClientItem::AssertValid();
|
||||
}
|
||||
|
||||
void CNetscapeCntrItem::Dump(CDumpContext& dc) const
|
||||
{
|
||||
COleClientItem::Dump(dc);
|
||||
}
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
1229
cmd/winfe/gendoc.cpp
1229
cmd/winfe/gendoc.cpp
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -2450,7 +2450,7 @@ void CGenericFrame::OnIBMHostOnDemand()
|
|||
|
||||
CString installDirectory, executable;
|
||||
|
||||
if(!FEU_IsIBMHostOnDemandAvailable)
|
||||
if(!FEU_IsIBMHostOnDemandAvailable())
|
||||
return;
|
||||
|
||||
#ifdef WIN32
|
||||
|
|
|
@ -526,7 +526,7 @@ LINK_LIBS= \
|
|||
LINK_FLAGS= \
|
||||
!if "$(MOZ_BITS)"=="32"
|
||||
!if defined(MOZ_DEBUG)
|
||||
!if "$(_MSC_VER)"=="1020" || "$(_MSC_VER)"=="1100"
|
||||
!if "$(_MSC_VER)"=="1020" || "$(_MSC_VER)"=="1100" || "$(_MSC_VER)"=="1200"
|
||||
mfc42d.lib \
|
||||
mfco42d.lib \
|
||||
mfcs42d.lib \
|
||||
|
@ -536,7 +536,7 @@ LINK_FLAGS= \
|
|||
mfcs40d.lib \
|
||||
!endif
|
||||
!else
|
||||
!if "$(_MSC_VER)"=="1020" || "$(_MSC_VER)"=="1100"
|
||||
!if "$(_MSC_VER)"=="1020" || "$(_MSC_VER)"=="1100" || "$(_MSC_VER)"=="1200"
|
||||
mfc42.lib \
|
||||
mfcs42.lib \
|
||||
!else
|
||||
|
@ -549,7 +549,7 @@ LINK_FLAGS= \
|
|||
$(LINKFLAGS_DEBUG) \
|
||||
kernel32.lib shell32.lib user32.lib gdi32.lib oldnames.lib advapi32.lib \
|
||||
comdlg32.lib uuid.lib oleaut32.lib ole32.lib \
|
||||
!if "$(_MSC_VER)"!="1100"
|
||||
!if "$(_MSC_VER)"!="1100" && "$(_MSC_VER)"!="1200"
|
||||
uuid2.lib \
|
||||
!endif
|
||||
/subsystem:windows \
|
||||
|
@ -1987,7 +1987,7 @@ install: \
|
|||
!ENDIF
|
||||
!endif
|
||||
|
||||
!if "$(_MSC_VER)" == "1100"
|
||||
!if "$(_MSC_VER)" == "1100" || "$(_MSC_VER)" == "1200"
|
||||
REBASE=rebase.exe
|
||||
!if [for %i in (. %PATH%) do $(QUIET)if exist %i\$(REBASE) echo %i\$(REBASE) > rebase.yes]
|
||||
!endif
|
||||
|
|
|
@ -636,9 +636,9 @@ CLanguagesPrefs::InitDialog()
|
|||
{
|
||||
// Load the bitmaps
|
||||
#ifdef _WIN32
|
||||
m_hUpBitmap = LoadImage(m_hInstance, MAKEINTRESOURCE(IDB_UPARROW), IMAGE_BITMAP,
|
||||
m_hUpBitmap = (HBITMAP)LoadImage(m_hInstance, MAKEINTRESOURCE(IDB_UPARROW), IMAGE_BITMAP,
|
||||
0, 0, LR_LOADTRANSPARENT | LR_LOADMAP3DCOLORS);
|
||||
m_hDownBitmap = LoadImage(m_hInstance, MAKEINTRESOURCE(IDB_DOWNARROW), IMAGE_BITMAP,
|
||||
m_hDownBitmap = (HBITMAP)LoadImage(m_hInstance, MAKEINTRESOURCE(IDB_DOWNARROW), IMAGE_BITMAP,
|
||||
0, 0, LR_LOADTRANSPARENT | LR_LOADMAP3DCOLORS);
|
||||
#else
|
||||
m_hUpBitmap = LoadTransparentBitmap(m_hInstance, IDB_UPARROW);
|
||||
|
|
|
@ -1,75 +0,0 @@
|
|||
IGNORE_MANIFEST=1
|
||||
# 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.
|
||||
|
||||
|
||||
!if "$(MOZ_BITS)" == "16"
|
||||
DLL_CFLAGS=/GA /GEd /GEf /D_WINDLL
|
||||
|
||||
!ifndef MOZ_DEBUG
|
||||
OPTIMIZER=-O1 -UDEBUG -DNDEBUG
|
||||
!endif
|
||||
!endif
|
||||
|
||||
DLLNAME = brpref$(MOZ_BITS)
|
||||
PDBFILE = $(DLLNAME).pdb
|
||||
MAPFILE = $(DLLNAME).map
|
||||
DLL =.\$(OBJDIR)\$(DLLNAME).dll
|
||||
DEFFILE = brpref$(MOZ_BITS).def
|
||||
RESFILE = brpref.res
|
||||
MAKE_OBJ_TYPE = DLL
|
||||
|
||||
LLIBS = $(DIST)\lib\prefuuid.lib \
|
||||
$(DIST)\lib\dllcom.lib \
|
||||
$(DIST)\lib\nsdlg$(MOZ_BITS).lib \
|
||||
$(DIST)\lib\xppref$(MOZ_BITS).lib
|
||||
LLIBS16 = ole2.lib shell.lib commdlg.lib toolhelp.lib
|
||||
LLIBS32 = ole32.lib comdlg32.lib shell32.lib uuid.lib
|
||||
|
||||
!if "$(_MSC_VER)" != "1100"
|
||||
LLIBS32 = $(LLIBS32) uuid2.lib
|
||||
!endif
|
||||
!if defined(MOZ_DEBUG) && defined(GLOWCODE)
|
||||
LLIBS32 = $(LLIBS32) $(GLOWDIR)\glowcode.lib
|
||||
!endif
|
||||
|
||||
!if "$(MOZ_BITS)" == "32"
|
||||
LLIBS = $(LLIBS) $(LLIBS32)
|
||||
!else
|
||||
LLIBS = $(LLIBS) $(LLIBS16)
|
||||
!endif
|
||||
|
||||
MODULE=winprefs
|
||||
DEPTH=..\..\..\..\..
|
||||
REQUIRES=dllcom winprefs pref dbm nspr js libreg
|
||||
CPPSRCS=brpref.cpp pages.cpp brpages.cpp appages.cpp advpages.cpp
|
||||
CPP_OBJS=.\$(OBJDIR)\brpref.obj .\$(OBJDIR)\pages.obj \
|
||||
.\$(OBJDIR)\brpages.obj .\$(OBJDIR)\appages.obj \
|
||||
.\$(OBJDIR)\advpages.obj
|
||||
!if "$(MOZ_BITS)" != "16"
|
||||
LINCS=-I$(XPDIST)\public\dllcom -I$(XPDIST)\public\winprefs \
|
||||
-I$(XPDIST)\public\pref -I$(XPDIST)\public\dbm \
|
||||
-I$(XPDIST)\public\nspr -I$(XPDIST)\public\js \
|
||||
-I$(XPDIST)\public\libreg
|
||||
!endif
|
||||
|
||||
!include "$(DEPTH)\config\rules.mak"
|
||||
|
||||
libs:: $(DLL)
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin
|
||||
!if "$(WINOS)" != "WIN95"
|
||||
@$(DIST)\bin\dllreg $(DIST)\bin\$(DLLNAME).dll
|
||||
!endif
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib
|
|
@ -1,358 +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.
|
||||
*/
|
||||
|
||||
#include "pch.h"
|
||||
#ifndef _WIN32
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#include <assert.h>
|
||||
#include "cdialog.h"
|
||||
|
||||
// This is the window procedure that we specified when we subclassed the
|
||||
// dialog. This routine is called to process messages sent to the dialog,
|
||||
// and is called before DefDlgproc is called
|
||||
LRESULT CALLBACK
|
||||
WindowFunc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
CDialog *pDialog;
|
||||
LRESULT result;
|
||||
|
||||
// Get the "this" pointer for the dialog, which we saved away in
|
||||
// the dialog specific user data
|
||||
pDialog = (CDialog*)GetWindowLong(hwndDlg, DWL_USER);
|
||||
assert(pDialog);
|
||||
assert(pDialog->m_hwndDlg == hwndDlg);
|
||||
|
||||
// Dispatch the message to the dialog object
|
||||
result = pDialog->WindowProc(uMsg, wParam, lParam);
|
||||
|
||||
if (uMsg == WM_DESTROY) {
|
||||
// Stop subclassing the window
|
||||
SubclassWindow(hwndDlg, pDialog->m_wpOriginalProc);
|
||||
pDialog->m_wpOriginalProc = NULL;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Callback function for processing messages sent to a dialog box.
|
||||
// The dialog box function is called by the Windows dialog box
|
||||
// window procedure DefDlgProc
|
||||
BOOL CALLBACK
|
||||
DialogFunc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (uMsg == WM_INITDIALOG) {
|
||||
CDialog *pDialog;
|
||||
|
||||
// The lParam is the "this" pointer
|
||||
pDialog = (CDialog*)lParam;
|
||||
pDialog->m_hwndDlg = hwndDlg;
|
||||
|
||||
// Save the "this" pointer in dialog specific user data
|
||||
SetWindowLong(hwndDlg, DWL_USER, (LONG)pDialog);
|
||||
|
||||
// Subclass the window
|
||||
assert(pDialog->m_wpOriginalProc == NULL);
|
||||
pDialog->m_wpOriginalProc = SubclassWindow(hwndDlg, WindowFunc);
|
||||
assert(pDialog->m_wpOriginalProc);
|
||||
|
||||
// Let the dialog handle WM_INITDIALOG
|
||||
return pDialog->InitDialog();
|
||||
}
|
||||
|
||||
// WM_INITDIALOG is the only message we handle here. All others are
|
||||
// handled in the window procedure we passed in when we subclassed
|
||||
// the window
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CDialog implementation
|
||||
|
||||
CDialog::CDialog(HINSTANCE hInstance, UINT nTemplateID)
|
||||
{
|
||||
m_hInstance = hInstance;
|
||||
m_nTemplateID = nTemplateID;
|
||||
m_hwndDlg = NULL;
|
||||
m_wpOriginalProc = NULL;
|
||||
}
|
||||
|
||||
BOOL
|
||||
CDialog::Create(HWND hwndOwner)
|
||||
{
|
||||
assert(m_hwndDlg == NULL);
|
||||
return CreateDialogParam(m_hInstance, MAKEINTRESOURCE(m_nTemplateID), hwndOwner,
|
||||
(DLGPROC)DialogFunc, (LPARAM)this) != NULL;
|
||||
}
|
||||
|
||||
int
|
||||
CDialog::DoModal(HWND hwndOwner)
|
||||
{
|
||||
int nResult;
|
||||
|
||||
assert(m_hwndDlg == NULL);
|
||||
nResult = DialogBoxParam(m_hInstance, MAKEINTRESOURCE(m_nTemplateID), hwndOwner,
|
||||
(DLGPROC)DialogFunc, (LPARAM)this);
|
||||
m_hwndDlg = NULL;
|
||||
return nResult;
|
||||
}
|
||||
|
||||
BOOL
|
||||
CDialog::DestroyWindow()
|
||||
{
|
||||
assert(m_hwndDlg);
|
||||
if (::DestroyWindow(m_hwndDlg)) {
|
||||
m_hwndDlg = NULL;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL
|
||||
CDialog::InitDialog()
|
||||
{
|
||||
// Transfer data to the dialog
|
||||
DoTransfer(FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL
|
||||
CDialog::OnCommand(int id, HWND hwndCtl, UINT notifyCode)
|
||||
{
|
||||
if (id == IDOK) {
|
||||
OnOK();
|
||||
return TRUE;
|
||||
|
||||
} else if (id == IDCANCEL) {
|
||||
OnCancel();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
CDialog::OnOK()
|
||||
{
|
||||
if (DoTransfer(TRUE))
|
||||
EndDialog(m_hwndDlg, IDOK);
|
||||
}
|
||||
|
||||
void
|
||||
CDialog::OnCancel()
|
||||
{
|
||||
EndDialog(m_hwndDlg, IDCANCEL);
|
||||
}
|
||||
|
||||
void
|
||||
CDialog::EnableDlgItem(UINT nCtlID, BOOL bEnable)
|
||||
{
|
||||
HWND hwndCtl = GetDlgItem(m_hwndDlg, nCtlID);
|
||||
|
||||
assert(hwndCtl);
|
||||
EnableWindow(hwndCtl, bEnable);
|
||||
}
|
||||
|
||||
// Data transfer for radio buttons. The ID must be the first in a group of
|
||||
// auto radio buttons
|
||||
void
|
||||
CDialog::RadioButtonTransfer(int nIDButton, int &value, BOOL bSaveAndValidate)
|
||||
{
|
||||
HWND hwndCtl = GetDlgItem(m_hwndDlg, nIDButton);
|
||||
|
||||
assert(GetWindowStyle(hwndCtl) & WS_GROUP);
|
||||
assert(SendMessage(hwndCtl, WM_GETDLGCODE, 0, 0) & DLGC_RADIOBUTTON);
|
||||
|
||||
if (bSaveAndValidate)
|
||||
value = -1; // value if no radio button is set
|
||||
|
||||
// Walk all the controls in the group. Stop when we get to the start of another group
|
||||
// or there are no controls left
|
||||
int iButton = 0;
|
||||
do {
|
||||
if (SendMessage(hwndCtl, WM_GETDLGCODE, 0, 0) & DLGC_RADIOBUTTON) {
|
||||
// Control is a radio button
|
||||
if (bSaveAndValidate) {
|
||||
if (Button_GetCheck(hwndCtl) != 0) {
|
||||
assert(value == -1); // only one button in the group should be set
|
||||
value = iButton;
|
||||
}
|
||||
} else {
|
||||
// Set the button state
|
||||
Button_SetCheck(hwndCtl, iButton == value);
|
||||
}
|
||||
|
||||
iButton++;
|
||||
#ifdef _DEBUG
|
||||
} else {
|
||||
OutputDebugString("Warning: skipping non-radio button in group.\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
hwndCtl = GetNextSibling(hwndCtl);
|
||||
|
||||
} while (hwndCtl && !(GetWindowStyle(hwndCtl) & WS_GROUP));
|
||||
}
|
||||
|
||||
// Data transfer for a check box
|
||||
void
|
||||
CDialog::CheckBoxTransfer(int nIDButton, BOOL &value, BOOL bSaveAndValidate)
|
||||
{
|
||||
if (bSaveAndValidate)
|
||||
value = IsDlgButtonChecked(m_hwndDlg, nIDButton);
|
||||
else
|
||||
CheckDlgButton(m_hwndDlg, nIDButton, value);
|
||||
}
|
||||
|
||||
// Data transfer for a edit field. Transfers the value as a CString
|
||||
void
|
||||
CDialog::EditFieldTransfer(int nIDEdit, CString &str, BOOL bSaveAndValidate)
|
||||
{
|
||||
HWND hwndCtl = GetDlgItem(m_hwndDlg, nIDEdit);
|
||||
|
||||
assert(hwndCtl);
|
||||
if (bSaveAndValidate)
|
||||
str.GetWindowText(hwndCtl);
|
||||
else
|
||||
Edit_SetText(hwndCtl, (const char *)str);
|
||||
}
|
||||
|
||||
// Data transfer for a edit field. Transfers the value as an integer
|
||||
void
|
||||
CDialog::EditFieldTransfer(int nIDEdit, int &value, BOOL bSaveAndValidate)
|
||||
{
|
||||
HWND hwndCtl = GetDlgItem(m_hwndDlg, nIDEdit);
|
||||
char szBuf[32];
|
||||
|
||||
assert(hwndCtl);
|
||||
if (bSaveAndValidate) {
|
||||
Edit_GetText(hwndCtl, szBuf, sizeof(szBuf));
|
||||
value = atoi(szBuf);
|
||||
|
||||
} else {
|
||||
wsprintf(szBuf, "%i", value);
|
||||
Edit_SetText(hwndCtl, szBuf);
|
||||
}
|
||||
}
|
||||
|
||||
// Data transfer for a edit field. Transfers the value as an unsigned integer
|
||||
void
|
||||
CDialog::EditFieldTransfer(int nIDEdit, UINT &value, BOOL bSaveAndValidate)
|
||||
{
|
||||
HWND hwndCtl = GetDlgItem(m_hwndDlg, nIDEdit);
|
||||
char szBuf[32];
|
||||
|
||||
assert(hwndCtl);
|
||||
if (bSaveAndValidate) {
|
||||
Edit_GetText(hwndCtl, szBuf, sizeof(szBuf));
|
||||
value = (UINT)strtoul(szBuf, NULL, 10);
|
||||
|
||||
} else {
|
||||
wsprintf(szBuf, "%u", value);
|
||||
Edit_SetText(hwndCtl, szBuf);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CDialog::ListBoxTransfer(int nIDList, int &index, BOOL bSaveAndValidate)
|
||||
{
|
||||
HWND hwndCtl = GetDlgItem(m_hwndDlg, nIDList);
|
||||
|
||||
if (bSaveAndValidate)
|
||||
index = ListBox_GetCurSel(hwndCtl);
|
||||
else
|
||||
ListBox_SetCurSel(hwndCtl, index);
|
||||
}
|
||||
|
||||
void
|
||||
CDialog::ListBoxTransfer(int nIDList, CString &str, BOOL bSaveAndValidate)
|
||||
{
|
||||
HWND hwndCtl = GetDlgItem(m_hwndDlg, nIDList);
|
||||
|
||||
if (bSaveAndValidate) {
|
||||
int nIndex = ListBox_GetCurSel(hwndCtl);
|
||||
|
||||
if (nIndex == -1)
|
||||
str.Empty();
|
||||
else
|
||||
ListBox_GetText(hwndCtl, nIndex,
|
||||
str.BufferSetLength(ListBox_GetTextLen(hwndCtl, nIndex)));
|
||||
|
||||
} else {
|
||||
// Set the current selection
|
||||
if (ListBox_SelectString(hwndCtl, -1, (LPCSTR)str) == LB_ERR) {
|
||||
#ifdef _DEBUG
|
||||
OutputDebugString("Warning: no listbox item selected.\n");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CDialog::ComboBoxTransfer(int nIDCombo, int &index, BOOL bSaveAndValidate)
|
||||
{
|
||||
HWND hwndCtl = GetDlgItem(m_hwndDlg, nIDCombo);
|
||||
|
||||
if (bSaveAndValidate)
|
||||
index = ComboBox_GetCurSel(hwndCtl);
|
||||
else
|
||||
ComboBox_SetCurSel(hwndCtl, index);
|
||||
}
|
||||
|
||||
void
|
||||
CDialog::ComboBoxTransfer(int nIDCombo, CString &str, BOOL bSaveAndValidate)
|
||||
{
|
||||
HWND hwndCtl = GetDlgItem(m_hwndDlg, nIDCombo);
|
||||
|
||||
if (bSaveAndValidate) {
|
||||
int nLen = ComboBox_GetTextLength(hwndCtl);
|
||||
|
||||
if (nLen == -1) {
|
||||
// GetWindowTextLength() doesn't work for drop down combo boxes
|
||||
// on Win 3.1, so assume a max of 255 characters
|
||||
nLen = 255;
|
||||
}
|
||||
|
||||
ComboBox_GetText(hwndCtl, str.BufferSetLength(nLen), nLen + 1);
|
||||
|
||||
} else if (ComboBox_SelectString(hwndCtl, -1, (LPARAM)(LPCSTR)str) == CB_ERR) {
|
||||
SetWindowText(hwndCtl, (LPCSTR)str); // just set the edit text
|
||||
}
|
||||
}
|
||||
|
||||
LRESULT
|
||||
CDialog::WindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (uMsg) {
|
||||
case WM_COMMAND:
|
||||
if (OnCommand(GET_WM_COMMAND_ID(wParam, lParam),
|
||||
GET_WM_COMMAND_HWND(wParam, lParam),
|
||||
GET_WM_COMMAND_CMD(wParam, lParam)))
|
||||
return 0; // command was handled
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Call the original window procedure
|
||||
assert(m_wpOriginalProc);
|
||||
return CallWindowProc((FARPROC)m_wpOriginalProc, m_hwndDlg, uMsg, wParam, lParam);
|
||||
}
|
||||
|
|
@ -1,74 +0,0 @@
|
|||
IGNORE_MANIFEST=1
|
||||
# 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.
|
||||
|
||||
|
||||
!if "$(MOZ_BITS)" == "16"
|
||||
LCFLAGS=/GEf
|
||||
|
||||
!ifndef MOZ_DEBUG
|
||||
OPTIMIZER=-O1 -UDEBUG -DNDEBUG
|
||||
!endif
|
||||
!endif
|
||||
|
||||
DLLNAME = nsdlg$(MOZ_BITS)
|
||||
PDBFILE = $(DLLNAME).pdb
|
||||
MAPFILE = $(DLLNAME).map
|
||||
DLL =.\$(OBJDIR)\$(DLLNAME).dll
|
||||
DEFFILE = nsdlg$(MOZ_BITS).def
|
||||
MAKE_OBJ_TYPE = DLL
|
||||
|
||||
!if "$(MOZ_BITS)" == "32"
|
||||
OBJS = $(OBJS) .\$(OBJDIR)\nsdlg.obj
|
||||
!endif
|
||||
|
||||
LLIBS = $(DIST)\lib\prefuuid.lib
|
||||
LLIBS16 = ole2.lib
|
||||
LLIBS32 = ole32.lib uuid.lib
|
||||
|
||||
!if "$(_MSC_VER)" != "1100"
|
||||
LLIBS32 = $(LLIBS32) uuid2.lib
|
||||
!endif
|
||||
!if defined(MOZ_DEBUG) && defined(GLOWCODE)
|
||||
LLIBS32 = $(LLIBS32) $(GLOWDIR)\glowcode.lib
|
||||
!endif
|
||||
|
||||
!if "$(MOZ_BITS)" == "32"
|
||||
LLIBS = $(LLIBS) $(LLIBS32)
|
||||
!else
|
||||
LLIBS = $(LLIBS) $(LLIBS16)
|
||||
!endif
|
||||
|
||||
!if "$(MOZ_BITS)" == "32"
|
||||
LLFLAGS=/entry:DllEntryPoint
|
||||
!endif
|
||||
|
||||
MODULE=winprefs
|
||||
DEPTH=..\..\..\..\..
|
||||
REQUIRES=winprefs
|
||||
CPPSRCS=cstring.cpp cdialog.cpp cppageex.cpp colorbtn.cpp dlgutil.cpp \
|
||||
bitmpbtn.cpp
|
||||
CPP_OBJS=.\$(OBJDIR)\cstring.obj .\$(OBJDIR)\cdialog.obj \
|
||||
.\$(OBJDIR)\cppageex.obj .\$(OBJDIR)\colorbtn.obj \
|
||||
.\$(OBJDIR)\dlgutil.obj .\$(OBJDIR)\bitmpbtn.obj
|
||||
!if "$(MOZ_BITS)" != "16"
|
||||
LINCS=-I$(XPDIST)\public\winprefs
|
||||
!endif
|
||||
|
||||
!include "$(DEPTH)\config\rules.mak"
|
||||
|
||||
libs:: $(DLL)
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib
|
|
@ -518,7 +518,7 @@ CPropertyFrameDialog::OnPaint(HDC hdc)
|
|||
else if (m_hBrush)
|
||||
FillRect(hdc, &rect, m_hBrush);
|
||||
else
|
||||
FillRect(hdc, &rect, GetStockObject(GRAY_BRUSH));
|
||||
FillRect(hdc, &rect, (HBRUSH)GetStockObject(GRAY_BRUSH));
|
||||
|
||||
// Display the title and description
|
||||
if (m_pCurPage) {
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
IGNORE_MANIFEST=1
|
||||
# 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.
|
||||
|
||||
|
||||
DLLNAME = prefui$(MOZ_BITS)
|
||||
PDBFILE = $(DLLNAME).pdb
|
||||
MAPFILE = $(DLLNAME).map
|
||||
DLL =.\$(OBJDIR)\$(DLLNAME).dll
|
||||
DEFFILE = prefui$(MOZ_BITS).def
|
||||
RESFILE = prefui.res
|
||||
MAKE_OBJ_TYPE = DLL
|
||||
|
||||
!if "$(MOZ_BITS)" == "32"
|
||||
OBJS = $(OBJS) .\$(OBJDIR)\grayramp.obj
|
||||
!else
|
||||
OBJS = $(OBJS) .\$(OBJDIR)\treeview.obj
|
||||
!endif
|
||||
|
||||
LLIBS = $(DIST)\lib\prefuuid.lib
|
||||
LLIBS16 = ole2.lib
|
||||
LLIBS32 = ole32.lib uuid.lib
|
||||
|
||||
!if "$(_MSC_VER)" != "1100"
|
||||
LLIBS32 = $(LLIBS32) uuid2.lib
|
||||
!endif
|
||||
!if defined(MOZ_DEBUG) && defined(GLOWCODE)
|
||||
LLIBS32 = $(LLIBS32) $(GLOWDIR)\glowcode.lib
|
||||
!endif
|
||||
|
||||
!if "$(MOZ_BITS)" == "32"
|
||||
LLIBS = $(LLIBS) $(LLIBS32)
|
||||
!else
|
||||
LLIBS = $(LLIBS) $(LLIBS16)
|
||||
!endif
|
||||
|
||||
!if "$(MOZ_BITS)" == "32"
|
||||
LLFLAGS=/entry:DllEntryPoint
|
||||
!endif
|
||||
|
||||
MODULE=winprefs
|
||||
DEPTH=..\..\..\..\..
|
||||
REQUIRES=winprefs
|
||||
CPPSRCS=prefui.cpp framedlg.cpp pagesite.cpp
|
||||
CPP_OBJS=.\$(OBJDIR)\prefui.obj .\$(OBJDIR)\framedlg.obj \
|
||||
.\$(OBJDIR)\pagesite.obj
|
||||
!if "$(MOZ_BITS)" != "16"
|
||||
LINCS=-I$(XPDIST)\public\winprefs
|
||||
!endif
|
||||
|
||||
!include "$(DEPTH)\config\rules.mak"
|
||||
|
||||
libs:: $(DLL)
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib
|
||||
|
Загрузка…
Ссылка в новой задаче