This commit is contained in:
hyatt%netscape.com 1998-07-23 17:48:39 +00:00
Родитель 41265902cf
Коммит 1b5b8fb32a
52 изменённых файлов: 3050 добавлений и 1416 удалений

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

@ -131,6 +131,7 @@ public:
virtual void SetMenu( UINT ) = 0;
// General Toolbar functionality
virtual void UpdateURLBars(char* url) = 0;
virtual void ShowToolbar(UINT nToolbarID, BOOL bShow = TRUE) = 0;
virtual BOOL GetToolbarVisible(UINT nToolbarID) = 0;
virtual CWnd *GetToolbar(UINT nToolbarID) = 0;
@ -146,6 +147,7 @@ public:
virtual void StopAnimation() = 0;
// Configurable Toolbar Manager stuff
virtual int CreateRDFToolbar(CString toolbarName, int nMaxToolbars, BOOL bHasAnimation)=0;
virtual int CreateCustomizableToolbar(CString toolbarName, int nMaxToolbars, BOOL bHasAnimation)=0;
virtual int CreateCustomizableToolbar(UINT nStringID, int nMaxToolbars, BOOL bHasAnimation) = 0;
virtual CString GetCustToolbarString() = 0;

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

@ -245,6 +245,12 @@ MWContext *CFE_CreateNewDocWindow(MWContext *pContext, URL_Struct *pURL) {
}
pFrame = (CMainFrame *) pGenFrame;
// Now that we have the frame, dynamically create the toolbars (We won't enter this function
// from JavaScript. FE_MakeNewWindow is used instead.)
if (!pFrame->IsEditFrame())
pFrame->BeginStreamingOfRDFToolbars();
MWContext *pNewContext = pFrame->GetMainContext()->GetContext();
// Appropriate assignment of options/prefs can only happen if we are also
@ -1517,14 +1523,25 @@ extern "C" MWContext *FE_IsNetcasterRunning(void) {
return theApp.m_pNetcasterWindow;
}
#ifdef SHACK
void CFE_DisplayBuiltin(MWContext *context, int iLocation, LO_BuiltinStruct *builtin_struct)
{
return;
if(ABSTRACTCX(context)->IsDestroyed())
{
// Don't allow this to happen if the context has been destroyed...
TRACE("Context %p Destroyed :: DisplayBuiltin Blocking\n", context);
return;
}
ABSTRACTCX(context)->DisplayBuiltin(context, iLocation, builtin_struct);
}
void CFE_FreeBuiltinElement(MWContext *context, LO_BuiltinStruct *builtin_struct)
void CFE_FreeBuiltinElement(MWContext *pContext, LO_BuiltinStruct *builtin_struct)
{
return;
if(ABSTRACTCX(pContext)->IsDestroyed()) {
// Don't allow this to happen if the context has been destroyed...
TRACE("Context %p Destroyed :: FreeBuiltinElement Blocking\n", pContext);
return;
}
ABSTRACTCX(pContext)->FreeBuiltinElement(pContext, builtin_struct);
}
#endif //SHACK

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

