Checks for ender only in #ifdef ENDERS mjudge

This commit is contained in:
mjudge%netscape.com 1998-09-10 21:15:28 +00:00
Родитель 3f86b47ae3
Коммит 2dd53d3a78
17 изменённых файлов: 742 добавлений и 259 удалений

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

@ -27,6 +27,8 @@
#include "netsdoc.h" //ENDER
#include "edview.h" //ENDER
#include "edt.h" //ENDER
#include "embdlist.h"
extern char * EDT_NEW_DOC_URL; //ENDER
#endif //ENDER
@ -1549,7 +1551,7 @@ void CPaneCX::DisplayBuiltin(MWContext *pContext, int iLocation, LO_BuiltinStruc
{
HWND cView = GetPane();
CWnd* cWnd = NULL;
char* classid = NULL;
char* type = NULL;
if ( !pBuiltin_struct || !(cWnd = CWnd::FromHandle(cView))){
XP_ASSERT(FALSE); //very invalid stuff.
return;
@ -1561,10 +1563,10 @@ void CPaneCX::DisplayBuiltin(MWContext *pContext, int iLocation, LO_BuiltinStruc
int height = pBuiltin_struct->height;
#ifdef ENDER
classid = LO_GetBuiltInAttribute(pBuiltin_struct, "classid"); //it is very possible to have NULL because of bad HTML
if (!classid)
type = LO_GetBuiltInAttribute(pBuiltin_struct, "type"); //it is very possible to have NULL because of bad HTML
if (!type)
TRACE("Bad object tag NULL\n");
if (!classid || XP_STRCMP(classid,"builtin:htmlarea")){ //left to default to tree here
if (!type || (XP_STRCMP(type,"builtin/htmlarea") && XP_STRCMP(type,"builtin/attachments"))){ //left to default to tree here
#endif //ENDER
char* url = LO_GetBuiltInAttribute(pBuiltin_struct, "data");
@ -1580,7 +1582,7 @@ void CPaneCX::DisplayBuiltin(MWContext *pContext, int iLocation, LO_BuiltinStruc
}
#ifdef ENDER
}
else if (classid && !XP_STRCMP(classid,"builtin:htmlarea")) { //ENDER
else if (type && !XP_STRCMP(type,"builtin/htmlarea")) { //ENDER
if (pBuiltin_struct->FE_Data == NULL) {
//create a new CPaneCX
CNetscapeDoc* pDoc = new CNetscapeDoc();
@ -1614,25 +1616,46 @@ void CPaneCX::DisplayBuiltin(MWContext *pContext, int iLocation, LO_BuiltinStruc
}
}
}
else if (classid)
TRACE("Bad object tag %s\n",classid);
else if (type && !XP_STRCMP(type,"builtin/attachments"))
{
if (pBuiltin_struct->FE_Data == NULL)
{
CEmbeddedAttachList *pWnd = new CEmbeddedAttachList();
if (pWnd)
{
if (pWnd->Create(cWnd,IDC_ATTACH))
pBuiltin_struct->FE_Data = pWnd;
else
delete pWnd;
RECT rect;
rect.left=xPos;
rect.top=yPos;
rect.right=xPos+width;
rect.bottom=yPos+height;
pWnd->MoveWindow(&rect,TRUE);
pWnd->ShowWindow(SW_SHOW);
}
}
}
else if (type)
TRACE("Bad object tag %s\n",type);
#endif //ENDER
}
void CPaneCX::FreeBuiltinElement(MWContext *pContext, LO_BuiltinStruct *pBuiltin_struct)
{
char* classid = NULL;
char* type = NULL;
if ( !pBuiltin_struct || !pContext ){
XP_ASSERT(FALSE); //very invalid stuff.
return;
}
#ifdef ENDER
classid = LO_GetBuiltInAttribute(pBuiltin_struct, "classid"); //it is very possible to have NULL because of bad HTML
if (!classid)
type = LO_GetBuiltInAttribute(pBuiltin_struct, "type"); //it is very possible to have NULL because of bad HTML
if (!type)
TRACE("Bad object tag NULL\n");
if (!classid || XP_STRCMP(classid,"builtin:htmlarea")){ //left to default to tree here
if (!type || (XP_STRCMP(type,"builtin/htmlarea") && XP_STRCMP(type,"builtin/attachments"))){ //left to default to tree here
#endif //ENDER
CRDFContentView* pWnd = (CRDFContentView*)pBuiltin_struct->FE_Data;
if (pWnd)
@ -1640,7 +1663,7 @@ void CPaneCX::FreeBuiltinElement(MWContext *pContext, LO_BuiltinStruct *pBuiltin
#ifdef ENDER
}
else
if (classid && !XP_STRCMP(classid,"builtin:htmlarea")){
if (type && !XP_STRCMP(type,"builtin/htmlarea")){
CObject* pObj = (CObject *)pBuiltin_struct->FE_Data;
if (pObj && pObj->IsKindOf( RUNTIME_CLASS( CNetscapeEditView ))){
CNetscapeEditView* pWnd = (CNetscapeEditView *)pObj;
@ -1658,5 +1681,14 @@ void CPaneCX::FreeBuiltinElement(MWContext *pContext, LO_BuiltinStruct *pBuiltin
pWnd->DestroyWindow();
}
}
else if (type&& !XP_STRCMP(type,"builtin/attachments"))
{
CObject* pObj = (CObject *)pBuiltin_struct->FE_Data;
if (pObj && pObj->IsKindOf( RUNTIME_CLASS( CEmbeddedAttachList )))
{
((CEmbeddedAttachList *)pObj)->DestroyWindow();
}
}
#endif //ENDER
}

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

@ -49,7 +49,7 @@ CComboToolBar::CComboToolBar()
// This is OK for default small toolbar,
// but we will try to get better estimate when toolbar is created
m_nComboTop = 3;
m_pCommandView = NULL;
m_pEnableConfig = NULL;
m_sizeImage.cx = m_sizeImage.cy = 16;
m_nIDBitmap = 0;
@ -96,13 +96,13 @@ END_MESSAGE_MAP()
BOOL CComboToolBar::CreateFloater(CWnd* pParent, UINT nIDBar, UINT nIDCaption,
UINT * pIDArray, int nIDCount, // Command ID array and count
UINT * pIDArray2,int nIDCount2,
UINT nIDBitmap, SIZE sizeButton, SIZE sizeImage )
UINT nIDBitmap, SIZE sizeButton, SIZE sizeImage ,CView *pCommandView /*=NULL*/)
{
ASSERT( pParent );
ASSERT(nIDCount >= 1); // must be at least one of them
ASSERT(pIDArray == NULL ||
AfxIsValidAddress(pIDArray, sizeof(UINT) * nIDCount, FALSE));
m_pCommandView = pCommandView;
DWORD dwStyle = WS_CHILD|CBRS_TOOLTIPS|CBRS_BOTTOM|CBRS_FLYBY|CBRS_SIZE_DYNAMIC;
// Toolbar is NOT initially visible
@ -220,7 +220,7 @@ BOOL CComboToolBar::CreateFloater(CWnd* pParent, UINT nIDBar, UINT nIDCaption,
// ASSUME WE WANT DOCKING AND TOOLTIPS!
EnableDocking(CBRS_ALIGN_BOTTOM);
// EnableDocking(CBRS_ALIGN_BOTTOM);
// Set caption that shows if toolbar is floating
if ( nIDCaption ) {
@ -570,8 +570,7 @@ void CComboToolBar::_SetCheck( int iIndex, int iCheck )
#ifdef FEATURE_EDCOMBTB
#include "edtcombtb.i01"
#endif
// CToolBar::SetCheck(iIndex,iCheck);
}
@ -731,10 +730,17 @@ void CComboToolBar::SetCNSToolbar(CNSToolbar2 *pToolbar)
void CComboToolBar::OnUpdateCmdUI( CFrameWnd* pTarget, BOOL bDisableIfNoHndler )
{
if (m_pToolbar)
#if 0
if (m_pToolbar)
m_pToolbar->OnUpdateCmdUI(pTarget, bDisableIfNoHndler);
CToolBar::OnUpdateCmdUI(pTarget, bDisableIfNoHndler);
#endif
if (m_pToolbar)
m_pToolbar->OnUpdateCmdUI(pTarget, FALSE);
CToolBar::OnUpdateCmdUI(pTarget, FALSE);
}
CSize CComboToolBar::CalcDynamicLayout(int nLength, DWORD dwMode )
@ -789,6 +795,7 @@ void CComboToolBar::OnLButtonDown(UINT nFlags, CPoint point)
PostMessage(WM_LBUTTONUP, (WPARAM)nFlags, MAKELONG(point.x, point.y) );
return;
}
}
}
@ -804,9 +811,28 @@ void CComboToolBar::OnLButtonUp(UINT nFlags, CPoint point)
// Send this message to the customizable toolbar for dragging
MapWindowPoints(GetParent(), &point, 1);
GetParent()->SendMessage(WM_LBUTTONUP, nFlags, MAKELPARAM(point.x, point.y));
GetParent()->SendMessage(WM_LBUTTONUP, nFlags, MAKELPARAM(point.x, point.y));
if (m_pCommandView)
{
LPTB_CONTROLINFO pInfo = m_pInfo;
for ( int i = 0; i < m_nCount; i++, pInfo++ )
{
// Test if we clicked inside a button
if ( pInfo->bIsButton )
{
CRect rect;
GetItemRect( i, &rect );
if ( rect.PtInRect(point))
{
// Trigger command
m_pCommandView->PostMessage(WM_COMMAND, (WPARAM)pInfo->nID , NULL);
m_pCommandView->SetFocus();
return;
}
}
}
}
}
void CComboToolBar::OnMouseMove(UINT nFlags, CPoint point)
@ -838,5 +864,39 @@ void CComboToolBar::OnSize( UINT nType, int cx, int cy )
CToolBar::OnSize(nType, cx, cy);
}
BOOL
CComboToolBar::OnCommand(WPARAM wParam, LPARAM lParam )
{
if (m_pCommandView && HIWORD(wParam) == CBN_SELENDOK )
{
LPTB_CONTROLINFO pInfo = m_pInfo;
for ( int i = 0; i < m_nCount; i++, pInfo++ )
{
// Test if we clicked inside a button
if ( pInfo->pComboBox )
{
CRect rect;
GetItemRect( i, &rect );
if ( pInfo->nID == (LONG)LOWORD(wParam))
{
// Trigger command
m_pCommandView->SetFocus();
return m_pCommandView->SendMessage(WM_COMMAND, wParam , lParam);
}
}
}
}
else if (m_pCommandView && LOWORD(wParam) ==ID_GET_COLOR)
{
return m_pCommandView->SendMessage(WM_COMMAND, wParam , lParam);
}
return CToolBar::OnCommand(wParam,lParam);
}
#endif // EDITOR

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

@ -86,7 +86,7 @@ private:
UINT m_nComboTop;
BOOL * m_pEnableConfig;
CNSToolbar2* m_pToolbar;
CView * m_pCommandView; //view to send button commands to.
#ifdef XP_WIN16
CNSToolTip * m_pToolTip;
#endif
@ -111,11 +111,14 @@ public:
BOOL CreateFloater(CWnd* pParent, UINT nIDBar, UINT nIDCaption,
UINT * pIDArray, int nIDCount, // Command ID array and count
UINT * pIDArray2,int nIDCount2,
UINT nIDBitmap, SIZE sizeButton, SIZE sizeImage );
UINT nIDBitmap, SIZE sizeButton, SIZE sizeImage, CView *pCommandView = NULL);
// After creating toobar, call this to enable/disable action on button down
// Used primarily when action is creation of a CDropdownToolbar
void SetDoOnButtonDown( UINT nID, BOOL bSet );
//need place to send commands in case this toolbar not in proper chain of messages.
void SetCommandView(CView *pView){ m_pCommandView = pView;}
// After creating toobar, call this to set combobox command ID and its full size
// (including dropdown height) of each combobox used
// If nHeight = 0, Height is calculated from number of items.
@ -186,11 +189,10 @@ public:
// How big do we need to be
CSize CalcDynamicLayout(int nLength, DWORD dwMode );
// Implementation
public:
virtual ~CComboToolBar();
virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam );
// Generated message map functions
protected:
#ifdef XP_WIN16

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

@ -406,7 +406,8 @@ void WFE_ExitComposer()
CEditToolBarController::CEditToolBarController(CWnd * pParent) :
m_pWnd(pParent),
m_iFontColorOtherIndex(0),
m_pCharacterToolbar(0)
m_pCharacterToolbar(0),
m_pCommandView(NULL)
{
}
@ -416,7 +417,16 @@ CEditToolBarController::~CEditToolBarController()
delete m_pCharacterToolbar;
}
BOOL CEditToolBarController::CreateEditBars(MWContext *pMWContext, BOOL bIsFloating, unsigned ett)
void CEditToolBarController::setEmbeddedView(CView *pView)
{
m_pCommandView = pView;
}
BOOL CEditToolBarController::CreateEditBars(MWContext *pMWContext, CView *pCommandView, unsigned ett)
{
// Initialize things needed by both CNetscapeEditFrame and CComposeFrame
CGenericFrame *pParent = (CGenericFrame*)GetParent();
@ -455,7 +465,7 @@ BOOL CEditToolBarController::CreateEditBars(MWContext *pMWContext, BOOL bIsFloat
if( ett & DISPLAY_CHARACTER_TOOLBAR ){
// We don't use the "Insert Object" last item if we are displaying the edit toolbar,
// which has these items
if (!bIsFloating)
if (!pCommandView)
{
if (!m_wndCharacterBar.Create(ett & DISPLAY_EDIT_TOOLBAR, GetParent(), IDW_PARA_TOOLBAR, IDS_CHAR_TOOLBAR_CAPTION,
nIDCharacterBarArray, CHARBAR_ID_COUNT,
@ -473,7 +483,8 @@ BOOL CEditToolBarController::CreateEditBars(MWContext *pMWContext, BOOL bIsFloat
nIDCharacterBarArray, CHARBAR_ID_COUNT, nIDCharFloatButtonBarArray,CHARBUTTONBARFLOAT_ID_COUNT ,
IDB_EDIT_FLOAT_TOOLBAR,
CSize(27, 22),
CSize(20, 16) ) )
CSize(20, 16),
pCommandView) )
return FALSE;
}

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

@ -79,15 +79,16 @@ public:
inline CComboToolBar* GetCharacterBar() { return( ::IsWindow(m_wndCharacterBar.m_hWnd) ? &m_wndCharacterBar : 0); }
inline CCommandToolbar *GetCNSToolbar() { if (m_pCharacterToolbar) return( ::IsWindow(m_pCharacterToolbar->m_hWnd) ? m_pCharacterToolbar : 0);else return FALSE; }
// Pass in MWContext to get palette to be used by comboboxes and display status messages
BOOL CreateEditBars(MWContext *pMWContext, BOOL isFloating,
BOOL CreateEditBars(MWContext *pMWContext, CView *pEditView,
unsigned ett = DISPLAY_EDIT_TOOLBAR|DISPLAY_CHARACTER_TOOLBAR);
// Calls appropriate GetCurSel(), but returns INDEX_OTHER if "Other..." item selected
int GetSelectedFontFaceIndex();
int GetSelectedFontColorIndex();
void setEmbeddedView(CView *pView);
protected:
CCommandToolbar* CreateCharacterToolbar(int nCount);
CView *m_pCommandView;
};

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

@ -1,3 +1,20 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef _EDITFLOAT_H
#define _EDITFLOAT_H

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

@ -2221,6 +2221,7 @@ void CDropdownToolbar::OnLButtonUp(UINT nFlags, CPoint cPoint)
// only if different from initial state (for pushbutton style)
if( m_pParent && m_pData[i].nCommandID != m_nInitialID ){
m_pParent->PostMessage(WM_COMMAND, m_pData[i].nCommandID);
m_pParent->SetFocus();
}
break;
}

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

@ -901,26 +901,26 @@ void CNetscapeEditView::OnSetFocus(CWnd *pOldWin)
}
#endif //XP_WIN16
#endif //_IME_COMPOSITION
#ifdef ENDER
#if 0
if (GetEmbedded())
{
CMainFrame * pFrame = (CMainFrame*)GetParentFrame();
CComboToolBar *pControler = pFrame->getComposeToolBar();
if (pControler)
CComboToolBar *pController = pFrame->getComposeToolBar();
if (pController)
{
//must calculate position for toolbar
if (!m_EnderBarRectInit)
{
CRect t_rect;
CRect t_EnderBarRect;
pControler->GetWindowRect(t_rect);
pController->GetWindowRect(t_rect);
GetWindowRect(t_EnderBarRect);
t_EnderBarRect.top -= 54;
t_EnderBarRect.left = t_EnderBarRect.right-310;
pFrame->FloatControlBar(pControler,CPoint(t_EnderBarRect.left,t_EnderBarRect.top),CBRS_ALIGN_LEFT);
pFrame->FloatControlBar(pController,CPoint(t_EnderBarRect.left,t_EnderBarRect.top),CBRS_ALIGN_LEFT);
m_EnderBarRectInit=TRUE;
}
pFrame->ShowControlBar(pControler,TRUE,FALSE);
pFrame->ShowControlBar(pController,TRUE,FALSE);
pFrame->RecalcLayout();
UpdateWindow();
}
@ -932,11 +932,11 @@ void CNetscapeEditView::OnKillFocus(CWnd *pOldWin)
{
MWContext * pMWContext=NULL;
#ifdef ENDER
#if 0
if (GetEmbedded())
{
CMainFrame * pFrame = (CMainFrame*)GetParentFrame();
CComboToolBar *pControler = pFrame->getComposeToolBar();
CComboToolBar *pController = pFrame->getComposeToolBar();
CWnd *pWnd=NULL;
CWnd *pCPparent=NULL;
BOOL keepToolbar=FALSE;
@ -958,10 +958,10 @@ void CNetscapeEditView::OnKillFocus(CWnd *pOldWin)
}
}
if (pControler && !keepToolbar)
if (pController && !keepToolbar)
{
//remember where the controler was!
pFrame->ShowControlBar(pControler,FALSE,FALSE);
pFrame->ShowControlBar(pController,FALSE,FALSE);
pFrame->RecalcLayout();
UpdateWindow();
}
@ -2760,16 +2760,14 @@ void CNetscapeEditView::OnCharacterBarToggle()
}
else
{ // In Mail Composer, we didn't embed the Character toolbar inside a CCommandToolbar
CEditToolBarController * pController = NULL;
#ifdef ENDER
CEnderBar *pEnderBar = NULL;
if (GetEmbedded())
{
pEnderBar = (CEnderBar *)GetParentFrame()->SendMessage(WM_TOOLCONTROLLER);
}
CEditToolBarController *pController;
CWnd *t_parent;
if (!GetEmbedded())
t_parent = (CWnd *)GetParentFrame();
else
#endif //ENDER
pController = (CEditToolBarController *)GetParentFrame()->SendMessage(WM_TOOLCONTROLLER);
t_parent = GetParent();
if (t_parent)
pController = (CEditToolBarController *)t_parent->SendMessage(WM_TOOLCONTROLLER);
if( pController )
{
CComboToolBar * pToolBar = pController->GetCharacterBar();
@ -2795,16 +2793,14 @@ void CNetscapeEditView::OnUpdateCharacterBarToggle(CCmdUI* pCmdUI)
}
else
{ // In Mail Composer, we didn't embed the Character toolbar inside a CCommandToolbar
CEditToolBarController * pController = NULL;
#ifdef ENDER
CEnderBar *pEnderBar = NULL;
if (GetEmbedded())
{
pEnderBar = (CEnderBar *)GetParentFrame()->SendMessage(WM_TOOLCONTROLLER);
}
CEditToolBarController *pController;
CWnd *t_parent;
if (!GetEmbedded())
t_parent = (CWnd *)GetParentFrame();
else
#endif //ENDER
pController = (CEditToolBarController *)GetParentFrame()->SendMessage(WM_TOOLCONTROLLER);
t_parent = GetParent();
if (t_parent)
pController = (CEditToolBarController *)t_parent->SendMessage(WM_TOOLCONTROLLER);
if( pController && pController->GetCharacterBar() )
{
pCmdUI->m_pMenu->ModifyMenu(ID_OPT_CHARBAR_TOGGLE, MF_BYCOMMAND | MF_STRING, ID_OPT_CHARBAR_TOGGLE,

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

@ -470,8 +470,15 @@ void SetCharacterCheck(MWContext * pMWContext, CCmdUI* pCmdUI, CWnd* pToolbar, E
void CNetscapeEditView::OnUpdateCharacterStyle(UINT nID, CCmdUI* pCmdUI)
{
void *pVoid = (CWnd *)GetParentFrame()->SendMessage(WM_TOOLCONTROLLER);
if (pVoid) {
CEditToolBarController *pController;
CWnd *t_parent;
if (!GetEmbedded())
t_parent = (CWnd *)GetParentFrame();
else
t_parent = GetParent();
if (t_parent)
pController = (CEditToolBarController *)t_parent->SendMessage(WM_TOOLCONTROLLER);
if (pController) {
ED_TextFormat iStyle = -1;
switch( nID )
{
@ -501,10 +508,10 @@ void CNetscapeEditView::OnUpdateCharacterStyle(UINT nID, CCmdUI* pCmdUI)
break;
}
if( iStyle != -1 ){
if ( ((CEditToolBarController *)pVoid)->GetCNSToolbar())
SetCharacterCheck(GET_MWCONTEXT, pCmdUI, ((CEditToolBarController *)pVoid)->GetCNSToolbar(), iStyle);
else if (((CEditToolBarController *)pVoid)->GetCharacterBar())
SetCharacterCheck(GET_MWCONTEXT, pCmdUI, ((CEditToolBarController *)pVoid)->GetCharacterBar(), iStyle);
if ( pController->GetCNSToolbar())
SetCharacterCheck(GET_MWCONTEXT, pCmdUI, pController->GetCNSToolbar(), iStyle);
else if (pController->GetCharacterBar())
SetCharacterCheck(GET_MWCONTEXT, pCmdUI, pController->GetCharacterBar(), iStyle);
pCmdUI->Enable( EDT_CanSetCharacterAttribute(GET_MWCONTEXT) );
}
}
@ -513,8 +520,14 @@ void CNetscapeEditView::OnUpdateCharacterStyle(UINT nID, CCmdUI* pCmdUI)
////////////////////////////////////////////////////////////////////////////////
void CNetscapeEditView::OnSetFocusParagraphStyle()
{
CEditToolBarController * pController = NULL;
pController = (CEditToolBarController *)GetParentFrame()->SendMessage(WM_TOOLCONTROLLER);
CEditToolBarController *pController;
CWnd *t_parent;
if (!GetEmbedded())
t_parent = (CWnd *)GetParentFrame();
else
t_parent = GetParent();
if (t_parent)
pController = (CEditToolBarController *)t_parent->SendMessage(WM_TOOLCONTROLLER);
if (pController) {
@ -525,8 +538,14 @@ void CNetscapeEditView::OnSetFocusParagraphStyle()
void CNetscapeEditView::OnSetFocusFontFace()
{
CEditToolBarController * pController = NULL;
pController = (CEditToolBarController *)GetParentFrame()->SendMessage(WM_TOOLCONTROLLER);
CEditToolBarController *pController;
CWnd *t_parent;
if (!GetEmbedded())
t_parent = (CWnd *)GetParentFrame();
else
t_parent = GetParent();
if (t_parent)
pController = (CEditToolBarController *)t_parent->SendMessage(WM_TOOLCONTROLLER);
if (pController) {
pController->GetFontFaceCombo()->SetFocus();
pController->GetFontFaceCombo()->ShowDropDown();
@ -535,8 +554,14 @@ void CNetscapeEditView::OnSetFocusFontFace()
void CNetscapeEditView::OnSetFocusFontSize()
{
CEditToolBarController * pController = NULL;
pController = (CEditToolBarController *)GetParentFrame()->SendMessage(WM_TOOLCONTROLLER);
CEditToolBarController *pController;
CWnd *t_parent;
if (!GetEmbedded())
t_parent = (CWnd *)GetParentFrame();
else
t_parent = GetParent();
if (t_parent)
pController = (CEditToolBarController *)t_parent->SendMessage(WM_TOOLCONTROLLER);
if (pController) {
pController->GetFontSizeCombo()->SetFocus();
pController->GetFontSizeCombo()->ShowDropDown();
@ -553,8 +578,14 @@ void CNetscapeEditView::OnGetFontColor()
bBusy = TRUE;
CEditToolBarController * pController = NULL;
pController = (CEditToolBarController *)GetParentFrame()->SendMessage(WM_TOOLCONTROLLER);
CEditToolBarController *pController;
CWnd *t_parent;
if (!GetEmbedded())
t_parent = (CWnd *)GetParentFrame();
else
t_parent = GetParent();
if (t_parent)
pController = (CEditToolBarController *)t_parent->SendMessage(WM_TOOLCONTROLLER);
if (pController)
{
pController->GetFontColorCombo()->SendMessage(WM_LBUTTONUP, 0,0);// ShowDropDown(FALSE);
@ -643,8 +674,14 @@ void CNetscapeEditView::OnSelendokParagraphCombo()
// TODO: ADD CODE TO TEST IF ALLOWED TO CHANGE STYLE!
// Get index to selected item in Paragraph styles list
CEditToolBarController * pController = NULL;
pController = (CEditToolBarController *)GetParentFrame()->SendMessage(WM_TOOLCONTROLLER);
CEditToolBarController *pController;
CWnd *t_parent;
if (!GetEmbedded())
t_parent = (CWnd *)GetParentFrame();
else
t_parent = GetParent();
if (t_parent)
pController = (CEditToolBarController *)t_parent->SendMessage(WM_TOOLCONTROLLER);
if (pController) {
UINT nSelected = pController->GetParagraphCombo()->GetCurSel();
@ -680,8 +717,14 @@ void CNetscapeEditView::OnUpdateParagraphComboBox(CCmdUI* pCmdUI)
if ( m_EditState.nParagraphFormat != nParagraphFormat )
{
CEditToolBarController * pController = NULL;
pController = (CEditToolBarController *)GetParentFrame()->SendMessage(WM_TOOLCONTROLLER);
CEditToolBarController *pController;
CWnd *t_parent;
if (!GetEmbedded())
t_parent = (CWnd *)GetParentFrame();
else
t_parent = GetParent();
if (t_parent)
pController = (CEditToolBarController *)t_parent->SendMessage(WM_TOOLCONTROLLER);
if (pController) {
if ( nParagraphFormat == P_UNKNOWN )
pController->GetParagraphCombo()->SetCurSel(-1);
@ -714,8 +757,14 @@ void CNetscapeEditView::OnUpdateFontFaceComboBox(CCmdUI* pCmdUI)
{
MWContext *pMWContext = GET_MWCONTEXT;
if(pMWContext){
CEditToolBarController * pController = NULL;
pController = (CEditToolBarController *)GetParentFrame()->SendMessage(WM_TOOLCONTROLLER);
CEditToolBarController *pController;
CWnd *t_parent;
if (!GetEmbedded())
t_parent = (CWnd *)GetParentFrame();
else
t_parent = GetParent();
if (t_parent)
pController = (CEditToolBarController *)t_parent->SendMessage(WM_TOOLCONTROLLER);
if (pController) {
CNSComboBox * pCombo = pController->GetFontFaceCombo();
char * pFace = EDT_GetFontFace(pMWContext);
@ -747,8 +796,14 @@ void CNetscapeEditView::OnUpdateFontFaceComboBox(CCmdUI* pCmdUI)
void CNetscapeEditView::OnSelendokFontFaceCombo()
{
CEditToolBarController * pController = NULL;
pController = (CEditToolBarController *)GetParentFrame()->SendMessage(WM_TOOLCONTROLLER);
CEditToolBarController *pController;
CWnd *t_parent;
if (!GetEmbedded())
t_parent = (CWnd *)GetParentFrame();
else
t_parent = GetParent();
if (t_parent)
pController = (CEditToolBarController *)t_parent->SendMessage(WM_TOOLCONTROLLER);
if (pController) {
int iFontIndex = pController->GetSelectedFontFaceIndex();
// Process "Other..." to get font from dialog and set it
@ -820,8 +875,14 @@ void CNetscapeEditView::OnSelendokFontSizeCombo()
}
// Font size is 1 more than index to selected item
CEditToolBarController * pController = NULL;
pController = (CEditToolBarController *)GetParentFrame()->SendMessage(WM_TOOLCONTROLLER);
CEditToolBarController *pController;
CWnd *t_parent;
if (!GetEmbedded())
t_parent = (CWnd *)GetParentFrame();
else
t_parent = GetParent();
if (t_parent)
pController = (CEditToolBarController *)t_parent->SendMessage(WM_TOOLCONTROLLER);
if (pController) {
int iSel = pController->GetFontSizeCombo()->GetCurSel();
int iNewFontSize = 0;
@ -856,8 +917,14 @@ void CNetscapeEditView::OnSelendokFontSizeCombo()
void CNetscapeEditView::OnFontSizeDropDown()
{
CEditToolBarController * pController = NULL;
pController = (CEditToolBarController *)GetParentFrame()->SendMessage(WM_TOOLCONTROLLER);
CEditToolBarController *pController;
CWnd *t_parent;
if (!GetEmbedded())
t_parent = (CWnd *)GetParentFrame();
else
t_parent = GetParent();
if (t_parent)
pController = (CEditToolBarController *)t_parent->SendMessage(WM_TOOLCONTROLLER);
if (pController) {
CNSComboBox * pCombo = pController->GetFontSizeCombo();
int iSel = pCombo->GetCurSel();
@ -900,8 +967,14 @@ void CNetscapeEditView::OnUpdateFontSizeComboBox(CCmdUI* pCmdUI)
iFontIndex != m_EditState.iFontIndex ||
iFontIndex > 1 )
{
CEditToolBarController * pController = NULL;
pController = (CEditToolBarController *)GetParentFrame()->SendMessage(WM_TOOLCONTROLLER);
CEditToolBarController *pController;
CWnd *t_parent;
if (!GetEmbedded())
t_parent = (CWnd *)GetParentFrame();
else
t_parent = GetParent();
if (t_parent)
pController = (CEditToolBarController *)t_parent->SendMessage(WM_TOOLCONTROLLER);
if (pController)
{
char * pSize = NULL;
@ -921,8 +994,14 @@ void CNetscapeEditView::OnUpdateFontSizeComboBox(CCmdUI* pCmdUI)
}
else
{
CEditToolBarController * pController = NULL;
pController = (CEditToolBarController *)GetParentFrame()->SendMessage(WM_TOOLCONTROLLER);
CEditToolBarController *pController;
CWnd *t_parent;
if (!GetEmbedded())
t_parent = (CWnd *)GetParentFrame();
else
t_parent = GetParent();
if (t_parent)
pController = (CEditToolBarController *)t_parent->SendMessage(WM_TOOLCONTROLLER);
if (pController)
pController->GetFontSizeCombo()->FindSelectedOrSetText(NULL);
}
@ -941,8 +1020,14 @@ void CNetscapeEditView::UpdateFontSizeCombo()
// Change current state to force updating the combo
m_EditState.bFontSizeMaybeChanged = TRUE;
m_EditState.iFontSize = -2;
CEditToolBarController * pController = NULL;
pController = (CEditToolBarController *)GetParentFrame()->SendMessage(WM_TOOLCONTROLLER);
CEditToolBarController *pController;
CWnd *t_parent;
if (!GetEmbedded())
t_parent = (CWnd *)GetParentFrame();
else
t_parent = GetParent();
if (t_parent)
pController = (CEditToolBarController *)t_parent->SendMessage(WM_TOOLCONTROLLER);
if (pController) {
wfe_FillFontSizeCombo(GET_MWCONTEXT, pController->GetFontSizeCombo(),
(EDT_GetFontFaceIndex(GET_MWCONTEXT) == 1));
@ -994,8 +1079,14 @@ void CNetscapeEditView::OnFontColorMenu(UINT nID)
void CNetscapeEditView::OnUpdateFontColorComboBox(CCmdUI* pCmdUI)
{
CEditToolBarController * pController = NULL;
pController = (CEditToolBarController *)GetParentFrame()->SendMessage(WM_TOOLCONTROLLER);
CEditToolBarController *pController;
CWnd *t_parent;
if (!GetEmbedded())
t_parent = (CWnd *)GetParentFrame();
else
t_parent = GetParent();
if (t_parent)
pController = (CEditToolBarController *)t_parent->SendMessage(WM_TOOLCONTROLLER);
if (pController) {
if ( m_EditState.bFontColorMaybeChanged &&
GetFocus() == this )
@ -1115,8 +1206,14 @@ void CNetscapeEditView::OnDisplayTables()
void CNetscapeEditView::OnUpdateDisplayTables(CCmdUI* pCmdUI)
{
CEditToolBarController * pController = NULL;
pController = (CEditToolBarController *)GetParentFrame()->SendMessage(WM_TOOLCONTROLLER);
CEditToolBarController *pController;
CWnd *t_parent;
if (!GetEmbedded())
t_parent = (CWnd *)GetParentFrame();
else
t_parent = GetParent();
if (t_parent)
pController = (CEditToolBarController *)t_parent->SendMessage(WM_TOOLCONTROLLER);
if( pController && pCmdUI->m_pMenu ){
pCmdUI->m_pMenu->ModifyMenu(ID_DISPLAY_TABLES, MF_BYCOMMAND | MF_STRING, ID_DISPLAY_TABLES,
szLoadString(EDT_GetDisplayTables(GET_MWCONTEXT) ?
@ -2521,8 +2618,14 @@ void CNetscapeEditView::UpdateListMenuItem(CCmdUI* pCmdUI, TagType t)
}
pCmdUI->Enable(CAN_INTERACT);
CEditToolBarController * pController = NULL;
pController = (CEditToolBarController *)GetParentFrame()->SendMessage(WM_TOOLCONTROLLER);
CEditToolBarController *pController;
CWnd *t_parent;
if (!GetEmbedded())
t_parent = (CWnd *)GetParentFrame();
else
t_parent = GetParent();
if (t_parent)
pController = (CEditToolBarController *)t_parent->SendMessage(WM_TOOLCONTROLLER);
if (pController && CAN_INTERACT && !pCmdUI->m_pMenu && pController->GetCharacterBar() ) {
(pController->GetCharacterBar())->SetCheck( pCmdUI->m_nID, bIsList );
}
@ -2562,8 +2665,14 @@ void CNetscapeEditView::OnAlignPopup()
RECT rectCaller = {0,0, 0, 0};
RECT newRectCaller = {0, 0, 0, 0 };
CEditToolBarController * pController = NULL;
pController = (CEditToolBarController *)GetParentFrame()->SendMessage(WM_TOOLCONTROLLER);
CEditToolBarController *pController;
CWnd *t_parent;
if (!GetEmbedded())
t_parent = (CWnd *)GetParentFrame();
else
t_parent = GetParent();
if (t_parent)
pController = (CEditToolBarController *)t_parent->SendMessage(WM_TOOLCONTROLLER);
if (pController) {
CComboToolBar * pToolbar = pController->GetCharacterBar();
CCommandToolbar *pCommandToolbar = pController->GetCNSToolbar();
@ -2594,7 +2703,10 @@ void CNetscapeEditView::OnAlignPopup()
// Build dropdown toolbar for alignment buttons
// CommandID is sent to parent frame when pressed
// Use this to include current state as a push-down button:
pTB = new CDropdownToolbar(GetParentFrame(), pMWContext, &rectCaller, ID_ALIGN_POPUP, nInitialID);
if (GetEmbedded())
pTB = new CDropdownToolbar(this, pMWContext, &rectCaller, ID_ALIGN_POPUP, nInitialID);
else
pTB = new CDropdownToolbar(GetParentFrame(), pMWContext, &rectCaller, ID_ALIGN_POPUP, nInitialID);
if( pTB ){
pTB->AddButton(IDB_HALIGN_LEFT, ID_ALIGN_LEFT);
pTB->AddButton(IDB_HALIGN_CENTER, ID_ALIGN_CENTER);
@ -2871,8 +2983,14 @@ void CNetscapeEditView::OnDisplayParagraphMarks()
void CNetscapeEditView::OnUpdateDisplayParagraphMarks(CCmdUI* pCmdUI)
{
CEditToolBarController * pController = NULL;
pController = (CEditToolBarController *)GetParentFrame()->SendMessage(WM_TOOLCONTROLLER);
CEditToolBarController *pController;
CWnd *t_parent;
if (!GetEmbedded())
t_parent = (CWnd *)GetParentFrame();
else
t_parent = GetParent();
if (t_parent)
pController = (CEditToolBarController *)t_parent->SendMessage(WM_TOOLCONTROLLER);
if( pController && pCmdUI->m_pMenu ){
pCmdUI->m_pMenu->ModifyMenu(ID_EDIT_DISPLAY_PARAGRAPH_MARKS, MF_BYCOMMAND | MF_STRING,
CASTUINT(ID_EDIT_DISPLAY_PARAGRAPH_MARKS),
@ -2889,8 +3007,14 @@ void CNetscapeEditView::OnInsertObjectPopup()
return;
}
RECT rectCaller = {0,0, 0, 0};
CEditToolBarController * pController = NULL;
pController = (CEditToolBarController *)GetParentFrame()->SendMessage(WM_TOOLCONTROLLER);
CEditToolBarController *pController;
CWnd *t_parent;
if (!GetEmbedded())
t_parent = (CWnd *)GetParentFrame();
else
t_parent = GetParent();
if (t_parent)
pController = (CEditToolBarController *)t_parent->SendMessage(WM_TOOLCONTROLLER);
if (pController)
{
// This ALWAYS gets the CharacterToolbar
@ -2928,7 +3052,10 @@ void CNetscapeEditView::OnInsertObjectPopup()
// Build dropdown toolbar for insert object buttons
// CommandID is sent to parent frame when pressed
pTB = NULL;
pTB = new CDropdownToolbar(GetParentFrame(), pMWContext, &rectCaller, ID_INSERT_POPUP, 0);
if (GetEmbedded())
pTB = new CDropdownToolbar(this, pMWContext, &rectCaller, ID_INSERT_POPUP, 0);
else
pTB = new CDropdownToolbar(GetParentFrame(), pMWContext, &rectCaller, ID_INSERT_POPUP, 0);
if( pTB ){
pTB->AddButton(IDB_INSERT_LINK, ID_MAKE_LINK);
pTB->AddButton(IDB_INSERT_TARGET, ID_INSERT_TARGET);

316
cmd/winfe/embdlist.cpp Normal file
Просмотреть файл

@ -0,0 +1,316 @@
#include "stdafx.h"
#include "embdlist.h"
#include "genframe.h"
#define BITMAP_WIDTH 16
#define BITMAP_HEIGHT 16
BEGIN_MESSAGE_MAP(CEmbeddedAttachList, CListBox)
ON_WM_CREATE()
ON_WM_KEYDOWN()
ON_WM_LBUTTONDOWN()
ON_WM_DROPFILES()
ON_WM_DESTROY()
ON_COMMAND(ID_EDIT_DELETE,OnDelete)
END_MESSAGE_MAP()
IMPLEMENT_DYNCREATE(CEmbeddedAttachList, CListBox)
void DrawTransBitmap(HDC hdc, HBITMAP hBitmap, short xStart, short yStart, COLORREF cTransparentColor );
void DrawTransBitmap(HDC hdc, HBITMAP hBitmap, short xStart, short yStart, COLORREF cTransparentColor )
{
HDC hSrcDC = CreateCompatibleDC(hdc);
SelectObject(hSrcDC, hBitmap);
BITMAP bm;
GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&bm);
POINT ptSize;
ptSize.x = bm.bmWidth;
ptSize.y = bm.bmHeight;
DPtoLP(hSrcDC, &ptSize, 1);
HPALETTE hPalette = (HPALETTE)GetCurrentObject(hdc, OBJ_PAL);
FEU_TransBlt(hdc, xStart, yStart, ptSize.x, ptSize.y, hSrcDC, 0, 0, hPalette, cTransparentColor);
DeleteDC(hSrcDC);
}
CEmbeddedAttachList::CEmbeddedAttachList()
:m_numattachments(0),m_attachmentlist(NULL)
{
}
CEmbeddedAttachList::~CEmbeddedAttachList()
{
for (int i = 0; i< m_numattachments; i++)
XP_FREE(m_attachmentlist[i]);
XP_FREE(m_attachmentlist);
}
BOOL
CEmbeddedAttachList::Create(CWnd *pWnd, UINT id)
{
BOOL bRetVal = CListBox::Create (
WS_CLIPCHILDREN|WS_CHILD|WS_BORDER|WS_VISIBLE|WS_VSCROLL|LBS_OWNERDRAWFIXED|
LBS_HASSTRINGS|LBS_NOTIFY|LBS_WANTKEYBOARDINPUT|LBS_NOINTEGRALHEIGHT,
CRect(0,0,0,0), pWnd, id);
return bRetVal;
}
void
CEmbeddedAttachList::OnDelete()
{
if (GetFocus() == this)
{
int idx = GetCurSel();
if (idx != LB_ERR)
{
DeleteString(idx);
}
}
}
int
CEmbeddedAttachList::OnCreate( LPCREATESTRUCT lpCreateStruct )
{
int iRet = CListBox::OnCreate(lpCreateStruct);
CGenericFrame * pFrame = (CGenericFrame*)GetParentFrame();
CDC * pdc = GetDC();
LOGFONT lf;
memset(&lf,0,sizeof(LOGFONT));
lf.lfPitchAndFamily = FF_SWISS;
if (INTL_DefaultWinCharSetID(0) == CS_LATIN1)
strcpy(lf.lfFaceName, "MS Sans Serif");
else
strcpy(lf.lfFaceName, IntlGetUIPropFaceName(0));
lf.lfCharSet = IntlGetLfCharset(pFrame->m_iCSID);
lf.lfHeight = -MulDiv(8,pdc->GetDeviceCaps(LOGPIXELSY), 72);
lf.lfQuality = PROOF_QUALITY;
m_cfTextFont = theApp.CreateAppFont( lf );
::SendMessage(GetSafeHwnd(), WM_SETFONT, (WPARAM)m_cfTextFont, FALSE);
ReleaseDC(pdc);
#if 0
const MSG_AttachmentData * pDataList = MSG_GetAttachmentList(GetMsgPane());
#endif //0
DragAcceptFiles();
return(iRet);
}
void
CEmbeddedAttachList::OnDestroy()
{
CListBox::OnDestroy();
}
void
CEmbeddedAttachList::OnDropFiles(HDROP hDropInfo)
{
CListBox::OnDropFiles(hDropInfo);
UINT wNumFilesDropped = ::DragQueryFile(hDropInfo,(UINT)-1,NULL,0);
for (UINT x = 0; x < wNumFilesDropped; x++)
{
int wPathnameSize = ::DragQueryFile(hDropInfo, x, NULL, 0);
char * pStr = (char*)XP_CALLOC(1,wPathnameSize+2);
ASSERT(pStr);
// Copy the pathname into the buffer & add to listbox
::DragQueryFile(hDropInfo, x, pStr, wPathnameSize+1);
AddAttachment(pStr);
XP_FREE(pStr);
}
}
void CEmbeddedAttachList::OnLButtonDown(UINT nFlags, CPoint point)
{
CListBox::OnLButtonDown(nFlags, point);
}
void CEmbeddedAttachList::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
switch (nChar)
{
case VK_INSERT:
AttachFile();
break;
case VK_DELETE:
RemoveAttachment();
break;
}
CListBox::OnKeyDown(nChar, nRepCnt, nFlags);
}
void CEmbeddedAttachList::RemoveAttachment()
{
int idx = GetCurSel();
if (idx != LB_ERR)
{
DeleteString(idx);
if (idx >= GetCount())
SetCurSel(idx-1);
}
}
void CEmbeddedAttachList::DrawItem( LPDRAWITEMSTRUCT lpDrawItemStruct )
{
if (lpDrawItemStruct->itemID != -1)
{
CDC dc;
dc.Attach(lpDrawItemStruct->hDC);
HBRUSH hRegBrush = ::CreateSolidBrush( GetSysColor( COLOR_WINDOW ) );
HPEN hRegPen = ::CreatePen( PS_SOLID, 1, GetSysColor ( COLOR_WINDOW ) );
HBRUSH hHighBrush = ::CreateSolidBrush( GetSysColor( COLOR_HIGHLIGHT ) );
HPEN hHighPen = ::CreatePen( PS_SOLID, 1, GetSysColor ( COLOR_HIGHLIGHT ) );
HBRUSH hOldBrush = (HBRUSH) dc.SelectObject ( hRegBrush );
HPEN hOldPen = (HPEN) dc.SelectObject ( hRegPen );
COLORREF cOldText = dc.SetTextColor ( GetSysColor ( COLOR_WINDOWTEXT ) );
COLORREF cOldBk = dc.SetBkColor ( GetSysColor ( COLOR_WINDOW ) );
CRect rect(lpDrawItemStruct->rcItem);
BOOL bSelected = lpDrawItemStruct->itemState & ODS_SELECTED;
if (bSelected && (GetFocus()==this))
{
dc.SelectObject ( hHighBrush );
dc.SelectObject ( hHighPen );
dc.SetTextColor ( GetSysColor ( COLOR_HIGHLIGHTTEXT ) );
dc.SetBkColor ( GetSysColor ( COLOR_HIGHLIGHT ) );
}
dc.Rectangle(rect);
char *t_pFile = m_attachmentlist[lpDrawItemStruct->itemID];
char *pszString = NULL;
if (t_pFile)
{
/* char* pFilePath = NULL;
char * pszString =
(pAttach->real_name && strlen(pAttach->real_name)) ? pAttach->real_name : pAttach->url;*/
int idBitmap = 0;
// if (!strnicmp(pAttach->url, "file:", strlen("file:")))
{
idBitmap = IDB_FILEATTACHMENT;
/* if (XP_STRCHR(pAttach->url, '#'))
{
char* pTemp = XP_STRCHR(pAttach->url, ':');
pFilePath = XP_NetToDosFileName(pTemp + 4); // remove :/// 4 bytes
}
else if (pszString == pAttach->url)
{
XP_ConvertUrlToLocalFile(pAttach->url, &pFilePath);
}*/
pszString = t_pFile; // rhp - move this into the conditional - or crash in MAPI
// pszString = pFilePath;
}
// else
// idBitmap = IDB_WEBATTACHMENT;
rect.left += BITMAP_WIDTH + 4;
dc.DrawText(pszString,strlen(pszString),rect,DT_LEFT|DT_VCENTER);
rect.left -= BITMAP_WIDTH + 4;
BITMAP bitmap;
CBitmap cbitmap;
cbitmap.LoadBitmap(MAKEINTRESOURCE(idBitmap));
cbitmap.GetObject(sizeof(BITMAP),&bitmap);
int center_x = 2;
int center_y = rect.top + (rect.Height()-bitmap.bmHeight)/2;
DrawTransBitmap(
dc.GetSafeHdc(),
(HBITMAP)cbitmap.GetSafeHandle(),
center_x, center_y,
RGB(255,0,255));
cbitmap.DeleteObject();
}
if (bSelected)
dc.DrawFocusRect(rect);
dc.SetTextColor ( cOldText );
dc.SetBkColor ( cOldBk );
dc.SelectObject ( hOldPen );
dc.SelectObject ( hOldBrush );
dc.Detach();
VERIFY(DeleteObject( hRegBrush ));
VERIFY(DeleteObject( hRegPen ));
VERIFY(DeleteObject( hHighBrush ));
VERIFY(DeleteObject( hHighPen ));
}
}
//=============================================================== MeasureItem
void CEmbeddedAttachList::MeasureItem( LPMEASUREITEMSTRUCT lpMeasureItemStruct )
{
lpMeasureItemStruct->itemHeight = BITMAP_HEIGHT + 2;
}
//================================================================ DeleteItem
void CEmbeddedAttachList::DeleteItem( LPDELETEITEMSTRUCT lpDeleteItemStruct )
{
}
void CEmbeddedAttachList::AttachFile()
{
}
void CEmbeddedAttachList::AttachUrl(char *pUrl /*= NULL*/)
{
if (pUrl)
AddString(pUrl);
}
void CEmbeddedAttachList::AddAttachment(char * pName)
{
if (pName)
{
AddString(pName);
char **t_list = m_attachmentlist;
m_attachmentlist = new char *[m_numattachments+1];
if (t_list)
XP_MEMCPY(m_attachmentlist,t_list,m_numattachments*sizeof(char *));
m_attachmentlist[m_numattachments++]=XP_STRDUP(pName);
UpdateWindow();
}
}

38
cmd/winfe/embdlist.h Normal file
Просмотреть файл

@ -0,0 +1,38 @@
#ifndef EMBDLIST_H
#define EMBDLIST_H
class CEmbeddedAttachList : public CListBox
{
public:
DECLARE_DYNCREATE(CEmbeddedAttachList)
HFONT m_cfTextFont;
CEmbeddedAttachList();
~CEmbeddedAttachList();
void AttachFile();
void RemoveAttachment();
void AttachUrl(char *pUrl = NULL);
void AddAttachment(char * pName);
char **AllocFillAttachList();
virtual BOOL Create(CWnd *pWnd, UINT id);
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
virtual void DeleteItem(LPDELETEITEMSTRUCT lpDeleteItemStruct);
afx_msg void OnDropFiles( HDROP hDropInfo );
protected:
UINT ItemFromPoint(CPoint pt, BOOL& bOutside) const;
afx_msg int OnCreate( LPCREATESTRUCT lpCreateStruct );
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) ;
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnDelete();
afx_msg void OnDestroy();
DECLARE_MESSAGE_MAP()
protected:
char **m_attachmentlist;
int m_numattachments;
};
#endif //EMBDLIST_H

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

@ -95,6 +95,11 @@ void CFormHtmlarea::DisplayFormElement(LTRB& Rect)
MoveWindow(m_pWidget->m_hWnd, Rect.left, Rect.top + EDIT_SPACE / 2);
m_pWidget->ShowWindow(SW_SHOW);
m_pWidget->UpdateWindow();
if (m_pWidget->GetEditView())
{
m_pWidget->GetEditView()->ShowWindow(SW_SHOW);
m_pWidget->GetEditView()->UpdateWindow();
}
CWnd::FromHandle(VOID2CX(GetContext(), CPaneCX)->GetPane())->InvalidateRect(&rect);
}
else
@ -115,19 +120,7 @@ void CFormHtmlarea::DestroyWidget()
// Get rid of the widget if around.
if (m_pWidget)
{
CNetscapeDoc* pDoc = (CNetscapeDoc *)m_pWidget->GetDocument();
//warning! do not allow the CWinCX to RE-FREE its frame.
//we are borrowning the frame from the "browser window or layer"
//call ClearFrame to "Clear the frame"
CWinCX *pCX = m_pWidget->GetContext();
if (pCX)
{
pCX->ClearFrame();//NOT WORKING, MUST FIX
EDT_DestroyEditBuffer(pCX->GetContext());
}
m_pWidget->DestroyWindow();
if (pDoc)
delete pDoc;
m_pWidget=NULL;
}
}
@ -137,109 +130,12 @@ void CFormHtmlarea::DestroyWidget()
void CFormHtmlarea::CreateWidget()
{
if(GetContext() && GetElement())
{
if(GetContext()->IsWindowContext() && VOID2CX(GetContext(), CPaneCX)->GetPane())
{
// Need a widget representation.
//create a new CPaneCX
CNetscapeDoc* pDoc = new CNetscapeDoc();
m_pWidget = new CNetscapeEditView();
m_pWidget->SetEmbedded(TRUE);
RECT rect;
rect.left=0;
rect.top=0;
rect.right=1;
rect.bottom=1;
if (!m_pWidget->Create(NULL, NULL,
WS_CHILD | WS_VSCROLL | WS_BORDER | ES_LEFT | WS_TABSTOP | ES_MULTILINE //AFX_WS_DEFAULT_VIEW
, rect,
CWnd::FromHandle(VOID2CX(GetContext(), CPaneCX)->GetPane()), ID_ENDER, NULL))
{
TRACE("Warning: could not create view for frame.\n");
m_pWidget=NULL;
return;
}
CPaneCX* cx= VOID2CX(GetContext(), CPaneCX);
HWND hwnd= cx->GetPane();
CWnd *pwnd= CWnd::FromHandle(hwnd);
CGenericView *genview=NULL;
if (pwnd->IsKindOf(RUNTIME_CLASS(CGenericView)))
genview=(CGenericView *)pwnd;
if (!genview)
return;
CWinCX* pDontCare = new CWinCX((CGenericDoc *)pDoc,
genview->GetFrame(), (CGenericView *)m_pWidget);
pDontCare->GetContext()->is_editor = TRUE;
m_pWidget->SetContext(pDontCare);
pDontCare->Initialize(pDontCare->CDCCX::IsOwnDC(), &rect);
pDontCare->NormalGetUrl(EDT_NEW_DOC_URL);
//ADJUST THE SIZE OF THE WINDOW ACCORDING TO ROWS AND COLS EVEN THOUGH THAT IS NOT ACCURATE
// Measure some text.
CDC *pDC = m_pWidget->GetDC();
CyaFont *pMyFont;
if(pDC)
{
CDC t_dc;
t_dc.CreateCompatibleDC( pDC );
CDCCX *pDCCX = VOID2CX(GetContext(), CDCCX);
pDCCX->SelectNetscapeFont( t_dc.GetSafeHdc(), GetTextAttr(), pMyFont );
if (pMyFont)
{
//SetWidgetFont(pDC->GetSafeHdc(), m_pWidget->m_hWnd);
//GetElement()->text_attr->FE_Data = pMyFont;
// Default length is 20
// Default lines is 1
int32 lLength = 20;
int32 lLines = 1;
// See if we can measure the default text, and/or
// set up the size and size limits.
if(GetElementHtmlareaData())
{
if(GetElementHtmlareaData()->cols > 0) {
// Use provided size.
lLength = GetElementHtmlareaData()->cols;
}
if(GetElementHtmlareaData()->rows > 0) {
// Use provided size.
lLines = GetElementHtmlareaData()->rows;
}
}
// Now figure up the width and height we would like.
// int32 lWidgetWidth = (lLength + 1) * tm.tmAveCharWidth + sysInfo.m_iScrollWidth;
// int32 lWidgetHeight = (lLines + 1) * tm.tmHeight;
int32 lWidgetWidth = (lLength + 1) * pMyFont->GetMeanWidth() + sysInfo.m_iScrollWidth;
int32 lWidgetHeight = (lLines + 1) * pMyFont->GetHeight();
// If no word wrapping, account a horizontal scrollbar.
if(GetElementHtmlareaData()->auto_wrap == TEXTAREA_WRAP_OFF) {
lWidgetHeight += sysInfo.m_iScrollHeight;
}
// Move the window.
m_pWidget->MoveWindow(1, 1, CASTINT(lWidgetWidth), CASTINT(lWidgetHeight), FALSE);
pDCCX->ReleaseNetscapeFont( t_dc.GetSafeHdc(), pMyFont );
pDCCX->ReleaseContextDC(t_dc.GetSafeHdc());
m_pWidget->ReleaseDC(pDC);
}
else
{
m_pWidget->ReleaseDC(pDC);
DestroyWidget();
}
}
else
{
DestroyWidget();
}
}
else if(GetContext()->IsPureDCContext())
{
// Need a drawn representation.
}
}
{
m_pWidget = new CEnderView(GetContext());
if (!m_pWidget->Create(CWnd::FromHandle(VOID2CX(GetContext(), CPaneCX)->GetPane()),GetElementHtmlareaData(),GetTextAttr() ))
DestroyWidget();
}
}
// Copy the current data out of the layout struct into the form 5
@ -251,14 +147,14 @@ void CFormHtmlarea::UseCurrentData()
if(GetContext()->IsWindowContext()) {
// Need a widget.
// Need a widget.
if(m_pWidget) {
if(m_pWidget && m_pWidget->GetEditView()) {
// Determine the default text to set.
char *pCurrent = "";
if(GetElementHtmlareaData() && GetElementHtmlareaData()->current_text) {
pCurrent = (char *)GetElementHtmlareaData()->current_text;
}
if (pCurrent)
EDT_SetDefaultHTML( m_pWidget->GetContext()->GetContext(), pCurrent );
EDT_SetDefaultHTML( m_pWidget->GetEditView()->GetContext()->GetContext(), pCurrent );
// We have to SetContext to the widget before we SetWindowText
// Otherwise, the widget don't know what csid the text is.
//m_pWidget->SetContext(GetContext());//, GetElement());
@ -289,7 +185,7 @@ void CFormHtmlarea::UseDefaultData()
pDefault = (char *)GetElementHtmlareaData()->default_text;
}
if (pDefault)
EDT_SetDefaultText( m_pWidget->GetContext()->GetContext(), pDefault );
EDT_SetDefaultHTML( m_pWidget->GetEditView()->GetContext()->GetContext(), pDefault );
// We have to SetContext to the widget before we SetWindowText
// Otherwise, the widget don't know what csid the text is.
//m_pWidget->SetContext(GetContext());//, GetElement());
@ -382,7 +278,7 @@ void CFormHtmlarea::UpdateCurrentData()
}
// if (EDT_DirtyFlag(m_pWidget->GetContext()->GetContext()))
// {
EDT_SaveToBuffer(m_pWidget->GetContext()->GetContext(),(char **)&GetElementHtmlareaData()->current_text);
EDT_SaveToBuffer(m_pWidget->GetEditView()->GetContext()->GetContext(),(char **)&GetElementHtmlareaData()->current_text);
// }
}
}

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

@ -19,13 +19,13 @@
#ifndef __FORM_HTMLAREA_H
#define __FORM_HTMLAREA_H
// This file is dedicated to one form type it uses the CNetscapeEditView as
// This file is dedicated to one form type it uses the CEnderView as
// their implementation as requried by the XP layout
// library.
// Required includes.
#include "fmabstra.h"
#include "edview.h"
#include "enderwrp.h"
class CFormHtmlarea : public CFormElement {
// Construction/destruction.
@ -80,7 +80,7 @@ public:
// The htmlarea widget.
private:
CNetscapeEditView *m_pWidget;
CEnderView *m_pWidget;
};
#endif // __FORM_HTMLAREA_H

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

@ -192,33 +192,6 @@ BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext *pContext)
if( IsEditFrame() && pDontCare->GetContext() ) {
pDontCare->GetContext()->is_editor = TRUE;
}
#ifdef ENDER
else
{
// Create the HTML edit toolbars. There are currently two separate
// toolbars.. one for formats and another for character operations.
EnableDocking(CBRS_ALIGN_BOTTOM);
m_pToolBarController = new CEditToolBarController(this);
if (!m_pToolBarController || !m_pToolBarController->CreateEditBars(GetMainContext()->GetContext(), TRUE, DISPLAY_CHARACTER_TOOLBAR))
{
TRACE("Bad ComposeBar");
if (m_pToolBarController)
delete m_pToolBarController;
m_pToolBarController = NULL;
return FALSE;
}
CComboToolBar *t_combobar=m_pToolBarController->GetCharacterBar();
if (t_combobar)
{
t_combobar->ShowWindow(SW_HIDE);
//t_combobar->SetWindowText(_T("Edit"));//RESOURCE IT!
DockControlBar(t_combobar,AFX_IDW_DOCKBAR_BOTTOM);
t_combobar->ShowWindow(SW_HIDE);
FloatControlBar(t_combobar,CPoint(0,0),CBRS_ALIGN_BOTTOM);
}
}
#endif //ENDER
#endif //EDITOR
// mwh - CDCCX::Initialize() will initialize the color palette, but we have to make sure we have

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

@ -1319,7 +1319,8 @@ $(OUTDIR)\mozilla.dep: $(DEPTH)\cmd\winfe\mkfiles32\mozilla.mak
$(DEPTH)\cmd\winfe\fmtxarea.cpp
!if defined(EDITOR)
$(DEPTH)\cmd\winfe\fmhtml.cpp
$(DEPTH)\cmd\winfe\editfloat.cpp
$(DEPTH)\cmd\winfe\enderwrp.cpp
$(DEPTH)\cmd\winfe\embdlist.cpp
!endif
!endif
$(DEPTH)\cmd\winfe\frameglu.cpp

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

@ -362,8 +362,14 @@ void CNetscapeView::OnFilePrintPreview()
// Hide the Composer's formatting toolbar,
// and remember state so we restore only if currently visible
m_bRestoreComposerToolbar = FALSE;
CEditToolBarController * pController =
(CEditToolBarController *)GetParentFrame()->SendMessage(WM_TOOLCONTROLLER);
CEditToolBarController *pControler;
CWnd *t_parent;
if (!GetEmbedded())
t_parent = (CWnd *)GetParentFrame();
else
t_parent = GetParent();
if (t_parent)
pControler = (CEditToolBarController *)t_parent->SendMessage(WM_TOOLCONTROLLER);
if( pController )
{
CComboToolBar * pToolBar = pController->GetCharacterBar();
@ -471,8 +477,14 @@ void CNetscapeView::OnEndPrintPreview(CDC *pDC, CPrintInfo *pInfo, POINT pXY, CP
// Restore Composer format/character toolbar only if it was visible before
if( m_bRestoreComposerToolbar )
{
CEditToolBarController * pController =
(CEditToolBarController *)GetParentFrame()->SendMessage(WM_TOOLCONTROLLER);
CEditToolBarController *pControler;
CWnd *t_parent;
if (!GetEmbedded())
t_parent = (CWnd *)GetParentFrame();
else
t_parent = GetParent();
if (t_parent)
pControler = (CEditToolBarController *)t_parent->SendMessage(WM_TOOLCONTROLLER);
if( pController )
{
CComboToolBar * pToolBar = pController->GetCharacterBar();

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

@ -1430,6 +1430,7 @@ IDB_EDIT_UNSUPPORTED_TAG BITMAP DISCARDABLE "res\\edtag.bmp"
IDB_EDIT_UNSUPPORTED_TAG_MASK BITMAP DISCARDABLE "res\\edtagm.bmp"
IDB_EDIT_UNSUPPORTED_END_TAG BITMAP DISCARDABLE "res\\edtage.bmp"
IDB_EDIT_UNSUPPORTED_END_TAG_MASK BITMAP DISCARDABLE "res\\edtagem.bmp"
IDB_FILEATTACHMENT BITMAP DISCARDABLE "res\\fattach.bmp"
#endif // EDITOR
#ifdef MOZ_MAIL_NEWS
IDB_MAILNEWS BITMAP DISCARDABLE "res\\outlmail.bmp"
@ -1447,7 +1448,6 @@ IDB_NEWSART BITMAP DISCARDABLE "res\\newsart.bmp"
IDB_MAILINGLIST BITMAP DISCARDABLE "res\\mailingl.bmp"
IDB_ADDRESSBOOKSELECT BITMAP DISCARDABLE "res\\addrbmp.bmp"
IDB_ATTACHBUTTON BITMAP DISCARDABLE "res\\attchbut.bmp"
IDB_FILEATTACHMENT BITMAP DISCARDABLE "res\\fattach.bmp"
IDB_MAILMESSAGE BITMAP DISCARDABLE "res\\mattach.bmp"
IDB_WEBATTACHMENT BITMAP DISCARDABLE "res\\wattach.bmp"
IDB_NEWSARTICLE BITMAP DISCARDABLE "res\\nattach.bmp"