diff --git a/mozilla/cmd/winfe/csttlbr2.cpp b/mozilla/cmd/winfe/csttlbr2.cpp index 076d11b20f4..e42d033d73b 100644 --- a/mozilla/cmd/winfe/csttlbr2.cpp +++ b/mozilla/cmd/winfe/csttlbr2.cpp @@ -1185,7 +1185,7 @@ void CCustToolbar::OnUpdateCmdUI( CFrameWnd* pTarget, BOOL bDisableIfNoHndler ) } } -void CCustToolbar::Customize(CLinkToolbar *pLinkToolbar, int nSelectedButton) +void CCustToolbar::Customize(CRDFToolbar *pLinkToolbar, int nSelectedButton) { } @@ -1632,7 +1632,7 @@ LRESULT CCustToolbar::OnDragToolbarOver(WPARAM wParam, LPARAM lParam) LRESULT CCustToolbar::OnCustomize(WPARAM wParam, LPARAM lParam) { - CLinkToolbar *pToolbar = (CLinkToolbar *)CWnd::FromHandlePermanent((HWND)lParam); + CRDFToolbar *pToolbar = (CRDFToolbar *)CWnd::FromHandlePermanent((HWND)lParam); int nButton = LOWORD(wParam); Customize(pToolbar, wParam); diff --git a/mozilla/cmd/winfe/csttlbr2.h b/mozilla/cmd/winfe/csttlbr2.h index c4e78f2814e..78d84579060 100644 --- a/mozilla/cmd/winfe/csttlbr2.h +++ b/mozilla/cmd/winfe/csttlbr2.h @@ -207,7 +207,7 @@ public: }; -class CLinkToolbar; +class CRDFToolbar; class CCustToolbar : public CControlBar { @@ -273,7 +273,7 @@ public: virtual void OnUpdateCmdUI( CFrameWnd* pTarget, BOOL bDisableIfNoHndler ); - void Customize(CLinkToolbar *pLinkToolbar = NULL, int nSelectedButton = 0); + void Customize(CRDFToolbar *pRDFToolbar = NULL, int nSelectedButton = 0); BOOL GetSaveToolbarInfo(void); void SetSaveToolbarInfo(BOOL bSaveToolbarInfo); void SetNewParentFrame(CFrameWnd *pParent); diff --git a/mozilla/cmd/winfe/cxicon.cpp b/mozilla/cmd/winfe/cxicon.cpp index 88805d142f5..7b445da264d 100644 --- a/mozilla/cmd/winfe/cxicon.cpp +++ b/mozilla/cmd/winfe/cxicon.cpp @@ -22,38 +22,41 @@ #include "winproto.h" #include "helper.h" -HBITMAP NSNavCenterImage::m_hBadImageBitmap = NULL; -int NSNavCenterImage::refCount = 0; +HBITMAP CRDFImage::m_hBadImageBitmap = NULL; +int CRDFImage::refCount = 0; -NSNavCenterImage::NSNavCenterImage(const char * url) +CRDFImage::CRDFImage(const char * url) { m_nRefCount = 0; pUrl = _strdup( url); bmpInfo = NULL; m_bCompletelyLoaded = FALSE; + m_bFrameLoaded = FALSE; bits = 0; maskbits = 0; + m_BadImage = FALSE; - NSNavCenterImage::refCount++; + CRDFImage::refCount++; iconContext = NULL; + pairCount = 0; } -NSNavCenterImage::~NSNavCenterImage() +CRDFImage::~CRDFImage() { - XP_FREE( bmpInfo); - CDCCX::HugeFree(bits); - CDCCX::HugeFree(maskbits); +// XP_FREE( bmpInfo); +// CDCCX::HugeFree(bits); +// CDCCX::HugeFree(maskbits); free(pUrl); - NSNavCenterImage::refCount--; + CRDFImage::refCount--; if (refCount == 0) { - if (NSNavCenterImage::m_hBadImageBitmap) - VERIFY(::DeleteObject(NSNavCenterImage::m_hBadImageBitmap)); + if (CRDFImage::m_hBadImageBitmap) + VERIFY(::DeleteObject(CRDFImage::m_hBadImageBitmap)); } } -void NSNavCenterImage::AddListener(CCustomImageObject* pObject, HT_Resource r) +void CRDFImage::AddListener(CCustomImageObject* pObject, HT_Resource r) { // We only want to have one copy of the same image in this list. for (POSITION pos = resourceList.GetHeadPosition(); @@ -78,7 +81,7 @@ void NSNavCenterImage::AddListener(CCustomImageObject* pObject, HT_Resource r) } } -void NSNavCenterImage::RemoveListener(CCustomImageObject *pObject) +void CRDFImage::RemoveListener(CCustomImageObject *pObject) { // Listener has been destroyed. Need to get all references to it out of the list. // Just do this by NULLing out the pObject field of the iconcallbackinfo structs. @@ -100,7 +103,30 @@ void NSNavCenterImage::RemoveListener(CCustomImageObject *pObject) } } -void NSNavCenterImage::DestroyContext() +void CRDFImage::RemoveListenerForSpecificResource(CCustomImageObject *pObject, HT_Resource r) +{ + // Listener has been destroyed. Need to get all references to it out of the list. + // Just do this by NULLing out the pObject field of the iconcallbackinfo structs. + for (POSITION pos = resourceList.GetHeadPosition(); + pos != NULL; ) + { + CIconCallbackInfo* pInfo = (CIconCallbackInfo*)resourceList.GetNext(pos); + if (pInfo->pObject == pObject && pInfo->pResource == r) + { + pInfo->pObject = NULL; + m_nRefCount--; + if (m_nRefCount == 0 && iconContext) + { + iconContext->Interrupt(); + DestroyContext(); + return; + } + } + } +} + + +void CRDFImage::DestroyContext() { iconContext->DeleteContextDC(); iconContext->NiceDestruction(); @@ -109,14 +135,19 @@ void NSNavCenterImage::DestroyContext() resourceList.RemoveAll(); } -BOOL NSNavCenterImage::CompletelyLoaded() +BOOL CRDFImage::FrameLoaded() { - return (m_bCompletelyLoaded); + return (m_bFrameLoaded); } -BOOL NSNavCenterImage::SuccessfullyLoaded() +BOOL CRDFImage::FrameSuccessfullyLoaded() { - return (m_bCompletelyLoaded && bits); + return (m_bFrameLoaded && bits); +} + +BOOL CRDFImage::CompletelyLoaded() +{ + return m_bCompletelyLoaded; } void Icon_GetUrlExitRoutine(URL_Struct *pUrl, int iStatus, MWContext *pContext) @@ -125,17 +156,18 @@ void Icon_GetUrlExitRoutine(URL_Struct *pUrl, int iStatus, MWContext *pContext) if(iStatus < 0 && pUrl->error_msg != NULL) { void* pData; - NSNavCenterImage* theImage = NULL; + CRDFImage* theImage = NULL; if (CHTFEData::m_CustomURLCache.Lookup(pUrl->address, pData)) - theImage = (NSNavCenterImage*)pData; + theImage = (CRDFImage*)pData; if (theImage) { // Since we cannot load this url, replace it with a bad image. - theImage->maskbits = 0; - theImage->bits = 0; theImage->m_BadImage = TRUE; - if (!NSNavCenterImage::m_hBadImageBitmap) - NSNavCenterImage::m_hBadImageBitmap = ::LoadBitmap(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_IMAGE_BAD)); + theImage->bits = 0; + theImage->maskbits = 0; + theImage->bmpInfo = 0; + if (!CRDFImage::m_hBadImageBitmap) + CRDFImage::m_hBadImageBitmap = ::LoadBitmap(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_IMAGE_BAD)); theImage->CompleteCallback(); } } @@ -188,7 +220,7 @@ static BOOL ValidNSBitmapFormat(char* extension) return FALSE; } -void NSNavCenterImage::ProcessIcon() +void CRDFImage::ProcessIcon() { char *ext = FE_FindFileExt(pUrl); if (ValidNSBitmapFormat(ext)) @@ -224,7 +256,7 @@ void NSNavCenterImage::ProcessIcon() } } -void NSNavCenterImage::CompleteCallback() +void CRDFImage::CompleteCallback() { m_bCompletelyLoaded = TRUE; while (!resourceList.IsEmpty()) @@ -241,7 +273,20 @@ void NSNavCenterImage::CompleteCallback() DestroyContext(); } -CXIcon::CXIcon(NSNavCenterImage* theImage) +void CRDFImage::CompleteFrameCallback() +{ + m_bFrameLoaded = TRUE; + for (POSITION pos = resourceList.GetHeadPosition(); pos != NULL; ) + { + CIconCallbackInfo* callback = (CIconCallbackInfo*)(resourceList.GetNext(pos)); + if (callback->pObject) + { + callback->pObject->LoadComplete(callback->pResource); + } + } +} + +CXIcon::CXIcon(CRDFImage* theImage) { MWContext *pContext = GetContext(); m_cxType = IconCX; @@ -263,59 +308,40 @@ BITMAPINFO * CXIcon::NewPixmap(NI_Pixmap *pImage, BOOL isMask) if (isMask) m_mask = pImage; else m_image = pImage; - + return CDCCX::NewPixmap(pImage, isMask); } +int CXIcon::DisplayPixmap(NI_Pixmap* image, NI_Pixmap* mask, int32 x, int32 y, int32 x_offset, int32 y_offset, int32 width, int32 height, LTRB& Rect) +{ + m_image = image; + m_mask = mask; + + m_icon->bmpInfo = FillBitmapInfoHeader(image); + m_icon->bits = image->bits; + if (mask) + m_icon->maskbits = mask->bits; + + m_icon->CompleteFrameCallback(); + return 1; +} void CXIcon::ImageComplete(NI_Pixmap* image) { - FEBitmapInfo *imageInfo; - imageInfo = (FEBitmapInfo*) image->client_data; - BITMAPINFOHEADER* header = (BITMAPINFOHEADER*)imageInfo->bmpInfo; - if (image == m_image) + // Will get a call for both the mask and for the image. + if (m_image && m_mask) { - int nColorTable; - if (GetBitsPerPixel() == 16 || GetBitsPerPixel() == 32) - nColorTable = 3; - else if (GetBitsPerPixel() < 16) - nColorTable = 1 << GetBitsPerPixel(); - else { - ASSERT(GetBitsPerPixel() == 24); - nColorTable = 0; - } - - m_icon->bmpInfo = FillBitmapInfoHeader(image); - m_icon->bits = HugeAlloc(header->biSizeImage, 1); - memcpy( m_icon->bits, image->bits, header->biSizeImage ); - } - else - { - m_icon->maskbits = HugeAlloc(header->biSizeImage, 1); - memcpy( m_icon->maskbits, image->bits, header->biSizeImage ); - } - - delete imageInfo; - image->client_data = 0; - if (m_image && m_mask) - { - if (m_icon->maskbits && m_icon->bits) - { - CDCCX::HugeFree(m_image->bits); - m_image->bits = 0; - CDCCX::HugeFree(m_mask->bits); - m_mask->bits = 0; + if (m_icon->pairCount == 2) m_icon->CompleteCallback(); - } + else m_icon->pairCount++; } - else + else { - // We do not have mask, so we don't need to wait for mask. - CDCCX::HugeFree(m_image->bits); - m_image->bits = 0; + // We have no mask. m_icon->CompleteCallback(); } } + // Don't display partial images. void CXIcon::AllConnectionsComplete(MWContext *pContext) { @@ -330,14 +356,14 @@ void CXIcon::NiceDestruction() // ========================= CCustomImageObject Helpers ============================= -NSNavCenterImage* CCustomImageObject::LookupImage(const char* url, HT_Resource r) +CRDFImage* CCustomImageObject::LookupImage(const char* url, HT_Resource r) { // Find the image. void* pData; - NSNavCenterImage* pImage = NULL; + CRDFImage* pImage = NULL; if (CHTFEData::m_CustomURLCache.Lookup(url, pData)) { - pImage = (NSNavCenterImage*)pData; + pImage = (CRDFImage*)pData; // Add ourselves to the callback list if the image hasn't completely loaded. if (!pImage->CompletelyLoaded()) @@ -350,7 +376,7 @@ NSNavCenterImage* CCustomImageObject::LookupImage(const char* url, HT_Resource r else { // Create a new NavCenter image. - pImage = new NSNavCenterImage(url); + pImage = new CRDFImage(url); pImage->AddListener(this, r); CHTFEData::m_CustomURLCache.SetAt(url, pImage); } @@ -366,19 +392,19 @@ CCustomImageObject::~CCustomImageObject() pos != NULL; ) { // Enumerate over the list and call remove listener on each image. - NSNavCenterImage* pImage = (NSNavCenterImage*)loadingImagesList.GetNext(pos); + CRDFImage* pImage = (CRDFImage*)loadingImagesList.GetNext(pos); pImage->RemoveListener(this); } } -void CCustomImageObject::AddLoadingImage(NSNavCenterImage* pImage) +void CCustomImageObject::AddLoadingImage(CRDFImage* pImage) { // We only want to have one copy of the same image in this list. for (POSITION pos = loadingImagesList.GetHeadPosition(); pos != NULL; ) { // Enumerate over the list and call remove listener on each image. - NSNavCenterImage* pNavImage = (NSNavCenterImage*)loadingImagesList.GetNext(pos); + CRDFImage* pNavImage = (CRDFImage*)loadingImagesList.GetNext(pos); if (pNavImage == pImage) return; } @@ -387,7 +413,7 @@ void CCustomImageObject::AddLoadingImage(NSNavCenterImage* pImage) loadingImagesList.AddHead(pImage); } -void CCustomImageObject::RemoveLoadingImage(NSNavCenterImage* pImage) +void CCustomImageObject::RemoveLoadingImage(CRDFImage* pImage) { // Should only occur once in our list. Find and remove. POSITION pos = loadingImagesList.Find(pImage); diff --git a/mozilla/cmd/winfe/cxicon.h b/mozilla/cmd/winfe/cxicon.h index 5d224297982..799566e9d8b 100644 --- a/mozilla/cmd/winfe/cxicon.h +++ b/mozilla/cmd/winfe/cxicon.h @@ -24,18 +24,18 @@ class CXIcon; class CCustomImageObject { -private: +protected: CPtrList loadingImagesList; // A list of images that this window is still waiting for. public: virtual void LoadComplete(HT_Resource r) = 0; - virtual NSNavCenterImage* LookupImage(const char* url, HT_Resource r); + virtual CRDFImage* LookupImage(const char* url, HT_Resource r); virtual ~CCustomImageObject(); - virtual void AddLoadingImage(NSNavCenterImage* pImage); - virtual void RemoveLoadingImage(NSNavCenterImage* pImage); + virtual void AddLoadingImage(CRDFImage* pImage); + virtual void RemoveLoadingImage(CRDFImage* pImage); }; struct CIconCallbackInfo @@ -48,36 +48,49 @@ struct CIconCallbackInfo }; -class NSNavCenterImage { +class CRDFImage +{ public: + char *pUrl; // The URL at which the image can be found. + + BOOL m_bCompletelyLoaded; // Whether or not the image has completely finished loading. + BOOL m_bFrameLoaded; // Whether or not a single frame of the image is available yet. + // (Lets you know whether or not you can start drawing something.) - char *pUrl; - BOOL m_bCompletelyLoaded; - BITMAPINFO *bmpInfo; + BITMAPINFO *bmpInfo; // The current bits of the image. void XP_HUGE *bits; void XP_HUGE *maskbits; HDC hSubDC; - static HBITMAP m_hBadImageBitmap; - static int refCount; - CXIcon* iconContext; - BOOL m_BadImage; + BOOL m_BadImage; // Whether or not to use the bad image bitmap. + static HBITMAP m_hBadImageBitmap; // A bitmap to use if the image is not obtainable. - CPtrList resourceList; - HT_Resource m_HTResource; + static int refCount; // A reference counter for the total # of RDF images that currently exist. - int m_nRefCount; + CXIcon* iconContext; // The context that is performing the load. + + CPtrList resourceList; // The observers of this image. + int m_nRefCount; // The # of observers. + + int pairCount; // Specifies whether or not the mask and the image bits are ready. - NSNavCenterImage(const char * pUrl); - virtual ~NSNavCenterImage(); +public: + CRDFImage(const char * pUrl); + virtual ~CRDFImage(); void ProcessIcon(); void CompleteCallback(); - BOOL CompletelyLoaded(); - BOOL SuccessfullyLoaded(); + void CompleteFrameCallback(); + + BOOL FrameLoaded(); // Whether or not a single frame is ready (either good or bad). + BOOL FrameSuccessfullyLoaded(); // Whether or not a good frame is ready. + + BOOL CompletelyLoaded(); // Whether or not the entire image is ready (either good or bad). + void DestroyContext(); void RemoveListener(CCustomImageObject* pObject); + void RemoveListenerForSpecificResource(CCustomImageObject *pObject, HT_Resource r); void AddListener(CCustomImageObject* pObject, HT_Resource r); }; @@ -85,7 +98,7 @@ class CXIcon : public CDCCX { public: CXIcon(){} - CXIcon(NSNavCenterImage* image); + CXIcon(CRDFImage* image); virtual ~CXIcon(); private: @@ -94,7 +107,7 @@ private: NI_Pixmap* m_image; NI_Pixmap* m_mask; - NSNavCenterImage* m_icon; + CRDFImage* m_icon; public: virtual HDC GetContextDC() { return m_hDC; } @@ -108,5 +121,7 @@ public: // Don't display partial images. virtual void AllConnectionsComplete(MWContext *pContext); void NiceDestruction(); + virtual int DisplayPixmap(NI_Pixmap* image, NI_Pixmap* mask, int32 x, int32 y, int32 x_offset, int32 y_offset, int32 width, int32 height, LTRB& Rect); }; + #endif diff --git a/mozilla/cmd/winfe/dropmenu.cpp b/mozilla/cmd/winfe/dropmenu.cpp index e14c9dbb7c2..21ed190873d 100644 --- a/mozilla/cmd/winfe/dropmenu.cpp +++ b/mozilla/cmd/winfe/dropmenu.cpp @@ -1430,7 +1430,7 @@ CSize CDropMenu::DrawImage(CDC * pDC, const CRect & rect, CDropMenuColumn *pColu } else if (pItem->GetIconType() == ARBITRARY_URL) { - NSNavCenterImage* pImage = pItem->GetCustomIcon(); + CRDFImage* pImage = pItem->GetCustomIcon(); HDC hDC = pDC->m_hDC; int left = ptDst.x; int top = ptDst.y; @@ -1438,14 +1438,14 @@ CSize CDropMenu::DrawImage(CDC * pDC, const CRect & rect, CDropMenuColumn *pColu int imageHeight = 16; COLORREF bkColor = (bIsSelected && (!m_bShowFeedback || eSelType == eON || eSelType == eNONE)) ? GetSysColor(COLOR_HIGHLIGHT) : GetSysColor(COLOR_MENU); - if (pImage && pImage->CompletelyLoaded()) + if (pImage && pImage->FrameLoaded()) { // Now we draw this bad boy. if (pImage->m_BadImage) { // display broken icon. HDC tempDC = ::CreateCompatibleDC(hDC); - HBITMAP hOldBmp = (HBITMAP)::SelectObject(tempDC, NSNavCenterImage::m_hBadImageBitmap); + HBITMAP hOldBmp = (HBITMAP)::SelectObject(tempDC, CRDFImage::m_hBadImageBitmap); ::StretchBlt(hDC, left, top, imageWidth, imageHeight, diff --git a/mozilla/cmd/winfe/dropmenu.h b/mozilla/cmd/winfe/dropmenu.h index f67f84e1bd3..2f6e9b9e9a8 100644 --- a/mozilla/cmd/winfe/dropmenu.h +++ b/mozilla/cmd/winfe/dropmenu.h @@ -113,7 +113,7 @@ public: void * GetUserData(void) { return m_pUserData; } void SetIcon(void* pIcon, IconType iconType) { m_pCustomIcon = pIcon; m_nIconType = iconType; } HICON GetLocalFileIcon() { return (HICON)m_pCustomIcon; } - NSNavCenterImage* GetCustomIcon() { return (NSNavCenterImage*)m_pCustomIcon; } + CRDFImage* GetCustomIcon() { return (CRDFImage*)m_pCustomIcon; } IconType GetIconType() { return m_nIconType; } }; diff --git a/mozilla/cmd/winfe/feimage.cpp b/mozilla/cmd/winfe/feimage.cpp index c36264790b4..1363afab5a6 100755 --- a/mozilla/cmd/winfe/feimage.cpp +++ b/mozilla/cmd/winfe/feimage.cpp @@ -27,6 +27,7 @@ #include "feimage.h" #include "il_types.h" #include "cxdc.h" +#include "cxicon.h" JMC_PUBLIC_API(void) _IMGCB_NewPixmap(struct IMGCB* self, jint op, void* displayContext, jint width, jint height, IL_Pixmap* image, IL_Pixmap* mask) diff --git a/mozilla/cmd/winfe/framinit.cpp b/mozilla/cmd/winfe/framinit.cpp index 916fb5909b3..8953b995513 100755 --- a/mozilla/cmd/winfe/framinit.cpp +++ b/mozilla/cmd/winfe/framinit.cpp @@ -364,7 +364,7 @@ int CMainFrame::CreateLocationBar() int CMainFrame::CreateLinkBar(void) { - m_barLinks = CLinkToolbar::CreateUserToolbar(this); + m_barLinks = CRDFToolbar::CreateUserToolbar(this); CButtonToolbarWindow *pWindow = new CButtonToolbarWindow(m_barLinks, theApp.m_pToolbarStyle, 43, 27, eSMALL_HTAB); diff --git a/mozilla/cmd/winfe/genframe.cpp b/mozilla/cmd/winfe/genframe.cpp index 14a61d6eb2d..2228f93a7fb 100644 --- a/mozilla/cmd/winfe/genframe.cpp +++ b/mozilla/cmd/winfe/genframe.cpp @@ -691,10 +691,8 @@ void CGenericFrame::FinishMenuExpansion(HT_Resource pRoot) m_BookmarksGarbageList->Add(item); // Add the URL to the map. We need to do this because Windows doesn't - // allow any client data to be associated with menu items. Note that - // we aren't making a copy of the string - m_pHotlistMenuMap->SetAt(FIRST_BOOKMARK_MENU_ID + m_nBookmarkItems, - HT_GetNodeURL(pEntry)); + // allow any client data to be associated with menu items. + m_pHotlistMenuMap->SetAt(FIRST_BOOKMARK_MENU_ID + m_nBookmarkItems, pEntry); } // Even though separators and pull-right sub-menus don't have command IDs, @@ -3058,13 +3056,21 @@ BOOL CGenericFrame::OnCommand(UINT wParam,LONG lParam) ASSERT(nLastSelectedCmdID == nID && nLastSelectedData); if (nLastSelectedCmdID != nID || !nLastSelectedData) return FALSE; + + char* nodeURL = HT_GetNodeURL((HT_Resource)nLastSelectedData); + #ifdef EDITOR // It is much safer to go through Composer's LoadUrl routine if(EDT_IS_EDITOR(GetMainContext()->GetContext())) - FE_LoadUrl((char*)nLastSelectedData, TRUE); + FE_LoadUrl(nodeURL, TRUE); else #endif - GetMainContext()->NormalGetUrl((char*)nLastSelectedData); + { + // Add HT_Launch support + if (!HT_Launch((HT_Resource)nLastSelectedData, GetMainContext()->GetContext())) + GetMainContext()->NormalGetUrl(nodeURL); + } + return TRUE; } diff --git a/mozilla/cmd/winfe/mainfrm.h b/mozilla/cmd/winfe/mainfrm.h index 1206e8be182..8b973b45452 100644 --- a/mozilla/cmd/winfe/mainfrm.h +++ b/mozilla/cmd/winfe/mainfrm.h @@ -59,7 +59,7 @@ private: // Some static public data, initialized in framinit.cpp static int m_FirstFrame; CURLBar * m_barLocation; - CLinkToolbar *m_barLinks; + CRDFToolbar *m_barLinks; CCommandToolbar *m_pCommandToolbar; diff --git a/mozilla/cmd/winfe/navbar.cpp b/mozilla/cmd/winfe/navbar.cpp index 0fd18894a85..0de2ec1eb9b 100644 --- a/mozilla/cmd/winfe/navbar.cpp +++ b/mozilla/cmd/winfe/navbar.cpp @@ -32,7 +32,7 @@ extern "C" RDF_NCVocab gNavCenter; /* This class may yet be of use. For now comment it out. -BEGIN_MESSAGE_MAP(CNavMenuButton, CLinkToolbarButton) +BEGIN_MESSAGE_MAP(CNavMenuButton, CRDFToolbarButton) ON_MESSAGE(NSDRAGMENUOPEN, OnDragMenuOpen) END_MESSAGE_MAP() @@ -221,7 +221,7 @@ void CNavMenuBar::OnPaint( ) m_pBackgroundImage = LookupImage(m_BackgroundImageURL, NULL); } - if (m_pBackgroundImage && m_pBackgroundImage->SuccessfullyLoaded()) + if (m_pBackgroundImage && m_pBackgroundImage->FrameSuccessfullyLoaded()) { // Draw the strip of the background image that should be placed // underneath this line. diff --git a/mozilla/cmd/winfe/navbar.h b/mozilla/cmd/winfe/navbar.h index f8a509a4c2b..bea1a4d659f 100644 --- a/mozilla/cmd/winfe/navbar.h +++ b/mozilla/cmd/winfe/navbar.h @@ -28,7 +28,7 @@ class CSelectorButton; /* This class may yet be of use. For now comment it out. -class CNavMenuButton : public CLinkToolbarButton +class CNavMenuButton : public CRDFToolbarButton { protected: HT_View m_HTView; // Pointer to HT_View if one exists. @@ -57,7 +57,7 @@ class CNavMenuBar : public CWnd, public CCustomImageObject COLORREF m_ForegroundColor; COLORREF m_BackgroundColor; CString m_BackgroundImageURL; - NSNavCenterImage* m_pBackgroundImage; + CRDFImage* m_pBackgroundImage; HT_View m_View; // The current HT_View. public: diff --git a/mozilla/cmd/winfe/navcntr.cpp b/mozilla/cmd/winfe/navcntr.cpp index fca8feb5efa..5dfb45d9fba 100644 --- a/mozilla/cmd/winfe/navcntr.cpp +++ b/mozilla/cmd/winfe/navcntr.cpp @@ -226,7 +226,7 @@ int CSelectorButton::Create(CWnd *pParent, int nToolbarStyle, CSize noviceButton HT_View theView = HT_GetSelectedView(m_Pane); BOOKMARKITEM bookmark; // For now, create with the pictures style. No text ever. - return CLinkToolbarButton::Create(pParent, TB_PICTURES, noviceButtonSize, advancedButtonSize, + return CRDFToolbarButton::Create(pParent, TB_PICTURES, noviceButtonSize, advancedButtonSize, pButtonText, pToolTipText, pStatusText, bitmapSize, nMaxTextChars, nMinTextChars, bookmark, HT_TopNode(theView), dwButtonStyle); } @@ -382,7 +382,7 @@ BEGIN_MESSAGE_MAP(CSelector, CView) ON_WM_RBUTTONDOWN() ON_WM_MOUSEMOVE() ON_WM_TIMER() - + ON_MESSAGE(NSBUTTONDRAGGING, OnButtonDrag) //}}AFX_MSG_MAP END_MESSAGE_MAP() @@ -888,11 +888,10 @@ void CSelector::RearrangeIcons() } } -CSelectorButton* CSelector::GetButtonFromPoint(CPoint point, BOOL& onButton) +CSelectorButton* CSelector::GetButtonFromPoint(CPoint point, int& dragFraction) { CRect buttonRect; - onButton = FALSE; - + CNSNavFrame* pFrame = (CNSNavFrame*)GetParentFrame(); int32 dockStyle = pFrame->GetDockStyle(); @@ -910,7 +909,13 @@ CSelectorButton* CSelector::GetButtonFromPoint(CPoint point, BOOL& onButton) if (buttonRect.PtInRect(point)) { - onButton = TRUE; + int hitY = point.y; + if (point.y >= buttonRect.top && point.y <= buttonRect.top + buttonRect.Height()/4.0) + dragFraction = 1; + else if (point.y >= buttonRect.bottom - buttonRect.Height()/4.0) + dragFraction = 3; + else dragFraction = 2; + return pButton; } @@ -918,15 +923,23 @@ CSelectorButton* CSelector::GetButtonFromPoint(CPoint point, BOOL& onButton) dockStyle == DOCKSTYLE_VERTRIGHT) { if (point.y <= buttonRect.bottom) - return pButton; + { + dragFraction = 1; + return pButton; + } } else { if (point.x <= buttonRect.right) - return pButton; + { + dragFraction = 1; + return pButton; + } } } } + + dragFraction = 2; return NULL; } @@ -1063,8 +1076,8 @@ BOOL CSelectorDropTarget::OnDrop(CWnd* pWnd, pSelector->KillSwitchTimer(); if (theView) { - // Do a drop. For now just use drag fractions of 2. - RDFGLOBAL_PerformDrop(pDataObject, HT_TopNode(theView), 2); + // Do a drop. + RDFGLOBAL_PerformDrop(pDataObject, HT_TopNode(theView), pSelector->GetDragFraction()); } @@ -1143,6 +1156,36 @@ BOOL CSelectorDropTarget::OnDrop(CWnd* pWnd, } +LRESULT CSelector::OnButtonDrag(WPARAM wParam, LPARAM lParam) +{ + HWND hWnd = (HWND) lParam; + + CWnd *pButton = CWnd::FromHandle(hWnd); + + COleDataSource * pDataSource = new COleDataSource; + CSelectorButton* pSelButton = (CSelectorButton*)pButton; + + pSelButton->FillInOleDataSource(pDataSource); + + // Need to clear the selection, since I use that for dropping stuff. + HT_SetSelection(HT_TopNode(pSelButton->GetHTView())); + + // Don't start drag until outside this rect + RECT rectDragStart; + pButton->GetClientRect(&rectDragStart); + pButton->MapWindowPoints(this, &rectDragStart); + + DROPEFFECT effect; + CToolbarDropSource * pDropSource = new CToolbarDropSource; + + effect=pDataSource->DoDragDrop(DROPEFFECT_COPY | DROPEFFECT_LINK | DROPEFFECT_MOVE | DROPEFFECT_SCROLL | DROPEFFECT_NONE, + &rectDragStart, pDropSource); + + delete pDropSource; + delete pDataSource; + + return 1; +} DROPEFFECT CSelectorDropTarget::OnDragEnter(CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point ) @@ -1154,22 +1197,24 @@ DROPEFFECT CSelectorDropTarget::OnDragOver(CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point ) { CSelector* pSelector = (CSelector*)pWnd; - BOOL onButton; + int dragFraction; - CSelectorButton* pButton = pSelector->GetButtonFromPoint(point, onButton); + CSelectorButton* pButton = pSelector->GetButtonFromPoint(point, dragFraction); HT_Resource theNode = pButton ? pButton->GetNode() : NULL; - // Give some drag feedback. For now just use drag fractions of 2. - DROPEFFECT answer = RDFGLOBAL_TranslateDropAction(theNode, pDataObject, 2); + // Give some drag feedback. + DROPEFFECT answer = RDFGLOBAL_TranslateDropAction(theNode, pDataObject, dragFraction); - if (pButton != pSelector->GetDragButton()) // User is over a different button + if (pButton != pSelector->GetDragButton() || dragFraction != pSelector->GetDragFraction()) { + // User is over a different button or different part of the same button if (pSelector->GetSwitchTimer() != 0) pSelector->KillSwitchTimer(); // Kill the existing pane switch timer. pSelector->SetDragButton(pButton); + pSelector->SetDragFraction(dragFraction); - if (answer != DROPEFFECT_NONE) // Set the pane switching timer if the user can drop here. + if (answer != DROPEFFECT_NONE && dragFraction == 2) // Set the pane switching timer if the user can drop here. pSelector->SetSwitchTimer(); else { diff --git a/mozilla/cmd/winfe/navcntr.h b/mozilla/cmd/winfe/navcntr.h index 0b4531c11fb..e4a8efe768d 100644 --- a/mozilla/cmd/winfe/navcntr.h +++ b/mozilla/cmd/winfe/navcntr.h @@ -63,7 +63,7 @@ class CRDFContentView; -class CSelectorButton : public CLinkToolbarButton +class CSelectorButton : public CRDFToolbarButton { friend class CSelector; @@ -221,18 +221,25 @@ public: HBRUSH GetHtBrush() {return hHtBrush;} void SetDragButton(CSelectorButton* pButton) { m_pDragButton = pButton; }; + void SetDragFraction(int dragFraction) { m_iDragFraction = dragFraction; } + CSelectorButton* GetDragButton() { return m_pDragButton; } + int GetDragFraction() { return m_iDragFraction; } + UINT GetSwitchTimer() { return m_hPaneSwitchTimer; } void KillSwitchTimer() { KillTimer(IDT_PANESWITCH); m_hPaneSwitchTimer = 0; } void SetSwitchTimer() { m_hPaneSwitchTimer = SetTimer(IDT_PANESWITCH, IDT_SWITCHDELAY, NULL); } - CSelectorButton* GetButtonFromPoint(CPoint point, BOOL& onButton); + CSelectorButton* GetButtonFromPoint(CPoint point, int& dragFraction); afx_msg void OnRButtonUp ( UINT nFlags, CPoint point ); afx_msg void OnLButtonDown (UINT nFlags, CPoint point ); afx_msg void OnLButtonUp(UINT nFlags, CPoint point); afx_msg void OnMouseMove(UINT nFlags, CPoint point); + // Message that is called when a button is being dragged. + LRESULT OnButtonDrag(WPARAM wParam, LPARAM lParam); + // function needed for NavFram.cpp void RearrangeIcons(); @@ -257,6 +264,8 @@ protected: HBRUSH hHtBrush; CSelectorButton* m_pDragButton; // The button that is currently hovered over in a drag. + int m_iDragFraction; // The drag fraction. + UINT m_hPaneSwitchTimer; CPoint m_PointHit; // The point hit on a mouse down on the selector bar (not on one of the buttons). diff --git a/mozilla/cmd/winfe/navfram.cpp b/mozilla/cmd/winfe/navfram.cpp index a8224ae0704..76ad0b857d6 100644 --- a/mozilla/cmd/winfe/navfram.cpp +++ b/mozilla/cmd/winfe/navfram.cpp @@ -150,6 +150,7 @@ void CNSNavFrame::CreateNewNavCenter(CNSGenFrame* pParentFrame, BOOL useViewType // Determine the pixels we should consume if docked int32 width; PREF_GetIntPref(gPrefDockPercentage, &width); + if ((int)width > 400) width = 400; m_DockSize = (int)width; // Read in our dockstyle diff --git a/mozilla/cmd/winfe/quickfil.cpp b/mozilla/cmd/winfe/quickfil.cpp index 32eaece0221..efbaeabf881 100755 --- a/mozilla/cmd/winfe/quickfil.cpp +++ b/mozilla/cmd/winfe/quickfil.cpp @@ -684,7 +684,7 @@ CSize CTreeMenu::DrawImage(CDC * pDC, const CRect & rect, CTreeItem * pItem, } else if (pItem->GetIconType() == ARBITRARY_URL) { - NSNavCenterImage* pImage = pItem->GetCustomIcon(); + CRDFImage* pImage = pItem->GetCustomIcon(); HDC hDC = pDC->m_hDC; int left = ptDst.x; int top = ptDst.y; @@ -692,14 +692,14 @@ CSize CTreeMenu::DrawImage(CDC * pDC, const CRect & rect, CTreeItem * pItem, int imageHeight = 16; COLORREF bkColor = bIsSelected ? GetSysColor(COLOR_HIGHLIGHT) : GetSysColor(COLOR_MENU); - if (pImage && pImage->CompletelyLoaded()) + if (pImage && pImage->FrameLoaded()) { // Now we draw this bad boy. if (pImage->m_BadImage) { // display broken icon. HDC tempDC = ::CreateCompatibleDC(hDC); - HBITMAP hOldBmp = (HBITMAP)::SelectObject(tempDC, NSNavCenterImage::m_hBadImageBitmap); + HBITMAP hOldBmp = (HBITMAP)::SelectObject(tempDC, CRDFImage::m_hBadImageBitmap); ::StretchBlt(hDC, left, top, imageWidth, imageHeight, diff --git a/mozilla/cmd/winfe/quickfil.h b/mozilla/cmd/winfe/quickfil.h index 3b8c1d25b15..3177097524d 100755 --- a/mozilla/cmd/winfe/quickfil.h +++ b/mozilla/cmd/winfe/quickfil.h @@ -150,7 +150,7 @@ class CTreeItem // Aurora improvements to handle custom icons and arbitrary URLs. void SetIcon(void* pIcon, IconType iconType) { m_pCustomIcon = pIcon; m_nIconType = iconType; } HICON GetLocalFileIcon() { return (HICON)m_pCustomIcon; } - NSNavCenterImage* GetCustomIcon() { return (NSNavCenterImage*)m_pCustomIcon; } + CRDFImage* GetCustomIcon() { return (CRDFImage*)m_pCustomIcon; } IconType GetIconType() { return m_nIconType; } protected: diff --git a/mozilla/cmd/winfe/rdfacc.h b/mozilla/cmd/winfe/rdfacc.h index e115b8c484e..b19e7d3e1c2 100644 --- a/mozilla/cmd/winfe/rdfacc.h +++ b/mozilla/cmd/winfe/rdfacc.h @@ -22,7 +22,7 @@ #include "cxstubs.h" class CCustomImageObject; -class NSNavCenterImage; +class CRDFImage; enum IconType { BUILTIN_BITMAP, LOCAL_FILE, ARBITRARY_URL }; // TODO: Use this icon type for the tree AND the toolbars @@ -45,7 +45,7 @@ public: while (pos != NULL) { m_CustomURLCache.GetNextAssoc(pos, key, pData); - NSNavCenterImage* pImage = (NSNavCenterImage*)pData; + CRDFImage* pImage = (CRDFImage*)pData; delete pImage; } } @@ -57,7 +57,7 @@ public: // "no extension" is used to represent files with no extension static CMapStringToPtr m_CustomURLCache; - // Hashed on the URL of the image. Holds pointers to NSNavCenterImages. + // Hashed on the URL of the image. Holds pointers to CRDFImages. }; class CRDFColumn : public CObject @@ -173,15 +173,15 @@ public: BOOL IsLocalFile(const char* pURL); BOOL IsExecutableURL(const char* pURL); HICON DrawLocalFileIcon(HT_Resource r, int left, int top, HDC hdc); -NSNavCenterImage* DrawArbitraryURL(HT_Resource r, int left, int top, int imageWidth, +CRDFImage* DrawArbitraryURL(HT_Resource r, int left, int top, int imageWidth, int imageHeight, HDC hDC, COLORREF bkColor, CCustomImageObject* pObject, BOOL largeIcon); HICON FetchLocalFileIcon(HT_Resource r); -NSNavCenterImage* FetchCustomIcon(HT_Resource r, CCustomImageObject* pObject, BOOL largeIcon); +CRDFImage* FetchCustomIcon(HT_Resource r, CCustomImageObject* pObject, BOOL largeIcon); IconType DetermineIconType(HT_Resource pNode, BOOL largeIcon); -void PaintBackground(HDC hdc, CRect rect, NSNavCenterImage* pImage, int ySrcOffset = -1); +void PaintBackground(HDC hdc, CRect rect, CRDFImage* pImage, int ySrcOffset = -1); // This function tiles and paints the background image in the tree. void ResolveToPaletteColor(COLORREF& color, HPALETTE hPal); #endif // RDFACC_H \ No newline at end of file diff --git a/mozilla/cmd/winfe/rdfliner.cpp b/mozilla/cmd/winfe/rdfliner.cpp index 26a54bc35e2..2a2c78d3461 100644 --- a/mozilla/cmd/winfe/rdfliner.cpp +++ b/mozilla/cmd/winfe/rdfliner.cpp @@ -240,6 +240,52 @@ void CRDFOutliner::HandleEvent(HT_Notification ns, HT_Resource n, HT_Event whatH { FinishExpansion(HT_GetNodeIndex(m_View, n)); } + else if (whatHappened == HT_EVENT_NODE_OPENCLOSE_CHANGING) + { + PRBool openState; + HT_GetOpenState(n, &openState); + if (openState) + { + // Node is closing. We need to iterate over our list of loading images and + // if the node(s) that are observing the resource are children of this node, + // we need to remove them from the observation list of the image. + for (POSITION pos = loadingImagesList.GetHeadPosition(); pos != NULL; ) + { + // Enumerate over the list of loading images. + CRDFImage* pImage = (CRDFImage*)loadingImagesList.GetNext(pos); + + // Figure out which of our resources are listening to this image. + for (POSITION pos2 = pImage->resourceList.GetHeadPosition(); + pos2 != NULL; ) + { + // Enumerate over the list and call remove listener on each image. + CIconCallbackInfo* pInfo = (CIconCallbackInfo*)(pImage->resourceList.GetNext(pos2)); + if (pInfo->pObject == this) + { + // We are currently observing this image. + // Find out if the resource that is observing the image is a direct + // descendant of the parent node that is closing. + + HT_Resource child; + for (child = pInfo->pResource; + child != NULL && child != n; + child = HT_GetParent(child)); + if (child == n) + { + // Do a removal. + if (pos2 != NULL) // Not at the end + { + pImage->resourceList.GetPrev(pos2); + if (pos2 == NULL) + pos2 = pImage->resourceList.GetHeadPosition(); + } + pImage->RemoveListenerForSpecificResource(this, pInfo->pResource); + } + } + } + } + } + } else if (whatHappened == HT_EVENT_NODE_SELECTION_CHANGED) { int i = HT_GetNodeIndex(m_View, n); @@ -527,18 +573,18 @@ HICON DrawLocalFileIcon(HT_Resource r, int left, int top, HDC hDC) return hIcon; } -NSNavCenterImage* DrawArbitraryURL(HT_Resource r, int left, int top, int imageWidth, int imageHeight, HDC hDC, COLORREF bkColor, +CRDFImage* DrawArbitraryURL(HT_Resource r, int left, int top, int imageWidth, int imageHeight, HDC hDC, COLORREF bkColor, CCustomImageObject* pObject, BOOL largeIcon) { - NSNavCenterImage* pImage = FetchCustomIcon(r, pObject, largeIcon); - if (pImage && pImage->CompletelyLoaded()) + CRDFImage* pImage = FetchCustomIcon(r, pObject, largeIcon); + if (pImage && pImage->FrameLoaded()) { // Now we draw this bad boy. if (pImage->m_BadImage) { // display broken icon. HDC tempDC = ::CreateCompatibleDC(hDC); - HBITMAP hOldBmp = (HBITMAP)::SelectObject(tempDC, NSNavCenterImage::m_hBadImageBitmap); + HBITMAP hOldBmp = (HBITMAP)::SelectObject(tempDC, CRDFImage::m_hBadImageBitmap); ::StretchBlt(hDC, left, top, imageWidth, imageHeight, @@ -700,9 +746,9 @@ HICON FetchLocalFileIcon(HT_Resource r) return hIcon; } -NSNavCenterImage* FetchCustomIcon(HT_Resource r, CCustomImageObject* imageObject, BOOL largeIcon) +CRDFImage* FetchCustomIcon(HT_Resource r, CCustomImageObject* imageObject, BOOL largeIcon) { - NSNavCenterImage* pImage = NULL; + CRDFImage* pImage = NULL; CString hashString; if (largeIcon) hashString = HT_GetNodeLargeIconURL(r); @@ -940,16 +986,24 @@ void CRDFOutliner::OnSelDblClk(int iLine) void CRDFOutliner::DisplayURL() { char* url = HT_GetNodeURL(m_Node); - if (IsExecutableURL(url)) + CAbstractCX * pCX = FEU_GetLastActiveFrameContext(); + ASSERT(pCX != NULL); + if (pCX == NULL) + return; + + // Let HT handle some URLs. + if (HT_Launch(m_Node, pCX->GetContext())) + return; + + // Shell execute all local file URLs. + if (IsLocalFile(url)) { - // Shell Execute -#ifdef _WIN32 char* pLocalName = NULL; XP_ConvertUrlToLocalFile(url, &pLocalName); pLocalName = NET_UnEscape(pLocalName); SHELLEXECUTEINFO sei; - + // Use ShellExecuteEx to launch sei.cbSize = sizeof(sei); sei.fMask = SEE_MASK_FLAG_NO_UI | SEE_MASK_NOCLOSEPROCESS; @@ -992,29 +1046,18 @@ void CRDFOutliner::DisplayURL() sprintf(szMsg, szLoadString(IDS_WINEXEC_XX), uSpawn); break; } - + CString s; if (s.LoadString( IDS_BOOKMARK_ADDRESSPROPERTIES )) { ::MessageBox(GetParentFrame()->m_hWnd, szMsg, s, MB_OK | MB_APPLMODAL); } } + if (pLocalName) XP_FREE(pLocalName); -#endif // _WIN32 - } - else - { - CAbstractCX * pCX = FEU_GetLastActiveFrameContext(); - ASSERT(pCX != NULL); - if (pCX != NULL) - { - if (!strncmp(url, "nes:", 4)) - pCX->NormalGetUrl((LPTSTR)&url[4]); - else - pCX->NormalGetUrl((LPTSTR) url); - } } + else pCX->NormalGetUrl((LPTSTR) url); // Do a normal fetch. } BOOL CRDFOutliner::TestRowCol(POINT point, int &iRow, int &iCol) @@ -1780,7 +1823,7 @@ void CRDFOutliner::OnPaint() m_pBackgroundImage = LookupImage(m_BackgroundImageURL, NULL); } - if (m_pBackgroundImage && m_pBackgroundImage->SuccessfullyLoaded()) + if (m_pBackgroundImage && m_pBackgroundImage->FrameSuccessfullyLoaded()) { int imageHeight = m_pBackgroundImage->bmpInfo->bmiHeader.biHeight; int ySrcOffset = (bgFillRect.top + m_iTopLine*m_itemHeight) % imageHeight; @@ -1818,7 +1861,7 @@ void CRDFOutliner::OnPaint() VERIFY(DeleteObject( hHighPen )); } -void DrawBGSubimage(NSNavCenterImage* pImage, HDC hDC, int xSrcOffset, int ySrcOffset, int xDstOffset, int yDstOffset, +void DrawBGSubimage(CRDFImage* pImage, HDC hDC, int xSrcOffset, int ySrcOffset, int xDstOffset, int yDstOffset, int width, int height) { if (pImage->bits) @@ -1854,7 +1897,7 @@ void DrawBGSubimage(NSNavCenterImage* pImage, HDC hDC, int xSrcOffset, int ySrcO } } -void PaintBackground(HDC hdc, CRect rect, NSNavCenterImage* pImage, int ySrcOffset) +void PaintBackground(HDC hdc, CRect rect, CRDFImage* pImage, int ySrcOffset) { int totalWidth = rect.Width(); int totalHeight = rect.Height(); @@ -2003,7 +2046,7 @@ void CRDFOutliner::PaintLine ( int iLineNo, HDC hdc, LPRECT lpPaintRect, rectColumn.left = offset; rectColumn.right = WinRect.right; - if (!(m_pBackgroundImage && m_pBackgroundImage->SuccessfullyLoaded())) + if (!(m_pBackgroundImage && m_pBackgroundImage->FrameSuccessfullyLoaded())) { if (m_bDrawDividers) rectColumn.bottom--; // Handle the divider @@ -2738,8 +2781,10 @@ void RDFGLOBAL_PerformDrop(COleDataObject* pDataObject, HT_Resource theNode, int DropPosition dropPosition = RDFGLOBAL_TranslateDropPosition(theNode, dragFraction); HT_Resource node = NULL; + BOOL nothingSelected = TRUE; while (node = (HT_GetNextSelection(pView, node))) { + nothingSelected = FALSE; if (dropPosition == DROP_BEFORE) HT_DropHTRAtPos(theNode, node, (PRBool)TRUE); else if (dropPosition == DROP_AFTER) @@ -2748,6 +2793,18 @@ void RDFGLOBAL_PerformDrop(COleDataObject* pDataObject, HT_Resource theNode, int HT_DropHTROn(theNode, node); else HT_DropHTROn(HT_GetParent(theNode), node); } + + if (nothingSelected) + { + // Use the top node of the view. + HT_Resource node = HT_TopNode(pView); + if (dropPosition == DROP_BEFORE) + HT_DropHTRAtPos(theNode, node, (PRBool)TRUE); + else if (dropPosition == DROP_AFTER) + HT_DropHTRAtPos(theNode, node, (PRBool)FALSE); + else if (dropPosition == DROP_ON) + HT_DropHTROn(theNode, node); + } } else if(pDataObject->IsDataAvailable(cfBookmark)) { @@ -2896,13 +2953,12 @@ DROPEFFECT CRDFOutliner::DropSelect(int iLineNo, COleDataObject *object) DropPosition RDFGLOBAL_TranslateDropPosition(HT_Resource dropTarget, int position) { HT_Resource targetParent = HT_GetParent(dropTarget); - - BOOL sortImposed = !HT_ContainerSupportsNaturalOrderSort(targetParent); // Is a sort imposed on the parent? - + BOOL sortImposed = FALSE; + if (targetParent != NULL) + sortImposed = !HT_ContainerSupportsNaturalOrderSort(targetParent); // Is a sort imposed on the parent? + DropPosition res; - if (targetParent == NULL) // Top Node of the view. Can't drop before or after. - res = DROP_ON; - else if (!sortImposed) // Can only drop/before or after if sort is not imposed on the view. + if (!sortImposed) // Can only drop/before or after if sort is not imposed on the view. { if (position == 1) { @@ -2949,9 +3005,11 @@ DROPEFFECT RDFGLOBAL_TranslateDropAction(HT_Resource dropTarget, COleDataObject* pView = *pBookmark; GlobalUnlock(hBookmark); - HT_Resource node = HT_GetNextSelection(pView, NULL); + HT_Resource node = HT_GetNextSelection(pView, NULL); + BOOL nothingSelected = TRUE; while (node != NULL) { + nothingSelected = FALSE; HT_DropAction res2; if (dropPosition == DROP_BEFORE) res2 = HT_CanDropHTRAtPos(dropTarget, node, (PRBool)TRUE); @@ -2971,6 +3029,20 @@ DROPEFFECT RDFGLOBAL_TranslateDropAction(HT_Resource dropTarget, COleDataObject* node = HT_GetNextSelection(pView, node); } + + if (nothingSelected) + { + // Use the top node of the view. + HT_Resource node = HT_TopNode(pView); + // Should only enter this code when buttons from the selector bar are being dragged. + if (dropPosition == DROP_BEFORE) + res = HT_CanDropHTRAtPos(dropTarget, node, (PRBool)TRUE); + else if (dropPosition == DROP_AFTER) + res = HT_CanDropHTRAtPos(dropTarget, node, (PRBool)FALSE); + else if (dropPosition == DROP_ON) + res = HT_CanDropHTROn(dropTarget, node); + else res = HT_CanDropHTROn(HT_GetParent(dropTarget), node); + } } else if (pDataObject->IsDataAvailable(cfBookmark)) { @@ -3248,7 +3320,7 @@ void CRDFOutlinerParent::OnPaint ( ) m_pBackgroundImage = LookupImage(m_BackgroundImageURL, NULL); } - BOOL shouldPaintBG = m_pBackgroundImage && m_pBackgroundImage->SuccessfullyLoaded(); + BOOL shouldPaintBG = m_pBackgroundImage && m_pBackgroundImage->FrameSuccessfullyLoaded(); if (shouldPaintBG) { PaintBackground(pdc, rectClient, m_pBackgroundImage); diff --git a/mozilla/cmd/winfe/rdfliner.h b/mozilla/cmd/winfe/rdfliner.h index a7991513cc1..d05831c7c96 100644 --- a/mozilla/cmd/winfe/rdfliner.h +++ b/mozilla/cmd/winfe/rdfliner.h @@ -117,7 +117,7 @@ private: BOOL m_bDrawDividers; // Whether or not dividers should be drawn CString m_BackgroundImageURL; // The URL of the background image. - NSNavCenterImage* m_pBackgroundImage; // The image for the background. + CRDFImage* m_pBackgroundImage; // The image for the background. public: CRDFOutliner (HT_Pane thePane, HT_View theView, CRDFOutlinerParent* theParent); @@ -357,7 +357,7 @@ private: CRDFCommandMap columnMap; COLORREF m_ForegroundColor; COLORREF m_BackgroundColor; - NSNavCenterImage* m_pBackgroundImage; + CRDFImage* m_pBackgroundImage; CString m_BackgroundImageURL; public: diff --git a/mozilla/cmd/winfe/tlbutton.cpp b/mozilla/cmd/winfe/tlbutton.cpp index 70a9d9ec7e3..4988d0bc15c 100644 --- a/mozilla/cmd/winfe/tlbutton.cpp +++ b/mozilla/cmd/winfe/tlbutton.cpp @@ -811,11 +811,7 @@ void CToolbarButton::OnLButtonDown(UINT nFlags, CPoint point) { m_hMenuTimer = SetTimer(IDT_MENU, MENU_DELAY_MS, NULL); } - else if(m_dwButtonStyle & TB_HAS_IMMEDIATE_MENU) - { - m_hMenuTimer = SetTimer(IDT_MENU, 0, NULL); - } - + RedrawWindow(); } if(m_pToolTipText != NULL) @@ -902,7 +898,13 @@ void CToolbarButton::OnLButtonUp(UINT nFlags, CPoint point) // Cursor is still over the button, so back to button up look m_eState = eBUTTON_UP; if(m_bButtonDown) - OnAction(); + { + if (m_dwButtonStyle & TB_HAS_IMMEDIATE_MENU) + { + m_hMenuTimer = SetTimer(IDT_MENU, 0, NULL); + } + else OnAction(); + } } } else diff --git a/mozilla/cmd/winfe/urlbar.cpp b/mozilla/cmd/winfe/urlbar.cpp index 7b82699e83e..89be3afd962 100755 --- a/mozilla/cmd/winfe/urlbar.cpp +++ b/mozilla/cmd/winfe/urlbar.cpp @@ -25,6 +25,7 @@ #include "hk_funcs.h" #include "prefapi.h" #include "glhist.h" +#include "navfram.h" extern void wfe_Progress(MWContext *pContext, const char *pMessage); @@ -690,7 +691,20 @@ BOOL CEditWnd::PreTranslateMessage ( MSG * msg ) { if ( strlen ( new_url ) ) { - pCX->NormalGetUrl(new_url); + CNSGenFrame* pFrame = (CNSGenFrame*)GetTopLevelFrame(); + BOOL doNormalLoad = TRUE; + if (pFrame) + { + CNSNavFrame* pNavCenter = pFrame->GetDockedNavCenter(); + if (pNavCenter) + { + HT_Pane thePane = pNavCenter->GetHTPane(); + doNormalLoad = !HT_LaunchURL(thePane, new_url, pCX->GetContext()); + } + } + + if (doNormalLoad) + pCX->NormalGetUrl(new_url); } XP_FREE(new_url); } @@ -698,7 +712,20 @@ BOOL CEditWnd::PreTranslateMessage ( MSG * msg ) { if ( strlen ( url ) ) { - pCX->NormalGetUrl(url); + CNSGenFrame* pFrame = (CNSGenFrame*)GetTopLevelFrame(); + BOOL doNormalLoad = TRUE; + if (pFrame) + { + CNSNavFrame* pNavCenter = pFrame->GetDockedNavCenter(); + if (pNavCenter) + { + HT_Pane thePane = pNavCenter->GetHTPane(); + doNormalLoad = !HT_LaunchURL(thePane, (char*)(const char*)url, pCX->GetContext()); + } + } + + if (doNormalLoad) + pCX->NormalGetUrl(url); } } } diff --git a/mozilla/cmd/winfe/usertlbr.cpp b/mozilla/cmd/winfe/usertlbr.cpp index e6d1ec1fba6..d6d73b80331 100644 --- a/mozilla/cmd/winfe/usertlbr.cpp +++ b/mozilla/cmd/winfe/usertlbr.cpp @@ -34,14 +34,14 @@ extern "C" { #define MAX_TOOLBAR_BUTTONS 60 #define MAX_TOOLBAR_ROWS 3 -int CLinkToolbar::m_nMinToolbarButtonChars = 15; -int CLinkToolbar::m_nMaxToolbarButtonChars = 30; +int CRDFToolbar::m_nMinToolbarButtonChars = 15; +int CRDFToolbar::m_nMaxToolbarButtonChars = 30; ////////////////////////////////////////////////////////////////////////////////////// -// CLinkToolbarButtonDropTarget +// CRDFToolbarButtonDropTarget ////////////////////////////////////////////////////////////////////////////////////// -DROPEFFECT CLinkToolbarButtonDropTarget::ProcessDragEnter(CWnd *pWnd, COleDataObject *pDataObject, +DROPEFFECT CRDFToolbarButtonDropTarget::ProcessDragEnter(CWnd *pWnd, COleDataObject *pDataObject, DWORD dwKeyState, CPoint point) { @@ -50,26 +50,26 @@ DROPEFFECT CLinkToolbarButtonDropTarget::ProcessDragEnter(CWnd *pWnd, COleDataOb return ProcessDragOver(pWnd, pDataObject, dwKeyState, point); } -DROPEFFECT CLinkToolbarButtonDropTarget::ProcessDragOver(CWnd *pWnd, COleDataObject *pDataObject, +DROPEFFECT CRDFToolbarButtonDropTarget::ProcessDragOver(CWnd *pWnd, COleDataObject *pDataObject, DWORD dwKeyState, CPoint point) { - CLinkToolbarButton* pButton = (CLinkToolbarButton*)m_pButton; + CRDFToolbarButton* pButton = (CRDFToolbarButton*)m_pButton; // Treat as a drop onto the folder. return RDFGLOBAL_TranslateDropAction(pButton->GetNode(), pDataObject, 2); } -BOOL CLinkToolbarButtonDropTarget::ProcessDrop(CWnd *pWnd, COleDataObject *pDataObject, +BOOL CRDFToolbarButtonDropTarget::ProcessDrop(CWnd *pWnd, COleDataObject *pDataObject, DROPEFFECT dropEffect, CPoint point) { // Treat as a drop onto the folder. - CLinkToolbarButton* pButton = (CLinkToolbarButton*)m_pButton; + CRDFToolbarButton* pButton = (CRDFToolbarButton*)m_pButton; RDFGLOBAL_PerformDrop(pDataObject, pButton->GetNode(), 2); return TRUE; } ////////////////////////////////////////////////////////////////////////////////////// -// CLinkToolbarButton +// CRDFToolbarButton ////////////////////////////////////////////////////////////////////////////////////// static HBITMAP m_hbmpBM = NULL; static HBITMAP m_hbmpBMSelected = NULL; @@ -78,7 +78,7 @@ static HBITMAP m_hbmpSelectedFolder = NULL; static HBITMAP m_hbmpFolderOpen = NULL; static int nBitmapRefCount = 0; -CLinkToolbarButton::CLinkToolbarButton() +CRDFToolbarButton::CRDFToolbarButton() { m_bShouldShowRMMenu = TRUE; @@ -90,7 +90,7 @@ CLinkToolbarButton::CLinkToolbarButton() } -CLinkToolbarButton::~CLinkToolbarButton() +CRDFToolbarButton::~CRDFToolbarButton() { if(m_Node && HT_IsContainer(m_Node)) { @@ -127,7 +127,7 @@ CLinkToolbarButton::~CLinkToolbarButton() } } -int CLinkToolbarButton::Create(CWnd *pParent, int nToolbarStyle, CSize noviceButtonSize, CSize advancedButtonSize, +int CRDFToolbarButton::Create(CWnd *pParent, int nToolbarStyle, CSize noviceButtonSize, CSize advancedButtonSize, LPCTSTR pButtonText, LPCTSTR pToolTipText, LPCTSTR pStatusText, CSize bitmapSize, int nMaxTextChars, int nMinTextChars, BOOKMARKITEM bookmark, @@ -166,19 +166,19 @@ int CLinkToolbarButton::Create(CWnd *pParent, int nToolbarStyle, CSize noviceBut return bResult; } -CSize CLinkToolbarButton::GetMinimalButtonSize(void) +CSize CRDFToolbarButton::GetMinimalButtonSize(void) { CString szText(HT_GetNodeName(m_Node)); return GetButtonSizeFromChars(szText, m_nMinTextChars); } -CSize CLinkToolbarButton::GetMaximalButtonSize(void) +CSize CRDFToolbarButton::GetMaximalButtonSize(void) { CString szText(HT_GetNodeName(m_Node)); return GetButtonSizeFromChars(szText, m_nMaxTextChars); } -void CLinkToolbarButton::OnAction(void) +void CRDFToolbarButton::OnAction(void) { if(m_Node && !HT_IsContainer(m_Node)) { @@ -186,12 +186,13 @@ void CLinkToolbarButton::OnAction(void) ASSERT(pCX != NULL); if (pCX != NULL) { - pCX->NormalGetUrl((LPTSTR)HT_GetNodeURL(m_Node)); + if (!HT_Launch(m_Node, pCX->GetContext())) + pCX->NormalGetUrl((LPTSTR)HT_GetNodeURL(m_Node)); } } } -void CLinkToolbarButton::FillInOleDataSource(COleDataSource *pDataSource) +void CRDFToolbarButton::FillInOleDataSource(COleDataSource *pDataSource) { CLIPFORMAT cfHTNode = (CLIPFORMAT)RegisterClipboardFormat(NETSCAPE_HTNODE_FORMAT); HANDLE hString = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE,1); @@ -205,12 +206,12 @@ void CLinkToolbarButton::FillInOleDataSource(COleDataSource *pDataSource) } -BOOKMARKITEM CLinkToolbarButton::GetBookmarkItem(void) +BOOKMARKITEM CRDFToolbarButton::GetBookmarkItem(void) { return m_bookmark; } -void CLinkToolbarButton::SetBookmarkItem(BOOKMARKITEM bookmark) +void CRDFToolbarButton::SetBookmarkItem(BOOKMARKITEM bookmark) { /* m_bookmark = bookmark; CString strText(bookmark.szText); @@ -218,7 +219,7 @@ void CLinkToolbarButton::SetBookmarkItem(BOOKMARKITEM bookmark) */ } -void CLinkToolbarButton::SetNode(HT_Resource pNode, BOOL bAddRef) +void CRDFToolbarButton::SetNode(HT_Resource pNode, BOOL bAddRef) { if (pNode == NULL) return; @@ -255,7 +256,7 @@ void CLinkToolbarButton::SetNode(HT_Resource pNode, BOOL bAddRef) } -void CLinkToolbarButton::EditTextChanged(char *pText) +void CRDFToolbarButton::EditTextChanged(char *pText) { if (pText) { @@ -266,25 +267,25 @@ void CLinkToolbarButton::EditTextChanged(char *pText) } RemoveTextEdit(); - ((CLinkToolbar*)GetParent())->LayoutButtons(-1); + ((CRDFToolbar*)GetParent())->LayoutButtons(-1); } -void CLinkToolbarButton::DrawPicturesAndTextMode(HDC hDC, CRect rect) +void CRDFToolbarButton::DrawPicturesAndTextMode(HDC hDC, CRect rect) { DrawBitmapOnSide(hDC, rect); } -void CLinkToolbarButton::DrawPicturesMode(HDC hDC, CRect rect) +void CRDFToolbarButton::DrawPicturesMode(HDC hDC, CRect rect) { DrawBitmapOnSide(hDC, rect); } -void CLinkToolbarButton::DrawButtonText(HDC hDC, CRect rcTxt, CSize sizeTxt, CString strTxt) +void CRDFToolbarButton::DrawButtonText(HDC hDC, CRect rcTxt, CSize sizeTxt, CString strTxt) { CToolbarButton::DrawButtonText(hDC, rcTxt, sizeTxt, strTxt); } -CSize CLinkToolbarButton::GetButtonSizeFromChars(CString s, int c) +CSize CRDFToolbarButton::GetButtonSizeFromChars(CString s, int c) { if(m_nToolbarStyle != TB_TEXT) return(GetBitmapOnSideSize(s, c)); @@ -292,18 +293,18 @@ CSize CLinkToolbarButton::GetButtonSizeFromChars(CString s, int c) return(GetTextOnlySize(s, c)); } -void CLinkToolbarButton::GetPicturesAndTextModeTextRect(CRect &rect) +void CRDFToolbarButton::GetPicturesAndTextModeTextRect(CRect &rect) { GetBitmapOnSideTextRect(rect); } -void CLinkToolbarButton::GetPicturesModeTextRect(CRect &rect) +void CRDFToolbarButton::GetPicturesModeTextRect(CRect &rect) { GetBitmapOnSideTextRect(rect); } -BOOL CLinkToolbarButton::CreateRightMouseMenu(void) +BOOL CRDFToolbarButton::CreateRightMouseMenu(void) { if (m_bShouldShowRMMenu) { @@ -334,12 +335,12 @@ BOOL CLinkToolbarButton::CreateRightMouseMenu(void) return m_bShouldShowRMMenu; } -CWnd* CLinkToolbarButton::GetMenuParent(void) +CWnd* CRDFToolbarButton::GetMenuParent(void) { return this; } -BOOL CLinkToolbarButton::OnCommand(UINT wParam, LONG lParam) +BOOL CRDFToolbarButton::OnCommand(UINT wParam, LONG lParam) { BOOL bRtn = TRUE; @@ -386,13 +387,14 @@ BOOL CLinkToolbarButton::OnCommand(UINT wParam, LONG lParam) ASSERT(pCX != NULL); if (pCX != NULL) { - pCX->NormalGetUrl((LPTSTR)HT_GetNodeURL(theNode)); + if (!HT_Launch(theNode, pCX->GetContext())) + pCX->NormalGetUrl((LPTSTR)HT_GetNodeURL(theNode)); } } } else { - bRtn = CLinkToolbarButtonBase::OnCommand(wParam, lParam); + bRtn = CRDFToolbarButtonBase::OnCommand(wParam, lParam); } return(bRtn); @@ -400,11 +402,11 @@ BOOL CLinkToolbarButton::OnCommand(UINT wParam, LONG lParam) } /////////////////////////////////////////////////////////////////////////////////// -// CLinkToolbarButton Messages +// CRDFToolbarButton Messages /////////////////////////////////////////////////////////////////////////////////// -BEGIN_MESSAGE_MAP(CLinkToolbarButton, CLinkToolbarButtonBase) - //{{AFX_MSG_MAP(CLinkToolbarButton) +BEGIN_MESSAGE_MAP(CRDFToolbarButton, CRDFToolbarButtonBase) + //{{AFX_MSG_MAP(CRDFToolbarButton) ON_MESSAGE(NSDRAGMENUOPEN, OnDragMenuOpen) ON_MESSAGE(DM_FILLINMENU, OnFillInMenu) ON_MESSAGE(DT_DROPOCCURRED, OnDropMenuDropOccurred) @@ -415,7 +417,7 @@ BEGIN_MESSAGE_MAP(CLinkToolbarButton, CLinkToolbarButtonBase) END_MESSAGE_MAP() -LRESULT CLinkToolbarButton::OnDragMenuOpen(WPARAM wParam, LPARAM lParam) +LRESULT CRDFToolbarButton::OnDragMenuOpen(WPARAM wParam, LPARAM lParam) { // Set our drop menu's user data. if (m_pDropMenu) @@ -438,7 +440,7 @@ LRESULT CLinkToolbarButton::OnDragMenuOpen(WPARAM wParam, LPARAM lParam) } -LRESULT CLinkToolbarButton::OnFillInMenu(WPARAM wParam, LPARAM lParam) +LRESULT CRDFToolbarButton::OnFillInMenu(WPARAM wParam, LPARAM lParam) { // Set our drop menu's user data. if (m_pDropMenu) @@ -455,7 +457,7 @@ LRESULT CLinkToolbarButton::OnFillInMenu(WPARAM wParam, LPARAM lParam) return 1; } -LRESULT CLinkToolbarButton::OnDropMenuDraggingOccurred(WPARAM wParam, LPARAM lParam) +LRESULT CRDFToolbarButton::OnDropMenuDraggingOccurred(WPARAM wParam, LPARAM lParam) { CDropMenuDragData* pData = (CDropMenuDragData*)lParam; UINT nCommand = pData->m_nCommand; @@ -483,7 +485,7 @@ LRESULT CLinkToolbarButton::OnDropMenuDraggingOccurred(WPARAM wParam, LPARAM lPa } -LRESULT CLinkToolbarButton::OnDropMenuDropOccurred(WPARAM wParam, LPARAM lParam) +LRESULT CRDFToolbarButton::OnDropMenuDropOccurred(WPARAM wParam, LPARAM lParam) { CDropMenuDragData* pData = (CDropMenuDragData*)lParam; UINT nCommand = pData->m_nCommand; @@ -508,7 +510,7 @@ LRESULT CLinkToolbarButton::OnDropMenuDropOccurred(WPARAM wParam, LPARAM lParam) return 1; } -LRESULT CLinkToolbarButton::OnDropMenuClosed(WPARAM wParam, LPARAM lParam) +LRESULT CRDFToolbarButton::OnDropMenuClosed(WPARAM wParam, LPARAM lParam) { int nCount; if(m_pDropMenu != NULL) @@ -532,7 +534,7 @@ LRESULT CLinkToolbarButton::OnDropMenuClosed(WPARAM wParam, LPARAM lParam) return 1; } -void CLinkToolbarButton::OnSysColorChange( ) +void CRDFToolbarButton::OnSysColorChange( ) { if(nBitmapRefCount > 0) { @@ -578,10 +580,10 @@ void CLinkToolbarButton::OnSysColorChange( ) } /////////////////////////////////////////////////////////////////////////// -// CLinkToolbarButton Helpers +// CRDFToolbarButton Helpers /////////////////////////////////////////////////////////////////////////// -void CLinkToolbarButton::FillInMenu(HT_Resource theNode) +void CRDFToolbarButton::FillInMenu(HT_Resource theNode) { m_pCachedDropMenu->CreateOverflowMenuItem(ID_HOTLIST_VIEW, CString(szLoadString(IDS_MORE_BOOKMARKS)), NULL, NULL ); @@ -629,7 +631,7 @@ void CLinkToolbarButton::FillInMenu(HT_Resource theNode) m_pCachedDropMenu = NULL; } -UINT CLinkToolbarButton::GetBitmapID(void) +UINT CRDFToolbarButton::GetBitmapID(void) { if (m_nBitmapID != 0) return m_nBitmapID; @@ -639,12 +641,12 @@ UINT CLinkToolbarButton::GetBitmapID(void) else return IDB_USERBTN; } -UINT CLinkToolbarButton::GetBitmapIndex(void) +UINT CRDFToolbarButton::GetBitmapIndex(void) { return 0; } -void CLinkToolbarButton::SetTextWithoutResize(CString text) +void CRDFToolbarButton::SetTextWithoutResize(CString text) { if(m_pButtonText != NULL) { @@ -655,12 +657,12 @@ void CLinkToolbarButton::SetTextWithoutResize(CString text) XP_STRCPY(m_pButtonText, text); } -void CLinkToolbarButton::LoadComplete(HT_Resource r) +void CRDFToolbarButton::LoadComplete(HT_Resource r) { Invalidate(); } -void CLinkToolbarButton::DrawCustomIcon(HDC hDC, int x, int y) +void CRDFToolbarButton::DrawCustomIcon(HDC hDC, int x, int y) { int size = UseLargeIcons() ? 23 : 16; DrawArbitraryURL(m_Node, x, y, size, size, hDC, @@ -669,7 +671,7 @@ void CLinkToolbarButton::DrawCustomIcon(HDC hDC, int x, int y) } -void CLinkToolbarButton::DrawLocalIcon(HDC hDC, int x, int y) +void CRDFToolbarButton::DrawLocalIcon(HDC hDC, int x, int y) { if (m_Node) DrawLocalFileIcon(m_Node, x, y, hDC); @@ -677,21 +679,21 @@ void CLinkToolbarButton::DrawLocalIcon(HDC hDC, int x, int y) /////////////////////////////////////////////////////////////////////////// -// Class CLinkToolbarDropTarget +// Class CRDFToolbarDropTarget /////////////////////////////////////////////////////////////////////////// -void CLinkToolbarDropTarget::Toolbar(CLinkToolbar *pToolbar) +void CRDFToolbarDropTarget::Toolbar(CRDFToolbar *pToolbar) { m_pToolbar = pToolbar; } -DROPEFFECT CLinkToolbarDropTarget::OnDragEnter(CWnd * pWnd, COleDataObject * pDataObject, +DROPEFFECT CRDFToolbarDropTarget::OnDragEnter(CWnd * pWnd, COleDataObject * pDataObject, DWORD dwKeyState, CPoint point) { return OnDragOver(pWnd, pDataObject, dwKeyState, point); } -DROPEFFECT CLinkToolbarDropTarget::OnDragOver(CWnd * pWnd, COleDataObject * pDataObject, +DROPEFFECT CRDFToolbarDropTarget::OnDragOver(CWnd * pWnd, COleDataObject * pDataObject, DWORD dwKeyState, CPoint point ) { int nStartX = 0; @@ -700,11 +702,11 @@ DROPEFFECT CLinkToolbarDropTarget::OnDragOver(CWnd * pWnd, COleDataObject * pDat int currentRow = 0; - CLinkToolbarButton* pButton = NULL; + CRDFToolbarButton* pButton = NULL; for(int i = 0; i < m_pToolbar->GetNumButtons(); i++) { - pButton = (CLinkToolbarButton*)(m_pToolbar->GetNthButton(i)); + pButton = (CRDFToolbarButton*)(m_pToolbar->GetNthButton(i)); pButton->GetClientRect(&buttonRect); pButton->MapWindowPoints(m_pToolbar, &buttonRect); @@ -748,7 +750,7 @@ DROPEFFECT CLinkToolbarDropTarget::OnDragOver(CWnd * pWnd, COleDataObject * pDat return RDFGLOBAL_TranslateDropAction(theNode, pDataObject, m_pToolbar->GetDragFraction()); } -BOOL CLinkToolbarDropTarget::OnDrop(CWnd * pWnd, COleDataObject * pDataObject, +BOOL CRDFToolbarDropTarget::OnDrop(CWnd * pWnd, COleDataObject * pDataObject, DROPEFFECT dropEffect, CPoint point) { HT_Resource theNode = HT_TopNode(HT_GetSelectedView(m_pToolbar->GetPane())); @@ -760,10 +762,10 @@ BOOL CLinkToolbarDropTarget::OnDrop(CWnd * pWnd, COleDataObject * pDataObject, return TRUE; } -// End CLinkToolbarDropTarget implementation +// End CRDFToolbarDropTarget implementation /////////////////////////////////////////////////////////////////////////// -// Class CLinkToolbar +// Class CRDFToolbar /////////////////////////////////////////////////////////////////////////// #define LINKTOOLBARHEIGHT 21 #define SPACE_BETWEEN_ROWS 2 @@ -771,7 +773,7 @@ BOOL CLinkToolbarDropTarget::OnDrop(CWnd * pWnd, COleDataObject * pDataObject, // The Event Handler for HT notifications on the personal toolbar static void ptNotifyProcedure (HT_Notification ns, HT_Resource n, HT_Event whatHappened) { - CLinkToolbar* theToolbar = (CLinkToolbar*)ns->data; + CRDFToolbar* theToolbar = (CRDFToolbar*)ns->data; if (n != NULL) { HT_View theView = HT_GetView(n); @@ -791,7 +793,7 @@ static void ptNotifyProcedure (HT_Notification ns, HT_Resource n, HT_Event whatH else { // Toolbar button menu. Populate it. - CLinkToolbarButton* theButton = (CLinkToolbarButton*)(HT_GetNodeFEData(n)); + CRDFToolbarButton* theButton = (CRDFToolbarButton*)(HT_GetNodeFEData(n)); theButton->FillInMenu(n); } } @@ -811,7 +813,7 @@ static void ptNotifyProcedure (HT_Notification ns, HT_Resource n, HT_Event whatH if (HT_EVENT_NODE_DELETED_DATA == whatHappened) { // Destroy the toolbar button - CLinkToolbarButton* pButton = (CLinkToolbarButton*)HT_GetNodeFEData(n); + CRDFToolbarButton* pButton = (CRDFToolbarButton*)HT_GetNodeFEData(n); if (theToolbar->m_hWnd) theToolbar->RemoveButton(pButton); else theToolbar->DecrementButtonCount(); @@ -826,7 +828,7 @@ static void ptNotifyProcedure (HT_Notification ns, HT_Resource n, HT_Event whatH } else if (whatHappened == HT_EVENT_NODE_VPROP_CHANGED) { - CLinkToolbarButton* pButton = (CLinkToolbarButton*)HT_GetNodeFEData(n); + CRDFToolbarButton* pButton = (CRDFToolbarButton*)HT_GetNodeFEData(n); pButton->SetText(HT_GetNodeName(n)); // Update our name. theToolbar->LayoutButtons(-1); } @@ -835,7 +837,7 @@ static void ptNotifyProcedure (HT_Notification ns, HT_Resource n, HT_Event whatH } } -CLinkToolbar::CLinkToolbar(int nMaxButtons, int nToolbarStyle, int nPicturesAndTextHeight, int nPicturesHeight, +CRDFToolbar::CRDFToolbar(int nMaxButtons, int nToolbarStyle, int nPicturesAndTextHeight, int nPicturesHeight, int nTextHeight) : CNSToolbar2(nMaxButtons, nToolbarStyle, nPicturesAndTextHeight, nPicturesHeight, nTextHeight) { @@ -852,7 +854,7 @@ CLinkToolbar::CLinkToolbar(int nMaxButtons, int nToolbarStyle, int nPicturesAndT HT_SetPaneFEData(m_PersonalToolbarPane, this); } -CLinkToolbar* CLinkToolbar::CreateUserToolbar(CWnd* pParent) +CRDFToolbar* CRDFToolbar::CreateUserToolbar(CWnd* pParent) { // read in the maximum size we're allowing for personal toolbar items int32 nMaxToolbarButtonChars; @@ -870,7 +872,7 @@ CLinkToolbar* CLinkToolbar::CreateUserToolbar(CWnd* pParent) else m_nMinToolbarButtonChars = CASTINT(nMinToolbarButtonChars); - CLinkToolbar* pToolbar = new CLinkToolbar(MAX_TOOLBAR_BUTTONS,theApp.m_pToolbarStyle, 43, 27, 27); + CRDFToolbar* pToolbar = new CRDFToolbar(MAX_TOOLBAR_BUTTONS,theApp.m_pToolbarStyle, 43, 27, 27); if (pToolbar->Create(pParent)) { @@ -883,7 +885,7 @@ CLinkToolbar* CLinkToolbar::CreateUserToolbar(CWnd* pParent) return pToolbar; } -CLinkToolbar::~CLinkToolbar() +CRDFToolbar::~CRDFToolbar() { if (m_PersonalToolbarPane) { @@ -893,7 +895,7 @@ CLinkToolbar::~CLinkToolbar() } } -int CLinkToolbar::Create(CWnd *pParent) +int CRDFToolbar::Create(CWnd *pParent) { int result = CNSToolbar2::Create(pParent); @@ -909,7 +911,7 @@ int CLinkToolbar::Create(CWnd *pParent) return result; } -void CLinkToolbar::FillInToolbar() +void CRDFToolbar::FillInToolbar() { if (!m_PersonalToolbarPane) return; @@ -932,12 +934,12 @@ void CLinkToolbar::FillInToolbar() LayoutButtons(-1); } -void CLinkToolbar::AddHTButton(HT_Resource item) +void CRDFToolbar::AddHTButton(HT_Resource item) { if (HT_IsSeparator(item)) return; - CLinkToolbarButton* pButton = new CLinkToolbarButton; + CRDFToolbarButton* pButton = new CRDFToolbarButton; BOOKMARKITEM bookmark; XP_STRCPY(bookmark.szText, HT_GetNodeName(item)); @@ -953,7 +955,7 @@ void CLinkToolbar::AddHTButton(HT_Resource item) if(HT_IsContainer(item)) { - CLinkToolbarButtonDropTarget *pDropTarget = new CLinkToolbarButtonDropTarget; + CRDFToolbarButtonDropTarget *pDropTarget = new CRDFToolbarButtonDropTarget; pButton->SetDropTarget(pDropTarget); } @@ -962,14 +964,14 @@ void CLinkToolbar::AddHTButton(HT_Resource item) AddButtonAtIndex(pButton); // Have to put the button in the array, since the toolbar base class depends on it. } -int CLinkToolbar::GetHeight(void) +int CRDFToolbar::GetHeight(void) { return m_nNumberOfRows * (LINKTOOLBARHEIGHT + SPACE_BETWEEN_ROWS) + SPACE_BETWEEN_ROWS; } -void CLinkToolbar::SetMinimumRows(int rowWidth) +void CRDFToolbar::SetMinimumRows(int rowWidth) { int rowCount = 1; int totalLine = 0; @@ -988,7 +990,7 @@ void CLinkToolbar::SetMinimumRows(int rowWidth) while (rowCount < MAX_TOOLBAR_ROWS && (item = HT_GetNextItem(cursor))) { // Get the current button - CLinkToolbarButton* pButton = (CLinkToolbarButton*)(HT_GetNodeFEData(item)); + CRDFToolbarButton* pButton = (CRDFToolbarButton*)(HT_GetNodeFEData(item)); if (!pButton) // Separator continue; @@ -1008,7 +1010,7 @@ void CLinkToolbar::SetMinimumRows(int rowWidth) SetRows(rowCount); } -void CLinkToolbar::ComputeLayoutInfo(CLinkToolbarButton* pButton, int numChars, int rowWidth, int& usedSpace) +void CRDFToolbar::ComputeLayoutInfo(CRDFToolbarButton* pButton, int numChars, int rowWidth, int& usedSpace) { CString originalText = HT_GetNodeName(pButton->GetNode()); @@ -1049,7 +1051,7 @@ void CLinkToolbar::ComputeLayoutInfo(CLinkToolbarButton* pButton, int numChars, } -void CLinkToolbar::LayoutButtons(int nIndex) +void CRDFToolbar::LayoutButtons(int nIndex) { int width = m_nWidth; @@ -1089,7 +1091,7 @@ void CLinkToolbar::LayoutButtons(int nIndex) while ((item = HT_GetNextItem(cursor))) { // Get the current button - CLinkToolbarButton* pButton = (CLinkToolbarButton*)(HT_GetNodeFEData(item)); + CRDFToolbarButton* pButton = (CRDFToolbarButton*)(HT_GetNodeFEData(item)); if (!pButton) continue; @@ -1116,7 +1118,7 @@ void CLinkToolbar::LayoutButtons(int nIndex) while ((item = HT_GetNextItem(cursor))) { // Get the current button - CLinkToolbarButton* pButton = (CLinkToolbarButton*)(HT_GetNodeFEData(item)); + CRDFToolbarButton* pButton = (CRDFToolbarButton*)(HT_GetNodeFEData(item)); if (!pButton) // Separator continue; @@ -1142,7 +1144,7 @@ void CLinkToolbar::LayoutButtons(int nIndex) while ((item = HT_GetNextItem(cursor))) { // Get the current button - CLinkToolbarButton* pButton = (CLinkToolbarButton*)(HT_GetNodeFEData(item)); + CRDFToolbarButton* pButton = (CRDFToolbarButton*)(HT_GetNodeFEData(item)); if (!pButton) // Separator continue; @@ -1172,7 +1174,7 @@ void CLinkToolbar::LayoutButtons(int nIndex) GetParentFrame()->RecalcLayout(); } -void CLinkToolbar::WidthChanged(int animWidth) +void CRDFToolbar::WidthChanged(int animWidth) { CRect rect; @@ -1207,7 +1209,7 @@ void CLinkToolbar::WidthChanged(int animWidth) while ((item = HT_GetNextItem(cursor))) { // Get the current button - CLinkToolbarButton* pButton = (CLinkToolbarButton*)(HT_GetNodeFEData(item)); + CRDFToolbarButton* pButton = (CRDFToolbarButton*)(HT_GetNodeFEData(item)); if (!pButton) // Separator continue; @@ -1234,7 +1236,7 @@ void CLinkToolbar::WidthChanged(int animWidth) while ((item = HT_GetNextItem(cursor))) { // Get the current button - CLinkToolbarButton* pButton = (CLinkToolbarButton*)(HT_GetNodeFEData(item)); + CRDFToolbarButton* pButton = (CRDFToolbarButton*)(HT_GetNodeFEData(item)); if (!pButton) continue; @@ -1261,7 +1263,7 @@ void CLinkToolbar::WidthChanged(int animWidth) while ((item = HT_GetNextItem(cursor))) { // Get the current button - CLinkToolbarButton* pButton = (CLinkToolbarButton*)(HT_GetNodeFEData(item)); + CRDFToolbarButton* pButton = (CRDFToolbarButton*)(HT_GetNodeFEData(item)); if (!pButton) continue; @@ -1291,17 +1293,17 @@ void CLinkToolbar::WidthChanged(int animWidth) /////////////////////////////////////////////////////////////////////////////////// -// CLinkToolbar Messages +// CRDFToolbar Messages /////////////////////////////////////////////////////////////////////////////////// -BEGIN_MESSAGE_MAP(CLinkToolbar, CNSToolbar2) +BEGIN_MESSAGE_MAP(CRDFToolbar, CNSToolbar2) //{{AFX_MSG_MAP(CNSToolbar2) ON_WM_RBUTTONDOWN() //}}AFX_MSG_MAP END_MESSAGE_MAP() -void CLinkToolbar::OnRButtonDown(UINT nFlags, CPoint point) +void CRDFToolbar::OnRButtonDown(UINT nFlags, CPoint point) { m_MenuCommandMap.Clear(); HT_View theView = HT_GetSelectedView(m_PersonalToolbarPane); @@ -1333,7 +1335,7 @@ void CLinkToolbar::OnRButtonDown(UINT nFlags, CPoint point) } } -BOOL CLinkToolbar::OnCommand( WPARAM wParam, LPARAM lParam ) +BOOL CRDFToolbar::OnCommand( WPARAM wParam, LPARAM lParam ) { if (wParam >= FIRST_HT_MENU_ID && wParam <= LAST_HT_MENU_ID) { diff --git a/mozilla/cmd/winfe/usertlbr.h b/mozilla/cmd/winfe/usertlbr.h index e32ba5ea31e..9b7c64ec98d 100644 --- a/mozilla/cmd/winfe/usertlbr.h +++ b/mozilla/cmd/winfe/usertlbr.h @@ -34,12 +34,12 @@ #include "rdfacc.h" #include "cxicon.h" -#define CLinkToolbarButtonDropTargetBase CToolbarButtonDropTarget +#define CRDFToolbarButtonDropTargetBase CToolbarButtonDropTarget -class CLinkToolbarButtonDropTarget : public CLinkToolbarButtonDropTargetBase +class CRDFToolbarButtonDropTarget : public CRDFToolbarButtonDropTargetBase { public: - CLinkToolbarButtonDropTarget(){m_pButton = NULL;} + CRDFToolbarButtonDropTarget(){m_pButton = NULL;} protected: virtual DROPEFFECT ProcessDragEnter(CWnd *pWnd, COleDataObject *pDataObject, DWORD dwKeyState, CPoint point); @@ -50,9 +50,9 @@ class CLinkToolbarButtonDropTarget : public CLinkToolbarButtonDropTargetBase }; -#define CLinkToolbarButtonBase CDragableToolbarButton +#define CRDFToolbarButtonBase CDragableToolbarButton -class CLinkToolbarButton: public CLinkToolbarButtonBase, public CCustomImageObject { +class CRDFToolbarButton: public CRDFToolbarButtonBase, public CCustomImageObject { protected: HT_Resource m_Node; // The resource corresponding to the RDF node @@ -67,8 +67,8 @@ protected: CRDFCommandMap m_MenuCommandMap; // Command map for back-end generated right mouse menu commands. public: - CLinkToolbarButton(); - ~CLinkToolbarButton(); + CRDFToolbarButton(); + ~CRDFToolbarButton(); int Create(CWnd *pParent, int nToolbarStyle, CSize noviceButtonSize, CSize advancedButtonSize, LPCTSTR pButtonText, LPCTSTR pToolTipText, @@ -117,7 +117,7 @@ protected: protected: // Generated message map functions - //{{AFX_MSG(CLinkToolbarButton) + //{{AFX_MSG(CRDFToolbarButton) afx_msg LRESULT OnDragMenuOpen(WPARAM, LPARAM); afx_msg BOOL OnCommand(UINT wParam,LONG lParam); afx_msg LRESULT OnDropMenuDropOccurred(WPARAM, LPARAM); @@ -137,23 +137,23 @@ void ptNotifyProcedure (HT_Notification ns, HT_Resource n, HT_Event whatHappened /**************************************************************************** * -* Class: CLinkToolbarDropTarget +* Class: CRDFToolbarDropTarget * * DESCRIPTION: * This class provides a drag-drop target for the bookmark quick file * button. * ****************************************************************************/ -class CLinkToolbar; +class CRDFToolbar; -class CLinkToolbarDropTarget : public COleDropTarget +class CRDFToolbarDropTarget : public COleDropTarget { private: - CLinkToolbar *m_pToolbar; + CRDFToolbar *m_pToolbar; public: - CLinkToolbarDropTarget() {m_pToolbar = NULL;} - void Toolbar(CLinkToolbar *pToolbar); + CRDFToolbarDropTarget() {m_pToolbar = NULL;} + void Toolbar(CRDFToolbar *pToolbar); protected: @@ -168,28 +168,28 @@ protected: }; -class CLinkToolbar : public CNSToolbar2 { +class CRDFToolbar : public CNSToolbar2 { private: - CLinkToolbarDropTarget m_DropTarget; + CRDFToolbarDropTarget m_DropTarget; HT_Pane m_PersonalToolbarPane; CRDFCommandMap m_MenuCommandMap; // Command map for back-end generated right mouse menu commands. int m_nNumberOfRows; - CLinkToolbarButton* m_pDragButton; + CRDFToolbarButton* m_pDragButton; int m_iDragFraction; static int m_nMinToolbarButtonChars; static int m_nMaxToolbarButtonChars; public: - CLinkToolbar(int nMaxButtons, int nToolbarStyle, int nPicturesAndTextHeight, int nPicturesHeight, + CRDFToolbar(int nMaxButtons, int nToolbarStyle, int nPicturesAndTextHeight, int nPicturesHeight, int nTextHeight); - ~CLinkToolbar(); + ~CRDFToolbar(); // Used to create toolbars - static CLinkToolbar* CreateUserToolbar(CWnd* pParent); + static CRDFToolbar* CreateUserToolbar(CWnd* pParent); int Create(CWnd *pParent); virtual int GetHeight(void); @@ -215,15 +215,15 @@ public: void SetDragFraction(int i) { m_iDragFraction = i; } int GetDragFraction() { return m_iDragFraction; } - void SetDragButton(CLinkToolbarButton* pButton) { m_pDragButton = pButton; } - CLinkToolbarButton* GetDragButton() { return m_pDragButton; } + void SetDragButton(CRDFToolbarButton* pButton) { m_pDragButton = pButton; } + CRDFToolbarButton* GetDragButton() { return m_pDragButton; } protected: // Helper function used in conjunction with LayoutButtons - void ComputeLayoutInfo(CLinkToolbarButton* pButton, int numChars, int rowWidth, int& usedSpace); + void ComputeLayoutInfo(CRDFToolbarButton* pButton, int numChars, int rowWidth, int& usedSpace); // Generated message map functions - //{{AFX_MSG(CLinkToolbar) + //{{AFX_MSG(CRDFToolbar) afx_msg void OnRButtonDown(UINT nFlags, CPoint point); afx_msg BOOL OnCommand( WPARAM wParam, LPARAM lParam ); //}}AFX_MSG