@ -112,6 +112,11 @@ void CButtonToolbarWindow::OnUpdateCmdUI( CFrameWnd* pTarget, BOOL bDisableIfNoH
((CNSToolbar2*)GetToolbar())->OnUpdateCmdUI(pTarget, bDisableIfNoHndler);
}
void CButtonToolbarWindow::UpdateURLBars(char* url)
{
((CNSToolbar2*)GetToolbar())->UpdateURLBars(url);
}
void CButtonToolbarWindow::SetToolbarStyle(int nToolbarStyle)
{
@ -221,7 +226,11 @@ int CDragToolbar::Create(CWnd *pParent, CToolbarWindow *pToolbar)
CBrush brush;
if (!CWnd::Create(theApp.NSToolBarClass, NULL, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, rect,
DWORD shouldClipChildren = 0;
if (ShouldClipChildren())
shouldClipChildren = WS_CLIPCHILDREN;
if (!CWnd::Create(theApp.NSToolBarClass, NULL, shouldClipChildren | WS_CHILD | WS_CLIPSIBLINGS, rect,
pParent, 0))
{
return 0;
@ -386,6 +395,11 @@ void CDragToolbar::OnUpdateCmdUI( CFrameWnd* pTarget, BOOL bDisableIfNoHndler )
m_pToolbar->OnUpdateCmdUI(pTarget, bDisableIfNoHndler);
}
void CDragToolbar::UpdateURLBars(char* url)
{
m_pToolbar->UpdateURLBars(url);
}
//////////////////////////////////////////////////////////////////////////
// Messages for CDragToolbar
//////////////////////////////////////////////////////////////////////////
@ -908,6 +922,11 @@ int CCustToolbar::Create(CFrameWnd* pParent, BOOL bHasAnimation)
return 1;
}
CDragToolbar* CCustToolbar::CreateDragBar()
{
return new CDragToolbar();
}
void CCustToolbar::AddNewWindow(UINT nToolbarID, CToolbarWindow* pWindow, int nPosition, int nNoviceHeight, int nAdvancedHeight,
UINT nTabBitmapIndex, CString tabTip, BOOL bIsNoviceMode, BOOL bIsOpen, BOOL bIsAnimation)
{
@ -915,7 +934,7 @@ void CCustToolbar::AddNewWindow(UINT nToolbarID, CToolbarWindow* pWindow, int nP
if(m_pToolbarArray[nPosition] != NULL || nPosition < 0 || nPosition >= m_nNumToolbars)
nPosition = FindFirstAvailablePosition();
CDragToolbar *pDragToolbar = new CDragToolbar;
CDragToolbar *pDragToolbar = CreateDragBar();
if(pDragToolbar->Create(this, pWindow))
{
@ -1185,6 +1204,17 @@ void CCustToolbar::OnUpdateCmdUI( CFrameWnd* pTarget, BOOL bDisableIfNoHndler )
}
}
void CCustToolbar::UpdateURLBars(char* url)
{
for (int i = 0; i < m_nNumToolbars; i++)
{
if(m_pToolbarArray[i] != NULL)
{
m_pToolbarArray[i]->UpdateURLBars(url);
}
}
}
void CCustToolbar::Customize(CRDFToolbar *pLinkToolbar, int nSelectedButton)
{
}

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

@ -81,7 +81,7 @@ public:
HTAB_BITMAP GetHTab(void) { return m_nHTab; }
virtual void OnUpdateCmdUI( CFrameWnd* pTarget, BOOL bDisableIfNoHndler ){}
virtual void UpdateURLBars(char* url) {}
};
// Class: CButtonToolbarWindow
@ -94,6 +94,7 @@ public:
HTAB_BITMAP nHTab);
virtual void OnUpdateCmdUI( CFrameWnd* pTarget, BOOL bDisableIfNoHndler );
virtual void UpdateURLBars(char* url);
virtual void SetToolbarStyle(int nToolbarStyle);
virtual int GetHeight(void);
virtual CWnd* GetNSToolbar() { return GetToolbar(); }
@ -118,7 +119,7 @@ public:
class CDragToolbar : public CWnd {
private:
protected:
CToolbarWindow * m_pToolbar;
BOOL m_bIsOpen;
BOOL m_bIsShowing;
@ -140,6 +141,8 @@ public:
~CDragToolbar();
int Create(CWnd *pParent, CToolbarWindow *pToolbar);
virtual BOOL ShouldClipChildren() { return TRUE; }
CWnd *GetToolbar(void);
int GetToolbarHeight(void);
int GetMouseOffsetWithinToolbar(void) { return m_mouseDownPoint.y; }
@ -158,6 +161,8 @@ public:
void SetAnimation(CAnimationBar2 *pAnimation);
HTAB_BITMAP GetHTabType(void) { return m_eHTabType;}
void OnUpdateCmdUI( CFrameWnd* pTarget, BOOL bDisableIfNoHndler );
virtual void UpdateURLBars(char* url);
// Generated message map functions
//{{AFX_MSG(CDragToolbar)
afx_msg void OnSize( UINT nType, int cx, int cy );
@ -236,7 +241,7 @@ public:
//Construction/destruction
CCustToolbar(int nNumToolbars);
~CCustToolbar();
virtual ~CCustToolbar();
//Creation
int Create(CFrameWnd* pParent, BOOL bHasAnimation);
@ -248,6 +253,8 @@ public:
// customizable toolbar.
void FinishedAddingNewWindows(void){}
CDragToolbar** GetVisibleToolbarArray() { return m_pToolbarArray; };
//Controlling the animated icon
void StopAnimation();
void StartAnimation();
@ -270,6 +277,7 @@ public:
CSize CalcDynamicLayout(int nLength, DWORD dwMode );
virtual void OnUpdateCmdUI( CFrameWnd* pTarget, BOOL bDisableIfNoHndler );
virtual void UpdateURLBars(char* url);
void Customize(CRDFToolbar *pRDFToolbar = NULL, int nSelectedButton = 0);
BOOL GetSaveToolbarInfo(void);
@ -286,6 +294,10 @@ public:
void RemoveExternalTab(UINT nTabID);
void SetBottomBorder(BOOL bBottomBorder);
int FindDragToolbarFromWindow(CWnd *pWindow, CDragToolbar **pToolbarArray);
int FindDragToolbarFromID(UINT nToolbarID, CDragToolbar **pToolbarArray);
// Generated message map functions
//{{AFX_MSG(CCustToolbar)
afx_msg void OnSize( UINT nType, int cx, int cy );
@ -310,8 +322,6 @@ public:
protected:
// virtual BOOL OnNotify( WPARAM wParam, LPARAM lParam, LRESULT* pResult );
private:
int CheckOpenButtons(CPoint point);
int CheckClosedButtons(CPoint point);
BOOL PointInClosedTab(CPoint point, HTAB_BITMAP tabType, int nNumClosedButtons, int nStartX,
@ -325,8 +335,6 @@ private:
int GetNextClosedButtonX(HTAB_BITMAP tabType, int nNumClosedButtons, int nClosedStartX);
void GetClosedButtonRegion(HTAB_BITMAP tabType, int nNumClosedButtons, CRgn &rgn);
HBITMAP CreateHorizTab(UINT nID);
int FindDragToolbarFromWindow(CWnd *pWindow, CDragToolbar **pToolbarArray);
int FindDragToolbarFromID(UINT nToolbarID, CDragToolbar **pToolbarArray);
void ShowDragToolbar(int nIndex, BOOL bShow);
void OpenDragToolbar(int nIndex);
void OpenExternalTab(int nIndex);
@ -337,6 +345,8 @@ private:
void DrawClosedTab(HDC hCompatibleDC, HDC hDestDC, HTAB_BITMAP tabType, int nNumClosedButtons,
BOOL bMouseOver, int nStartX, int nBottom);
virtual CDragToolbar* CreateDragBar();
DECLARE_MESSAGE_MAP()
};

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

@ -707,9 +707,7 @@ int CAbstractCX::GetUrl(URL_Struct *pUrl, FO_Present_Types iFormatOut, BOOL bRea
CFrameGlue *pFrame = pWinCX->GetFrame();
if(pFrame){
CURLBar *pUrlBar = (CURLBar *)pFrame->GetChrome()->GetToolbar(ID_LOCATION_TOOLBAR);
if(pUrlBar)
pUrlBar->UpdateFields(pUrl->address);
pFrame->GetChrome()->UpdateURLBars(pUrl->address);
}
}
}

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

@ -2747,6 +2747,12 @@ void CDCCX::DisplayPlugin(MWContext *pContext, LO_EmbedStruct *pEmbed,
}
#ifndef MOZ_NGLAYOUT
void CDCCX::DisplayBuiltin(MWContext *pContext, int iLocation, LO_BuiltinStruct *pBuiltin)
{
return;
}
void CDCCX::DisplayEmbed(MWContext *pContext, int iLocation, LO_EmbedStruct *pEmbed)
{
NPEmbeddedApp* pEmbeddedApp = (NPEmbeddedApp*)pEmbed->objTag.FE_Data;
@ -3759,6 +3765,11 @@ moved into DrawTextPostDecoration()
} // void CDCCX::DisplayText()
#ifndef MOZ_NGLAYOUT
void CDCCX::FreeBuiltinElement(MWContext *pContext, LO_BuiltinStruct *pBuiltin) {
return;
}
void CDCCX::FreeEmbedElement(MWContext *pContext, LO_EmbedStruct *pEmbed) {
// We have our OLE document handle this.
GetDocument()->FreeEmbedElement(pContext, pEmbed);

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

@ -685,6 +685,7 @@ public:
#ifndef MOZ_NGLAYOUT
virtual void DisplayEmbed(MWContext *pContext, int iLocation, LO_EmbedStruct *pEmbed);
#endif
virtual void DisplayBuiltin(MWContext *pContext, int iLocation, LO_BuiltinStruct *pBuiltin);
virtual void DisplayBorder(MWContext *pContext, int iLocation, int x, int y, int width, int height, int bw, LO_Color *color, LO_LineStyle style);
virtual void DisplayHR(MWContext *pContext, int iLocation, LO_HorizRuleStruct *pHorizRule);
virtual BITMAPINFO* NewPixmap(NI_Pixmap* pImage, BOOL mask = FALSE);
@ -711,6 +712,7 @@ public:
#endif
#ifndef MOZ_NGLAYOUT
virtual void FreeEmbedElement(MWContext *pContext, LO_EmbedStruct *pEmbed);
virtual void FreeBuiltinElement(MWContext *pContext, LO_BuiltinStruct *pBuiltin);
virtual void GetEmbedSize(MWContext *pContext, LO_EmbedStruct *pEmbed, NET_ReloadMethod bReload);
#endif /* MOZ_NGLAYOUT */
#ifdef LAYERS

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

@ -325,14 +325,72 @@ BITMAPINFO * CXIcon::NewPixmap(NI_Pixmap *pImage, BOOL isMask)
int CXIcon::DisplayPixmap(NI_Pixmap* image, NI_Pixmap* mask, int32 x, int32 y, int32 x_offset, int32 y_offset, int32 width, int32 height, int32 lScaleWidth, int32 lScaleHeight, LTRB& Rect)
{
/*
if (m_image)
{
CDCCX::HugeFree(m_image->bits);
m_image->bits = NULL;
FEBitmapInfo *imageInfo = (FEBitmapInfo*)m_image->client_data;
delete imageInfo;
m_image->client_data = NULL;
m_image = NULL;
}
if (m_mask)
{
CDCCX::HugeFree(m_mask->bits);
m_mask->bits = NULL;
FEBitmapInfo *imageInfo = (FEBitmapInfo*)m_mask->client_data;
delete imageInfo;
m_mask->client_data = NULL;
m_mask = NULL;
}
*/
if (m_icon->bits)
{
// Free the old pixmap to make way for the new.
CDCCX::HugeFree(m_icon->bits);
m_icon->bits = NULL;
}
if (m_icon->maskbits)
{
// Free the old mask to make way for the new.
CDCCX::HugeFree(m_icon->maskbits);
m_icon->maskbits = NULL;
}
if (m_icon->bmpInfo)
{
XP_FREE(m_icon->bmpInfo);
m_icon->bmpInfo = NULL;
}
// Get the new pixmap.
m_image = image;
m_mask = mask;
// Fill in our header.
m_icon->bmpInfo = FillBitmapInfoHeader(image);
m_icon->bits = image->bits;
if (mask)
m_icon->maskbits = mask->bits;
// Copy our bits if we have any.
if (m_image->bits)
{
FEBitmapInfo* imageInfo = (FEBitmapInfo*) m_image->client_data;
BITMAPINFOHEADER* header = (BITMAPINFOHEADER*)imageInfo->bmpInfo;
m_icon->bits = HugeAlloc(header->biSizeImage, 1);
memcpy( m_icon->bits, m_image->bits, header->biSizeImage );
}
if (mask && m_mask->bits)
{
FEBitmapInfo* imageInfo = (FEBitmapInfo*) m_mask->client_data;
BITMAPINFOHEADER* header = (BITMAPINFOHEADER*)imageInfo->bmpInfo;
m_icon->maskbits = HugeAlloc(header->biSizeImage, 1);
memcpy( m_icon->maskbits, m_mask->bits, header->biSizeImage );
}
m_icon->CompleteFrameCallback();
return 1;
}
@ -342,9 +400,9 @@ void CXIcon::ImageComplete(NI_Pixmap* image)
// Will get a call for both the mask and for the image.
if (m_image && m_mask)
{
m_icon->pairCount++;
if (m_icon->pairCount == 2)
m_icon->CompleteCallback();
else m_icon->pairCount++;
}
else
{

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

@ -22,6 +22,7 @@
#include "intelli.h"
#endif
#include "navcontv.h"
#include "rdfliner.h"
// What is CPaneCX?
// A pane is part of a complete window.
@ -1528,3 +1529,45 @@ BOOL CPaneCX::SubClass(HWND hWnd, BOOL bSubClass)
#endif
}
char* getBuiltInAttribute (LO_BuiltinStruct *builtin_struct, char* att) {
int n = 0;
while (n < builtin_struct->attribute_cnt) {
char* attName = *(builtin_struct->attribute_list + n);
char* attValue = *(builtin_struct->value_list + n);
if (attName && (stricmp(attName, att) == 0)) {
return attValue;
}
n++;
}
return NULL;
}
void CPaneCX::DisplayBuiltin(MWContext *pContext, int iLocation, LO_BuiltinStruct *builtin_struct)
{
// This code assumes a type of builtin/tree. Will have to be changed.
HWND cView = PANECX(pContext)->GetPane();
// Ok, we have the parent window. we need to know where to display it.
int xPos = builtin_struct->x;
int yPos = builtin_struct->y;
int width = builtin_struct->width;
int height = builtin_struct->height;
char* url = getBuiltInAttribute(builtin_struct, "data");
char* target = getBuiltInAttribute(builtin_struct, "target");
if (builtin_struct->FE_Data == NULL)
{
CRDFContentView* pWnd = CRDFContentView::DisplayRDFTreeFromSHACK(CWnd::FromHandle(cView), xPos, yPos, width, height, url, builtin_struct->attribute_cnt, builtin_struct->attribute_list, builtin_struct->value_list);
((CRDFOutliner*)pWnd->GetOutlinerParent()->GetOutliner())->SetWindowTarget(target);
builtin_struct->FE_Data = pWnd;
}
}
void CPaneCX::FreeBuiltinElement(MWContext *pContext, LO_BuiltinStruct *pBuiltin)
{
// This code assumed a type of builtin/tree. Will have to be changed.
CRDFContentView* pWnd = (CRDFContentView*)pBuiltin->FE_Data;
pWnd->DestroyWindow();
}

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

@ -189,6 +189,8 @@ public:
virtual void LayoutNewDocument(MWContext *pContext, URL_Struct *pURL, int32 *pWidth, int32 *pHeight, int32 *pmWidth, int32 *pmHeight);
virtual void FinishedLayout(MWContext *pContext);
virtual void SetDocDimension(MWContext *pContext, int iLocation, int32 lWidth, int32 lLength);
virtual void DisplayBuiltin(MWContext *pContext, int iLocation, LO_BuiltinStruct *pBuiltin);
virtual void FreeBuiltinElement(MWContext *pContext, LO_BuiltinStruct *pBuiltin);
};
inline HWND CPaneCX::GetPane() const

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

@ -287,6 +287,9 @@ void CStubsCX::DisplayEdge(MWContext *pContext, int iLocation, LO_EdgeStruct *pE
void CStubsCX::DisplayEmbed(MWContext *pContext, int iLocation, LO_EmbedStruct *pEmbed) {
}
void CStubsCX::DisplayBuiltin(MWContext *pContext, int iLocation, LO_BuiltinStruct *pBuiltin) {
}
void CStubsCX::DisplayFormElement(MWContext *pContext, int iLocation, LO_FormElementStruct *pFormElement) {
}
#endif
@ -362,6 +365,9 @@ void CStubsCX::DestroyEmbedWindow(MWContext *pContext, NPEmbeddedApp *pApp) {
void CStubsCX::FreeEmbedElement(MWContext *pContext, LO_EmbedStruct *pEmbed) {
}
void CStubsCX::FreeBuiltinElement(MWContext *pContext, LO_BuiltinStruct *pBuiltin) {
}
void CStubsCX::GetEmbedSize(MWContext *pContext, LO_EmbedStruct *pEmbed, NET_ReloadMethod Reload) {
}

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

@ -4540,20 +4540,11 @@ void CWinCX::LayoutNewDocument(MWContext *pContext, URL_Struct *pURL, int32 *pWi
if(GetContext()->type == MWContextBrowser && !EDT_IS_EDITOR(GetContext())) {
LPCHROME pChrome = GetFrame()->GetChrome();
if(pChrome) {
CWnd *pWnd = pChrome->GetToolbar(ID_LOCATION_TOOLBAR);
if (pWnd && pWnd->IsKindOf(RUNTIME_CLASS(CURLBar))){
CURLBar *pUrlBar = (CURLBar *) pWnd;
if(pUrlBar != NULL) {
pUrlBar->m_pBox->GetWindowText(csText);
if(m_csSaveLocationBarText == csText && IsGridCell() == FALSE) {
pUrlBar->UpdateFields(pURL->address);
}
}
else
csText.Empty();
if(pChrome)
{
if(IsGridCell() == FALSE)
{
pChrome->UpdateURLBars(pURL->address);
}
else
csText.Empty();
@ -4787,11 +4778,14 @@ void CWinCX::SetInternetKeyword(const char *keyword) {
return;
// Only if we're the main context
/* Disabled. Needs to be fixed so that the chrome is searched and all URL bars get
their tooltips updated.
if( GetFrame()->GetMainContext() == this ) {
CURLBar *urlBar = (CURLBar *) GetFrame()->GetChrome()->GetToolbar(ID_LOCATION_TOOLBAR);
if (urlBar)
urlBar->SetToolTip(keyword);
}
*/
}
void CWinCX::ClearView(MWContext *pContext, int iView) {

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

@ -207,7 +207,7 @@ void CDragBar::EndDrag()
GetDesktopWindow()->MapWindowPoints( m_parentView, &tempRect);
MoveWindow(tempRect);
Invalidate();
m_dockedFrame->m_pSelector->Invalidate();
//m_dockedFrame->m_pSelector->Invalidate();
m_parentView->RecalcLayout();
}

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

@ -2602,8 +2602,22 @@ void CDropMenu::LoadComplete(HT_Resource r)
// invalidated.
int childIndex = HT_GetNodeIndex(HT_GetView(r), r);
int parentIndex = HT_GetNodeIndex(HT_GetView(parent), parent);
int actualIndex = childIndex - parentIndex - 1;
CDropMenuItem *item = (CDropMenuItem*)m_pMenuItemArray[actualIndex];
if (parent == HT_TopNode(HT_GetView(r)))
parentIndex = -1;
// Need to count up from the parent index to the child index and only include nodes
// with indentation equal to the child index.
int indentation = HT_GetItemIndentation(r);
int offset = 0;
for (int i = parentIndex + 1; i < childIndex; i++)
{
int otherIndentation = HT_GetItemIndentation(HT_GetNthItem(HT_GetView(r), i));
if (otherIndentation == indentation)
offset++;
}
CDropMenuItem *item = (CDropMenuItem*)m_pMenuItemArray[offset];
InvalidateMenuItemIconRect(item);
}
}

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

@ -33,6 +33,7 @@
#include "libevent.h"
#include "navfram.h"
#include "edview.h"
#include "vocab.h"
#ifdef _DEBUG
#undef THIS_FILE
@ -100,8 +101,7 @@ BEGIN_MESSAGE_MAP(CMainFrame, CGenericFrame)
ON_UPDATE_COMMAND_UI(ID_VIEW_COMMANDTOOLBAR, OnUpdateViewCommandToolbar)
ON_UPDATE_COMMAND_UI(ID_VIEW_LOCATIONTOOLBAR, OnUpdateViewLocationToolbar)
ON_UPDATE_COMMAND_UI(ID_VIEW_CUSTOMTOOLBAR, OnUpdateViewCustomToolbar)
ON_UPDATE_COMMAND_UI(ID_VIEW_NAVCENTER, OnUpdateViewNavCenter)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
@ -259,6 +259,22 @@ int colorCubeSize = 216;
#define TEXT_WIDTH 49
#endif
// The Event Handler for the top-level bookmarks menu in a frame.
static void qfNotifyProcedure (HT_Notification ns, HT_Resource n, HT_Event whatHappened,
void *token, uint32 tokenType)
{
if (whatHappened == HT_EVENT_NODE_OPENCLOSE_CHANGED)
{
// The node was opened.
PRBool openState;
HT_GetOpenState(n, &openState);
if (openState)
{
CGenericFrame* pFrame = (CGenericFrame*)ns->data;
pFrame->FinishMenuExpansion(n);
}
}
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
@ -275,16 +291,19 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
pIStatusBar->Create( this );
pIStatusBar->Release();
}
} else {
//I'm hardcoding string since I don't want it translated.
GetChrome()->CreateCustomizableToolbar("Browser", 5, TRUE);
// Now that the application palette has been created (if
// appropriate) we can create the url bar. The animation
// might need custom colors so we need the palette to be around
//
if (!theApp.m_bInGetCriticalFiles)
{
// Get the top level menu going.
// Construct the notification struct used by HT
HT_Notification ns = new HT_NotificationStruct;
XP_BZERO(ns, sizeof(HT_NotificationStruct));
ns->notifyProc = qfNotifyProcedure;
ns->data = this;
m_BookmarkMenuPane = theApp.m_bInGetCriticalFiles ? NULL : HT_NewQuickFilePane(ns);
}
} else {
LPNSSTATUSBAR pIStatusBar = NULL;
GetChrome()->QueryInterface( IID_INSStatusBar, (LPVOID *) &pIStatusBar );
if( pIStatusBar )
@ -295,14 +314,6 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
pIStatusBar->Show(FALSE);
}
CreateMainToolbar();
if (!theApp.m_bInGetCriticalFiles) { // if we are here, don't show link bar
CreateLocationBar();
CreateLinkBar();
GetChrome()->FinishedAddingBrowserToolbars();
}
if(!IsEditFrame())
{
AddToMenuMap(FILEMENU, IDM_MAINFRAMEFILEMENU);
@ -330,8 +341,8 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
int CMainFrame::CreateLocationBar()
{
/*
>>>>>>> 3.3.2.11
m_barLocation=new CURLBar();
if (!m_barLocation->Create(this, CURLBar::IDD, CBRS_TOP,CURLBar::IDD)) {
@ -359,13 +370,14 @@ int CMainFrame::CreateLocationBar()
m_barLocation->SetContext((LPUNKNOWN)GetMainContext());
RecalcLayout();
*/
return TRUE;
}
int CMainFrame::CreateLinkBar(void)
{
m_barLinks = CRDFToolbar::CreateUserToolbar(this);
m_barLinks = CRDFToolbar::CreateUserToolbar(NULL, this);
CButtonToolbarWindow *pWindow = new CButtonToolbarWindow(m_barLinks, theApp.m_pToolbarStyle, 43, 27, eSMALL_HTAB);
@ -486,6 +498,33 @@ int CMainFrame::CreateMainToolbar(void)
return TRUE;
}
void CMainFrame::BeginStreamingOfRDFToolbars()
{
GetChrome()->CreateRDFToolbar("Browser", 5, TRUE);
if (!theApp.m_bInGetCriticalFiles)
{
// Get the top level menu going.
// Construct the notification struct used by HT
HT_Notification ns = new HT_NotificationStruct;
XP_BZERO(ns, sizeof(HT_NotificationStruct));
ns->notifyProc = qfNotifyProcedure;
ns->data = this;
m_BookmarkMenuPane = theApp.m_bInGetCriticalFiles ? NULL : HT_NewQuickFilePane(ns);
}
/*
if (!theApp.m_bInGetCriticalFiles && AllowDocking() &&
!theApp.m_ParentAppWindow && !theApp.m_bKioskMode)
{
// Show the selector if the pref says we should.
BOOL bSelVisible;
PREF_GetBoolPref(gPrefSelectorVisible, &bSelVisible);
if (bSelVisible)
theApp.CreateNewNavCenter(this);
}
*/
}
void CMainFrame::OnShowWindow (BOOL bShow, UINT nStatus)
{
CGenericFrame::OnShowWindow(bShow,nStatus);
@ -599,9 +638,7 @@ void CMainFrame::OnLoadHomePage()
if (nStartup != 0){
GetMainContext()->NormalGetUrl(lpszHomePage);
CURLBar *pUrlBar = (CURLBar *)GetChrome()->GetToolbar(ID_LOCATION_TOOLBAR);
if(pUrlBar != NULL)
pUrlBar->UpdateFields(lpszHomePage);
GetChrome()->UpdateURLBars((char*)lpszHomePage);
}
}
}

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

@ -785,34 +785,8 @@ BOOL CGenericChrome::procTabNavigation( UINT nChar, UINT firstTime, UINT control
void CGenericChrome::ShowToolbar(UINT nToolbarID, BOOL bShow)
{
if(m_pCustToolbar)
m_pCustToolbar->ShowToolbar(nToolbarID, bShow);
if (nToolbarID == ID_PERSONAL_TOOLBAR) // Hack. Show Aurora if and only if a personal toolbar is shown.
{
if (m_pParent->IsKindOf(RUNTIME_CLASS(CGenericFrame)))
{
CGenericFrame* genFrame = (CGenericFrame*)m_pParent;
// Create NavCenter unless bShow is FALSE... then we hide it. HACK!
// THIS CODE WILL BE REMOVED! JUST TEMPORARILY HACKED TO PREVENT NAVCENTER
// FROM SHOWING UP EVERYWHERE!
if (!theApp.m_bInGetCriticalFiles && genFrame->AllowDocking() &&
!theApp.m_ParentAppWindow && !theApp.m_bKioskMode)
{
// Show the selector if the pref says we should.
BOOL bSelVisible;
PREF_GetBoolPref(gPrefSelectorVisible, &bSelVisible);
if (bSelVisible && bShow)
theApp.CreateNewNavCenter(genFrame);
}
CNSNavFrame* navFrame = genFrame->GetDockedNavCenter();
if (navFrame && !bShow)
{
// Destroy the Nav Center.
navFrame->DeleteNavCenter();
}
}
m_pCustToolbar->ShowToolbar(nToolbarID, bShow);
}
}
@ -978,6 +952,22 @@ void CGenericChrome::StopAnimation()
}
}
int CGenericChrome::CreateRDFToolbar(CString toolbarName, int nMaxToolbars, BOOL bHasAnimation)
{
CRDFToolbarHolder* pHolder = new CRDFToolbarHolder(nMaxToolbars, m_pParent);
m_pCustToolbar = pHolder;
if(! m_pCustToolbar->Create(m_pParent, bHasAnimation))
return FALSE;
m_toolbarName = toolbarName;
// Toolbars will start coming in here.
pHolder->InitializeRDFData();
return TRUE;
}
int CGenericChrome::CreateCustomizableToolbar(CString toolbarName, int nMaxToolbars, BOOL bHasAnimation)
{
m_pCustToolbar=new CCustToolbar(nMaxToolbars);
@ -1072,6 +1062,13 @@ void CGenericChrome::ImagesButton(BOOL bShowImagesButton)
}
}
// URL Bar Stuff
void CGenericChrome::UpdateURLBars(char* url)
{
if(m_pCustToolbar)
m_pCustToolbar->UpdateURLBars(url);
}
// Window Title Stuff
void CGenericChrome::SetWindowTitle(const char *lpszText)
{

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

@ -242,6 +242,9 @@ public:
virtual void SaveToolbarConfiguration(UINT nToolbarID, CString &csToolbarName);
virtual void SetSaveToolbarInfo(BOOL bSaveToolbarInfo);
// URL bars stuff
virtual void UpdateURLBars(char* url);
// Animation Stuff
virtual void StartAnimation();
virtual void StopAnimation();
@ -251,6 +254,7 @@ public:
virtual void SetDocumentTitle(const char*);
// ToolbarManager Stuff
virtual int CreateRDFToolbar(CString toolbarName, int nMaxToolbars, BOOL bHasAnimation);
virtual int CreateCustomizableToolbar(CString toolbarName, int nMaxToolbars, BOOL bHasAnimation);
virtual int CreateCustomizableToolbar(UINT nStringID, int nMaxToolbars, BOOL bHasAnimation);
virtual CString GetCustToolbarString();

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

@ -330,7 +330,7 @@ void CGenericFrame::OnFilePageSetup()
void CGenericFrame::OnGoHistory()
{
theApp.CreateNewNavCenter(NULL, TRUE, HT_VIEW_HISTORY);
//theApp.CreateNewNavCenter(NULL, TRUE, HT_VIEW_HISTORY);
}
void CGenericFrame::OnPageFromWizard()

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

@ -150,30 +150,9 @@ IMPLEMENT_DYNCREATE(CGenericFrame, CNSGenFrame)
#define new DEBUG_NEW
#endif
// The Event Handler
static void qfNotifyProcedure (HT_Notification ns, HT_Resource n, HT_Event whatHappened)
{
if (whatHappened == HT_EVENT_NODE_OPENCLOSE_CHANGED)
{
// The node was opened.
PRBool openState;
HT_GetOpenState(n, &openState);
if (openState)
{
CGenericFrame* pFrame = (CGenericFrame*)ns->data;
pFrame->FinishMenuExpansion(n);
}
}
}
CGenericFrame::CGenericFrame()
{
// Construct the notification struct used by HT
HT_Notification ns = new HT_NotificationStruct;
ns->notifyProc = qfNotifyProcedure;
ns->data = this;
m_BookmarkMenuPane = theApp.m_bInGetCriticalFiles ? NULL : HT_NewQuickFilePane(ns);
m_BookmarkMenuPane = NULL;
m_nBookmarkItems = 0;
m_nFileBookmarkItems = 0;
m_pHotlistMenuMap = new CMapWordToPtr();
@ -855,8 +834,6 @@ BEGIN_MESSAGE_MAP(CGenericFrame, CFrameWnd)
ON_COMMAND(ID_VIEW_LOCATIONTOOLBAR, OnViewLocationToolbar)
ON_UPDATE_COMMAND_UI(ID_VIEW_CUSTOMTOOLBAR, OnUpdateViewCustomToolbar)
ON_COMMAND(ID_VIEW_CUSTOMTOOLBAR, OnViewCustomToolbar)
ON_UPDATE_COMMAND_UI(ID_VIEW_NAVCENTER, OnUpdateViewNavCenter)
ON_COMMAND(ID_VIEW_NAVCENTER, OnViewNavCenter)
ON_UPDATE_COMMAND_UI(ID_CUSTOMIZE_TOOLBAR, OnUpdateCustomizeToolbar)
ON_COMMAND(ID_CUSTOMIZE_TOOLBAR, OnCustomizeToolbar)
ON_UPDATE_COMMAND_UI(ID_PLACES, OnUpdatePlaces)
@ -2252,7 +2229,7 @@ void CGenericFrame::OnAbout()
void CGenericFrame::OnShowBookmarkWindow()
{
theApp.CreateNewNavCenter(NULL, TRUE, HT_VIEW_BOOKMARK);
//theApp.CreateNewNavCenter(NULL, TRUE, HT_VIEW_BOOKMARK);
}
///////////////////////////////////////////////////////////////////////////////
@ -2565,30 +2542,6 @@ void CGenericFrame::OnUpdateViewCommandToolbar(CCmdUI *pCmdUI)
}
}
void CGenericFrame::OnViewNavCenter()
{
CNSNavFrame* pFrame = GetDockedNavCenter();
if (pFrame)
pFrame->DeleteNavCenter();
else theApp.CreateNewNavCenter(this);
}
void CGenericFrame::OnUpdateViewNavCenter(CCmdUI *pCmdUI)
{
CNSNavFrame* pFrame = GetDockedNavCenter();
BOOL bShow = (pFrame != NULL);
if( pCmdUI->m_pMenu )
{
pCmdUI->m_pMenu->ModifyMenu(CASTUINT(ID_VIEW_NAVCENTER), CASTUINT(MF_BYCOMMAND | MF_STRING), CASTUINT(ID_VIEW_NAVCENTER),
szLoadString(CASTUINT(bShow ? IDS_HIDE_NAVCENTER : IDS_SHOW_NAVCENTER)) );
}
else
{
pCmdUI->SetCheck(bShow);
}
}
void CGenericFrame::OnViewLocationToolbar()
{
GetChrome()->ShowToolbar(ID_LOCATION_TOOLBAR, !GetChrome()->GetToolbarVisible(ID_LOCATION_TOOLBAR));

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

@ -295,8 +295,6 @@ protected:
afx_msg void OnUpdateViewLocationToolbar(CCmdUI* pCmdUI);
afx_msg void OnViewCustomToolbar();
afx_msg void OnUpdateViewCustomToolbar(CCmdUI* pCmdUI);
afx_msg void OnViewNavCenter();
afx_msg void OnUpdateViewNavCenter(CCmdUI* pCmdUI);
afx_msg void OnUpdatePlaces(CCmdUI* pCmdUI);
afx_msg void OnUpdateCustomizeToolbar(CCmdUI *pCmdUI);
afx_msg void OnCustomizeToolbar();

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

@ -116,6 +116,8 @@ public:
#endif
virtual BOOL AllowDocking() {return TRUE;}
virtual void BeginStreamingOfRDFToolbars();
// Generated message map functions
protected:
//{{AFX_MSG(CMainFrame)

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

@ -816,6 +816,7 @@ $(OUTDIR)\mozilla.dep: $(DEPTH)\cmd\winfe\mkfiles32\mozilla.mak
$(DEPTH)\lib\layout\fsfile.cpp
$(DEPTH)\lib\layout\streams.cpp
$(DEPTH)\lib\layout\layarena.c
$(DEPTH)\lib\layout\laybuiltin.c
$(DEPTH)\lib\layout\layblock.c
$(DEPTH)\lib\layout\laycell.c
$(DEPTH)\lib\layout\laycols.c

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

@ -1467,6 +1467,9 @@ BOOL CNetscapeApp::InitInstance()
RDF_Init(&initStruct); // TODO: Can this fail? Want to bail if so.
// Initialize the command map used by RDF configurable UI.
m_pBrowserCommandMap = CIsomorphicCommandMap::InitializeCommandMap("Browser Commands");
m_pCommandToolbarIndices = CIsomorphicCommandMap::InitializeCommandMap("Command Toolbar Bitmap Indices");
// RDF INITIALIZATION ENDS HERE
@ -2063,34 +2066,27 @@ BOOL CNetscapeApp::InitInstance()
#endif /* MOZ_MAIL_NEWS */
#ifdef EDITOR
if ( (bIsGold && (iStartupMode & STARTUP_EDITOR)) && !(iStartupMode & STARTUP_BROWSER))
{ //start the editor
theApp.m_EditTmplate->OpenDocumentFile(NULL);
if (bIsGold && (iStartupMode & STARTUP_EDITOR))
{ //start the editor
theApp.m_EditTmplate->OpenDocumentFile(NULL);
CMainFrame *pMainFrame = (CMainFrame *)FEU_GetLastActiveFrame(MWContextBrowser, TRUE);
if(pMainFrame) pMainFrame->OnLoadHomePage();//suppose to load what ever was on the command line
}
else
#endif // EDITOR
if ((iStartupMode & STARTUP_BROWSER) && !(iStartupMode & STARTUP_EDITOR) )
{ //start the browser
theApp.m_ViewTmplate->OpenDocumentFile(NULL);
CMainFrame *pMainFrame = (CMainFrame *)FEU_GetLastActiveFrame(MWContextBrowser, FALSE);
if(pMainFrame) pMainFrame->OnLoadHomePage(); //suppose to load what ever was on the command line
}
#ifdef EDITOR
else if ((iStartupMode & STARTUP_BROWSER) && (iStartupMode & STARTUP_EDITOR) )
if (iStartupMode & STARTUP_BROWSER)
{
theApp.m_ViewTmplate->OpenDocumentFile(NULL); //open browser window
CGenericFrame *pFrame = (CGenericFrame *)FEU_GetLastActiveFrame(MWContextBrowser, FALSE);
if (pFrame)
{
//start both of these guys since there preferences were set
//theApp.m_EditTmplate->OpenDocumentFile(NULL);
theApp.m_ViewTmplate->OpenDocumentFile(NULL); //open browser window
CGenericFrame *pFrame = (CGenericFrame *)FEU_GetLastActiveFrame(MWContextBrowser, FALSE);
if (pFrame){
CMainFrame *pMainFrame = (CMainFrame*)pFrame;
pMainFrame->OnLoadHomePage();
pFrame->OnOpenComposerWindow();
}
CMainFrame *pMainFrame = (CMainFrame*)pFrame;
pMainFrame->OnLoadHomePage();
// Now that we have the frame, dynamically create the toolbars (We won't enter this function
// from JavaScript. FE_MakeNewWindow is used instead.)
pMainFrame->BeginStreamingOfRDFToolbars();
}
#endif // EDITOR
}
}
if(m_pFrameList && m_pFrameList->GetMainContext())

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

@ -276,6 +276,9 @@ public:
HWND m_ParentAppWindow;
BOOL m_bChildWindow;
CIsomorphicCommandMap* m_pBrowserCommandMap;
CIsomorphicCommandMap* m_pCommandToolbarIndices;
// Our very own run/pump/idle implementation.
public:
int Run();

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

@ -351,13 +351,6 @@ BEGIN
EDITTEXT IDC_PROMPT_ANS,10,39,229,14,ES_AUTOHSCROLL
END
IDD_URLTITLEBAR DIALOG DISCARDABLE 0, 0, 338, 21
STYLE WS_CHILD | WS_CLIPCHILDREN
FONT 8, "MS Sans Serif"
BEGIN
RTEXT "Location:",IDC_URLTEXT,94,5,33,8
END
IDD_INTERNETSHORTCUT DIALOG DISCARDABLE 0, 0, 248, 69
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Create Internet Shortcut"
@ -3756,8 +3749,6 @@ BEGIN
IDS_MAIL_THISFOLDER "This Folder"
IDS_HIDE_COMMANDTOOLBAR "Hide &Navigation Toolbar"
IDS_SHOW_COMMANDTOOLBAR "Show &Navigation Toolbar"
IDS_HIDE_NAVCENTER "Hide Navi&gation Center"
IDS_SHOW_NAVCENTER "Show Navi&gation Center"
IDS_EXPANDO "WHS"
END

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

@ -31,129 +31,10 @@
// The Nav Center vocab element
extern "C" RDF_NCVocab gNavCenter;
/* This class may yet be of use. For now comment it out.
BEGIN_MESSAGE_MAP(CNavMenuButton, CRDFToolbarButton)
ON_MESSAGE(NSDRAGMENUOPEN, OnDragMenuOpen)
END_MESSAGE_MAP()
CNavMenuButton::CNavMenuButton()
:m_HTView(NULL)
{
m_bShouldShowRMMenu = FALSE;
}
LRESULT CNavMenuButton::OnDragMenuOpen(WPARAM wParam, LPARAM lParam)
{
// Set the focus to the tree view.
if (!m_HTView)
return 1;
CSelectorButton* pSelectorButton = (CSelectorButton*)HT_GetViewFEData(m_HTView);
if (!pSelectorButton)
return 1;
// Get the tree view and set focus to it.
CRDFContentView* pView = pSelectorButton->GetTreeView();
if (pView)
pView->SetFocus();
// Set our drop menu's user data.
m_pCachedDropMenu = (CDropMenu *)lParam; // Set our drop menu
m_MenuCommandMap.Clear();
HT_View theView = m_HTView;
HT_Resource node = NULL;
node = HT_GetNextSelection(theView, node);
BOOL bg = (node == NULL);
HT_Cursor theCursor = HT_NewContextualMenuCursor(theView, PR_FALSE, (PRBool)bg);
if (theCursor != NULL)
{
// We have a cursor. Attempt to iterate
HT_MenuCmd theCommand;
while (HT_NextContextMenuItem(theCursor, &theCommand))
{
char* menuName = HT_GetMenuCmdName(theCommand);
if (theCommand == HT_CMD_SEPARATOR)
m_pCachedDropMenu->AppendMenu(MF_SEPARATOR, 0, TRUE, NULL, NULL);
else
{
// Add the command to our command map
CRDFMenuCommand* rdfCommand = new CRDFMenuCommand(menuName, theCommand);
int index = m_MenuCommandMap.AddCommand(rdfCommand);
m_pCachedDropMenu->AppendMenu(MF_STRING, index+FIRST_HT_MENU_ID, menuName, TRUE, NULL, NULL, NULL);
}
}
HT_DeleteCursor(theCursor);
}
return 1;
}
BOOL CNavMenuButton::OnCommand(UINT wParam, LONG lParam)
{
BOOL bRtn = TRUE;
if (wParam >= FIRST_HT_MENU_ID && wParam <= LAST_HT_MENU_ID)
{
// A selection was made from the context menu.
// Use the menu map to get the HT command value
CRDFMenuCommand* theCommand = (CRDFMenuCommand*)(m_MenuCommandMap.GetCommand((int)wParam-FIRST_HT_MENU_ID));
if (theCommand)
{
HT_MenuCmd htCommand = theCommand->GetHTCommand();
HT_DoMenuCmd(HT_GetPane(m_HTView), htCommand);
}
}
return bRtn;
}
void CNavMenuButton::UpdateView(HT_View v)
{
m_HTView = v;
if (v == NULL)
SetText("No View Selected.");
else SetText(HT_GetNodeName(HT_TopNode(m_HTView)));
}
void CNavMenuButton::UpdateButtonText(CRect rect)
{
CString originalText = "No View Selected.";
if (m_HTView != NULL)
originalText = HT_GetNodeName(HT_TopNode(m_HTView));
int currCount = originalText.GetLength();
// Start off at the maximal string
CString strTxt = originalText;
CSize theSize = GetButtonSizeFromChars(originalText, currCount);
int horExtent = theSize.cx;
int width = horExtent;
int cutoff = rect.right - NAVBAR_CLOSEBOX - 9;
if (width > cutoff && cutoff > 0)
width = cutoff;
while (horExtent > width)
{
strTxt = originalText.Left(currCount-3) + "...";
theSize = GetButtonSizeFromChars(strTxt, currCount);
horExtent = theSize.cx;
currCount--;
}
SetTextWithoutResize(strTxt);
int height = GetRequiredButtonSize().cy;
MoveWindow(2, (rect.Height()-height)/2, width, height);
}
*/
extern void DrawUpButton(HDC dc, CRect& rect);
BEGIN_MESSAGE_MAP(CNavMenuBar, CWnd)
//{{AFX_MSG_MAP(CNavMenuBar)
BEGIN_MESSAGE_MAP(CNavTitleBar, CWnd)
//{{AFX_MSG_MAP(CNavTitleBar)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code !
ON_WM_CREATE()
@ -165,19 +46,19 @@ BEGIN_MESSAGE_MAP(CNavMenuBar, CWnd)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
CNavMenuBar::CNavMenuBar()
:m_pSelectorButton(NULL), m_bHasFocus(FALSE) // ,m_pMenuButton(NULL)
CNavTitleBar::CNavTitleBar()
:m_bHasFocus(FALSE)
{
m_pBackgroundImage = NULL;
m_View = NULL;
}
CNavMenuBar::~CNavMenuBar()
CNavTitleBar::~CNavTitleBar()
{
// delete m_pMenuButton;
}
void CNavMenuBar::OnPaint( )
void CNavTitleBar::OnPaint( )
{
CPaintDC dc(this);
CRect rect;
@ -190,25 +71,36 @@ void CNavMenuBar::OnPaint( )
// Read in all the properties
if (!m_View) return;
HT_Resource top = HT_TopNode(m_View);
HT_Resource topNode = HT_TopNode(m_View);
void* data;
PRBool foundData = FALSE;
CRDFOutliner* pOutliner = (CRDFOutliner*)HT_GetViewFEData(m_View);
if (pOutliner->InNavigationMode())
{
m_ForegroundColor = pOutliner->GetForegroundColor();
m_BackgroundColor = pOutliner->GetBackgroundColor();
m_BackgroundImageURL = pOutliner->GetBackgroundImageURL();
}
else
{
m_ForegroundColor = RGB(255,255,255);
m_BackgroundColor = RGB(64,64,64);
m_BackgroundImageURL = "";
}
// Foreground color
HT_GetNodeData(top, gNavCenter->titleBarFGColor, HT_COLUMN_STRING, &data);
HT_GetNodeData(topNode, gNavCenter->titleBarFGColor, HT_COLUMN_STRING, &data);
if (data)
WFE_ParseColor((char*)data, &m_ForegroundColor);
else m_ForegroundColor = RGB(255,255,255);
// background color
HT_GetNodeData(top, gNavCenter->titleBarBGColor, HT_COLUMN_STRING, &data);
HT_GetNodeData(topNode, gNavCenter->titleBarBGColor, HT_COLUMN_STRING, &data);
if (data)
WFE_ParseColor((char*)data, &m_BackgroundColor);
else m_BackgroundColor = RGB(64,64,64);
// Background image URL
m_BackgroundImageURL = "";
HT_GetNodeData(top, gNavCenter->titleBarBGURL, HT_COLUMN_STRING, &data);
HT_GetNodeData(topNode, gNavCenter->titleBarBGURL, HT_COLUMN_STRING, &data);
if (data)
m_BackgroundImageURL = (char*)data;
m_pBackgroundImage = NULL; // Clear out the BG image.
@ -246,9 +138,18 @@ void CNavMenuBar::OnPaint( )
}
// Draw the text.
HFONT font = WFE_GetUIFont(dc.m_hDC);
//HFONT font = WFE_GetUIFont(dc.m_hDC);
CFont arialFont;
LOGFONT lf;
XP_MEMSET(&lf,0,sizeof(LOGFONT));
lf.lfHeight = 120;
lf.lfWeight = 700;
strcpy(lf.lfFaceName, "Arial");
arialFont.CreatePointFontIndirect(&lf, &dc);
HFONT font = (HFONT)arialFont.GetSafeHandle();
HFONT hOldFont = (HFONT)::SelectObject(dc.m_hDC, font);
CRect sizeRect(0,0,150,0);
CRect sizeRect(0,0,10000,0);
int height = ::DrawText(dc.m_hDC, titleText, titleText.GetLength(), &sizeRect, DT_CALCRECT | DT_WORDBREAK);
if (sizeRect.Width() > rect.Width() - NAVBAR_CLOSEBOX - 9)
@ -256,8 +157,8 @@ void CNavMenuBar::OnPaint( )
// Don't write into the close box area!
sizeRect.right = sizeRect.left + (rect.Width() - NAVBAR_CLOSEBOX - 9);
}
sizeRect.left += 2; // indent slightly horizontally
sizeRect.right += 5;
sizeRect.left += 4; // indent slightly horizontally
sizeRect.right += 4;
// Center the text vertically.
sizeRect.top = (rect.Height() - height) / 2;
@ -266,72 +167,37 @@ void CNavMenuBar::OnPaint( )
// Draw the text
int nOldBkMode = dc.SetBkMode(TRANSPARENT);
UINT nFormat = DT_SINGLELINE | DT_VCENTER;
UINT nFormat = DT_SINGLELINE | DT_VCENTER | DT_EXTERNALLEADING;
COLORREF oldColor;
oldColor = dc.SetTextColor(m_ForegroundColor);
dc.DrawText((LPCSTR)titleText, -1, &sizeRect, DT_CENTER | DT_EXTERNALLEADING | nFormat);
dc.DrawText((LPCSTR)titleText, -1, &sizeRect, nFormat);
dc.SetTextColor(oldColor);
dc.SetBkMode(nOldBkMode);
// Draw the close box at the edge of the bar.
CNSNavFrame* navFrameParent = (CNSNavFrame*)GetParentFrame();
if (XP_IsNavCenterDocked(navFrameParent->GetHTPane()))
{
int left = rect.right - NAVBAR_CLOSEBOX - 5;
int right = left + NAVBAR_CLOSEBOX;
int top = rect.top + (rect.Height() - NAVBAR_CLOSEBOX)/2;
int bottom = top + NAVBAR_CLOSEBOX;
CRect edgeRect(left, top, right, bottom);
CBrush* closeBoxBrush = CBrush::FromHandle(sysInfo.m_hbrBtnFace);
dc.FillRect(&edgeRect, closeBoxBrush);
DrawUpButton(dc.m_hDC, edgeRect);
HPEN hPen = (HPEN)::CreatePen(PS_SOLID, 1, RGB(0,0,0));
HPEN hOldPen = (HPEN)(dc.SelectObject(hPen));
dc.MoveTo(edgeRect.left+4, edgeRect.top+4);
dc.LineTo(edgeRect.right-5, edgeRect.bottom-4);
dc.MoveTo(edgeRect.right-6, edgeRect.top+4);
dc.LineTo(edgeRect.left+3, edgeRect.bottom-4);
dc.SelectObject(hOldPen);
VERIFY(::DeleteObject(hPen));
}
if (sysInfo.m_iBitsPerPixel < 16 && (::GetDeviceCaps(dc.m_hDC, RASTERCAPS) & RC_PALETTE))
{
::SelectPalette(dc.m_hDC, pOldPalette, FALSE);
}
/* HPEN hShadowPen = ::CreatePen(PS_SOLID, 1, ::GetSysColor(COLOR_3DSHADOW));
dc.SelectObject(hShadowPen);
dc.MoveTo(rect.left, rect.bottom-1);
dc.LineTo(rect.right, rect.bottom-1);
int top = rect.top + (rect.Height() - NAVBAR_CLOSEBOX)/2;
int left = rect.right - (3*(NAVBAR_CLOSEBOX+1)) - 4;
VERIFY(::DeleteObject(hShadowPen));
*/
HDC hDC = dc.m_hDC;
CRDFImage* pImage = LookupImage("http://rdf.netscape.com/rdf/closebox.gif", NULL);
DrawRDFImage(pImage, left, top, 16, 16, hDC, m_BackgroundColor);
left += NAVBAR_CLOSEBOX+1;
pImage = LookupImage("http://rdf.netscape.com/rdf/closebox.gif", NULL);
DrawRDFImage(pImage, left, top, 16, 16, hDC, m_BackgroundColor);
left += NAVBAR_CLOSEBOX+1;
pImage = LookupImage("http://rdf.netscape.com/rdf/closebox.gif", NULL);
DrawRDFImage(pImage, left, top, 16, 16, hDC, m_BackgroundColor);
}
int CNavMenuBar::OnCreate(LPCREATESTRUCT lpCreateStruct)
int CNavTitleBar::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
// m_pMenuButton = new CNavMenuButton();
// BOOKMARKITEM dummy;
// m_pMenuButton->Create(this, FALSE, CSize(32, 21), CSize(32, 21), "No view selected.",
// "Click here to view the options menu.",
// "Click on the button to view the options menu.", CSize(0,0), 100, 15, dummy,
// NULL, TB_HAS_IMMEDIATE_MENU | TB_HAS_DRAGABLE_MENU);
return 0;
}
void CNavMenuBar::OnLButtonDown (UINT nFlags, CPoint point )
void CNavTitleBar::OnLButtonDown (UINT nFlags, CPoint point )
{
// Called when the user clicks on the menu bar. Start a drag or collapse the view.
CRect rect;
@ -342,30 +208,41 @@ void CNavMenuBar::OnLButtonDown (UINT nFlags, CPoint point )
int top = rect.top + (rect.Height() - NAVBAR_CLOSEBOX)/2;
int bottom = top + NAVBAR_CLOSEBOX;
CRect edgeRect(left, top, right, bottom);
if (edgeRect.PtInRect(point))
CRect closeBoxRect(left, top, right, bottom);
left -= NAVBAR_CLOSEBOX;
right -= NAVBAR_CLOSEBOX;
CRect modeBoxRect(left, top, right, bottom);
left -= NAVBAR_CLOSEBOX;
right -= NAVBAR_CLOSEBOX;
CRect sortBoxRect(left, top, right, bottom);
if (closeBoxRect.PtInRect(point))
{
// Collapse the view
if (m_pSelectorButton)
m_pSelectorButton->OnAction();
// Destroy the window.
CFrameWnd* pFrameWnd = GetParentFrame();
if (pFrameWnd->IsKindOf(RUNTIME_CLASS(CNSNavFrame)))
((CNSNavFrame*)pFrameWnd)->DeleteNavCenter();
}
else if (modeBoxRect.PtInRect(point))
{
CRDFOutliner* pOutliner = (CRDFOutliner*)HT_GetViewFEData(m_View);
pOutliner->SetNavigationMode(!pOutliner->InNavigationMode());
}
else if (sortBoxRect.PtInRect(point))
{
}
else
{
// Set the focus.
if (m_pSelectorButton)
{
CRDFContentView* pView = m_pSelectorButton->GetTreeView();
if (pView)
pView->SetFocus();
}
m_PointHit = point;
SetCapture();
CFrameWnd* pFrameWnd = GetParentFrame();
if (pFrameWnd->IsKindOf(RUNTIME_CLASS(CNSNavFrame)))
SetCapture();
}
}
void CNavMenuBar::OnMouseMove(UINT nFlags, CPoint point)
void CNavTitleBar::OnMouseMove(UINT nFlags, CPoint point)
{
if (GetCapture() == this)
{
@ -377,13 +254,14 @@ void CNavMenuBar::OnMouseMove(UINT nFlags, CPoint point)
ReleaseCapture();
// Start a drag
CRDFOutliner* pOutliner = (CRDFOutliner*)HT_GetViewFEData(m_View);
MapWindowPoints(navFrameParent, &point, 1);
navFrameParent->StartDrag(point);
}
}
}
void CNavMenuBar::OnLButtonUp(UINT nFlags, CPoint point)
void CNavTitleBar::OnLButtonUp(UINT nFlags, CPoint point)
{
if (GetCapture() == this)
{
@ -391,35 +269,14 @@ void CNavMenuBar::OnLButtonUp(UINT nFlags, CPoint point)
}
}
void CNavMenuBar::OnSize( UINT nType, int cx, int cy )
void CNavTitleBar::OnSize( UINT nType, int cx, int cy )
{
/* if (m_pMenuButton)
{
CRect rect;
GetClientRect(&rect);
m_pMenuButton->UpdateButtonText(rect);
}
*/
}
void CNavMenuBar::UpdateView(CSelectorButton* pButton, HT_View view)
{
m_pSelectorButton = pButton;
/*
if (m_pMenuButton)
{
CRect rect;
GetClientRect(&rect);
m_pMenuButton->UpdateView(view);
m_pMenuButton->UpdateButtonText(rect);
}
*/
if (pButton && pButton->GetTreeView())
{
((CRDFOutliner*)(pButton->GetTreeView()->GetOutlinerParent()->GetOutliner()))->SetDockedMenuBar(this);
}
titleText = "No View Selected.";
void CNavTitleBar::SetHTView(HT_View view)
{
titleText = "";
m_View = view;
if (view)
{

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

@ -23,33 +23,11 @@
#include "usertlbr.h"
#define NAVBAR_HEIGHT 23
#define NAVBAR_CLOSEBOX 15
#define NAVBAR_CLOSEBOX 16
class CSelectorButton;
/* This class may yet be of use. For now comment it out.
class CNavMenuButton : public CRDFToolbarButton
class CNavTitleBar : public CWnd, public CCustomImageObject
{
protected:
HT_View m_HTView; // Pointer to HT_View if one exists.
public:
CNavMenuButton();
void UpdateView(HT_View v);
void UpdateButtonText(CRect target);
afx_msg LRESULT OnDragMenuOpen(WPARAM wParam, LPARAM lParam);
afx_msg BOOL OnCommand(UINT wParam, LONG lParam);
DECLARE_MESSAGE_MAP()
};
*/
class CNavMenuBar : public CWnd, public CCustomImageObject
{
//CNavMenuButton* m_pMenuButton; // Pointer to the button
CSelectorButton* m_pSelectorButton; // Selector button
BOOL m_bHasFocus; // Determines what colors to use for the caption
CPoint m_PointHit; // MouseDown tracking
CString titleText; // Name of the current workspace
@ -61,15 +39,15 @@ class CNavMenuBar : public CWnd, public CCustomImageObject
HT_View m_View; // The current HT_View.
public:
CNavMenuBar();
~CNavMenuBar();
CNavTitleBar();
~CNavTitleBar();
void UpdateView(CSelectorButton* pButton, HT_View view);
void SetHTView(HT_View theView);
void NotifyFocus(BOOL hasFocus) { m_bHasFocus = hasFocus; Invalidate(); }
void LoadComplete(HT_Resource r) { Invalidate(); }
//{{AFX_MSG(CNavMenuBar)
//{{AFX_MSG(CNavTitleBar)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code!

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

@ -49,7 +49,8 @@ static char THIS_FILE[] = __FILE__;
// The Main Event Handler for the NavCenter. Handles events on the selector bar AND within the tree
// views.
void notifyProcedure (HT_Notification ns, HT_Resource n, HT_Event whatHappened)
void notifyProcedure (HT_Notification ns, HT_Resource n, HT_Event whatHappened,
void *token, uint32 tokenType)
{
CSelector* theSelector = (CSelector*)ns->data;
if (theSelector == NULL)
@ -60,11 +61,10 @@ void notifyProcedure (HT_Notification ns, HT_Resource n, HT_Event whatHappened)
// The pane has to handle some events. These will go here.
if (whatHappened == HT_EVENT_VIEW_SELECTED)
{
CView* pView = theSelector->GetCurrentView();
CSelectorButton* pButton = theSelector->GetCurrentButton();
// If the new selected view is NULL, then we need to make sure our pane is closed.
if (theView == NULL && pView != NULL)
if (theView == NULL && pButton != NULL)
{
// We're open. Close the pane.
((CNSNavFrame*)theSelector->GetParentFrame())->CollapseWindow();
@ -72,10 +72,10 @@ void notifyProcedure (HT_Notification ns, HT_Resource n, HT_Event whatHappened)
else if (theView != NULL)
{
// We have a view. Select it.
CSelectorButton* pButton = (CSelectorButton*)HT_GetViewFEData(theView);
theSelector->SetCurrentView(pButton);
if (pView == NULL)
CSelectorButton* pNewButton = (CSelectorButton*)HT_GetViewFEData(theView);
theSelector->SetCurrentButton(pNewButton);
if (pButton == NULL)
{
// Need to open the pane.
((CNSNavFrame*)theSelector->GetParentFrame())->ExpandWindow();
@ -89,9 +89,8 @@ void notifyProcedure (HT_Notification ns, HT_Resource n, HT_Event whatHappened)
if (whatHappened == HT_EVENT_VIEW_ADDED)
{
theSelector->ConstructView(theView);
theSelector->AddButton(theView);
theSelector->RearrangeIcons();
CSelectorButton* pButton = (CSelectorButton*)HT_GetViewFEData(theView);
}
else if (whatHappened == HT_EVENT_VIEW_DELETED)
{
@ -99,8 +98,6 @@ void notifyProcedure (HT_Notification ns, HT_Resource n, HT_Event whatHappened)
CSelectorButton* pButton = (CSelectorButton*)HT_GetViewFEData(theView);
if (pButton)
{
pButton->GetView()->DestroyWindow();
// Delete the button
delete pButton;
@ -118,6 +115,11 @@ void notifyProcedure (HT_Notification ns, HT_Resource n, HT_Event whatHappened)
// Invalidate the button.
pButton->Invalidate();
// The remaining invalidation only happens if the selected view is the one that was just
// changed.
if (theSelector->GetCurrentButton() != pButton)
return;
// Invalidate the title bar.
CFrameWnd* pFrame = pButton->GetParentFrame();
if (pFrame->IsKindOf(RUNTIME_CLASS(CNSNavFrame)))
@ -126,12 +128,12 @@ void notifyProcedure (HT_Notification ns, HT_Resource n, HT_Event whatHappened)
if (pNavFrame)
{
// Invalidate the title bar.
CNavMenuBar* pBar = pNavFrame->GetNavMenuBar();
CNavTitleBar* pBar = pNavFrame->GetNavTitleBar();
if (pBar)
pBar->Invalidate();
// Invalidate the tree view.
CRDFContentView* theOutlinerView = (CRDFContentView*)pButton->GetTreeView();
CRDFContentView* theOutlinerView = theSelector->GetContentView();
if (theOutlinerView)
{
CRDFOutlinerParent* pParent = (CRDFOutlinerParent*)(theOutlinerView->GetOutlinerParent());
@ -154,51 +156,38 @@ void notifyProcedure (HT_Notification ns, HT_Resource n, HT_Event whatHappened)
else if (whatHappened == HT_EVENT_VIEW_WORKSPACE_REFRESH)
theSelector->RearrangeIcons(); // Redraw the selector.
// If the pane doesn't handle the event, then a view does.
else
// If the pane doesn't handle the event, then the tree view does, but only if this button is the current
// selected button on the selector bar.
else
{
// View needs to exist in order for us to send this event to it.
CSelectorButton* pButton = (CSelectorButton*)HT_GetViewFEData(theView);
if (pButton)
if (pButton && (pButton == theSelector->GetCurrentButton()))
{
CRDFContentView* theOutlinerView = (CRDFContentView*)pButton->GetTreeView();
CRDFContentView* theOutlinerView = theSelector->GetContentView();
if (theOutlinerView)
{
CRDFOutliner* theOutliner = (CRDFOutliner*)(theOutlinerView->GetOutlinerParent()->GetOutliner());
theOutliner->HandleEvent(ns, n, whatHappened);
if (theOutliner)
theOutliner->HandleEvent(ns, n, whatHappened);
}
}
else if (pButton && whatHappened == HT_EVENT_NODE_OPENCLOSE_CHANGED &&
(pButton->GetDropMenu() != NULL))
{
// We opened or closed a node in the popup menu.
PRBool openState;
HT_GetOpenState(n, &openState);
if (openState)
pButton->FillInMenu(n);
}
}
}
// The Event Handler for selector popup menus
static void selectorPopupNotifyProcedure (HT_Notification ns, HT_Resource n, HT_Event whatHappened)
{
// We respond only to open/closed events. This procedure is only entered when the user clicks
// and holds on a selector bar button to bring up a popup menu.
CSelectorButton* theButton = (CSelectorButton*)ns->data;
if (n != NULL)
{
HT_View theView = HT_GetView(n);
if (theView != NULL && (whatHappened == HT_EVENT_NODE_OPENCLOSE_CHANGED))
{
PRBool openState;
HT_GetOpenState(n, &openState);
if (openState)
{
theButton->FillInMenu(n);
}
}
}
}
// SelectorButton
CSelectorButton::~CSelectorButton()
{
if (m_Pane)
HT_DeletePane(m_Pane);
m_Node = NULL;
}
@ -208,27 +197,18 @@ int CSelectorButton::Create(CWnd *pParent, int nToolbarStyle, CSize noviceButton
LPCTSTR pStatusText,
CSize bitmapSize, int nMaxTextChars, int nMinTextChars,
HT_Resource pNode,
DWORD dwButtonStyle, CView* view, CPaneCX* pane)
{
pView = view;
m_pPane = pane;
// Construct the notification struct used by HT
HT_Notification ns = new HT_NotificationStruct;
ns->notifyProc = selectorPopupNotifyProcedure;
ns->data = this;
// Construct the pane and give it our notification struct
m_Pane = HT_PaneFromResource(HT_GetRDFResource(pNode), ns, (PRBool)TRUE);
HT_SetPaneFEData(m_Pane, this);
HT_Resource pEntry = NULL;
HT_View theView = HT_GetSelectedView(m_Pane);
DWORD dwButtonStyle)
{
BOOKMARKITEM bookmark; // For now, create with the pictures style. No text ever.
return CRDFToolbarButton::Create(pParent, TB_PICTURES, noviceButtonSize, advancedButtonSize,
BOOL bResult = CRDFToolbarButton::Create(pParent, TB_PICTURES, noviceButtonSize, advancedButtonSize,
pButtonText, pToolTipText, pStatusText, bitmapSize, nMaxTextChars, nMinTextChars,
bookmark, HT_TopNode(theView), dwButtonStyle);
bookmark, pNode, dwButtonStyle);
return bResult;
}
CRDFContentView* CSelectorButton::GetContentView()
{
return m_pSelector->GetContentView();
}
void CSelectorButton::OnAction()
@ -398,9 +378,9 @@ BEGIN_MESSAGE_MAP(CSelector, CView)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
CSelector::CSelector()
CSelector::CSelector(CRDFContentView* pContent)
{
m_pCurView = NULL;
m_pContentView = pContent;
m_xpos = ICONXPOS;
m_ypos = ICONYPOS;
m_pDropTarget = NULL;
@ -499,59 +479,36 @@ void CSelector::SelectNthView(int i)
BOOL CSelector::IsTreeVisible()
{
return m_pCurView != NULL;
return m_pCurButton != NULL;
}
void CSelector::SetCurrentView(CSelectorButton* pButton)
void CSelector::SetCurrentButton(CSelectorButton* pButton)
{
CView* pView = pButton->GetView();
if (m_pCurButton)
// Deselect the old button.
if (m_pCurButton)
{
m_pCurButton->SetDepressed(FALSE);
}
// Selecting the button.
m_pCurButton = pButton;
m_pCurButton->SetDepressed(TRUE);
if (m_pCurView != pView )
{
if (m_pCurView)
m_pCurView->ShowWindow(SW_HIDE);
m_pCurView = pView;
GetParentFrame()->SetActiveView( m_pCurView);
((CNSNavFrame*)GetParentFrame())->GetNavMenuBar()->UpdateView(m_pCurButton, m_pCurButton->GetHTView());
((CNSNavFrame*)GetParentFrame())->UpdateTitleBar(m_pCurButton->GetHTView());
}
// adjust the window. here.
m_pCurView->ShowWindow(SW_SHOW);
if(m_pCurView->GetParent()->IsKindOf(RUNTIME_CLASS(CContentView)))
{
CContentView* contentView = (CContentView*)m_pCurView->GetParent();
contentView->CalcChildSizes();
}
m_pCurView->SetFocus();
m_pContentView->SwitchHTViews(m_pCurButton->GetHTView());
m_pContentView->SetFocus();
}
void CSelector::UnSelectAll()
{
if (m_pCurButton)
m_pCurButton->SetDepressed(FALSE);
m_pCurButton = 0;
if (m_pCurView)
{
m_pCurView->ShowWindow(SW_HIDE);
m_pCurView = 0;
GetParentFrame()->SetActiveView( m_pCurView);
}
((CNSNavFrame*)GetParentFrame())->GetNavMenuBar()->UpdateView(NULL, NULL);
m_pCurButton = NULL;
}
CView* CSelector::GetCurrentView()
CRDFContentView* CSelector::GetContentView()
{
return m_pCurView;
return m_pContentView;
}
CSelectorButton* CSelector::GetCurrentButton()
@ -627,26 +584,26 @@ void CSelector::ShowScrollButton(CSelectorButton* button)
}
void CSelector::AddViewContext(const char* pTitle, CView* pView, CRDFContentView* pTree,
CPaneCX* htmlPane, HT_View theView)
void CSelector::AddButton(HT_View theView)
{
// Create the selector button.
CSelectorButton* theNSViewButton = new CSelectorButton(this);
// Button meets the view. View meets the button.
// Set the HT view for the button.
theNSViewButton->SetHTView(theView);
theNSViewButton->SetTreeView(pTree);
HT_SetViewFEData(theView, theNSViewButton);
HT_Resource node = theView ? HT_TopNode(theView) : NULL;
char* pNodeURL = node ? HT_GetNodeURL(node) : "";
HT_Resource node = HT_TopNode(theView);
char* pNodeURL = HT_GetNodeURL(node);
char* pTitle = HT_GetNodeName(node);
theNSViewButton->Create(this, theApp.m_pToolbarStyle, CSize(60,42), CSize(85, 25),
pTitle,
pTitle, pNodeURL,
CSize(23,23), 10, 5,
node,
TB_HAS_DRAGABLE_MENU | TB_HAS_TIMED_MENU, pView, htmlPane);
TB_HAS_DRAGABLE_MENU | TB_HAS_TIMED_MENU);
CRect rect;
rect.left = (long)m_xpos;
@ -669,35 +626,15 @@ void CSelector::AddViewContext(const char* pTitle, CView* pView, CRDFContentView
m_ypos += buttonSize.cy + 2;
rect.right = rect.left + BUTTON_WIDTH;
}
/*
CString originalText = HT_GetNodeName(theNSViewButton->GetNode());
int currCount = originalText.GetLength();
// Start off at the maximal string
CString strTxt = originalText;
CSize theSize = theNSViewButton->GetButtonSizeFromChars(originalText, currCount);
int horExtent = theSize.cx;
while (horExtent > BUTTON_WIDTH)
{
strTxt = originalText.Left(currCount-3) + "...";
theSize = theNSViewButton->GetButtonSizeFromChars(strTxt, currCount);
horExtent = theSize.cx;
currCount--;
}
theNSViewButton->SetTextWithoutResize(strTxt);
*/
ShowScrollButton(theNSViewButton);
}
void CSelector::PopulatePane()
{
// Construct the notification struct used by HT
HT_Notification ns = new HT_NotificationStruct;
XP_BZERO(ns, sizeof(HT_NotificationStruct));
ns->notifyProc = notifyProcedure;
ns->data = this;
m_Notification = ns;
@ -709,6 +646,7 @@ void CSelector::PopulatePane()
// Inform our XP layer of the new nav center.
MWContext *pDockedCX = NULL;
CNSNavFrame *pParentFrame = GetParentFrame()->IsKindOf(RUNTIME_CLASS(CNSNavFrame)) ? (CNSNavFrame*)GetParentFrame() : NULL;
// Since the XP layer isn't set up yet, we can't use
// XP_IsNavCenterDocked in order to tell
// if the window is docked. Use instead wether or
@ -727,51 +665,6 @@ void CSelector::PopulatePane()
RearrangeIcons();
}
void CSelector::ConstructView(HT_View theView)
{
if (theView == NULL)
return;
CString viewName = HT_GetNodeName(HT_TopNode(theView));
// Construct the RDF view
CWnd *theParent = (CWnd *)(((CNSNavFrame*)GetParentFrame())->GetContentView());
DWORD dwCurrentStyle = WS_CHILD;
// Parent may change depending on view (need more panes).
CRect rClient(0, 0, 100, 100);
CContentView *pAltParent = NULL;
CPaneCX *pCX = NULL;
if(HT_HasHTMLPane(theView))
{
pAltParent = new CContentView();
pAltParent->Create(NULL, "", WS_CHILD, rClient, theParent, NC_IDW_MISCVIEW, NULL);
pCX = wfe_CreateNavCenterHTMLPain(theView, pAltParent->m_hWnd);
// Make all other children visible now (we control visibility by being the parent).
dwCurrentStyle |= WS_VISIBLE;
}
if(pAltParent) {
theParent = (CWnd *)pAltParent;
}
theParent->GetClientRect(&rClient);
// Can't use CSelector's m_Pane, because it might not have been initialized yet. Calls
// HT_GetPane instead.
CRDFOutlinerParent* newParent = new CRDFOutlinerParent(HT_GetPane(theView), theView);
CRDFContentView* newView = new CRDFContentView(newParent);
// Create the windows
newView->Create( NULL, "", dwCurrentStyle, rClient, theParent, NC_IDW_OUTLINER);
// Initialize the columns, etc.
newParent->Initialize();
// Name and icon for the view correspond to the name/icon of the top node in the view.
AddViewContext(viewName, pAltParent ? (CView *)pAltParent : (CView *)newView, newView, pCX, theView);
}
void CSelector::DestroyViews()
{
int viewCount = HT_GetViewListCount(m_Pane);
@ -861,10 +754,10 @@ void CSelector::RearrangeIcons()
if (dockStyle == DOCKSTYLE_HORZTOP || dockStyle == DOCKSTYLE_HORZBOTTOM)
{
m_xpos = ICONXPOS;
m_ypos = 2;
m_ypos = 1;
}
else {
m_xpos = 2;
m_xpos = 1;
m_ypos = ICONYPOS;
}
CRect parentRect;
@ -983,9 +876,8 @@ void CSelector::OnLButtonDown (UINT nFlags, CPoint point )
// Called when the user clicks on the menu bar. Start a drag or collapse the view.
if (m_pCurButton)
{
CRDFContentView* pView = m_pCurButton->GetTreeView();
if (pView)
pView->SetFocus();
if (m_pContentView)
m_pContentView->SetFocus();
}
m_PointHit = point;

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

@ -68,50 +68,35 @@ class CSelectorButton : public CRDFToolbarButton
friend class CSelector;
protected:
CView* pView; // View including the HTML pane
CRDFContentView* m_pTreeView; // Pointer straight to the RDF Tree view.
CPaneCX* m_pPane;
CSelector* m_pSelector;
HT_View m_HTView; // Pointer to HT_View if one exists. Could be NULL.
HT_Pane m_Pane; // This is the button's popup menu pane.
// The Selector Button actually has two HT_Nodes, two HT_Views, and two HT_Panes. One set is the pane in
// which the button is found (along with all the other buttons). The second set is for the popup menu
// that comes up on a timed mouse down on the button.
// m_HTView is used with the pane that contains all the buttons.
// m_Pane is used for the popup menu.
// The base class has an m_Node member variable. This is the popup variable's top node in its selected
// HT_View. -- Dave H.
public:
CSelectorButton(CSelector* pSelector)
:m_pSelector(pSelector), pView(NULL), m_pPane(NULL),
m_HTView(NULL) {};
:m_pSelector(pSelector), m_HTView(NULL) {};
~CSelectorButton();
void SetHTView(HT_View v) { m_HTView = v; }
virtual HT_View GetHTView() { return m_HTView; }
CView* GetView() { return pView; }
CRDFContentView* GetContentView();
virtual BOOL UseLargeIcons() { return TRUE; }
virtual void DisplayAndTrackMenu(void);
virtual UINT GetBitmapID() { return 0; }
virtual void OnAction(void);
int Create(CWnd *pParent, int nToolbarStyle, CSize noviceButtonSize, CSize advancedButtonSize,
LPCTSTR pButtonText, LPCTSTR pToolTipText,
LPCTSTR pStatusText,
CSize bitmapSize, int nMaxTextChars, int nMinTextChars,
HT_Resource pNode, DWORD dwButtonStyle = 0, CView* view = NULL, CPaneCX* pane = NULL);
CSize bitmapSize, int nMaxTextChars, int nMinTextChars,
HT_Resource pNode, DWORD dwButtonStyle = 0);
virtual BOOL foundOnRDFToolbar() { return FALSE; } // buttons sit on a selector bar and not on a toolbar
void SetDepressed(BOOL b) { m_bDepressed = b; Invalidate(); }
CRDFContentView* GetTreeView() { return m_pTreeView; } // Returns only the tree
void SetTreeView(CRDFContentView* tree) { m_pTreeView = tree; } // Sets the tree view
virtual void DrawPicturesMode(HDC hDC, CRect rect);
// Overridden because LinkToolbarButtons draw text with the pictures always. We
// want to revert to ToolbarButton behavior.
@ -195,30 +180,47 @@ public:
class CSelector : public CView
{
friend class CSelectorButton;
public:
DECLARE_DYNAMIC(CSelector)
CSelector();
virtual ~CSelector();
void AddViewContext(const char* pTitle, CView* pView, CRDFContentView* pTree,
CPaneCX* htmlPane, HT_View theView);
CView* GetCurrentView(); // Gets the view including the HTML pane
CSelectorButton* GetCurrentButton();
void SetCurrentView(CSelectorButton* pButton);
void SelectNthView(int i);
CSelector(CRDFContentView* pContent);
virtual ~CSelector();
void AddButton(HT_View theView);
// Add a new view to the selector bar.
CRDFContentView* GetContentView();
// Gets the content area associated with this selector bar.
CSelectorButton* GetCurrentButton();
// Gets the current pressed button (if there is one).
void SetCurrentButton(CSelectorButton* pButton);
// Sets the current button.
void SelectNthView(int i);
// Select the nth HT view.
void PopulatePane();
// Function that fills the selector bar.
void DestroyViews();
void ConstructView(HT_View v);
// Function that destroys the HT views
HT_Pane GetHTPane() {return m_Pane;}
// Gets the pane associated with this selector bar.
void UnSelectAll();
// Function that deselects all buttons.
void ShowScrollButton(CSelectorButton* button);
void OnDraw( CDC* pDC );
int GetScrollDirection() {return m_scrollDirection;}
void ScrollSelector();
void StopScrolling() {m_scrollDirection = NOSCROLL;}
void UnSelectAll();
HBRUSH GetNormalBrush() {return hBrush;}
HBRUSH GetHtBrush() {return hHtBrush;}
@ -249,8 +251,8 @@ public:
protected:
int m_scrollDirection;
CSelectorButton * m_pCurButton;
CView* m_pCurView; // The entire view (including the HTML pane)
CSelectorButton * m_pCurButton; // The current selected button.
CRDFContentView* m_pContentView; // The entire view (including the HTML pane)
CRDFCommandMap m_MenuCommandMap; // Command map for back-end generated right mouse menu commands.
CSelectorDropTarget * m_pDropTarget;

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

@ -47,13 +47,9 @@ public:
void CalcChildSizes();
void AddChildSizeInfo(NAVCENTPOS *pPreference);
// drag and drop operation for the nav center content view. If there is a child window
// that has ID == NC_IDW_OUTLINER. The drag and drop message will get pass onto
// this child. If not, the drag and drop message will get pass onto the parent window.
protected:
virtual void OnActivateView( BOOL bActivate, CView* pActivateView, CView* pDeactiveView );
//{{AFX_MSG(CMainFrame)
afx_msg void CContentView::OnActivateView( BOOL bActivate, CView* pActivateView, CView* pDeactiveView );
afx_msg void OnSize( UINT nType, int cx, int cy );
afx_msg void OnSetFocus(CWnd* pWnd);
afx_msg void OnMouseMove( UINT nFlags, CPoint point );

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

@ -20,7 +20,7 @@
//
#include "stdafx.h"
#include "rdfliner.h"
#include "navfram.h"
#include "feimage.h"
#include "cxicon.h"
@ -72,26 +72,27 @@ END_MESSAGE_MAP()
CNSNavFrame::CNSNavFrame()
{
m_pSelector = 0;
m_nsContent= 0;
m_pSelector = NULL;
m_nsContent= NULL;
m_bDragging = FALSE;
m_DragWnd = 0;
m_dockingState = unknown;
m_DragWnd = NULL;
m_Node = NULL;
m_pButton = NULL;
}
CNSNavFrame::~CNSNavFrame()
{
if (m_dwOverDockStyle != DOCKSTYLE_FLOATING)
{
PREF_SetIntPref(gPrefDockPercentage, m_DockSize);
PREF_SetIntPref(gPrefDockOrientation, m_dwOverDockStyle);
}
else
{
PREF_SetRectPref(gPrefFloatRect, (int16)m_rectFloat.left, (int16)m_rectFloat.top, (int16)m_rectFloat.right, (int16)m_rectFloat.bottom);
}
if (m_dwOverDockStyle != DOCKSTYLE_FLOATING)
{
PREF_SetIntPref(gPrefDockPercentage, m_DockSize);
PREF_SetIntPref(gPrefDockOrientation, m_dwOverDockStyle);
}
else
{
PREF_SetRectPref(gPrefFloatRect, (int16)m_rectFloat.left, (int16)m_rectFloat.top, (int16)m_rectFloat.right, (int16)m_rectFloat.bottom);
}
delete m_pNavMenu;
// delete m_pNavTitle;
}
void CNSNavFrame::UpdateTitleBar(HT_View pView)
@ -140,11 +141,7 @@ void CNSNavFrame::CreateNewNavCenter(CNSGenFrame* pParentFrame, BOOL useViewType
// Create the window there.
m_rectFloat.SetRect(left, top, right, bottom);
// Don't reset this if being undocked.
if ( m_dockingState != beingUndocked )
{
m_rectDrag = m_rectFloat;
}
m_rectDrag = m_rectFloat;
CString title = "Navigation Center";
Create( NULL, title, WS_OVERLAPPEDWINDOW, m_rectFloat, NULL);
@ -167,19 +164,11 @@ void CNSNavFrame::CreateNewNavCenter(CNSGenFrame* pParentFrame, BOOL useViewType
{
// create a docked window
DockFrame(pParentFrame, m_dwOverDockStyle);
m_dockingState = docked;
}
else
{
// Create a floating window
m_dwOverDockStyle = DOCKSTYLE_FLOATING;
// Position to where user requested, if being undocked.
if ( m_dockingState == beingUndocked )
{
MoveWindow( m_rectDrag );
}
m_dockingState = undocked;
}
// Put the selector buttons into the pane.
@ -203,19 +192,29 @@ void CNSNavFrame::DeleteNavCenter()
// Tell ParentFrame that we are not docked anymore.
if (pLayout)
pLayout->RecalcLayout();
pLayout->RecalcLayout();
if (m_DragWnd)
m_DragWnd->DestroyWindow();
DestroyWindow();
PostMessage(WM_CLOSE);
if (m_pButton)
{
m_pButton->SetDepressed(FALSE);
m_pButton->Invalidate();
CRDFToolbarHolder* pHolder = (CRDFToolbarHolder*)(m_pButton->GetParent()->GetParent()->GetParent());
pHolder->SetCurrentButton(NULL);
m_pButton = NULL;
}
}
BOOL CNSNavFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
m_pSelector = new CSelector();
m_nsContent = new CContentView();
m_pNavMenu = new CNavMenuBar();
/*
m_nsContent = new CRDFContentView();
m_pSelector = new CSelector(m_nsContent);
m_pNavTitle = new CNavTitleBar();
CRect rect1;
rect1.left = rect1.top = 0;
@ -225,10 +224,31 @@ BOOL CNSNavFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
this, NC_IDW_SELECTOR, pContext );
rect1.right = rect1.bottom = 1;
m_pNavMenu->Create(NULL, "", WS_CHILD | WS_VISIBLE, rect1, this, NC_IDW_NAVMENU, pContext);
m_pNavTitle->Create(NULL, "", WS_CHILD | WS_VISIBLE, rect1, this, NC_IDW_NAVMENU, pContext);
m_nsContent->Create( NULL, "", WS_CHILD | WS_VISIBLE, rect1,
this, NC_IDW_MISCVIEW, pContext );
this , NC_IDW_OUTLINER, pContext);
*/
m_nsContent = CRDFContentView::DisplayRDFTreeFromResource(this, 0, 0, 100, 100, m_Node, pContext);
CRDFOutliner* pOutliner = (CRDFOutliner*)(m_nsContent->GetOutlinerParent()->GetOutliner());
SetHTNode(HT_TopNode(pOutliner->GetHTView()));
// Read in our float rect pref.
int16 left,right,top, bottom;
PREF_GetRectPref(gPrefFloatRect,&left, &top, &right, &bottom);
// Create the window there.
m_rectFloat.SetRect(left, top, right, bottom);
m_rectDrag = m_rectFloat;
// Determine the pixels we should consume if docked
int32 width;
PREF_GetIntPref(gPrefDockPercentage, &width);
m_DockSize = (int)width;
// Read in our dockstyle
m_dwOverDockStyle = DOCKSTYLE_VERTLEFT;
PREF_GetIntPref(gPrefDockOrientation, &m_dwOverDockStyle);
return TRUE;
}
@ -260,7 +280,7 @@ void CNSNavFrame::OnSize( UINT nType, int cx, int cy )
{
CRect tempRect;
// We want to handle the redraw ourself to reduce the flickering.
m_pSelector->GetClientRect(&tempRect);
/* m_pSelector->GetClientRect(&tempRect);
m_pSelector->MapWindowPoints( this, &tempRect);
m_pSelector->SetWindowPos( NULL, 0, top, MIN_CATEGORY_WIDTH, cy - STARTY - top, SWP_NOREPOSITION | SWP_NOREDRAW);
if ((tempRect.Height()) < cy - STARTY)
@ -272,9 +292,11 @@ void CNSNavFrame::OnSize( UINT nType, int cx, int cy )
m_pSelector->InvalidateRect( &tempRect, TRUE);
}
m_pNavMenu->ShowWindow(SW_SHOW);
m_pNavMenu->SetWindowPos(NULL, MIN_CATEGORY_WIDTH+2, top, cx - MIN_CATEGORY_WIDTH, NAVBAR_HEIGHT, SWP_NOREPOSITION);
m_pNavTitle->ShowWindow(SW_SHOW);
m_pNavTitle->SetWindowPos(NULL, MIN_CATEGORY_WIDTH+2, top, cx - MIN_CATEGORY_WIDTH, NAVBAR_HEIGHT, SWP_NOREPOSITION);
m_nsContent->SetWindowPos( NULL, MIN_CATEGORY_WIDTH+2, top+NAVBAR_HEIGHT, cx - MIN_CATEGORY_WIDTH - 2, cy - STARTY - top - NAVBAR_HEIGHT, 0);
*/
m_nsContent->SetWindowPos(NULL, 0, 0, cx, cy, 0);
}
else
{ //dock horiz.
@ -293,7 +315,7 @@ void CNSNavFrame::OnSize( UINT nType, int cx, int cy )
cx - STARTX, cy - MIN_CATEGORY_HEIGHT, SWP_NOREPOSITION | SWP_NOREDRAW);
}
ShowWindow(SW_SHOW);
if (m_DragWnd)
if (m_DragWnd && IsTreeVisible())
m_DragWnd->ShowWindow(SW_SHOW);
}
@ -306,6 +328,25 @@ BOOL CNSNavFrame::PreCreateWindow(CREATESTRUCT & cs)
return (CFrameWnd::PreCreateWindow(cs));
}
CNSNavFrame* CNSNavFrame::CreateFramedRDFViewFromResource(CWnd* pParent, int xPos, int yPos,
int width, int height, HT_Resource node)
{
CNSNavFrame* pNavFrame = new CNSNavFrame();
pNavFrame->SetDockStyle(DOCKSTYLE_FLOATING);
pNavFrame->SetHTNode(node);
pNavFrame->Create(NULL, HT_GetNodeName(node), WS_POPUP,
CRect(xPos, yPos, width, height),
pParent);
pNavFrame->SetWindowPos(&wndTopMost, xPos, yPos, width, height, 0);
pNavFrame->ShowWindow(SW_SHOW);
CRDFOutliner* pOutliner = (CRDFOutliner*)(pNavFrame->GetContentView()->GetOutlinerParent()->GetOutliner());
pOutliner->SetIsPopup(TRUE);
pOutliner->SetFocus();
return pNavFrame;
}
//------------------------------------------------------------------------------
// void CNSNavFrame::StartDrag(CPoint pt)
//
@ -319,8 +360,11 @@ void CNSNavFrame::StartDrag(CPoint pt, BOOL mapDesktop)
if (mapDesktop)
MapWindowPoints(NULL, &cursorPt, 1); // Convert the point to screen coords.
if (XP_IsNavCenterDocked(GetHTPane()))
CRDFOutliner* pOutliner = (CRDFOutliner*)(GetContentView()->GetOutlinerParent()->GetOutliner());
if (XP_IsNavCenterDocked(GetHTPane()) || pOutliner->IsPopup())
{
pOutliner->SetIsPopup(FALSE);
ForceFloat(FALSE);
}
else ShowWindow(SW_HIDE);
@ -332,13 +376,13 @@ void CNSNavFrame::StartDrag(CPoint pt, BOOL mapDesktop)
CNSGenFrame* pFrame = NULL;
CFrameGlue *pGlue = CFrameGlue::GetLastActiveFrame(MWContextBrowser, FEU_FINDBROWSERANDEDITOR);
CFrameWnd *pBaseWnd = pGlue ? pGlue->GetFrameWnd() : NULL;
CFrameWnd *pBaseWnd = pGlue->GetFrameWnd();
if(pBaseWnd && pBaseWnd->IsKindOf(RUNTIME_CLASS(CNSGenFrame)))
{
{
pFrame = (CNSGenFrame *)pBaseWnd;
CalcClientArea(&m_parentRect, pFrame);
pFrame->MapWindowPoints( NULL, &m_parentRect);
}
CalcClientArea(&m_parentRect, pFrame);
pFrame->MapWindowPoints( NULL, &m_parentRect);
// Cache the offset that we wish to preserve.
m_nXOffset = cursorPt.x - m_dockingDragRect.left;
@ -408,7 +452,7 @@ BOOL nsModifyStyle(HWND hWnd, int nStyleOffset, DWORD dwRemove, DWORD dwAdd, UIN
{
ASSERT(hWnd != NULL);
DWORD dwStyle = ::GetWindowLong(hWnd, nStyleOffset);
DWORD dwNewStyle;
DWORD dwNewStyle = dwStyle;
if (dwRemove != NULL)
dwNewStyle = dwStyle & ~dwRemove;
if (dwAdd != NULL)
@ -481,7 +525,8 @@ void CNSNavFrame::ForceFloat(BOOL show)
CFrameWnd *pLayout = GetParentFrame();
nsModifyStyle( GetSafeHwnd(), GWL_STYLE, WS_CHILD, WS_OVERLAPPEDWINDOW);
nsModifyStyle( GetSafeHwnd(), GWL_EXSTYLE, 0, WS_EX_CLIENTEDGE);
if (show)
{
MoveWindow( m_rectDrag);
@ -489,8 +534,12 @@ void CNSNavFrame::ForceFloat(BOOL show)
else ShowWindow(SW_HIDE);
SetParent(NULL);
m_DragWnd->DestroyWindow();
m_DragWnd = NULL;
if (m_DragWnd)
{
m_DragWnd->DestroyWindow();
m_DragWnd = NULL;
}
m_dwOverDockStyle = DOCKSTYLE_FLOATING;
@ -502,17 +551,20 @@ void CNSNavFrame::ForceFloat(BOOL show)
XP_UndockNavCenter(GetHTPane());
// Tell ParentFrame that we are not docked anymore.
pLayout->RecalcLayout();
if (pLayout)
pLayout->RecalcLayout();
// Select a new view if we were formerly collapsed.
if (m_pSelector->GetCurrentButton() == NULL)
if (m_pSelector && m_pSelector->GetCurrentButton() == NULL)
m_pSelector->SelectNthView(0);
/*
if (show)
{
m_nsContent->ShowWindow(SW_SHOW);
m_nsContent->CalcChildSizes();
}
*/
}
void CNSNavFrame::ComputeDockingSizes()
@ -525,8 +577,8 @@ void CNSNavFrame::ComputeDockingSizes()
else
{
m_DockWidth = MIN_CATEGORY_WIDTH + DRAGWIDTH;
m_DockHeight = MIN_CATEGORY_HEIGHT + DRAGWIDTH;
m_DockWidth = MIN_CATEGORY_WIDTH;
m_DockHeight = MIN_CATEGORY_HEIGHT;
}
}
@ -541,10 +593,13 @@ void CNSNavFrame::DockFrame(CNSGenFrame* pParent, short dockStyle)
{
CNSNavFrame* pFrame = pParent->GetDockedNavCenter();
if (pFrame)
{ // if the parent frame has a docked frame, tell this frame to float.
{ // if the parent frame has a docked frame, then destroy it.
pFrame->DeleteNavCenter();
}
nsModifyStyle( GetSafeHwnd(), GWL_STYLE, WS_OVERLAPPEDWINDOW , WS_CHILD);
nsModifyStyle( GetSafeHwnd(), GWL_STYLE, WS_OVERLAPPEDWINDOW, WS_CHILD);
nsModifyStyle( GetSafeHwnd(), GWL_EXSTYLE, WS_EX_CLIENTEDGE, 0);
nsModifyStyle( GetSafeHwnd(), GWL_STYLE, WS_POPUP, 0);
SetParent(pParent);
// Tell XP layer that we are now docked.
@ -594,11 +649,6 @@ void CNSNavFrame::DockFrame(CNSGenFrame* pParent, short dockStyle)
rect.right = m_parentRect.right;
}
// Now move the window to the correct location.
ShowWindow(SW_HIDE);
SetWindowPos( &wndBottom, rect.left, rect.top, rect.right - rect.left,
rect.bottom - rect.top,0 );
// Figure out the correct location to display the resize bar.
CRect dragBarRect(rect);
if (m_dwOverDockStyle == DOCKSTYLE_VERTLEFT) {
@ -637,7 +687,11 @@ void CNSNavFrame::DockFrame(CNSGenFrame* pParent, short dockStyle)
m_DragWnd->SetRect(dragBarRect);
m_DragWnd->SetParent(GetParentFrame());
m_DragWnd->ShowWindow(SW_SHOW);
// Now move the window to the correct location.
ShowWindow(SW_HIDE);
SetWindowPos( &wndBottom, rect.left, rect.top, rect.right - rect.left,
rect.bottom - rect.top,0 );
ShowWindow(SW_SHOW);
}
@ -665,39 +719,27 @@ void CNSNavFrame::EndDrag(CPoint pt) // drop
{
pFrame = (CNSGenFrame *)pBaseWnd;
}
// see if we're being re-docked.
if ( m_dockingState == undocked )
{
// Indicate we need to be reborn docked.
m_dockingState = beingDocked;
// Destroy the old windows.
DeleteNavCenter();
} else {
DockFrame(pFrame, dwOverDockStyle);
m_nsContent->CalcChildSizes();
ShowWindow(SW_SHOW);
}
DockFrame(pFrame, dwOverDockStyle);
// m_nsContent->CalcChildSizes();
}
else
{
// Float this frame.
MoveWindow( m_rectDrag);
// See if we're being undocked.
if ( m_dockingState == docked ) {
// Indicate we need to be reborn undocked.
m_dockingState = beingUndocked;
// Destroy the old windows.
DeleteNavCenter();
} else {
ShowWindow(SW_SHOW);
}
// If it had a button associated with it, now it doesn't.
if (m_pButton)
{
CRDFToolbarHolder* pHolder = (CRDFToolbarHolder*)
(m_pButton->GetParent()->GetParent()->GetParent());
pHolder->SetCurrentButton(NULL);
m_pButton->SetDepressed(FALSE);
m_pButton->Invalidate();
m_pButton = NULL;
}
}
ShowWindow(SW_SHOW);
}
@ -799,12 +841,12 @@ short CNSNavFrame::CanDock(CPoint pt, BOOL mapDesktop)
CNSGenFrame* pFrame = NULL;
CFrameGlue *pGlue = CFrameGlue::GetLastActiveFrame(MWContextBrowser, FEU_FINDBROWSERANDEDITOR);
CFrameWnd *pBaseWnd = pGlue ? pGlue->GetFrameWnd() : NULL;
CFrameWnd *pBaseWnd = pGlue->GetFrameWnd();
if(pBaseWnd && pBaseWnd->IsKindOf(RUNTIME_CLASS(CNSGenFrame))) {
pFrame = (CNSGenFrame *)pBaseWnd;
}
if (pFrame && mapDesktop) {
if (mapDesktop) {
CWnd *pView = pFrame->GetDescendantWindow(AFX_IDW_PANE_FIRST, TRUE);
if (XP_IsNavCenterDocked(GetHTPane())) {
@ -816,7 +858,7 @@ short CNSNavFrame::CanDock(CPoint pt, BOOL mapDesktop)
}
// If the top most activated frame is not a Navigator window, do not dock.
if (pFrame && pFrame->AllowDocking()) {
if (pFrame->AllowDocking()) {
if (m_parentRect.PtInRect(pt)) {
if ((pt.x < (m_parentRect.left +m_DockWidth)) &&
pt.x > m_parentRect.left)
@ -902,6 +944,8 @@ LRESULT CNSNavFrame::OnSizeParent(WPARAM, LPARAM lParam)
// the top and bottom coordinates of the dragRect should already be included
// in the toolbar.
if (!m_DragWnd) return 0;
CRect oldRect;
GetWindowRect(&oldRect);
CRect resizeRect(lpLayout->rect);
@ -909,54 +953,48 @@ LRESULT CNSNavFrame::OnSizeParent(WPARAM, LPARAM lParam)
m_DragWnd->GetRect(oldDragRect);
CRect dragRect(resizeRect);
if (m_dwOverDockStyle == DOCKSTYLE_VERTLEFT) {
//dragRect.top += 10;
//dragRect.bottom -= 10;
resizeRect.right = lpLayout->rect.left + oldRect.Width();
if (oldDragRect.left != resizeRect.right) // we move the drag bar. Need to resize here.
resizeRect.right += oldDragRect.left - resizeRect.right;
if (IsTreeVisible())
{
CWnd* pParent = GetParent();
CRect parentRect;
pParent->GetClientRect(&parentRect);
if (parentRect.Width() < resizeRect.Width() + DRAGWIDTH)
{
resizeRect.right = resizeRect.left + parentRect.Width() - DRAGWIDTH;
}
}
dragRect.left = resizeRect.right;
dragRect.right = dragRect.left + + DRAGWIDTH;
lpLayout->rect.left = resizeRect.right + DRAGWIDTH;
dragRect.right = dragRect.left + DRAGWIDTH;
if (IsTreeVisible())
lpLayout->rect.left = resizeRect.right + DRAGWIDTH;
else lpLayout->rect.left = resizeRect.right;
m_DragWnd->SetRect(dragRect);
m_DockWidth = resizeRect.Width();
}
else if (m_dwOverDockStyle == DOCKSTYLE_VERTRIGHT) {
resizeRect.left = lpLayout->rect.right - oldRect.Width();
if (oldDragRect.right != resizeRect.left) // we moved the drag bar. Need to resize here.
resizeRect.left -= resizeRect.left - oldDragRect.right;
dragRect.right = resizeRect.left;
dragRect.left = dragRect.right - DRAGWIDTH;
lpLayout->rect.right = resizeRect.left - DRAGWIDTH;
m_DragWnd->SetRect(dragRect);
m_DockWidth = resizeRect.Width();
}
else if (m_dwOverDockStyle == DOCKSTYLE_HORZTOP) {
resizeRect.bottom = lpLayout->rect.top + oldRect.Height();
if (oldDragRect.top != resizeRect.bottom) // we moved the drag bar. Need to resize here.
resizeRect.bottom += oldDragRect.top - resizeRect.bottom;
dragRect.top = resizeRect.bottom;
dragRect.bottom = dragRect.top + DRAGWIDTH;
lpLayout->rect.top = resizeRect.bottom + DRAGWIDTH;
m_DragWnd->SetRect(dragRect);
m_DockHeight = resizeRect.Height();
}
else if (m_dwOverDockStyle == DOCKSTYLE_HORZBOTTOM) {
resizeRect.top = lpLayout->rect.bottom - oldRect.Height();
if (oldDragRect.bottom != resizeRect.top) // we moved the drag bar. Need to resize here.
resizeRect.top -= resizeRect.top - oldDragRect.bottom;
dragRect.bottom = resizeRect.top;
dragRect.top = dragRect.bottom - DRAGWIDTH;
lpLayout->rect.bottom = resizeRect.top - DRAGWIDTH;
m_DragWnd->SetRect(dragRect);
m_DockHeight = resizeRect.Height();
}
if (lpLayout->hDWP != NULL) {
// reposition our frame window.
SetWindowPos( &wndBottom, resizeRect.left, resizeRect.top, resizeRect.right - resizeRect.left,
resizeRect.bottom - resizeRect.top, SWP_SHOWWINDOW );
m_dockingDragRect = resizeRect;
m_DragWnd->SetWindowPos( &wndBottom, dragRect.left, dragRect.top, dragRect.Width(),
dragRect.Height(), SWP_SHOWWINDOW );
if (IsTreeVisible())
m_DragWnd->SetWindowPos( &wndBottom, dragRect.left, dragRect.top, dragRect.Width(),
dragRect.Height(), SWP_SHOWWINDOW );
}
@ -1047,7 +1085,7 @@ void CNSNavFrame::CollapseWindow()
}
else if (m_dwOverDockStyle == DOCKSTYLE_VERTLEFT)
{
dragBox.left -= (tempRect.Width() - MIN_CATEGORY_WIDTH - DRAGWIDTH);
dragBox.left -= (tempRect.Width() - MIN_CATEGORY_WIDTH);
dragBox.right = dragBox.left + DRAGWIDTH;
}
else
@ -1063,6 +1101,7 @@ void CNSNavFrame::CollapseWindow()
{
m_DragWnd->SetRect(dragBox);
m_DragWnd->MoveWindow(dragBox);
m_DragWnd->ShowWindow(SW_HIDE);
GetParentFrame()->RecalcLayout();
}
}
@ -1134,11 +1173,9 @@ void CNSNavFrame::Dump(CDumpContext& dc) const
HT_Pane CNSNavFrame::GetHTPane()
{
HT_Pane htRetval = NULL;
if(m_pSelector) {
htRetval = m_pSelector->GetHTPane();
}
return(htRetval);
if(m_Node)
return HT_GetPane(HT_GetView(m_Node));
return NULL;
}
void CNSNavFrame::OnNcLButtonDown( UINT nHitTest, CPoint point )
@ -1178,37 +1215,3 @@ void CNSNavFrame::OnMouseMove( UINT nHitTest, CPoint point )
CWnd::OnNcMouseMove(nHitTest, point);
}
void CNSNavFrame::PostNcDestroy()
{
// Check to see if we need to recreate the NavCenter windows.
switch ( m_dockingState ) {
case beingDocked:
// Re-create within docked-to frame.
{
CFrameGlue *pGlue = CFrameGlue::GetLastActiveFrame(MWContextBrowser, FEU_FINDBROWSERANDEDITOR);
CFrameWnd *pBaseWnd = pGlue ? pGlue->GetFrameWnd() : NULL;
if(pBaseWnd && pBaseWnd->IsKindOf(RUNTIME_CLASS(CNSGenFrame)))
{
CreateNewNavCenter( (CNSGenFrame*)pBaseWnd );
}
else
{
CreateNewNavCenter(NULL);
}
}
break;
case beingUndocked:
// Re-create with no parent.
CreateNewNavCenter(NULL);
break;
case unknown:
case docked:
case undocked:
default:
// Pass on to base class (which will "delete this").
CFrameWnd::PostNcDestroy();
break;
}
}

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

@ -72,7 +72,9 @@ public: // create from serialization only
// Implementation
public:
virtual ~CNSNavFrame();
CContentView* GetContentView() {return m_nsContent;}
CRDFContentView* GetContentView() {return m_nsContent;}
void SetContentView(CRDFContentView* v) { m_nsContent = v; }
// Add new view to this frame.
//void AddViewContext(const char* pUrl, const char* pTitle, CView* pView, CPaneCX* htmlPane = NULL);
@ -81,6 +83,10 @@ public:
void CreateNewNavCenter(CNSGenFrame* pParentFrame = NULL, BOOL useViewType = FALSE, HT_ViewType viewType = HT_VIEW_BOOKMARK);
void DeleteNavCenter();
static CNSNavFrame* CreateFramedRDFViewFromResource(CWnd* pParent, int xPos, int yPos,
int width, int height,
HT_Resource node);
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
@ -95,17 +101,21 @@ public:
short CanDock(CPoint pt, BOOL mapDesktop = FALSE);
void ForceFloat(BOOL show = TRUE);
int32 GetDockStyle() { return m_dwOverDockStyle;}
void SetDockStyle(int32 d) { m_dwOverDockStyle = d; }
void ExpandWindow();
void CollapseWindow();
void ComputeDockingSizes();
void UpdateTitleBar(HT_View pView);
virtual void PostNcDestroy();
public:
HT_Pane GetHTPane();
CNavMenuBar* GetNavMenuBar() { return m_pNavMenu; }
BOOL IsTreeVisible() { return m_pSelector->IsTreeVisible(); }
CNavTitleBar* GetNavTitleBar() { return m_pNavTitle; }
BOOL IsTreeVisible() { return TRUE; } //m_pSelector->IsTreeVisible(); }
void SetHTNode(HT_Resource node) { m_Node = node; }
void SetRDFButton(CRDFToolbarButton* pButton) { m_pButton = pButton; }
CRDFToolbarButton* GetRDFButton() { return m_pButton; }
protected: // control bar embedded members
friend class CSelector;
@ -118,7 +128,9 @@ protected: // control bar embedded members
CPoint m_ptLast; // last mouse position during drag
CDC* m_pDC; // where to draw during drag
CDragBar* m_DragWnd; // the resize bar, when this frame is docked.
HT_Resource m_Node; // the top node of the view.
CRDFToolbarButton* m_pButton; // A pointer to the button this view points to.
// NULL if window is floating.
// All of these rects are in the Desktop window's coordinates.
CRect m_rectDrag; // bounding rect when this frame is floating
@ -130,17 +142,8 @@ protected: // control bar embedded members
int m_nXOffset, m_nYOffset;
CSelector* m_pSelector; // the selector pane.
CContentView *m_nsContent; // the content pane.
CNavMenuBar* m_pNavMenu; // the embedded menu bar.
// Indicator used when being docked/undocked.
enum {
unknown,
docked,
beingDocked,
undocked,
beingUndocked
} m_dockingState;
CRDFContentView *m_nsContent; // the content pane.
CNavTitleBar* m_pNavTitle; // the embedded title strip.
// Generated message map functions
protected:

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

@ -232,6 +232,24 @@ COutliner::~COutliner ( )
delete m_pTip;
}
void COutliner::DestroyColumns()
{
if ( m_pColumn )
{
while ( m_iNumColumns )
{
if (m_pColumn[ m_iNumColumns - 1]->pHeader)
free((char*)m_pColumn[ m_iNumColumns - 1]->pHeader);
delete(m_pColumn[ m_iNumColumns - 1 ]);
m_iNumColumns--;
}
free(m_pColumn);
m_pColumn = NULL;
}
m_iNumColumns = 0;
}
STDMETHODIMP COutliner::QueryInterface(
REFIID refiid,
LPVOID * ppv)
@ -3360,6 +3378,15 @@ void COutlinerParent::GetColumnRect( int iCol, RECT &rc )
}
}
void COutlinerParent::EnableHeaders(BOOL bEnable)
{
m_bDisableHeaders = !bEnable;
CRect rect;
GetClientRect(&rect);
Invalidate();
OnSize(0, rect.Width(), rect.Height());
}
void COutlinerParent::InvalidateColumn( int iCol )
{
RECT rc;

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

@ -317,6 +317,8 @@ public:
virtual void SetTotalLines( int );
virtual int GetTotalLines();
virtual void DestroyColumns();
protected:
//
@ -459,7 +461,7 @@ public:
~COutlinerParent();
void EnableBorder ( BOOL bEnable = TRUE ) { m_bHasBorder = bEnable; }
void EnableHeaders ( BOOL bEnable = TRUE) { m_bDisableHeaders = !bEnable; Invalidate ( ); }
void EnableHeaders ( BOOL bEnable = TRUE);
void EnableFocusFrame ( BOOL bEnable = TRUE) { m_bEnableFocusFrame = bEnable; }
void SetOutliner ( COutliner * pOutliner );

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

@ -22,7 +22,7 @@
#include "pain.h"
#include "navcntr.h"
CPaneCX *wfe_CreateNavCenterHTMLPain(HT_View htView, HWND hParent)
CPaneCX *wfe_CreateNavCenterHTMLPain(HWND hParent)
{
CPaneCX *pRetval = NULL;
@ -47,7 +47,6 @@ CPaneCX *wfe_CreateNavCenterHTMLPain(HT_View htView, HWND hParent)
CWinCX *pWinCX = new CWinCX((CGenericDoc *)cccGrid.m_pCurrentDoc, NULL, pNewView, MWContextPane, Pane);
if(pWinCX) {
pWinCX->Initialize(pWinCX->CDCCX::IsOwnDC(), crClient);
XP_RegisterViewHTMLPane(htView, pWinCX->GetContext());
pRetval = VOID2CX(pWinCX, CPaneCX);
}
}

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

@ -19,6 +19,6 @@
#ifndef __PAIN_H
#define __PAIN_H
CPaneCX *wfe_CreateNavCenterHTMLPain(HT_View htView, HWND hParent);
CPaneCX *wfe_CreateNavCenterHTMLPain(HWND hParent);
#endif // __PAIN_H

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

@ -21,6 +21,34 @@
#include "cxstubs.h"
class CIsomorphicCommandMap
{
private:
CMapStringToString mapFromXPToFE;
CMapStringToString mapFromFEToXP;
public:
static CIsomorphicCommandMap* InitializeCommandMap(const CString& initType);
// This function builds the command map and prepopulates it with the set of commands
// that can be responded to.
void AddItem(CString xpItem, UINT feResource);
// Adds an isomorphic entry into the two maps.
void RemoveXPItem(CString xpItem);
// Removes the isomorphic entry from the two maps (keyed on the XP item).
void RemoveFEItem(UINT feResource);
// Removes the isomorphic entry from the two maps (keyed on the FE resource ID)
UINT GetFEResource(CString xpItem);
// Given an XP name, retrieves the FE resource.
CString GetXPResource(UINT resource);
// Given an FE resource, retrieves the XP name.
};
class CCustomImageObject;
class CRDFImage;
@ -161,12 +189,19 @@ HICON DrawLocalFileIcon(HT_Resource r, int left, int top, HDC hdc);
CRDFImage* DrawArbitraryURL(HT_Resource r, int left, int top, int imageWidth,
int imageHeight, HDC hDC, COLORREF bkColor,
CCustomImageObject* pObject, BOOL largeIcon);
CRDFImage* DrawRDFImage(CRDFImage* pImage, int left, int top, int imageWidth, int imageHeight, HDC hDC,
COLORREF bkColor);
HICON FetchLocalFileIcon(HT_Resource r);
CRDFImage* FetchCustomIcon(HT_Resource r, CCustomImageObject* pObject, BOOL largeIcon);
IconType DetermineIconType(HT_Resource pNode, BOOL largeIcon);
void PaintBackground(HDC hdc, CRect rect, CRDFImage* pImage, int ySrcOffset = -1);
// This function tiles and paints the background image in the tree.
void PaintBackground(HDC hdc, CRect rect, CRDFImage* pImage, int xSrcOffset=-1, int ySrcOffset=-1);
// This function tiles and paints the background image in the tree.
void Compute3DColors(COLORREF rgbColor, COLORREF &rgbLight, COLORREF &rgbDark);
// This function computes the appropriate highlight and shadow colors to
// use against a custom background.
void ResolveToPaletteColor(COLORREF& color, HPALETTE hPal);
#endif // RDFACC_H

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

@ -21,9 +21,11 @@
#include "stdafx.h"
#include "mainfrm.h"
#include "hiddenfr.h"
#include "xp_ncent.h"
#include "rdf.h"
#include "htrdf.h"
#include "rdfliner.h"
#include "pain.h"
#include "shcut.h"
#include "shcutdlg.h"
#include "prefapi.h"
@ -56,7 +58,7 @@ extern int XP_BKMKS_HOURS_AGO;
#define IDT_DRAGRECT 16414
#define EDIT_DELAY 500
#define SPRINGLOAD_DELAY 300
#define SPRINGLOAD_DELAY 500
#define RDF_DRAG_HEARTBEAT 125 // Faster than COutliner's DRAG_HEARTBEAT
// Click location stuff
@ -198,14 +200,15 @@ BEGIN_MESSAGE_MAP(CRDFOutliner, COutliner)
ON_WM_RBUTTONUP()
ON_WM_CREATE()
ON_WM_TIMER()
ON_WM_SIZE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
CRDFOutliner::CRDFOutliner (HT_Pane thePane, HT_View theView, CRDFOutlinerParent* theParent)
CRDFOutliner::CRDFOutliner (CRDFOutlinerParent* theParent, HT_Pane thePane, HT_View theView)
:COutliner(FALSE), m_pAncestor(NULL), m_Pane(thePane), m_View(theView), m_Parent(theParent), m_EditField(NULL),
m_nSortType(HT_NO_SORT), m_nSortColumn(HT_NO_SORT), m_hEditTimer(0), m_hDragRectTimer(0),
m_bNeedToClear(FALSE), m_nSelectedColumn(0), m_bDoubleClick(FALSE), m_Node(NULL),
m_bDataSourceInWindow(FALSE), m_NavMenuBar(NULL)
m_bDataSourceInWindow(FALSE), m_NavTitleBar(NULL), m_bInNavigationMode(FALSE), m_bIsPopup(FALSE)
{
ApiApiPtr(api);
m_pUnkUserImage = api->CreateClassInstance(APICLASS_IMAGEMAP,NULL,(APISIGNATURE)IDB_BOOKMARKS);
@ -234,6 +237,13 @@ int CRDFOutliner::OnCreate(LPCREATESTRUCT lpCreateStruct)
return iRetVal;
}
void CRDFOutliner::OnSize( UINT nType, int cx, int cy )
{
SqueezeColumns( -1, 0, FALSE );
m_iPaintLines = ( cy / m_itemHeight ) + 1;
EnableScrollBars ( );
}
void CRDFOutliner::HandleEvent(HT_Notification ns, HT_Resource n, HT_Event whatHappened)
{
if (whatHappened == HT_EVENT_NODE_OPENCLOSE_CHANGED)
@ -593,6 +603,12 @@ CRDFImage* DrawArbitraryURL(HT_Resource r, int left, int top, int imageWidth, in
CCustomImageObject* pObject, BOOL largeIcon)
{
CRDFImage* pImage = FetchCustomIcon(r, pObject, largeIcon);
return DrawRDFImage(pImage, left, top, imageWidth, imageHeight, hDC, bkColor);
}
CRDFImage* DrawRDFImage(CRDFImage* pImage, int left, int top, int imageWidth, int imageHeight, HDC hDC,
COLORREF bkColor)
{
if (pImage && pImage->FrameLoaded())
{
// Now we draw this bad boy.
@ -793,7 +809,7 @@ IconType DetermineIconType(HT_Resource pNode, BOOL largeIcon)
if (pNode != NULL)
{
char* pURL = largeIcon? HT_GetNodeLargeIconURL(pNode) : HT_GetNodeSmallIconURL(pNode);
TRACE("%s\n", pURL);
//TRACE("%s\n", pURL);
if (strncmp("icon", pURL, 4) != 0)
{
// Time to load a custom image.
@ -893,7 +909,7 @@ void CRDFOutliner::SelectItem(int iSel,int mode,UINT flags)
if (m_bNeedToClear)
{
HT_SetSelection(m_Node);
if (m_bNeedToEdit && !m_bDoubleClick)
if (m_bNeedToEdit && !m_bDoubleClick && !m_bUseSingleClick)
{
CRDFCommandMap& map = m_Parent->GetColumnCommandMap();
@ -910,6 +926,8 @@ void CRDFOutliner::SelectItem(int iSel,int mode,UINT flags)
m_bNeedToClear = FALSE;
m_bNeedToEdit = FALSE;
m_bDoubleClick = FALSE;
if (m_bUseSingleClick)
OnSelDblClk(iSel);
break;
case OUTLINER_LBUTTONDOWN:
case OUTLINER_KEYDOWN:
@ -984,6 +1002,16 @@ BOOL CRDFOutliner::IsDocked()
return theFrame->IsChild(this);
}
void CRDFOutliner::SetNavigationMode(BOOL mode)
{
m_bInNavigationMode = mode;
((CRDFOutlinerParent*)GetParent())->EnableHeaders(!m_bInNavigationMode);
// Need to invalidate the title strip.
CRDFContentView* pView = (CRDFContentView*)(GetParent()->GetParent());
pView->GetTitleBar()->Invalidate();
}
void CRDFOutliner::OnSelDblClk(int iLine)
{
if (m_Node)
@ -995,13 +1023,32 @@ void CRDFOutliner::OnSelDblClk(int iLine)
else if (!HT_IsSeparator(m_Node))// && !IsDocked()) For now always do double-click behavior
{
DisplayURL();
if (IsPopup())
{
// Destroy the entire tree.
CFrameWnd* pFrameWnd = GetParentFrame();
if (pFrameWnd->IsKindOf(RUNTIME_CLASS(CNSNavFrame)))
((CNSNavFrame*)pFrameWnd)->DeleteNavCenter();
}
}
}
}
void CRDFOutliner::SetHTView(HT_View v)
{
m_Pane = HT_GetPane(v);
m_View = v;
m_iSelection = m_iFocus = -1;
int newCount = HT_GetItemListCount(m_View);
SetTotalLines(newCount); // Update the outliner's visible lines
m_iTopLine = 0;
}
void CRDFOutliner::DisplayURL()
{
char* url = HT_GetNodeURL(m_Node);
// Hacking the window target (Added by Dave on 7/12/98)
CAbstractCX * pCX = FEU_GetLastActiveFrameContext();
//Check for whether we need new browser window.
@ -1078,7 +1125,9 @@ void CRDFOutliner::DisplayURL()
if (pLocalName)
XP_FREE(pLocalName);
}
else pCX->NormalGetUrl((LPTSTR) url); // Do a normal fetch.
else if (m_WindowTarget == "")
pCX->NormalGetUrl((LPTSTR) url, "rdftree"); // Do a normal fetch.
else pCX->NormalGetUrl((LPTSTR) url, "rdftree", (char*)(const char*)m_WindowTarget);
}
BOOL CRDFOutliner::TestRowCol(POINT point, int &iRow, int &iCol)
@ -1646,17 +1695,23 @@ void CRDFOutliner::OnKillFocus ( CWnd * pNewWnd )
void CRDFOutliner::FocusCheck(CWnd* pWnd, BOOL gotFocus)
{
if (m_NavMenuBar)
if (m_NavTitleBar)
{
if (gotFocus)
m_NavMenuBar->NotifyFocus(TRUE);
m_NavTitleBar->NotifyFocus(TRUE);
else
{
CFrameWnd* pFrame = GetParentFrame();
if (pFrame && !pFrame->IsChild(pWnd))
CFrameWnd* pFrameWnd = GetParentFrame();
if (pFrameWnd && !pFrameWnd->IsChild(pWnd))
{
// Invalidate for a redraw
m_NavMenuBar->NotifyFocus(FALSE);
m_NavTitleBar->NotifyFocus(FALSE);
if (IsPopup())
{
// Destroy the window.
if (pFrameWnd->IsKindOf(RUNTIME_CLASS(CNSNavFrame)))
((CNSNavFrame*)pFrameWnd)->DeleteNavCenter();
}
}
}
}
@ -1723,23 +1778,64 @@ void CRDFOutliner::OnPaint()
GetClientRect(&rcClient);
CPaintDC pdc ( this );
if (m_View == NULL)
return;
// Read in all the properties
HT_Resource top = HT_TopNode(m_View);
void* data;
PRBool foundData = FALSE;
if (m_bInNavigationMode)
{
// Options for navigation mode.
// Inherit colors from the toolbar if we point to a button.
CFrameWnd* pFrameWnd = GetParentFrame();
if (pFrameWnd->IsKindOf(RUNTIME_CLASS(CNSNavFrame)))
{
// We have a parent navframe that could POTENTIALLY be attached to a button.
CNSNavFrame* pNav = (CNSNavFrame*)pFrameWnd;
if (pNav->GetRDFButton() != NULL)
{
// There's a button from which to inherit colors.
CRDFToolbar* pToolbar = (CRDFToolbar*)(pNav->GetRDFButton()->GetParent());
m_ForegroundColor = m_SortForegroundColor = pToolbar->GetForegroundColor();
m_BackgroundColor = m_SortBackgroundColor = pToolbar->GetBackgroundColor();
}
}
else
{
// Use some defaults
m_ForegroundColor = m_SortForegroundColor = RGB(0,0,0);
m_BackgroundColor = m_SortBackgroundColor = RGB(240,240,240);
}
m_bHasPipes = FALSE;
m_bDrawDividers = FALSE;
m_bUseSingleClick = TRUE;
}
else
{
// Options for management mode.
m_ForegroundColor = RGB(0,0,0);
m_BackgroundColor = RGB(240,240,240);
m_SortBackgroundColor = RGB(224,224,224);
m_SortForegroundColor = RGB(0,0,0);
m_bHasPipes = TRUE;
m_bDrawDividers = TRUE;
m_bUseSingleClick = FALSE;
}
// Foreground color
HT_GetNodeData(top, gNavCenter->treeFGColor, HT_COLUMN_STRING, &data);
HT_GetNodeData(top, gNavCenter->viewFGColor, HT_COLUMN_STRING, &data);
if (data)
WFE_ParseColor((char*)data, &m_ForegroundColor);
else m_ForegroundColor = RGB(0,0,0);
// background color
HT_GetNodeData(top, gNavCenter->treeBGColor, HT_COLUMN_STRING, &data);
HT_GetNodeData(top, gNavCenter->viewBGColor, HT_COLUMN_STRING, &data);
if (data)
WFE_ParseColor((char*)data, &m_BackgroundColor);
else m_BackgroundColor = RGB(240,240,240);
HT_GetNodeData(top, gNavCenter->showTreeConnections, HT_COLUMN_STRING, &data);
if (data)
{
@ -1747,19 +1843,20 @@ void CRDFOutliner::OnPaint()
if (answer.GetLength() > 0 && (answer.GetAt(0) == 'n' || answer.GetAt(0) == 'N'))
m_bHasPipes = FALSE;
}
else m_bHasPipes = TRUE;
// Sort foreground color
HT_GetNodeData(top, gNavCenter->sortColumnFGColor, HT_COLUMN_STRING, &data);
if (data)
WFE_ParseColor((char*)data, &m_SortForegroundColor);
else m_SortForegroundColor = RGB(0,0,0);
// Sort background color
HT_GetNodeData(top, gNavCenter->sortColumnBGColor, HT_COLUMN_STRING, &data);
if (data)
WFE_ParseColor((char*)data, &m_SortBackgroundColor);
else m_SortBackgroundColor = RGB(224,224,224);
// Compute the shadow/highlight colors for sorting and for normal modes.
Compute3DColors(m_SortBackgroundColor, m_SortHighlightColor, m_SortShadowColor);
Compute3DColors(m_BackgroundColor, m_HighlightColor, m_ShadowColor);
// Selection foreground color
HT_GetNodeData(top, gNavCenter->selectionFGColor, HT_COLUMN_STRING, &data);
@ -1775,7 +1872,7 @@ void CRDFOutliner::OnPaint()
// Background image URL
m_BackgroundImageURL = "";
HT_GetNodeData(top, gNavCenter->treeBGURL, HT_COLUMN_STRING, &data);
HT_GetNodeData(top, gNavCenter->viewBGURL, HT_COLUMN_STRING, &data);
if (data)
m_BackgroundImageURL = (char*)data;
m_pBackgroundImage = NULL; // Clear out the BG image.
@ -1793,8 +1890,7 @@ void CRDFOutliner::OnPaint()
if (answer.GetLength() > 0 && (answer.GetAt(0) == 'n' || answer.GetAt(0) == 'N'))
m_bDrawDividers = FALSE;
}
else m_bDrawDividers = TRUE;
HPALETTE pOldPalette = NULL;
if (sysInfo.m_iBitsPerPixel < 16 && (::GetDeviceCaps(pdc.m_hDC, RASTERCAPS) & RC_PALETTE))
{
@ -1848,7 +1944,7 @@ void CRDFOutliner::OnPaint()
{
int imageHeight = m_pBackgroundImage->bmpInfo->bmiHeader.biHeight;
int ySrcOffset = (bgFillRect.top + m_iTopLine*m_itemHeight) % imageHeight;
PaintBackground(pdc, bgFillRect, m_pBackgroundImage, ySrcOffset);
PaintBackground(pdc, bgFillRect, m_pBackgroundImage, 0, ySrcOffset);
}
else
{
@ -1918,7 +2014,161 @@ void DrawBGSubimage(CRDFImage* pImage, HDC hDC, int xSrcOffset, int ySrcOffset,
}
}
void PaintBackground(HDC hdc, CRect rect, CRDFImage* pImage, int ySrcOffset)
#define LIGHT_GRAY RGB(192, 192, 192)
#define DARK_GRAY RGB(128, 128, 128)
#define WHITE RGB(255, 255, 255)
#define BLACK RGB(0, 0, 0)
void
GetSystem3DColors(COLORREF rgbBackground, COLORREF& rgbLightColor, COLORREF& rgbDarkColor)
{
#ifdef XP_WIN32
if (sysInfo.IsWin4_32()) {
// These are Windows 95 only
rgbLightColor = ::GetSysColor(COLOR_3DLIGHT);
rgbDarkColor = ::GetSysColor(COLOR_3DSHADOW);
} else {
rgbLightColor = LIGHT_GRAY;
rgbDarkColor = ::GetSysColor(COLOR_BTNSHADOW);
}
#else
rgbLightColor = LIGHT_GRAY;
rgbDarkColor = ::GetSysColor(COLOR_BTNSHADOW);
#endif
// We need to make sure that both colors are visible against
// the background
if (rgbLightColor == rgbBackground)
rgbLightColor = rgbBackground == LIGHT_GRAY ? WHITE : LIGHT_GRAY;
if (rgbDarkColor == rgbBackground)
rgbDarkColor = rgbBackground == DARK_GRAY ? BLACK : DARK_GRAY;
}
// Constants for calculating Highlight (TS = "TopShadow") and
// shadow (BS = "BottomShadow") values relative to background
// Taken from UNIX version -- Eric Bina's Visual.c
//
// Bias brightness calculation by standard color-sensitivity values
// (Percents -- UNIX used floats, but we don't need to)
//
#define RED_LUMINOSITY 30
#define GREEN_LUMINOSITY 59
#define BLUE_LUMINOSITY 11
// Percent effect of intensity, light, and luminosity & on brightness,
#define INTENSITY_FACTOR 25
#define LIGHT_FACTOR 0
#define LUMINOSITY_FACTOR 75
// LITE color model percent to interpolate RGB towards black for BS, TS
#define COLOR_LITE_BS_FACTOR 45
#define COLOR_LITE_TS_FACTOR 70
// DARK color model - percent to interpolate RGB towards white for BS, TS
#define COLOR_DARK_BS_FACTOR 30
#define COLOR_DARK_TS_FACTOR 50
#define MAX_COLOR 255
#define COLOR_DARK_THRESHOLD 51
#define COLOR_LIGHT_THRESHOLD 204
void Compute3DColors(COLORREF rgbColor, COLORREF &rgbLight, COLORREF &rgbDark)
{
unsigned uRed, uGreen, uBlue;
unsigned uRedBack = GetRValue(rgbColor);
unsigned uGreenBack = GetGValue(rgbColor);
unsigned uBlueBack = GetBValue(rgbColor);
unsigned intensity = (uRedBack + uGreenBack + uBlueBack) / 3;
unsigned luminosity = ((RED_LUMINOSITY * uRedBack)/ 100)
+ ((GREEN_LUMINOSITY * uGreenBack)/ 100)
+ ((BLUE_LUMINOSITY * uBlueBack)/ 100);
unsigned backgroundBrightness = ((intensity * INTENSITY_FACTOR) +
(luminosity * LUMINOSITY_FACTOR)) / 100;
unsigned f;
if (backgroundBrightness < COLOR_DARK_THRESHOLD) {
// Dark Background - interpolate 30% toward black
uRed = uRedBack - (COLOR_DARK_BS_FACTOR * uRedBack / 100);
uGreen = uGreenBack - (COLOR_DARK_BS_FACTOR * uGreenBack / 100);
uBlue = uBlueBack - (COLOR_DARK_BS_FACTOR * uBlueBack / 100);
rgbDark = RGB(uRed, uGreen, uBlue);
// This interpolotes to 50% toward white
uRed = uRedBack + (COLOR_DARK_TS_FACTOR *
(MAX_COLOR - uRedBack) / 100);
uGreen = uGreenBack + (COLOR_DARK_TS_FACTOR *
(MAX_COLOR - uGreenBack) / 100);
uBlue = uBlueBack + (COLOR_DARK_TS_FACTOR *
(MAX_COLOR - uBlueBack) / 100);
} else if (backgroundBrightness > COLOR_LIGHT_THRESHOLD) {
// Interpolate 45% toward black
uRed = uRedBack - (COLOR_LITE_BS_FACTOR * uRedBack / 100);
uGreen = uGreenBack - (COLOR_LITE_BS_FACTOR * uGreenBack / 100);
uBlue = uBlueBack - (COLOR_LITE_BS_FACTOR * uBlueBack / 100);
rgbDark = RGB(uRed, uGreen, uBlue);
// Original algorithm (from X source: visual.c) used:
// uRed = uRedBack - (COLOR_LITE_TS_FACTOR * uRedBack / 100),
// where FACTOR is 20%, but that makes no sense!
// I think the intention was large interpolation toward white,
// so use max of "medium" range (70%) for smooth continuity across threshhold
uRed = uRedBack + (COLOR_LITE_TS_FACTOR * (MAX_COLOR - uRedBack) / 100);
uGreen = uGreenBack + (COLOR_LITE_TS_FACTOR * (MAX_COLOR - uGreenBack) / 100);
uBlue = uBlueBack + (COLOR_LITE_TS_FACTOR * (MAX_COLOR - uBlueBack) / 100);
} else {
// Medium Background
f = COLOR_DARK_BS_FACTOR + (backgroundBrightness
* ( COLOR_LITE_BS_FACTOR - COLOR_DARK_BS_FACTOR )
/ MAX_COLOR);
uRed = uRedBack - (f * uRedBack / 100);
uGreen = uGreenBack - (f * uGreenBack / 100);
uBlue = uBlueBack - (f * uBlueBack / 100);
rgbDark = RGB(uRed, uGreen, uBlue);
f = COLOR_DARK_TS_FACTOR + (backgroundBrightness
* ( COLOR_LITE_TS_FACTOR - COLOR_DARK_TS_FACTOR )
/ MAX_COLOR);
uRed = uRedBack + (f * (MAX_COLOR - uRedBack) / 100);
uGreen = uGreenBack + (f * (MAX_COLOR - uGreenBack) / 100);
uBlue = uBlueBack + (f * (MAX_COLOR - uBlueBack) / 100);
}
// Safety check for upper limit
uRed = min(MAX_COLOR, uRed);
uGreen = min(MAX_COLOR, uGreen);
uBlue = min(MAX_COLOR, uBlue);
rgbLight = RGB(uRed, uGreen, uBlue);
// Special case white backgrounds and black backgrounds
if (rgbLight == rgbColor && (uRedBack == MAX_COLOR && uGreenBack == MAX_COLOR && uBlueBack == MAX_COLOR))
{
// For a white separator use medium gray colors.
rgbLight = RGB(192,192,192);
}
else if (rgbDark == rgbColor && rgbColor == 0)
{
// Use a dark gray color.
rgbDark = RGB(64,64,64);
}
// If either of these colors is the same as the background color
// then use the system 3D element colors instead
if (rgbLight == rgbColor || rgbDark == rgbColor) {
GetSystem3DColors(rgbColor, rgbLight, rgbDark);
}
}
void PaintBackground(HDC hdc, CRect rect, CRDFImage* pImage, int xSrcOffset, int ySrcOffset)
{
int totalWidth = rect.Width();
int totalHeight = rect.Height();
@ -1933,10 +2183,12 @@ void PaintBackground(HDC hdc, CRect rect, CRDFImage* pImage, int ySrcOffset)
int xDstOffset = rect.left;
int yDstOffset = rect.top;
int xSrcOffset = 0;
if (ySrcOffset == -1) // Assume we don't have a scrolled offset in the view we're drawing into.
ySrcOffset = rect.top % imageHeight;
if (xSrcOffset == -1) // Assume we don't have a scrolled offset in the view we're drawing into.
xSrcOffset = rect.left % imageWidth;
int xRemainder = imageWidth - xSrcOffset;
int yRemainder = imageHeight - ySrcOffset;
@ -2107,21 +2359,37 @@ void CRDFOutliner::PaintColumn(int iLineNo, int iColumn, LPRECT lpColumnRect,
{
BOOL hasFocus = FALSE;
if (theNode && HT_IsSeparator(theNode))
CRect WinRect;
GetClientRect(&WinRect);
if (theNode && HT_IsSeparator(theNode) && lpColumnRect->right != WinRect.right)
{
// Draw the horizontal line.
CPen separatorPen;
if (iColumn == GetSortColumn())
separatorPen.CreatePen(PS_SOLID, 1, m_SortForegroundColor);
else separatorPen.CreatePen(PS_SOLID, 1, m_ForegroundColor);
HPEN sepPen = (HPEN)separatorPen.GetSafeHandle();
HPEN usePen = IsSelected(iLineNo) ? hHighlightPen : sepPen;
CPen separatorHighlightPen;
CPen separatorShadowPen;
HPEN pOldPen = (HPEN)(::SelectObject(hdc, usePen));
if (iColumn == GetSortColumn())
{
separatorHighlightPen.CreatePen(PS_SOLID, 1, m_SortHighlightColor);
separatorShadowPen.CreatePen(PS_SOLID, 1, m_SortShadowColor);
}
else
{
separatorHighlightPen.CreatePen(PS_SOLID, 1, m_HighlightColor);
separatorShadowPen.CreatePen(PS_SOLID, 1, m_ShadowColor);
}
//HPEN sepPen = (HPEN)separatorPen.GetSafeHandle();
//HPEN usePen = IsSelected(iLineNo) ? hHighlightPen : sepPen;
HPEN pOldPen = (HPEN)(::SelectObject(hdc, (HPEN)separatorShadowPen.GetSafeHandle()));
::MoveToEx(hdc, lpColumnRect->left, lpColumnRect->top+m_itemHeight/2, NULL);
::LineTo(hdc, lpColumnRect->right, lpColumnRect->top+m_itemHeight/2);
::SelectObject(hdc, (HPEN)separatorHighlightPen.GetSafeHandle());
::MoveToEx(hdc, lpColumnRect->left, lpColumnRect->top+m_itemHeight/2+1, NULL);
::LineTo(hdc, lpColumnRect->right, lpColumnRect->top+m_itemHeight/2+1);
::SelectObject(hdc, pOldPen);
}
@ -2223,15 +2491,15 @@ void CRDFOutliner::DrawColumn(HDC hdc, LPRECT lpColumnRect, LPCTSTR lpszString,
CRect newRect(bgRect);
if (hasFocus)
{
newRect.top +=2;
newRect.bottom-=2;
newRect.left+=2;
newRect.right-=2;
newRect.top +=1;
newRect.bottom-=1;
newRect.left+=1;
newRect.right-=1;
}
::FillRect(hdc, &newRect, theBrush);
}
else if (!hasFocus)
::FrameRect( hdc, &bgRect, theBrush);
::FrameRect( hdc, &bgRect, theBrush);
}
// Adjust the text rectangle for the left and right margins
@ -2239,11 +2507,6 @@ void CRDFOutliner::DrawColumn(HDC hdc, LPRECT lpColumnRect, LPCTSTR lpszString,
textRect.right -= COL_LEFT_MARGIN;
WFE_DrawTextEx( m_iCSID, hdc, (LPTSTR) lpszString, iLength, &textRect, dwDTFormat, dwMoreFormat );
if (hasFocus)
{
DrawFocusRect ( hdc, &bgRect );
}
}
int CRDFOutliner::DrawPipes ( int iLineNo, int iColNo, int offset, HDC hdc, void * pLineData )
@ -2325,7 +2588,7 @@ int CRDFOutliner::DrawPipes ( int iLineNo, int iColNo, int offset, HDC hdc, void
}
HT_Resource r = (HT_Resource)pLineData;
if (r && HT_IsContainer(r))
if (r && HT_IsContainer(r) && m_bHasPipes)
{
// Draw the trigger
CBrush outerTrigger(RGB(128,128,128));
@ -2386,6 +2649,12 @@ void CRDFOutliner::ColumnsSwapped()
SetImageColumn(m_pColumn[0]->iCommand);
}
void CRDFOutliner::DestroyColumns()
{
m_Parent->DestroyColumns();
COutliner::DestroyColumns();
}
CRect CRDFOutliner::GetColumnRect(int iLine, int column)
{
CRect rectColumn;
@ -3249,7 +3518,7 @@ END_MESSAGE_MAP()
CRDFOutlinerParent::CRDFOutlinerParent(HT_Pane thePane, HT_View theView)
{
CRDFOutliner* theOutliner = new CRDFOutliner(thePane, theView, this);
CRDFOutliner* theOutliner = new CRDFOutliner(this, thePane, theView);
m_pOutliner = theOutliner;
}
@ -3284,6 +3553,9 @@ void CRDFOutlinerParent::OnPaint ( )
// Read in our values.
CRDFOutliner* pRDFLiner = (CRDFOutliner*)m_pOutliner;
HT_View view = pRDFLiner->GetHTView();
if (view == NULL)
return;
HT_Resource top = HT_TopNode(view);
// Foreground color
@ -3482,16 +3754,24 @@ void CRDFOutlinerParent::CreateColumns ( void )
void* token;
uint32 tokenType;
UINT index = 0;
while (HT_GetNextColumn(columnCursor, &columnName, &columnWidth, &token, &tokenType))
{
// We have retrieved a new column. Contruct a front end column object
CRDFColumn* newColumn = new CRDFColumn(columnName, columnWidth, token, tokenType);
index = (UINT)columnMap.AddCommand(newColumn);
m_pOutliner->AddColumn(columnName, index, 5000, 10000, ColumnVariable, 3000);
m_pOutliner->AddColumn(columnName, index, 50, 10000, ColumnVariable, 100);
}
HT_DeleteColumnCursor(columnCursor);
m_pOutliner->SetVisibleColumns(1); // For now... TODO: Get visible/invisible info!
m_pOutliner->SetImageColumn(0);
m_pOutliner->SetImageColumn(m_pOutliner->m_pColumn[0]->iCommand);
// Make it so
RECT rcClient;
m_pOutliner->GetClientRect(&rcClient);
((CRDFOutliner*)m_pOutliner)->OnSize(0, rcClient.right, rcClient.bottom);
Invalidate();
}
BOOL CRDFOutlinerParent::RenderData( int iColumn, CRect & rect, CDC &dc, LPCTSTR text )
@ -3563,9 +3843,7 @@ BOOL CRDFOutlinerParent::ColumnCommand( int iColumn )
if (enSortType == HT_SORT_ASCENDING)
sort = FALSE;
pOutliner->SetSelectedColumn(pOutliner->m_pColumn[ iColumn ]->iCommand);
Invalidate();
pOutliner->SetSelectedColumn(iColumn);
HT_SetSortColumn(pOutliner->GetHTView(),
enSortType == HT_NO_SORT ? NULL : theColumn->GetToken(),
@ -3644,106 +3922,154 @@ void CRDFEditWnd::OnKillFocus( CWnd* pNewWnd )
// =========================================================================
// RDF Content View
IMPLEMENT_DYNAMIC(CRDFContentView, CContentView)
BEGIN_MESSAGE_MAP(CRDFContentView, CContentView)
IMPLEMENT_DYNAMIC(CRDFContentView, CView)
BEGIN_MESSAGE_MAP(CRDFContentView, CView)
//{{AFX_MSG_MAP(CMainFrame)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code !
ON_MESSAGE(WM_NAVCENTER_QUERYPOSITION, OnNavCenterQueryPosition)
ON_WM_CREATE()
ON_WM_SIZE()
ON_WM_SETFOCUS()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
LRESULT CRDFContentView::OnNavCenterQueryPosition(WPARAM wParam, LPARAM lParam)
{
NAVCENTPOS *pPos = (NAVCENTPOS *)lParam;
// We like being in the middle.
pPos->m_iYDisposition = 0;
// We like being this many units in size.
pPos->m_iYVector = 200;
// Handled.
return(NULL);
}
BOOL CRDFContentView::PreCreateWindow(CREATESTRUCT& cs)
{
cs.style |= WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
return CContentView::PreCreateWindow(cs);
}
void CRDFContentView::OnDraw ( CDC * pDC )
{
}
CRDFContentView::CRDFContentView()
{ m_pOutlinerParent = NULL; m_pHTMLView = NULL; m_pNavBar = NULL; }
int CRDFContentView::OnCreate ( LPCREATESTRUCT lpCreateStruct )
{
int iRetVal = CContentView::OnCreate ( lpCreateStruct );
int iRetVal = CView::OnCreate ( lpCreateStruct );
LPCTSTR lpszClass = AfxRegisterWndClass( CS_VREDRAW, ::LoadCursor(NULL, IDC_ARROW));
m_pNavBar = new CNavTitleBar();
m_pOutlinerParent = new CRDFOutlinerParent();
m_pOutlinerParent->Create( lpszClass, _T("NSOutlinerParent"),
WS_VISIBLE|WS_CHILD|WS_CLIPCHILDREN,
CRect(0,0,100,100), this, 101 );
m_pHTMLView = NULL; //wfe_CreateNavCenterHTMLPain(m_hWnd);
m_pNavBar->Create(NULL, "", WS_CHILD | WS_VISIBLE, CRect(0,0,100,100), this, NC_IDW_NAVMENU);
return iRetVal;
}
CRDFContentView::~CRDFContentView()
{
CRDFOutliner* pOutliner = (CRDFOutliner*)(GetOutlinerParent()->GetOutliner());
HT_View v = pOutliner->GetHTView();
HT_SetViewFEData(v, NULL);
XP_UnregisterNavCenter(HT_GetPane(v));
HT_DeletePane(HT_GetPane(v));
delete m_pNavBar;
delete m_pOutlinerParent;
delete m_pHTMLView;
}
void CRDFContentView::OnSize ( UINT nType, int cx, int cy )
{
CView::OnSize ( nType, cx, cy );
if (IsWindow(m_pOutlinerParent->m_hWnd))
{
m_pOutlinerParent->MoveWindow ( 0, 0, cx, cy );
m_pNavBar->MoveWindow(0,0, cx, NAVBAR_HEIGHT);
m_pOutlinerParent->MoveWindow ( 0, NAVBAR_HEIGHT, cx, cy-NAVBAR_HEIGHT);
}
}
void CRDFContentView::InvalidateOutlinerParent()
{
// COutliner* outliner = m_pOutlinerParent->GetOutliner();
// outliner->SqueezeColumns(-1, 0, TRUE);
}
void CRDFContentView::OnSetFocus ( CWnd * pOldWnd )
{
m_pOutlinerParent->SetFocus ( );
}
void CRDFContentView::SwitchHTViews(HT_View newView)
{
m_pOutlinerParent->SetHTView(newView);
m_pOutlinerParent->GetOutliner()->DestroyColumns();
CreateColumns();
}
void CRDFContentView::OnKillFocus(CWnd* pNewWnd)
{
}
// Functionality for the RDF Tree Embedded in HTML (Added 3/10/98 by Dave Hyatt).
// The event handler. Only cares about tree events, so we'll just pass everything to the
// tree view.
void embeddedTreeNotifyProcedure (HT_Notification ns, HT_Resource n, HT_Event whatHappened)
void embeddedTreeNotifyProcedure (HT_Notification ns, HT_Resource n, HT_Event whatHappened,
void *token, uint32 tokenType)
{
CRDFOutliner* theOutliner = (CRDFOutliner*)HT_GetViewFEData(HT_GetView(n));
if (theOutliner)
theOutliner->HandleEvent(ns, n, whatHappened);
}
void CRDFContentView::DisplayRDFTree(CWnd* pParent, int width, int height, RDF_Resource rdfResource)
CRDFContentView* CRDFContentView::DisplayRDFTreeFromPane(CWnd* pParent, int xPos, int yPos,
int width, int height, HT_Pane thePane, CCreateContext* pContext)
{
HT_Notification ns = new HT_NotificationStruct;
ns->notifyProc = embeddedTreeNotifyProcedure;
ns->data = NULL;
// Construct the pane and give it our notification struct
HT_Pane thePane = HT_PaneFromResource(rdfResource, ns, PR_FALSE);
// Build our FE windows.
CRDFOutlinerParent* newParent = new CRDFOutlinerParent(thePane, HT_GetSelectedView(thePane));
CRDFContentView* newView = new CRDFContentView(newParent);
// Create the windows
CRect rClient(0, 0, width, height);
newView->Create( NULL, "", WS_CHILD | WS_VISIBLE, rClient, pParent, NC_IDW_OUTLINER);
CRect rClient(xPos, yPos, width, height);
CRDFContentView* newView = new CRDFContentView();
newView->Create(NULL, "", WS_CHILD | WS_VISIBLE, rClient, pParent, NC_IDW_OUTLINER, pContext);
// Get the parent
COutlinerParent* newParent = newView->GetOutlinerParent();
((CRDFOutlinerParent*)newParent)->SetHTView(HT_GetSelectedView(thePane));
// Initialize the columns, etc.
newParent->Initialize();
((CRDFOutlinerParent*)newParent)->Initialize();
// Retrieve the RDF Outliner.
CRDFOutliner* pOutliner = (CRDFOutliner*)newParent->GetOutliner();
// Set to navigation mode.
pOutliner->SetNavigationMode(TRUE);
// Set our FE data to be the outliner.
HT_SetViewFEData(HT_GetSelectedView(thePane), newParent->GetOutliner());
HT_SetViewFEData(HT_GetSelectedView(thePane), pOutliner);
// Explain who the title bar belongs to.
CNavTitleBar* pTitleBar = newView->GetTitleBar();
pTitleBar->SetHTView(HT_GetSelectedView(thePane));
pOutliner->SetTitleBar(pTitleBar);
return newView;
}
CRDFContentView* CRDFContentView::DisplayRDFTreeFromResource(CWnd* pParent,
int xPos, int yPos, int width, int height, HT_Resource node, CCreateContext* pContext)
{
HT_Notification ns = new HT_NotificationStruct;
XP_BZERO(ns, sizeof(HT_NotificationStruct));
ns->notifyProc = embeddedTreeNotifyProcedure;
ns->data = NULL;
theApp.m_pRDFCX->TrackRDFWindow(pParent);
HT_Pane thePane = HT_PaneFromResource(HT_GetRDFResource(node), ns, PR_FALSE, PR_TRUE, PR_TRUE);
// Now call our helper function
return DisplayRDFTreeFromPane(pParent, xPos, yPos, width, height, thePane, pContext);
}
CRDFContentView* CRDFContentView::DisplayRDFTreeFromSHACK(CWnd* pParent, int xPos, int yPos, int width, int height, char* url, int32 param_count, char** param_names, char** param_values)
{
HT_Notification ns = new HT_NotificationStruct;
XP_BZERO(ns, sizeof(HT_NotificationStruct));
ns->notifyProc = embeddedTreeNotifyProcedure;
ns->data = NULL;
theApp.m_pRDFCX->TrackRDFWindow(pParent);
// Construct the pane and give it our notification struct
HT_Pane thePane = HT_PaneFromURL(url, ns, 0, param_count, param_names, param_values);
// Now call our helper function
return DisplayRDFTreeFromPane(pParent, xPos, yPos, width, height, thePane);
}
// Function to grab an RDF context

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

@ -11,9 +11,9 @@
* 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.
* Commuyright (C) 1998 Netscape Communications Corporation. All Rights
* Resnications Corporation. Portions created by Netscape are
* Coperved.
*/
// RDF Tree View for Aurora. Created by Dave Hyatt.
@ -100,7 +100,7 @@ private:
CRDFCommandMap m_MenuCommandMap; // The command mapping for menus
CNavMenuBar* m_NavMenuBar; // A pointer to the title nav menu. NULL if no menu button is present.
CNavTitleBar* m_NavTitleBar; // A pointer to the title strip.
// Tree colors, fonts, and backgrounds
COLORREF m_ForegroundColor; // The foreground color. Used for text, separators, etc.
@ -113,34 +113,71 @@ private:
COLORREF m_SelectionForegroundColor; // Foreground color of the selection
COLORREF m_SelectionBackgroundColor; // Background color of the selection
COLORREF m_ShadowColor; // Shadow color of the tree (used for drawing separators).
COLORREF m_HighlightColor; // Highlight color of the tree (used for drawing separators).
COLORREF m_SortShadowColor; // Shadow color of the sorted tree (used for drawing separators).
COLORREF m_SortHighlightColor; // Highlight color of the sorted tree (used for drawing separators).
COLORREF m_RolloverColor; // Rollover color of the tree.
COLORREF m_DividerColor; // Color of the dividers drawn between lines
BOOL m_bDrawDividers; // Whether or not dividers should be drawn
CString m_BackgroundImageURL; // The URL of the background image.
CRDFImage* m_pBackgroundImage; // The image for the background.
BOOL m_bBarColor; // The color of the tree connections.
BOOL m_bUseSingleClick; // Single click vs. double click
BOOL m_bUseHyperbolicScaling; // Whether or not to use hyperbolic scaling.
CString m_WindowTarget; // The target window for this tree view. If "", then the
// last active window is assumed.
BOOL m_bInNavigationMode; // The tree view has two different sets of defaults that
// it will assume if no value is defined for a specific
// property. These defaults are based on whether or not
// the user is browsing or managing data.
BOOL m_bIsPopup; // Whether or not we're a popup tree.
public:
CRDFOutliner (HT_Pane thePane, HT_View theView, CRDFOutlinerParent* theParent);
CRDFOutliner (CRDFOutlinerParent* theParent, HT_Pane thePane = NULL, HT_View theView = NULL);
~CRDFOutliner ( );
// Inspectors
COLORREF GetForegroundColor() { return m_ForegroundColor; }
COLORREF GetBackgroundColor() { return m_BackgroundColor; }
CString GetBackgroundImageURL() { return m_BackgroundImageURL; }
HT_View GetHTView() { return m_View; } // Return a handle to the hypertree view
HT_Resource GetAcquiredNode() { return m_Node; } // Return handle to the acquired HT node
CRDFOutlinerParent* GetRDFParent() { return m_Parent; } // RDFOutlinerParent handle
UINT GetSelectedColumn() { return m_nSelectedColumn; } // Returns selected column
int GetSortColumn() { return m_nSortColumn; }
int GetSortType() { return m_nSortType; }
BOOL IsPopup() { return m_bIsPopup; }
BOOL InNavigationMode() { return m_bInNavigationMode; }
// Setters
void SetNavigationMode(BOOL inMode);
void SetIsPopup(BOOL isPopup) { m_bIsPopup = isPopup; }
void SetHTView(HT_View v);
void SetWindowTarget(char* target) { m_WindowTarget = target; }
void SetSortType(int sortType) { m_nSortType = sortType; }
void SetSortColumn(int sortColumn) { m_nSortColumn = sortColumn; }
void SetSelectedColumn(int nColumn) { m_nSelectedColumn = nColumn; }
void SetDockedMenuBar(CNavMenuBar* bar) { m_NavMenuBar = bar; }
void SetTitleBar(CNavTitleBar* bar) { m_NavTitleBar = bar; }
// I am explicitly labeling as virtual any functions that have been
// overridden. That is, unless I state otherwise, all virtual functions
// are overridden versions of COutliner functions.
virtual void DestroyColumns();
// Overridden to destroy the outliner's columns and clear our RDF column command map.
virtual void InitializeItemHeight(int iDesiredSize) { m_itemHeight = 19; }
// Overridden to place a pixel of padding on either side of the line and to add a pixel for the
// divider that is drawn between lines.
@ -318,6 +355,9 @@ public:
afx_msg void OnPaint();
// Overridden to perform a drawing optimization (not performed by Outliner)
afx_msg void OnSize( UINT nType, int cx, int cy );
// Overridden to ensure column repainting and resizing.
afx_msg void OnLButtonDown ( UINT nFlags, CPoint point );
afx_msg void OnLButtonUp (UINT nFlags, CPoint point );
afx_msg void OnMouseMove( UINT nFlags, CPoint point );
@ -364,11 +404,13 @@ private:
CString m_BackgroundImageURL;
public:
CRDFOutlinerParent(HT_Pane thePane, HT_View theView);
CRDFOutlinerParent(HT_Pane thePane = NULL, HT_View theView = NULL);
BOOL PreCreateWindow(CREATESTRUCT& cs);
COutliner* GetOutliner();
void CreateColumns();
void DestroyColumns() { columnMap.Clear(); }
BOOL RenderData( int iColumn, CRect & rect, CDC &dc, LPCTSTR text );
BOOL ColumnCommand( int iColumn );
void Initialize();
@ -376,6 +418,8 @@ public:
void LoadComplete(HT_Resource r) { Invalidate(); }
void SetHTView(HT_View newView) { ((CRDFOutliner*)GetOutliner())->SetHTView(newView); Invalidate(); GetOutliner()->Invalidate(); }
protected:
afx_msg void OnDestroy();
afx_msg void OnPaint();
@ -383,47 +427,56 @@ protected:
};
class CRDFContentView : public CContentView
class CRDFContentView : public CView
{
public:
COutlinerParent * m_pOutlinerParent;
CRDFOutlinerParent * m_pOutlinerParent;
CPaneCX* m_pHTMLView;
CNavTitleBar* m_pNavBar;
// Construction
public:
CRDFContentView(CRDFOutlinerParent* outlinerStuff)
{ m_pOutlinerParent = outlinerStuff; };
CRDFContentView();
~CRDFContentView();
~CRDFContentView()
{
delete m_pOutlinerParent;
}
void OnDraw(CDC* pDC) {};
COutlinerParent* GetOutlinerParent() { return m_pOutlinerParent; }
// This functionality has been folded in from COutlinerView. I no longer derive from this class
// but instead come off of CContentView.
// This functionality has been folded in from COutlinerView.
void CreateColumns ( )
{
m_pOutlinerParent->CreateColumns ( );
}
void InvalidateOutlinerParent();
void SwitchHTViews(HT_View htView);
static void DisplayRDFTree(CWnd* pParent, int width, int height, RDF_Resource rdfResource);
// This function can be called to create an embedded RDF tree view inside another window.
// Used to embed the tree in HTML.
CNavTitleBar* GetTitleBar() { return m_pNavBar; }
static CRDFContentView* DisplayRDFTreeFromSHACK(CWnd* pParent, int xPos, int yPos, int width,
int height, char* url, int32 param_count, char** param_names, char** param_values);
// This function can be called to create an embedded RDF tree view using an
// external URL and specified targeting.
static CRDFContentView* DisplayRDFTreeFromResource(CWnd* pParent, int xPos, int yPos, int width,
int height, HT_Resource node, CCreateContext* pContext = NULL);
// This function creates an embedded RDF tree view from an existing resource.
static CRDFContentView* DisplayRDFTreeFromPane(CWnd* pParent, int xPos, int yPos, int width,
int height, HT_Pane pane, CCreateContext* pContext = NULL);
// This function creates an embedded RDF tree view once the pane has been constructed.
protected:
virtual void OnDraw(CDC *pDC);
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
DECLARE_DYNCREATE(CRDFContentView)
//{{AFX_MSG(CMainFrame)
//{{AFX_MSG(CRDFContentView)
afx_msg LRESULT OnNavCenterQueryPosition(WPARAM wParam, LPARAM lParam);
afx_msg int OnCreate ( LPCREATESTRUCT );
afx_msg void OnSize ( UINT, int, int );
afx_msg void OnSetFocus ( CWnd * pOldWnd );
afx_msg void OnKillFocus (CWnd* pNewWnd);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
@ -454,8 +507,4 @@ protected:
DECLARE_MESSAGE_MAP()
};
// Functions that will be used by the Personal Toolbar and Quickfile. Allow the
// display of arbitrary icons (or local file system icons)
#endif

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

@ -379,7 +379,6 @@ BEGIN
MENUITEM "Show &Navigation Toolbar", ID_VIEW_COMMANDTOOLBAR
MENUITEM "Show &Location Toolbar", ID_VIEW_LOCATIONTOOLBAR
MENUITEM "Show &Personal Toolbar", ID_VIEW_CUSTOMTOOLBAR
MENUITEM "Show Navi&gation Center", ID_VIEW_NAVCENTER
MENUITEM SEPARATOR
MENUITEM "In&crease Font\tCtrl+]", ID_VIEW_INCREASEFONT
MENUITEM "&Decrease Font\tCtrl+[", ID_VIEW_DECREASEFONT
@ -783,7 +782,6 @@ BEGIN
MENUITEM "Show &Navigation Toolbar", ID_VIEW_COMMANDTOOLBAR
MENUITEM "Show &Location Toolbar", ID_VIEW_LOCATIONTOOLBAR
MENUITEM "Show &Personal Toolbar", ID_VIEW_CUSTOMTOOLBAR
MENUITEM "Show Navi&gation Center", ID_VIEW_NAVCENTER
MENUITEM SEPARATOR
MENUITEM "In&crease Font\tCtrl+]" ID_VIEW_INCREASEFONT
MENUITEM "&Decrease Font\tCtrl+[" ID_VIEW_DECREASEFONT

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

@ -103,7 +103,6 @@
#define IDS_LDAP_SERVER_PROPERTY 125
#define IDI_MAIL 126
#define IDS_ADD_NEWS_SERVER 126
#define IDC_URLTEXT 127
#define IDD_DIALOG1 127
#define IDR_MAINFRAME2 127
#define IDD_ADDRESS_USER 127
@ -4073,9 +4072,6 @@
#define IDM_SAVEASTEMPLATE 65504
#define IDS_ADVSEARCH_TITLE 65505
#define IDS_BASICSEARCH_TITLE 65506
#define ID_VIEW_NAVCENTER 65507
#define IDS_SHOW_NAVCENTER 65508
#define IDS_HIDE_NAVCENTER 65509
// Next default values for new objects
//

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

@ -1088,6 +1088,7 @@ CNetscapeStatusBar::CParentSubclass::CParentSubclass( CWnd *pParent, CNetscapeSt
ASSERT( IsWindow( m_pParent->m_hWnd ) );
m_uTimerId = 0;
//
// Subclass the parent window so we can process the WM_MENUSELECT msg i.e., so we
// can switch modes from Simple/Panes without client intervention.

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

@ -811,7 +811,7 @@ void CToolbarButton::OnLButtonDown(UINT nFlags, CPoint point)
{
m_hMenuTimer = SetTimer(IDT_MENU, MENU_DELAY_MS, NULL);
}
RedrawWindow();
}
if(m_pToolTipText != NULL)
@ -822,7 +822,13 @@ void CToolbarButton::OnLButtonDown(UINT nFlags, CPoint point)
// Do action immediately if this is set
if( m_bDoOnButtonDown )
OnAction();
{
if (m_dwButtonStyle & TB_HAS_IMMEDIATE_MENU)
{
m_hMenuTimer = SetTimer(IDT_MENU, 0, NULL);
}
else OnAction();
}
else
m_bButtonDown = TRUE;
}
@ -890,28 +896,24 @@ void CToolbarButton::OnLButtonUp(UINT nFlags, CPoint point)
{
if(m_bEnabled)
{
if (m_bHaveFocus)
// Do action only if not done on button down
if(!m_bDoOnButtonDown)
{
// Cursor is still over the button, so back to button up look
m_eState = eBUTTON_UP;
if(m_bButtonDown)
{
if (m_dwButtonStyle & TB_HAS_IMMEDIATE_MENU)
{
m_hMenuTimer = SetTimer(IDT_MENU, 0, NULL);
}
else OnAction();
}
}
if (m_dwButtonStyle & TB_HAS_IMMEDIATE_MENU)
{
// Do action only if not done on button down
if(!m_bDoOnButtonDown)
{
// Cursor is still over the button, so back to button up look
m_eState = eBUTTON_UP;
if(m_bButtonDown)
{
if (m_dwButtonStyle & TB_HAS_IMMEDIATE_MENU)
{
m_hMenuTimer = SetTimer(IDT_MENU, 0, NULL);
}
else OnAction();
}
}
}
else
{
// Restore borderless look
if(m_nChecked == 0)
m_eState = eNORMAL;
m_hMenuTimer = SetTimer(IDT_MENU, 0, NULL);
}
RedrawWindow();
@ -1032,13 +1034,7 @@ void CToolbarButton::OnPaint()
// Use the button face color as our background
HBRUSH brFace = sysInfo.m_hbrBtnFace;
if (m_bDepressed)
{
// Use the button shadow color as our background instead.
brFace = ::CreateSolidBrush(sysInfo.m_clrBtnShadow);
::SetBkColor(hMemDC, sysInfo.m_clrBtnShadow);
}
else if (hasCustomBGColor)
if (hasCustomBGColor)
{
// Use the button's custom background
brFace = ::CreateSolidBrush(customBGColor);

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

@ -215,6 +215,8 @@ public:
const char *GetToolTipText(void) { return m_pToolTipText; }
void SetToolTipText(LPCSTR pToolTipText);
void SetDepressed(BOOL b) { m_bDepressed = b; }
void SetStatusText(LPCSTR pStatusText);
void SetBitmap(HBITMAP hBmpImg, BOOL bParentOwns);
@ -231,21 +233,25 @@ public:
virtual CSize GetMaximalButtonSize(void);
virtual CSize GetMinimalButtonSize(void);
CDropMenu* GetDropMenu() { return m_pDropMenu; }
BOOL AtMinimalSize(void);
BOOL AtMaximalSize(void);
virtual void CheckForMinimalSize(void);
virtual void CheckForMaximalSize(void);
virtual void UpdateURLBar(char* url) {}
BOOL IsResourceID(void) { return m_bIsResourceID; }
UINT GetBitmapID(void) { return m_nBitmapID; }
virtual UINT GetBitmapID(void) { return m_nBitmapID; }
UINT GetBitmapIndex(void) { return m_nBitmapIndex; }
LPCTSTR GetBitmapFile(void) { return m_pBitmapFile; }
CSize GetBitmapSize(void) { return m_bitmapSize; }
int GetMaxTextCharacters(void) { return m_nMaxTextChars; }
int GetMinTextCharacters(void) { return m_nMinTextChars; }
BOOL NeedsUpdate(void) { return m_bNeedsUpdate; }
virtual BOOL NeedsUpdate(void) { return m_bNeedsUpdate; }
void Enable(BOOL bEnabled) { m_bEnabled = bEnabled; }
BOOL IsEnabled(void) { return m_bEnabled; }

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

@ -119,8 +119,12 @@ int CNSToolbar2::Create(CWnd *pParent)
rect.SetRectEmpty();
CBrush brush;
DWORD shouldClipChildren = 0;
if (ShouldClipChildren())
shouldClipChildren = WS_CLIPCHILDREN;
BOOL bResult = CWnd::Create( theApp.NSToolBarClass, NULL,
WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
WS_CHILD | shouldClipChildren | WS_CLIPSIBLINGS,
rect, pParent, 0, NULL);
if(bResult)
@ -643,6 +647,14 @@ void CNSToolbar2::OnUpdateCmdUI( CFrameWnd* pTarget, BOOL bDisableIfNoHndler )
}
}
void CNSToolbar2::UpdateURLBars(char* url)
{
for(int i = 0; i < m_nNumButtons; i++)
{
m_pButtonArray[i]->UpdateURLBar(url);
}
}
BOOL CNSToolbar2::OnNotify( WPARAM wParam, LPARAM lParam, LRESULT* pResult )
{
NMHDR *hdr = (NMHDR*)lParam;

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

@ -98,6 +98,7 @@ public:
CToolbarButton* RemoveButtonByCommand(UINT nCommand);
void DecrementButtonCount() { m_nNumButtons--; }
virtual BOOL ShouldClipChildren() { return TRUE; }
void HideButtonByCommand(UINT nCommand);
void ShowButtonByCommand(UINT nCommand, int nPos);
@ -141,6 +142,7 @@ public:
virtual BOOL OnNotify( WPARAM wParam, LPARAM lParam, LRESULT* pResult );
void OnUpdateCmdUI( CFrameWnd* pTarget, BOOL bDisableIfNoHndler );
void UpdateURLBars(char* url);
// Set a button to do its command on button down instead of button up
BOOL SetDoOnButtonDownByCommand(UINT nCommand, BOOL bDoOnButtonDown);

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

@ -27,6 +27,7 @@
CNSToolTip2::CNSToolTip2()
{
hasCustomColors = FALSE;
}
@ -68,6 +69,7 @@ LRESULT CNSToolTip2::WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
BEGIN_MESSAGE_MAP(CNSToolTip2, CToolTipCtrl)
//{{AFX_MSG_MAP(CNSToolTip2)
ON_WM_CTLCOLOR_REFLECT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
@ -79,5 +81,15 @@ void CNSToolTip2::SetBounding(int *coord, int num, int x, int y)
{
}
HBRUSH CNSToolTip2::CtlColor ( CDC* pDC, UINT nCtlColor )
{
if (hasCustomColors)
{
pDC->SetTextColor( m_ForegroundColor ); // text
pDC->SetBkColor( m_BackgroundColor ); // text bkgnd
return m_BackgroundBrush; // ctl bkgnd
}
return NULL;
}
#endif

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

@ -36,7 +36,12 @@
#else
class CNSToolTip2 : public CToolTipCtrl {
private:
COLORREF m_BackgroundColor;
COLORREF m_ForegroundColor;
CBrush m_BackgroundBrush;
BOOL hasCustomColors;
public:
//Construction
CNSToolTip2();
@ -44,9 +49,14 @@ public:
protected:
virtual LRESULT WindowProc( UINT message, WPARAM wParam, LPARAM lParam );
void SetCustomColors(COLORREF fore, COLORREF back)
{ m_BackgroundColor = back; m_ForegroundColor = fore; hasCustomColors = TRUE;
m_BackgroundBrush.CreateSolidBrush(m_BackgroundColor);
}
// Generated message map functions
//{{AFX_MSG(CNSToolTip2)
afx_msg HBRUSH CtlColor ( CDC* pDC, UINT nCtlColor );
//}}AFX_MSG
DECLARE_MESSAGE_MAP()

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

@ -48,6 +48,8 @@ static const int DRAG_ICON_HEIGHT = 15;
static const int BOOKMARKS_TEXT_LEFT = 10;
static const int URLBAR_HEIGHT = 23;
BEGIN_MESSAGE_MAP(CURLBar, CURLBarBase)
//{{AFX_MSG_MAP(CURLBar)
ON_UPDATE_COMMAND_UI(ID_EDIT_COPY, OnUpdateEditCopy)
@ -121,72 +123,10 @@ void CURLBar::SetContext( LPUNKNOWN pUnk )
}
}
LRESULT CURLBar::WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
{
if ( ( message == WM_COMMAND ) &&
#ifdef WIN32
( LOWORD( wParam ) == IDC_URL_EDIT ) )
switch ( HIWORD ( wParam ) )
#else
( wParam == IDC_URL_EDIT ) )
switch ( HIWORD ( lParam ) )
#endif
{
case CBN_EDITCHANGE:
OnEditChange ( );
break;
case CBN_SELCHANGE:
OnSelChange ( );
Invalidate(FALSE);
break;
case CBN_CLOSEUP:
Invalidate(FALSE);
break;
}
return CURLBarBase::WindowProc ( message, wParam, lParam );
}
void CURLBar::OnLButtonDown(UINT nFlags, CPoint point)
{
CDialogBar::OnLButtonDown(nFlags, point);
int load = FALSE;
if (!m_pIMWContext)
return;
MapWindowPoints(GetParent(), &point, 1);
GetParent()->SendMessage(WM_LBUTTONDOWN, nFlags, MAKELPARAM(point.x, point.y));
}
HBRUSH CURLBar::OnCtlColor( CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
return CURLBarBase::OnCtlColor(pDC, pWnd, nCtlColor);
}
void CURLBar::OnPaint()
{
CURLBarBase::OnPaint ( );
CClientDC dc(this);
CRect rcClient;
GetClientRect(&rcClient);
HPALETTE hPalette = WFE_GetUIPalette(GetParentFrame());
HPALETTE hOldPalette = ::SelectPalette(dc.m_hDC, hPalette, FALSE);
// Use our background color
::FillRect(dc.m_hDC, &rcClient, sysInfo.m_hbrBtnFace);
CPaintDC dc(this);
#ifdef _WIN32
if ( sysInfo.m_bWin4 )
m_pBox->SetFont( CFont::FromHandle ( (HFONT) GetStockObject (DEFAULT_GUI_FONT) ) );
@ -199,54 +139,9 @@ void CURLBar::OnPaint()
ASSERT(m_pFont != NULL);
::SendMessage(m_pBox->GetSafeHwnd(), WM_SETFONT, (WPARAM)m_pFont, FALSE);
}
m_pBox->UpdateWindow ( );
if ( !sysInfo.m_bWin4 )
{
// Draw 3D frame around URL box
RECT rect;
m_pBox->GetWindowRect ( &rect );
rect.right++;
rect.bottom++;
rect.left--;
rect.top--;
ScreenToClient ( &rect );
rect.right--;
rect.bottom--;
RECT rcTmp = rect;
::InflateRect( &rcTmp, -1, -1 );
WFE_DrawHighlight( dc.m_hDC, &rcTmp,
RGB(128, 128, 128),
RGB(0, 0, 0));
WFE_DrawHighlight( dc.m_hDC, &rect,
RGB(192, 192, 192),
RGB(231, 231, 231) );
}
::SelectPalette(dc.m_hDC, hOldPalette, TRUE);
m_pBox->UpdateWindow();
}
void CURLBar::OnShowWindow( BOOL bShow, UINT nStatus )
{
m_bEraseBackground = bShow;
}
BOOL CURLBar::OnEraseBkgnd( CDC* pDC )
{
if ( m_bEraseBackground ) {
m_bEraseBackground = FALSE;
return (BOOL) Default();
} else {
return TRUE;
}
}
#define TOTAL_SAVED_URLS 15
#define TOTAL_DISPLAYED_URLS 10
@ -270,38 +165,13 @@ int CURLBar::OnCreate(LPCREATESTRUCT lpCreateStruct)
m_pBox = new CEditWnd(this);
m_pBox->Create(
WS_CHILD|WS_VISIBLE|WS_TABSTOP,
rect, (CWnd *) m_pProxySurround, IDC_URL_EDIT);
rect, m_pProxySurround, IDC_URL_EDIT);
}
return(nRtn);
}
void CURLBar::OnDestroy( )
{
CWnd::OnDestroy();
}
void CURLBar::OnClose()
{
}
void CURLBar::OnPaletteChanged( CWnd* pFocusWnd )
{
if (pFocusWnd != this) {
HPALETTE hPalette = WFE_GetUIPalette(GetParentFrame());
if (WFE_IsGlobalPalette(hPalette)) {
HDC hDC = ::GetDC(m_hWnd);
HPALETTE hOldPalette = ::SelectPalette(hDC, hPalette, FALSE);
::SelectPalette(hDC, hOldPalette, TRUE);
::ReleaseDC(m_hWnd, hDC);
}
Invalidate();
}
}
CURLBar::~CURLBar()
{
@ -321,31 +191,27 @@ CURLBar::~CURLBar()
}
void CURLBar::DoDataExchange(CDataExchange* pDX)
{
CURLBarBase::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CURLBar)
//}}AFX_DATA_MAP
}
/////////////////////////////////////////////////////////////////////////////
// CURLBar message handlers
void CURLBar::OnMouseMove(UINT nFlags, CPoint point)
{
CURLBarBase::OnMouseMove(nFlags, point);
// Display previous status
wfe_Progress( m_pIMWContext->GetContext(), "" );
MapWindowPoints(GetParent(), &point, 1);
GetParent()->SendMessage(WM_MOUSEMOVE, nFlags, MAKELPARAM(point.x, point.y));
}
void CURLBar::OnSize(UINT nType, int cx, int cy)
{
int txtSpacing;
int boxSpacing;
CRect rcURLtext, rcIcon, bookmarkRect;
int x = BOOKMARKS_TEXT_LEFT;
CWnd *pText = GetDlgItem( IDC_URLTEXT );
if (pText) {
pText->GetWindowRect(&rcURLtext);
// figure out how big we need to make the box
CDC * pDC = m_pBox->GetDC();
int boxSpacing;
if( m_pBox )
{
CDC * pDC = m_pBox->GetDC();
TEXTMETRIC tm;
// creates font for multibyte system running on WinNT and Win16
@ -378,45 +244,22 @@ void CURLBar::OnSize(UINT nType, int cx, int cy)
if(m_nBoxHeight > (cy - 2))
m_nBoxHeight = cy - 2;
m_pBox->ReleaseDC(pDC);
}
CURLBarBase::OnSize(nType, cx, cy);
if( pText && m_pBox )
{
// position the "Location" text
txtSpacing = (cy - rcURLtext.Height()) / 2 ;
pText->MoveWindow(x,
txtSpacing, rcURLtext.Width(), rcURLtext.Height());
x += rcURLtext.Width() + 3;
m_DragIconX = x;
m_DragIconX = 1;
// Position the proxy surround wnd
m_pProxySurround->MoveWindow(0, 0, cx, cy);
m_pProxySurround->MoveWindow(x-1, 1, ( cx - x -
( GetSystemMetrics(SM_CXBORDER) * 2)),cy-2);
boxSpacing = (cy - m_nBoxHeight) / 2 ;
m_DragIconY = boxSpacing + (m_nBoxHeight - DRAG_ICON_HEIGHT)/2;
m_DragIconY = (cy - DRAG_ICON_HEIGHT)/2;
m_pPageProxy->MoveWindow(1, m_DragIconY-1, DRAG_ICON_WIDTH, DRAG_ICON_HEIGHT);
m_pPageProxy->MoveWindow(m_DragIconX, m_DragIconY, DRAG_ICON_WIDTH, DRAG_ICON_HEIGHT);
x += DRAG_ICON_WIDTH + 2;
// position the location edit box
m_pBox->MoveWindow( DRAG_ICON_WIDTH+3,
(cy - m_nBoxHeight) / 2 -1,
( cx - x -
( GetSystemMetrics(SM_CXBORDER) * 2)) ,
m_nBoxHeight);
boxSpacing, cx - DRAG_ICON_WIDTH - 5, m_nBoxHeight);
}
m_DragIconY = boxSpacing + (m_nBoxHeight - DRAG_ICON_HEIGHT)/2 + 1;
}
//////////////////////////////////////////////////////////////////////////////
@ -446,9 +289,6 @@ void CURLBar::ProcessEnterKey()
id = 0;
}
#ifdef MOZ_NGLAYOUT
XP_ASSERT(0);
#else
if (HK_CallHook(HK_LOCATION, NULL, id, text, &new_text))
{
// Nothing, new_text is already set.
@ -457,7 +297,6 @@ void CURLBar::ProcessEnterKey()
{
new_text = NULL;
}
#endif /* MOZ_NGLAYOUT */
}
if (new_text)
@ -481,14 +320,8 @@ void CURLBar::ProcessEnterKey()
// need to because of the location / netsite history
void CURLBar::UpdateFields( const char * msg )
{
CWnd *pText = GetDlgItem( IDC_URLTEXT );
#ifdef MOZ_NGLAYOUT
XP_ASSERT(0);
#else
// strip random backend crap out of the url
msg = LM_StripWysiwygURLPrefix(msg);
#endif /* MOZ_NGLAYOUT */
CString cs(msg);
m_pBox->SetWindowText(cs);
@ -497,13 +330,13 @@ void CURLBar::UpdateFields( const char * msg )
m_pBox->Clear();
// If this was a netsite server change the string
History_entry* pEntry = SHIST_GetCurrent(&m_pIMWContext->GetContext()->hist);
/* History_entry* pEntry = SHIST_GetCurrent(&m_pIMWContext->GetContext()->hist);
if (pEntry && pEntry->is_netsite)
pText->SetWindowText(szLoadString(IDS_NETSITE));
else
pText->SetWindowText(szLoadString(IDS_LOCATION));
*/
m_nTextStatus = TRUE;
}
@ -578,38 +411,13 @@ void CURLBar::OnSelChange()
// "Go to:" rather than "Location:"
void CURLBar::OnEditChange()
{
CWnd *pText = GetDlgItem( IDC_URLTEXT );
/* TODO:
if( pText && m_nTextStatus )
{
pText->SetWindowText(szLoadString(IDS_GOTO));
m_nTextStatus = FALSE;
}
}
void CURLBar::OnMouseMove(UINT nFlags, CPoint point)
{
CURLBarBase::OnMouseMove(nFlags, point);
// Display previous status
wfe_Progress( m_pIMWContext->GetContext(), "" );
MapWindowPoints(GetParent(), &point, 1);
GetParent()->SendMessage(WM_MOUSEMOVE, nFlags, MAKELPARAM(point.x, point.y));
}
void CURLBar::OnLButtonDblClk(UINT nFlags, CPoint point)
{
CURLBarBase::OnLButtonDblClk(nFlags, point);
}
void CURLBar::OnLButtonUp(UINT nFlags, CPoint point)
{
MapWindowPoints(GetParent(), &point, 1);
GetParent()->SendMessage(WM_LBUTTONUP, nFlags, MAKELPARAM(point.x, point.y));
*/
}
CEditWnd::~CEditWnd()
@ -618,13 +426,11 @@ CEditWnd::~CEditWnd()
KillTimer(m_idTimer);
if (m_pComplete)
free(m_pComplete);
delete m_ToolTip;
}
BEGIN_MESSAGE_MAP(CEditWnd,CGenericEdit)
ON_WM_TIMER()
ON_WM_MOUSEMOVE()
END_MESSAGE_MAP()
@ -692,7 +498,6 @@ BOOL CEditWnd::PreTranslateMessage ( MSG * msg )
const char *c_url = (const char *)url;
url_str = (char *)c_url;
#ifndef MOZ_NGLAYOUT
if (HK_CallHook(HK_LOCATION, NULL, id, url_str, &new_url))
{
// Nothing, new_url is already set.
@ -701,7 +506,6 @@ BOOL CEditWnd::PreTranslateMessage ( MSG * msg )
{
new_url = NULL;
}
#endif /* MOZ_NGLAYOUT */
}
if (new_url)
@ -911,7 +715,6 @@ void CEditWnd::OnMouseMove(UINT nFlags, CPoint point)
}
}
// CProxySurroundWnd
BEGIN_MESSAGE_MAP(CProxySurroundWnd, CWnd)
@ -1240,3 +1043,145 @@ void CPageProxyWindow::OnTimer( UINT nIDEvent )
}
// ==============================================
// The URLBar Button class.
// ==============================================
BEGIN_MESSAGE_MAP(CURLBarButton, CRDFToolbarButton)
//{{AFX_MSG_MAP(CURLBarButton)
ON_WM_SIZE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// The Nav Center vocab element
extern "C" RDF_NCVocab gNavCenter;
CSize CURLBarButton::GetButtonSizeFromChars(CString s, int c)
{
// Get our width
void* data;
BOOL percent = FALSE;
int width = 100;
if (m_Node == NULL)
return CSize(0,0);
m_bIsSpring = FALSE;
HT_GetNodeData(m_Node, gNavCenter->urlBarWidth, HT_COLUMN_STRING, &data);
if (data)
{
CString strData((char*)data);
int length = strData.GetLength();
if (strData[length-1] == '%')
{
percent = TRUE;
strData = strData.Left(length-1);
}
else if (strData[0] == '*')
{
m_bIsSpring = TRUE;
strData = "0";
}
else
percent = FALSE;
width = atoi(strData);
}
if (foundOnRDFToolbar())
{
CRDFToolbar* pToolbar = (CRDFToolbar*)GetParent();
int rowWidth = pToolbar->GetRowWidth();
if (percent)
return CSize((width/100.0) * rowWidth, URLBAR_HEIGHT);
else return CSize(width, URLBAR_HEIGHT);
}
return CSize(0,0); // Must be on an RDF toolbar to make any sense at all.
}
void CURLBarButton::DrawButtonBitmap(HDC hDC, CRect rcImg)
{
} // Do nothing.
void CURLBarButton::DrawButtonText(HDC hDC, CRect rcTxt, CSize sizeTxt, CString strTxt)
{
CRect rect;
GetClientRect(&rect);
CRect textRect(rect);
::DrawText(hDC, strTxt, -1, &textRect, DT_CENTER | DT_EXTERNALLEADING | DT_CALCRECT);
rect.right = textRect.right;
rect.left += 6;
rect.right += 6;
CRDFToolbarButton::DrawButtonText(hDC, rect, CSize(textRect.Width(), textRect.Height()), strTxt);
}
int CURLBarButton::Create(CWnd *pParent, int nToolbarStyle, CSize noviceButtonSize, CSize advancedButtonSize,
LPCTSTR pButtonText, LPCTSTR pToolTipText,
LPCTSTR pStatusText,
CSize bitmapSize, int nMaxTextChars, int nMinTextChars, BOOKMARKITEM bookmark,
HT_Resource pNode, DWORD dwButtonStyle)
{
int result = CRDFToolbarButton::Create(pParent, nToolbarStyle, noviceButtonSize, advancedButtonSize,
pButtonText, pToolTipText, pStatusText, bitmapSize, nMaxTextChars, nMinTextChars,
bookmark, pNode, dwButtonStyle);
if (result)
{
// Button successfully created. Build the URL bar.
m_pURLBar=new CURLBar();
m_pURLBar->Create( NULL, NULL,
WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE,
CRect(0,0,10,10), this, CURLBar::IDD);
CWnd* pWnd = GetTopLevelFrame();
if (pWnd->IsKindOf(RUNTIME_CLASS(CMainFrame)))
{
CMainFrame* pMain = (CMainFrame*)pWnd;
m_pURLBar->SetContext((LPUNKNOWN)pMain->GetMainContext());
}
}
return result;
}
void CURLBarButton::OnSize(UINT nType, int x, int y)
{
m_bitmapSize.cx = m_bitmapSize.cy = 0;
if (m_pURLBar)
{
CRect rect;
GetClientRect(&rect);
CRect textRect(rect);
CDC* pDC = GetDC();
char* text = HT_GetNodeName(m_Node);
pDC->DrawText(text, -1, &textRect, DT_CENTER | DT_EXTERNALLEADING | DT_CALCRECT);
ReleaseDC(pDC);
int startY = (rect.Height() - URLBAR_HEIGHT)/2;
m_pURLBar->MoveWindow(textRect.right, startY, rect.Width() - textRect.Width() - 3,
URLBAR_HEIGHT);
}
}
void CURLBarButton::UpdateURLBar(char* url)
{
if (m_pURLBar)
m_pURLBar->UpdateFields(url);
}
CURLBarButton::CURLBarButton()
:m_pURLBar(NULL), m_bIsSpring(FALSE)
{}
CURLBarButton::~CURLBarButton()
{
delete m_pURLBar;
}

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

@ -20,6 +20,7 @@
// CURLBar dialog
#include "toolbar2.h"
#include "usertlbr.h"
#include "dropmenu.h"
#ifndef URLBAR_H
@ -32,19 +33,19 @@ protected:
BOOL m_bRestart;
char * m_pComplete;
BOOL m_Scroll;
CWnd* m_pBar;
CNSToolTip2 *m_ToolTip;
CWnd* m_pBar;
CNSToolTip2 *m_ToolTip;
public:
CEditWnd(CWnd* bar) { m_pBar = bar; m_ToolTip = 0; m_idTimer = 0; m_bRestart = TRUE; m_pComplete = NULL; m_Scroll = FALSE; }
CEditWnd(CWnd* bar) { m_pBar = bar; m_idTimer = 0; m_bRestart = TRUE; m_pComplete = NULL; m_Scroll = FALSE; }
~CEditWnd();
void UrlCompletion(void);
void DrawCompletion(CString & cs, char * pszResult);
void SetToolTip(const char *inTipStr);
void SetToolTip(const char *inTipStr);
virtual BOOL PreTranslateMessage ( MSG * msg );
virtual LRESULT DefWindowProc( UINT message, WPARAM wParam, LPARAM lParam );
virtual afx_msg void OnTimer( UINT nIDEvent );
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
virtual afx_msg void OnTimer( UINT nIDEvent );
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
DECLARE_MESSAGE_MAP();
};
@ -100,7 +101,7 @@ public:
DECLARE_MESSAGE_MAP()
};
#define CURLBarBase CDialogBar
#define CURLBarBase CWnd
class CURLBar : public CURLBarBase
{
@ -144,16 +145,12 @@ public:
LPMWCONTEXT GetContext() const { return m_pIMWContext; }
void UpdateFields( const char * msg);
void SetToolTip(const char * inTip);
void SetToolTip(const char * inTip);
// Implementation
protected:
void ProcessEnterKey();
// Overrides
virtual LRESULT WindowProc( UINT message, WPARAM wParam, LPARAM lParam );
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
protected:
// Generated message map functions
//{{AFX_MSG(CURLBar)
@ -169,20 +166,43 @@ protected:
afx_msg void OnUpdateEditUndo(CCmdUI* pCmdUI);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnClose();
afx_msg void OnDestroy( );
afx_msg void OnPaint();
afx_msg void OnShowWindow( BOOL bShow, UINT nStatus );
afx_msg BOOL OnEraseBkgnd( CDC* pDC );
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg HBRUSH OnCtlColor( CDC*, CWnd*, UINT );
afx_msg void OnPaletteChanged( CWnd* pFocusWnd );
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
class CURLBarButton : public CRDFToolbarButton
{
protected:
CURLBar* m_pURLBar; // A pointer to the URL bar object.
BOOL m_bIsSpring; // Whether or not the url bar wants to expand to consume as much space as it can.
public:
CURLBarButton();
~CURLBarButton();
virtual CSize GetButtonSizeFromChars(CString s, int c);
// Overridden to handle special width/height requirements.
virtual void DrawButtonBitmap(HDC hDC, CRect rcImg);
virtual void DrawButtonText(HDC hDC, CRect rcTxt, CSize sizeTxt, CString strTxt);
virtual void UpdateURLBar(char* url);
virtual BOOL IsSpring() { return m_bIsSpring; }
int Create(CWnd *pParent, int nToolbarStyle, CSize noviceButtonSize, CSize advancedButtonSize,
LPCTSTR pButtonText, LPCTSTR pToolTipText,
LPCTSTR pStatusText,
CSize bitmapSize, int nMaxTextChars, int nMinTextChars, BOOKMARKITEM bookmark,
HT_Resource pNode, DWORD dwButtonStyle = 0);
// Generated message map functions
//{{AFX_MSG(CToolbarButton)
afx_msg void OnSize(UINT nType, int x, int y);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#endif // URLBAR_H

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -52,8 +52,8 @@ class CRDFToolbarButtonDropTarget : public CRDFToolbarButtonDropTargetBase
#define CRDFToolbarButtonBase CDragableToolbarButton
class CRDFToolbarButton: public CRDFToolbarButtonBase, public CCustomImageObject {
class CRDFToolbarButton: public CRDFToolbarButtonBase, public CCustomImageObject
{
protected:
HT_Resource m_Node; // The resource corresponding to the RDF node
BOOKMARKITEM m_bookmark;
@ -62,15 +62,18 @@ protected:
int currentRow; // The row of the personal toolbar this button resides on.
CDropMenu* m_pCachedDropMenu; // A pointer to a drop menu that is tracked across
// node opening (HT) callbacks
CNSNavFrame* m_pTreeView; // A pointer to a tree popup that is tracked.
BOOL m_bShouldShowRMMenu; // Set to TRUE by default. Quickfile/Breadcrumbs set it to FALSE.
CRDFCommandMap m_MenuCommandMap; // Command map for back-end generated right mouse menu commands.
int m_nActualBitmapHeight; // The actual bitmap's height.
public:
CRDFToolbarButton();
~CRDFToolbarButton();
int Create(CWnd *pParent, int nToolbarStyle, CSize noviceButtonSize, CSize advancedButtonSize,
virtual int Create(CWnd *pParent, int nToolbarStyle, CSize noviceButtonSize, CSize advancedButtonSize,
LPCTSTR pButtonText, LPCTSTR pToolTipText,
LPCTSTR pStatusText,
CSize bitmapSize, int nMaxTextChars, int nMinTextChars, BOOKMARKITEM bookmark,
@ -79,13 +82,24 @@ public:
int GetRow() { return currentRow; }
void SetRow(int i) { currentRow = i; }
virtual BOOL foundOnRDFToolbar() { return TRUE; } // RDF Buttons must ALWAYS reside on RDF toolbars. (Derived
// classes could have different behavior, but base-class buttons
// make the assumption that they sit on an RDF toolbar.
CNSNavFrame* GetTreeView() { return m_pTreeView; }
virtual void OnAction(void);
virtual CSize GetButtonSizeFromChars(CString s, int c);
virtual CSize GetMinimalButtonSize();
virtual CSize GetMaximalButtonSize();
virtual BOOL IsSpring() { return FALSE; } // Whether or not the button will expand to consume
// all remaining space on a row.
virtual BOOL UseLargeIcons() { return FALSE; }
virtual void UpdateIconInfo() { DetermineIconType(m_Node, UseLargeIcons()); }
virtual void UpdateIconInfo();
virtual void DrawButtonBitmap(HDC hDC, CRect rcImg);
virtual void FillInOleDataSource(COleDataSource *pDataSource);
@ -106,6 +120,8 @@ public:
virtual HT_View GetHTView() { return HT_GetView(m_Node); }
virtual BOOL NeedsUpdate();
protected:
virtual void DrawPicturesMode(HDC hDC, CRect rect);
virtual void DrawPicturesAndTextMode(HDC hDC, CRect rect);
@ -125,7 +141,9 @@ protected:
afx_msg LRESULT OnDropMenuClosed(WPARAM, LPARAM);
afx_msg LRESULT OnFillInMenu(WPARAM wParam, LPARAM lParam);
afx_msg void OnSysColorChange( );
afx_msg void OnPaint();
afx_msg int OnMouseActivate( CWnd* pDesktopWnd, UINT nHitTest, UINT message );
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
@ -133,7 +151,30 @@ protected:
};
void ptNotifyProcedure (HT_Notification ns, HT_Resource n, HT_Event whatHappened);
void toolbarNotifyProcedure (HT_Notification ns, HT_Resource n, HT_Event whatHappened);
/****************************************************************************
*
* Class: CRDFSeparatorButton
*
****************************************************************************/
class CRDFSeparatorButton : public CRDFToolbarButton
{
protected:
public:
virtual CSize GetButtonSizeFromChars(CString s, int c);
// Overridden to handle special width/height requirements.
virtual void DrawButtonBitmap(HDC hDC, CRect rcImg);
virtual void DrawButtonText(HDC hDC, CRect rcTxt, CSize sizeTxt, CString strTxt) {};
// Generated message map functions
//{{AFX_MSG(CRDFSeparatorButton)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/****************************************************************************
*
@ -168,37 +209,51 @@ protected:
};
class CRDFToolbar : public CNSToolbar2 {
class CRDFToolbar : public CNSToolbar2, public CCustomImageObject {
private:
CRDFToolbarDropTarget m_DropTarget;
HT_Pane m_PersonalToolbarPane;
HT_View m_ToolbarView;
CRDFCommandMap m_MenuCommandMap; // Command map for back-end generated right mouse menu commands.
int m_nNumberOfRows;
int m_nRowHeight;
CRDFToolbarButton* m_pDragButton;
int m_iDragFraction;
COLORREF m_BackgroundColor;
COLORREF m_ForegroundColor;
COLORREF m_RolloverColor;
COLORREF m_PressedColor;
COLORREF m_DisabledColor;
COLORREF m_ShadowColor;
COLORREF m_HighlightColor;
CRDFImage* m_pBackgroundImage;
static int m_nMinToolbarButtonChars;
static int m_nMaxToolbarButtonChars;
public:
CRDFToolbar(int nMaxButtons, int nToolbarStyle, int nPicturesAndTextHeight, int nPicturesHeight,
CRDFToolbar(HT_View theView, int nMaxButtons, int nToolbarStyle, int nPicturesAndTextHeight, int nPicturesHeight,
int nTextHeight);
~CRDFToolbar();
// Used to create toolbars
static CRDFToolbar* CreateUserToolbar(CWnd* pParent);
static CRDFToolbar* CreateUserToolbar(HT_View theView, CWnd* pParent);
int Create(CWnd *pParent);
virtual int GetHeight(void);
virtual int GetRowWidth();
// Override layout scheme to dynamically resize buttons.
void LayoutButtons(int nIndex); // Index will be ignored by this version of the function
// since adding/deleting buttons may cause all buttons to resize
// Toolbar's event handler.
void HandleEvent(HT_Notification ns, HT_Resource n, HT_Event whatHappened);
void AddHTButton(HT_Resource n); // Called to add a new button to the toolbar
void SetMinimumRows(int rowWidth); // Called to determine and set the # of rows required by the toolbar.
@ -210,7 +265,8 @@ public:
void FillInToolbar(); // Called to create and place the buttons on the toolbar
HT_Pane GetPane() { return m_PersonalToolbarPane; } // Returns the HT-Pane
HT_View GetHTView() { return m_ToolbarView; } // Returns the HT-View for this toolbar.
void SetHTView(HT_View v) { m_ToolbarView = v; }
void SetDragFraction(int i) { m_iDragFraction = i; }
int GetDragFraction() { return m_iDragFraction; }
@ -218,6 +274,34 @@ public:
void SetDragButton(CRDFToolbarButton* pButton) { m_pDragButton = pButton; }
CRDFToolbarButton* GetDragButton() { return m_pDragButton; }
void SetRowHeight(int i) { m_nRowHeight = i; }
int GetRowHeight() { return m_nRowHeight; }
// Color/background customizability stuff
COLORREF GetBackgroundColor() { return m_BackgroundColor; }
COLORREF GetForegroundColor() { return m_ForegroundColor; }
COLORREF GetRolloverColor() { return m_RolloverColor; }
COLORREF GetPressedColor() { return m_PressedColor; }
COLORREF GetDisabledColor() { return m_DisabledColor; }
COLORREF GetShadowColor() { return m_ShadowColor; }
COLORREF GetHighlightColor() { return m_HighlightColor; }
CRDFImage* GetBackgroundImage() { return m_pBackgroundImage; }
void SetBackgroundColor(COLORREF c) { m_BackgroundColor = c; }
void SetForegroundColor(COLORREF c) { m_ForegroundColor = c; }
void SetRolloverColor(COLORREF c) { m_RolloverColor = c; }
void SetPressedColor(COLORREF c) { m_PressedColor = c; }
void SetDisabledColor(COLORREF c) { m_DisabledColor = c; }
void SetShadowColor(COLORREF c) { m_ShadowColor = c; }
void SetHighlightColor(COLORREF c) { m_HighlightColor = c; }
void SetBackgroundImage(CRDFImage* p) { m_pBackgroundImage = p; }
void LoadComplete(HT_Resource r) { Invalidate(); }
void ChangeButtonSizes(void); // Overridden to prevent separators and url bars from changing size.
protected:
// Helper function used in conjunction with LayoutButtons
void ComputeLayoutInfo(CRDFToolbarButton* pButton, int numChars, int rowWidth, int& usedSpace);
@ -226,11 +310,48 @@ protected:
//{{AFX_MSG(CRDFToolbar)
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg BOOL OnCommand( WPARAM wParam, LPARAM lParam );
afx_msg void OnPaint(void);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
class CRDFDragToolbar : public CDragToolbar
{
public:
// Generated message map functions
//{{AFX_MSG(CDragToolbar)
afx_msg void OnPaint(void);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
class CRDFToolbarHolder : public CCustToolbar
{
protected:
HT_Pane m_ToolbarPane;
CFrameWnd* m_pCachedParentWindow;
CRDFToolbarButton* m_pCurrentButton;
public:
CRDFToolbarHolder(int maxToolbars, CFrameWnd* pParent);
virtual ~CRDFToolbarHolder();
CRDFToolbarButton* GetCurrentButton() { return m_pCurrentButton; }
void SetCurrentButton(CRDFToolbarButton* button) { m_pCurrentButton = button; }
HT_Pane GetHTPane() { return m_ToolbarPane; }
void SetHTPane(HT_Pane p) { m_ToolbarPane = p; }
CFrameWnd* GetCachedParentWindow() { return m_pCachedParentWindow; }
void InitializeRDFData();
virtual CDragToolbar* CreateDragBar()
{
return new CRDFDragToolbar();
}
};
#endif