Added control strip, removed selector bar and HTML pane, and added support

for template data fetching from the back end.
This commit is contained in:
hyatt%netscape.com 1998-08-04 01:10:49 +00:00
Родитель 5ac329bef7
Коммит bed2025014
17 изменённых файлов: 515 добавлений и 606 удалений

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

@ -1395,11 +1395,11 @@ void CCustToolbar::OnPaint()
if(m_nNumOpen != 0)
{
DrawSeparator(hMemDC, rcClient.left, rcClient.right, nStartY, TRUE);
DrawSeparator(0, hMemDC, rcClient.left, rcClient.right, nStartY, TRUE);
}
else
{
DrawSeparator(hMemDC, rcClient.left, rcClient.right, nStartY, FALSE);
DrawSeparator(0, hMemDC, rcClient.left, rcClient.right, nStartY, FALSE);
}
nStartY += SPACE_BETWEEN_TOOLBARS;
@ -1423,11 +1423,11 @@ void CCustToolbar::OnPaint()
if(nNumOpenButtons != m_nNumOpen)
{
DrawSeparator(hMemDC, rcClient.left, rcClient.right, nStartY, TRUE);
DrawSeparator(i, hMemDC, rcClient.left, rcClient.right, nStartY, TRUE);
}
else
{
DrawSeparator(hMemDC, rcClient.left, rcClient.right, nStartY, FALSE);
DrawSeparator(i, hMemDC, rcClient.left, rcClient.right, nStartY, FALSE);
}
nStartY +=SPACE_BETWEEN_TOOLBARS;
@ -1464,7 +1464,7 @@ void CCustToolbar::OnPaint()
}
if(m_bBottomBorder)
DrawSeparator(hMemDC, rcClient.left, rcClient.right, rcClient.bottom - 2, TRUE);
DrawSeparator(0, hMemDC, rcClient.left, rcClient.right, rcClient.bottom - 2, TRUE);
::BitBlt(hSrcDC, 0, 0, rcClient.Width(), rcClient.Height(), hMemDC, 0, 0,
SRCCOPY);
@ -1804,7 +1804,7 @@ BOOL CCustToolbar::PointInClosedTab(CPoint point, HTAB_BITMAP tabType, int nNumC
// if bToolbarSeparator is true then draw a grey line and a white line. If it's false then it is the
// separator between the last toolbar and the closed buttons so draw a grey line and a black line
void CCustToolbar::DrawSeparator(HDC hDC, int nStartX, int nEndX, int nStartY, BOOL bToolbarSeparator)
void CCustToolbar::DrawSeparator(int i, HDC hDC, int nStartX, int nEndX, int nStartY, BOOL bToolbarSeparator)
{
HPEN pen = ::CreatePen(PS_SOLID, 1, GetSysColor(COLOR_BTNSHADOW));

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

@ -214,8 +214,7 @@ class CRDFToolbar;
class CCustToolbar : public CControlBar {
private:
protected:
CFrameWnd * m_pParent;
CDragToolbar** m_pToolbarArray;
CDragToolbar** m_pHiddenToolbarArray;
@ -326,7 +325,7 @@ protected:
int CheckClosedButtons(CPoint point);
BOOL PointInClosedTab(CPoint point, HTAB_BITMAP tabType, int nNumClosedButtons, int nStartX,
int nBottom);
void DrawSeparator(HDC hDC, int nStartX, int nEndX, int nStartY, BOOL bToolbarSeparator = TRUE);
virtual void DrawSeparator(int i, HDC hDC, int nStartX, int nEndX, int nStartY, BOOL bToolbarSeparator = TRUE);
void SwitchChildren(CDragToolbar *pOriginal, CDragToolbar *pSwitch, int dir, int yPoint);
int FindIndex(CDragToolbar *pToolbar);
CDragToolbar *FindToolbarFromPoint(CPoint point, CDragToolbar *pIgnore);

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

@ -128,9 +128,12 @@ void CRDFImage::RemoveListenerForSpecificResource(CCustomImageObject *pObject, H
void CRDFImage::DestroyContext()
{
iconContext->DeleteContextDC();
iconContext->NiceDestruction();
iconContext = NULL;
if (iconContext)
{
iconContext->DeleteContextDC();
iconContext->NiceDestruction();
iconContext = NULL;
}
resourceList.RemoveAll();
}
@ -172,12 +175,14 @@ void Icon_GetUrlExitRoutine(URL_Struct *pUrl, int iStatus, MWContext *pContext)
}
}
// standard free-a-URL-with-Windows-DDE-gunk mechanism:
if (NCAPIDATA(pUrl))
NCAPIDATA(pUrl)->EndProgress();
if (!NCAPIDATA(pUrl) || NCAPIDATA(pUrl)->CanFreeUrl()) {
FEU_DeleteUrlData(pUrl, NULL);
NET_FreeURLStruct(pUrl);
}
}
static BOOL IsImageMimeType(const CString& theFormat)
@ -270,6 +275,7 @@ void CRDFImage::ProcessIcon()
void CRDFImage::CompleteCallback()
{
m_bCompletelyLoaded = TRUE;
m_bFrameLoaded = TRUE;
while (!resourceList.IsEmpty())
{
CIconCallbackInfo* callback = (CIconCallbackInfo*)(resourceList.RemoveHead());

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

@ -21,7 +21,6 @@
#ifdef XP_WIN32
#include "intelli.h"
#endif
#include "navcontv.h"
#include "rdfliner.h"
#ifdef ENDER
@ -1283,6 +1282,7 @@ void CPaneCX::MakeElementVisible(int32 lX, int32 lY)
void CPaneCX::PreNavCenterQueryPosition(PaneMessage *pMessage)
{
/*
// Only handle if we're a NavCenter HTML Pane.
if(IsNavCenterHTMLPane()) {
NAVCENTPOS *pPos = (NAVCENTPOS *)pMessage->lParam;
@ -1297,10 +1297,12 @@ void CPaneCX::PreNavCenterQueryPosition(PaneMessage *pMessage)
pMessage->lRetval = NULL;
pMessage->bSetRetval = TRUE;
}
*/
}
void CPaneCX::PreIdleUpdateCmdUI(PaneMessage *pMsg)
{
/*
// Don't want to update CMD UI unless we have a frame parent.
// This effectively stops CMD UI in the NavCenter HTML pane
// from messing with the UI state when docked.
@ -1309,6 +1311,7 @@ void CPaneCX::PreIdleUpdateCmdUI(PaneMessage *pMsg)
pMsg->lRetval = NULL;
pMsg->bSetRetval = TRUE;
}
*/
}
#ifdef XP_WIN16
@ -1387,12 +1390,16 @@ PaneProc(HWND hPane, UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_HSCROLL:
pThis->PreWMHScroll(&message);
break;
/*
case WM_NAVCENTER_QUERYPOSITION:
pThis->PreNavCenterQueryPosition(&message);
break;
case WM_IDLEUPDATECMDUI:
pThis->PreIdleUpdateCmdUI(&message);
break;
*/
#if defined(XP_WIN32) && _MSC_VER >= 1100
case WM_MOUSEWHEEL:
pThis->PreWMMouseWheel(&message);

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

@ -157,9 +157,6 @@ void CDragBar::DrawFocusRect(BOOL bRemoveRect)
void CDragBar::OnLButtonDown(UINT nFlags, CPoint point)
{
if (!m_dockedFrame->IsTreeVisible())
return;
// Capture mouse events.
InitLoop();
@ -193,7 +190,7 @@ void CDragBar::OnLButtonDown(UINT nFlags, CPoint point)
void CDragBar::OnRButtonDown(UINT nFlags, CPoint point)
{
m_dockedFrame->CollapseWindow();
//m_dockedFrame->CollapseWindow();
}
void CDragBar::EndDrag()
@ -236,9 +233,7 @@ void CDragBar::Move( CPoint point )
void CDragBar::OnMouseMove( UINT nFlags, CPoint point )
{
if(m_bDragging == TRUE) return;
if (!m_dockedFrame->IsTreeVisible()) // Cannot drag when tree is closed.
return;
static HCURSOR hcurLast = NULL;
static HCURSOR hcurDestroy = NULL;
static UINT uLastCursorID = 0;
@ -352,15 +347,8 @@ void CDragBar::CalcClientArea(RECT* lpRectClient)
lpRectClient->right = layout.rect.right;
lpRectClient->top = layout.rect.top;
lpRectClient->bottom = layout.rect.bottom;
if (dockStyle == DOCKSTYLE_VERTLEFT)
if (dockStyle == DOCKSTYLE_DOCKEDLEFT)
lpRectClient->left += MIN_CATEGORY_WIDTH;
else if (dockStyle == DOCKSTYLE_VERTRIGHT)
lpRectClient->right -= MIN_CATEGORY_WIDTH;
else if (dockStyle == DOCKSTYLE_HORZTOP)
lpRectClient->top += MIN_CATEGORY_HEIGHT;
else if (dockStyle == DOCKSTYLE_HORZBOTTOM)
lpRectClient->bottom -= MIN_CATEGORY_HEIGHT;
}
BOOL CDragBar::Track()

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

@ -528,10 +528,10 @@ CNSNavFrame *CNSGenFrame::GetDockedNavCenter()
CNSNavFrame *pRetval = NULL;
// Do we have one?
CWnd *pWnd = GetDescendantWindow(NC_IDW_SELECTOR);
if(pWnd && pWnd->IsKindOf(RUNTIME_CLASS(CSelector))) {
CSelector *pSelector = (CSelector *)pWnd;
CFrameWnd *pFrame = pSelector->GetParentFrame();
CWnd *pWnd = GetDescendantWindow(NC_IDW_OUTLINER);
if(pWnd)
{
CFrameWnd *pFrame = pWnd->GetParentFrame();
if(pFrame && pFrame->IsKindOf(RUNTIME_CLASS(CNSNavFrame))) {
pRetval = (CNSNavFrame *)pFrame;
}

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

@ -1333,8 +1333,6 @@ $(OUTDIR)\mozilla.dep: $(DEPTH)\cmd\winfe\mkfiles32\mozilla.mak
$(DEPTH)\cmd\winfe\mucwiz.cpp
$(DEPTH)\cmd\winfe\mucproc.cpp
$(DEPTH)\cmd\winfe\navbar.cpp
$(DEPTH)\cmd\winfe\navcntr.cpp
$(DEPTH)\cmd\winfe\navcontv.cpp
$(DEPTH)\cmd\winfe\navfram.cpp
$(DEPTH)\cmd\winfe\navigate.cpp
$(DEPTH)\cmd\winfe\ncapiurl.cpp

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

@ -20,7 +20,6 @@
#include "stdafx.h"
#include "navbar.h"
#include "navcntr.h"
#include "navfram.h"
#include "usertlbr.h"
#include "dropmenu.h"
@ -63,10 +62,6 @@ void CNavTitleBar::OnPaint( )
CPaintDC dc(this);
CRect rect;
GetClientRect(&rect);
// if (m_bHasFocus)
// m_pMenuButton->SetCustomColors(::GetSysColor(COLOR_CAPTIONTEXT), ::GetSysColor(COLOR_ACTIVECAPTION));
// else m_pMenuButton->SetCustomColors(::GetSysColor(COLOR_INACTIVECAPTIONTEXT), ::GetSysColor(COLOR_INACTIVECAPTION));
// Read in all the properties
if (!m_View) return;
@ -75,55 +70,48 @@ void CNavTitleBar::OnPaint( )
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 = "";
}
m_ForegroundColor = RGB(0,0,0);
m_BackgroundColor = RGB(192,192,192);
m_BackgroundImageURL = "";
m_ControlStripForegroundColor = RGB(255,255,255);
m_ControlStripBackgroundColor = RGB(64,64,64);
m_ControlStripBackgroundImageURL = "";
// Control strip colors
// Foreground color
HT_GetNodeData(topNode, gNavCenter->titleBarFGColor, HT_COLUMN_STRING, &data);
HT_GetTemplateData(topNode, gNavCenter->controlStripFGColor, HT_COLUMN_STRING, &data);
if (data)
WFE_ParseColor((char*)data, &m_ForegroundColor);
// background color
HT_GetNodeData(topNode, gNavCenter->titleBarBGColor, HT_COLUMN_STRING, &data);
HT_GetTemplateData(topNode, gNavCenter->controlStripBGColor, HT_COLUMN_STRING, &data);
if (data)
WFE_ParseColor((char*)data, &m_BackgroundColor);
// Background image URL
HT_GetNodeData(topNode, gNavCenter->titleBarBGURL, HT_COLUMN_STRING, &data);
HT_GetTemplateData(topNode, gNavCenter->controlStripBGURL, HT_COLUMN_STRING, &data);
if (data)
m_ControlStripBackgroundImageURL = (char*)data;
m_pControlStripBackgroundImage = NULL; // Clear out the BG image.
// Main Title strip colors
// Foreground color
HT_GetTemplateData(topNode, gNavCenter->titleBarFGColor, HT_COLUMN_STRING, &data);
if (data)
WFE_ParseColor((char*)data, &m_ForegroundColor);
// background color
HT_GetTemplateData(topNode, gNavCenter->titleBarBGColor, HT_COLUMN_STRING, &data);
if (data)
WFE_ParseColor((char*)data, &m_BackgroundColor);
// Background image URL
HT_GetTemplateData(topNode, gNavCenter->titleBarBGURL, HT_COLUMN_STRING, &data);
if (data)
m_BackgroundImageURL = (char*)data;
m_pBackgroundImage = NULL; // Clear out the BG image.
CBrush faceBrush(m_BackgroundColor); // (::GetSysColor(m_bHasFocus? COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION));
if (m_BackgroundImageURL != "")
{
// There's a background that needs to be drawn.
m_pBackgroundImage = LookupImage(m_BackgroundImageURL, NULL);
}
if (m_pBackgroundImage && m_pBackgroundImage->FrameSuccessfullyLoaded())
{
// Draw the strip of the background image that should be placed
// underneath this line.
PaintBackground(dc.m_hDC, rect, m_pBackgroundImage);
}
else
{
dc.FillRect(&rect, &faceBrush);
}
HPALETTE pOldPalette = NULL;
if (sysInfo.m_iBitsPerPixel < 16 && (::GetDeviceCaps(dc.m_hDC, RASTERCAPS) & RC_PALETTE))
{
@ -135,10 +123,56 @@ void CNavTitleBar::OnPaint( )
// Find the nearest match in our palette for our colors.
ResolveToPaletteColor(m_BackgroundColor, hPalette);
ResolveToPaletteColor(m_ForegroundColor, hPalette);
ResolveToPaletteColor(m_ControlStripBackgroundColor, hPalette);
ResolveToPaletteColor(m_ControlStripForegroundColor, hPalette);
}
// Draw the text.
//HFONT font = WFE_GetUIFont(dc.m_hDC);
CRect controlStripRect(rect);
CRect titleBarRect(rect);
controlStripRect.bottom = NAVBAR_CONTROLSTRIP_HEIGHT;
titleBarRect.top = NAVBAR_CONTROLSTRIP_HEIGHT;
titleBarRect.bottom = NAVBAR_TOTAL_HEIGHT;
CBrush faceBrush(m_BackgroundColor);
if (m_BackgroundImageURL != "")
{
// There's a background that needs to be drawn.
m_pBackgroundImage = LookupImage(m_BackgroundImageURL, NULL);
}
if (m_pBackgroundImage && m_pBackgroundImage->FrameSuccessfullyLoaded())
{
// Draw the strip of the background image that should be placed
// underneath this line.
PaintBackground(dc.m_hDC, titleBarRect, m_pBackgroundImage);
}
else
{
dc.FillRect(&titleBarRect, &faceBrush);
}
CBrush controlStripFaceBrush(m_ControlStripBackgroundColor);
if (m_ControlStripBackgroundImageURL != "")
{
// There's a background that needs to be drawn.
m_pControlStripBackgroundImage = LookupImage(m_ControlStripBackgroundImageURL, NULL);
}
if (m_pControlStripBackgroundImage && m_pControlStripBackgroundImage->FrameSuccessfullyLoaded())
{
// Draw the strip of the background image that should be placed
// underneath this line.
PaintBackground(dc.m_hDC, controlStripRect, m_pControlStripBackgroundImage);
}
else
{
dc.FillRect(&controlStripRect, &controlStripFaceBrush);
}
// Draw the title strip text.
CString titleText(HT_GetNodeName(HT_TopNode(m_View)));
CFont arialFont;
LOGFONT lf;
XP_MEMSET(&lf,0,sizeof(LOGFONT));
@ -149,19 +183,19 @@ void CNavTitleBar::OnPaint( )
HFONT font = (HFONT)arialFont.GetSafeHandle();
HFONT hOldFont = (HFONT)::SelectObject(dc.m_hDC, font);
CRect sizeRect(0,0,10000,0);
CRect sizeRect(titleBarRect);
int height = ::DrawText(dc.m_hDC, titleText, titleText.GetLength(), &sizeRect, DT_CALCRECT | DT_WORDBREAK);
if (sizeRect.Width() > rect.Width() - NAVBAR_CLOSEBOX - 9)
if (sizeRect.Width() > rect.Width() - 9)
{
// Don't write into the close box area!
sizeRect.right = sizeRect.left + (rect.Width() - NAVBAR_CLOSEBOX - 9);
sizeRect.right = sizeRect.left + (rect.Width() - 9);
}
sizeRect.left += 4; // indent slightly horizontally
sizeRect.right += 4;
// Center the text vertically.
sizeRect.top = (rect.Height() - height) / 2;
sizeRect.top = NAVBAR_CONTROLSTRIP_HEIGHT + (titleBarRect.Height() - height) / 2;
sizeRect.bottom = sizeRect.top + height;
// Draw the text
@ -173,23 +207,77 @@ void CNavTitleBar::OnPaint( )
oldColor = dc.SetTextColor(m_ForegroundColor);
dc.DrawText((LPCSTR)titleText, -1, &sizeRect, nFormat);
// Draw the control strip text.
CString modeText("details");
HT_GetTemplateData(topNode, gNavCenter->controlStripModeText, HT_COLUMN_STRING, &data);
if (data)
modeText = (char*)data;
CFont smallArialFont;
LOGFONT lf2;
XP_MEMSET(&lf2,0,sizeof(LOGFONT));
lf2.lfHeight = 90;
lf2.lfWeight = 400;
strcpy(lf2.lfFaceName, "Arial");
smallArialFont.CreatePointFontIndirect(&lf2, &dc);
HFONT smallFont = (HFONT)smallArialFont.GetSafeHandle();
::SelectObject(dc.m_hDC, smallFont);
CRect modeRect(controlStripRect);
int smallHeight = ::DrawText(dc.m_hDC, modeText, modeText.GetLength(), &modeRect, DT_CALCRECT | DT_WORDBREAK);
if (modeRect.Width() > rect.Width() - 9)
{
// Don't write into the close box area!
modeRect.right = modeRect.left + (rect.Width() - 9);
}
modeRect.left += 4; // indent slightly horizontally
modeRect.right += 4;
// Center the text vertically.
modeRect.top = (controlStripRect.Height() - smallHeight) / 2;
modeRect.bottom = modeRect.top + smallHeight;
// Cache the rect
cachedModeRect.top = 0;
cachedModeRect.left = 0;
cachedModeRect.bottom = NAVBAR_CONTROLSTRIP_HEIGHT;
cachedModeRect.right = modeRect.right;
// Now compute the close box rect.
CString closeText("close");
HT_GetTemplateData(topNode, gNavCenter->controlStripCloseText, HT_COLUMN_STRING, &data);
if (data)
closeText = (char*)data;
CRect closeRect(controlStripRect);
::DrawText(dc.m_hDC, closeText, closeText.GetLength(), &closeRect, DT_CALCRECT | DT_WORDBREAK);
int closeWidth = closeRect.Width();
closeRect.right = rect.right - 4;
closeRect.left = closeRect.right - closeWidth;
// Center the text vertically.
closeRect.top = modeRect.top;
closeRect.bottom = modeRect.bottom;
// Cache the rect
cachedCloseRect.top = 0;
cachedCloseRect.left = 0;
cachedCloseRect.bottom = NAVBAR_CONTROLSTRIP_HEIGHT;
cachedCloseRect.right = closeRect.right;
// Draw the text
dc.SetTextColor(m_ControlStripForegroundColor);
dc.DrawText((LPCSTR)closeText, -1, &closeRect, nFormat);
dc.DrawText((LPCSTR)modeText, -1, &modeRect, nFormat);
dc.SetTextColor(oldColor);
dc.SetBkMode(nOldBkMode);
int top = rect.top + (rect.Height() - NAVBAR_CLOSEBOX)/2;
int left = rect.right - (3*(NAVBAR_CLOSEBOX+1)) - 4;
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);
::SelectObject(dc.m_hDC, hOldFont);
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 CNavTitleBar::OnCreate(LPCREATESTRUCT lpCreateStruct)
@ -199,38 +287,19 @@ int CNavTitleBar::OnCreate(LPCREATESTRUCT lpCreateStruct)
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;
GetClientRect(&rect);
// Called when the user clicks on us. Start a drag, switch modes, or close the view.
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 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))
if (cachedCloseRect.PtInRect(point))
{
// Destroy the window.
CFrameWnd* pFrameWnd = GetParentFrame();
if (pFrameWnd->IsKindOf(RUNTIME_CLASS(CNSNavFrame)))
((CNSNavFrame*)pFrameWnd)->DeleteNavCenter();
}
else if (modeBoxRect.PtInRect(point))
else if (cachedModeRect.PtInRect(point))
{
CRDFOutliner* pOutliner = (CRDFOutliner*)HT_GetViewFEData(m_View);
pOutliner->SetNavigationMode(!pOutliner->InNavigationMode());
}
else if (sortBoxRect.PtInRect(point))
{
HT_ToggleTreeMode(m_View);
}
else
{
@ -259,6 +328,9 @@ void CNavTitleBar::OnMouseMove(UINT nFlags, CPoint point)
navFrameParent->StartDrag(point);
}
}
else
{
}
}
void CNavTitleBar::OnLButtonUp(UINT nFlags, CPoint point)
@ -276,15 +348,6 @@ void CNavTitleBar::OnSize( UINT nType, int cx, int cy )
void CNavTitleBar::SetHTView(HT_View view)
{
titleText = "";
m_View = view;
if (view)
{
HT_Resource r = HT_TopNode(view);
if (r)
{
titleText = HT_GetNodeName(r);
}
Invalidate();
}
Invalidate();
}

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

@ -22,15 +22,21 @@
#include "htrdf.h"
#include "usertlbr.h"
#define NAVBAR_HEIGHT 23
#define NAVBAR_CONTROLSTRIP_HEIGHT 18
#define NAVBAR_TITLEBAR_HEIGHT 23
#define NAVBAR_TOTAL_HEIGHT 41
#define NAVBAR_CLOSEBOX 16
class CNavTitleBar : public CWnd, public CCustomImageObject
{
BOOL m_bHasFocus; // Determines what colors to use for the caption
BOOL m_bHasFocus; // Determines what colors to use for the caption (OBSOLETE)
CPoint m_PointHit; // MouseDown tracking
CString titleText; // Name of the current workspace
COLORREF m_ControlStripForegroundColor;
COLORREF m_ControlStripBackgroundColor;
CString m_ControlStripBackgroundImageURL;
CRDFImage* m_pControlStripBackgroundImage;
COLORREF m_ForegroundColor;
COLORREF m_BackgroundColor;
@ -38,6 +44,11 @@ class CNavTitleBar : public CWnd, public CCustomImageObject
CRDFImage* m_pBackgroundImage;
HT_View m_View; // The current HT_View.
BOOL m_bShowTitleText;
CRect cachedCloseRect;
CRect cachedModeRect;
public:
CNavTitleBar();
~CNavTitleBar();

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

@ -21,15 +21,6 @@
#include "usertlbr.h"
// Window Control IDs for NavCenter.
// Improves findability.
#define NC_IDW(ID) (AFX_IDW_PANE_LAST - (ID))
#define NC_IDW_MISCVIEW NC_IDW(0)
#define NC_IDW_SELECTOR NC_IDW(1)
#define NC_IDW_OUTLINER NC_IDW(2)
#define NC_IDW_HTMLPANE NC_IDW(3)
#define NC_IDW_DRAGEDGE NC_IDW(5)
#define NC_IDW_NAVMENU NC_IDW(6)
#define ICONXPOS 5

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

@ -57,7 +57,6 @@ BEGIN_MESSAGE_MAP(CNSNavFrame, CFrameWnd)
ON_WM_LBUTTONUP()
ON_MESSAGE(WM_SIZEPARENT, OnSizeParent)
ON_WM_CLOSE()
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
#define MFS_MOVEFRAME 0x00000800L // no sizing, just moving
@ -72,7 +71,6 @@ END_MESSAGE_MAP()
CNSNavFrame::CNSNavFrame()
{
m_pSelector = NULL;
m_nsContent= NULL;
m_bDragging = FALSE;
m_DragWnd = NULL;
@ -82,17 +80,24 @@ CNSNavFrame::CNSNavFrame()
CNSNavFrame::~CNSNavFrame()
{
if (m_dwOverDockStyle != DOCKSTYLE_FLOATING)
if (m_dwOverDockStyle == DOCKSTYLE_DOCKEDLEFT)
{
PREF_SetIntPref(gPrefDockPercentage, m_DockSize);
PREF_SetIntPref(gPrefDockOrientation, m_dwOverDockStyle);
}
else
else if (m_dwOverDockStyle == DOCKSTYLE_FLOATING)
{
PREF_SetRectPref(gPrefFloatRect, (int16)m_rectFloat.left, (int16)m_rectFloat.top, (int16)m_rectFloat.right, (int16)m_rectFloat.bottom);
}
}
// delete m_pNavTitle;
void CNSNavFrame::OnClose()
{
if (m_dwOverDockStyle == DOCKSTYLE_FLOATING)
{
GetWindowRect(&m_rectFloat);
}
CFrameWnd::OnClose();
}
void CNSNavFrame::UpdateTitleBar(HT_View pView)
@ -104,12 +109,6 @@ void CNSNavFrame::UpdateTitleBar(HT_View pView)
SetWindowText(title);
}
void CNSNavFrame::OnClose( )
{
CFrameWnd::OnClose();
}
int CNSNavFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
#ifdef XP_WIN32
@ -135,6 +134,8 @@ int CNSNavFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
//------------------------------------------------------------------------
void CNSNavFrame::CreateNewNavCenter(CNSGenFrame* pParentFrame, BOOL useViewType, HT_ViewType viewType)
{
// OBSOLETE: WILL GO AWAY SOON
// Read in our float rect pref.
int16 left,right,top, bottom;
PREF_GetRectPref(gPrefFloatRect,&left, &top, &right, &bottom);
@ -155,8 +156,7 @@ void CNSNavFrame::CreateNewNavCenter(CNSGenFrame* pParentFrame, BOOL useViewType
m_DockSize = (int)width;
// Read in our dockstyle
m_dwOverDockStyle = DOCKSTYLE_VERTLEFT;
PREF_GetIntPref(gPrefDockOrientation, &m_dwOverDockStyle);
m_dwOverDockStyle = DOCKSTYLE_DOCKEDLEFT;
// Find out if a view should be displayed
@ -171,9 +171,6 @@ void CNSNavFrame::CreateNewNavCenter(CNSGenFrame* pParentFrame, BOOL useViewType
m_dwOverDockStyle = DOCKSTYLE_FLOATING;
}
// Put the selector buttons into the pane.
m_pSelector->PopulatePane();
// Show the window.
ShowWindow(SW_SHOW);
@ -199,6 +196,11 @@ void CNSNavFrame::DeleteNavCenter()
PostMessage(WM_CLOSE);
UnhookFromButton();
}
void CNSNavFrame::UnhookFromButton()
{
if (m_pButton)
{
m_pButton->SetDepressed(FALSE);
@ -211,24 +213,6 @@ void CNSNavFrame::DeleteNavCenter()
BOOL CNSNavFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
/*
m_nsContent = new CRDFContentView();
m_pSelector = new CSelector(m_nsContent);
m_pNavTitle = new CNavTitleBar();
CRect rect1;
rect1.left = rect1.top = 0;
rect1.right = MIN_CATEGORY_WIDTH;
rect1.bottom = 1;
m_pSelector->Create( NULL, "", WS_CHILD | WS_VISIBLE, rect1,
this, NC_IDW_SELECTOR, pContext );
rect1.right = rect1.bottom = 1;
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_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()));
@ -246,77 +230,30 @@ BOOL CNSNavFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
PREF_GetIntPref(gPrefDockPercentage, &width);
m_DockSize = (int)width;
// Read in our dockstyle
m_dwOverDockStyle = DOCKSTYLE_VERTLEFT;
PREF_GetIntPref(gPrefDockOrientation, &m_dwOverDockStyle);
return TRUE;
}
void CNSNavFrame::OnSize( UINT nType, int cx, int cy )
{
if(GetHTPane() && !XP_IsNavCenterDocked(GetHTPane()))
if(m_dwOverDockStyle == DOCKSTYLE_FLOATING)
{
// Make sure our float rect always matches our size when floating.
GetWindowRect(&m_rectFloat);
PREF_SetRectPref(gPrefFloatRect, (int16)m_rectFloat.left, (int16)m_rectFloat.top, (int16)m_rectFloat.right, (int16)m_rectFloat.bottom);
}
else
else if (m_dwOverDockStyle == DOCKSTYLE_DOCKEDLEFT)
{
// Recompute our docked percentage if the tree is visible
CRect rect;
GetClientRect(&rect);
if (IsTreeVisible())
{
CalcClientArea(&m_parentRect);
if (m_dwOverDockStyle == DOCKSTYLE_VERTLEFT || m_dwOverDockStyle == DOCKSTYLE_VERTRIGHT)
m_DockWidth = m_DockSize = rect.Width();
else m_DockHeight = m_DockSize = rect.Height();
}
CalcClientArea(&m_parentRect);
m_DockWidth = m_DockSize = rect.Width();
PREF_SetIntPref(gPrefDockPercentage, m_DockSize);
}
int top = 0;
if (m_dwOverDockStyle == DOCKSTYLE_FLOATING || m_dwOverDockStyle == DOCKSTYLE_VERTLEFT ||
m_dwOverDockStyle == DOCKSTYLE_VERTRIGHT)
{
CRect tempRect;
// We want to handle the redraw ourself to reduce the flickering.
/* 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)
{
int orgHeight = tempRect.Height();
tempRect.top = tempRect.bottom;
tempRect.bottom = tempRect.top + (cy - orgHeight);
MapWindowPoints(m_pSelector, &tempRect);
m_pSelector->InvalidateRect( &tempRect, TRUE);
}
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.
CRect tempRect;
m_pSelector->GetClientRect(&tempRect);
m_pSelector->MapWindowPoints( this, &tempRect);
m_pSelector->SetWindowPos( NULL, STARTX, top, cx - STARTX, MIN_CATEGORY_HEIGHT, SWP_NOREPOSITION | SWP_NOREDRAW);
if ((tempRect.Width()) < cx - STARTX) {
int orgWidth = tempRect.Width();
tempRect.right = tempRect.left;
tempRect.right = tempRect.left + (cx - orgWidth);
MapWindowPoints(m_pSelector, &tempRect);
m_pSelector->InvalidateRect( &tempRect, FALSE);
}
m_nsContent->SetWindowPos( NULL, STARTX, MIN_CATEGORY_HEIGHT + 2 ,
cx - STARTX, cy - MIN_CATEGORY_HEIGHT, SWP_NOREPOSITION | SWP_NOREDRAW);
}
ShowWindow(SW_SHOW);
if (m_DragWnd && IsTreeVisible())
m_DragWnd->ShowWindow(SW_SHOW);
CRect tempRect;
m_nsContent->SetWindowPos(NULL, 0, 0, cx, cy, 0);
}
BOOL CNSNavFrame::PreCreateWindow(CREATESTRUCT & cs)
@ -332,17 +269,54 @@ CNSNavFrame* CNSNavFrame::CreateFramedRDFViewFromResource(CWnd* pParent, int xPo
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);
pNavFrame->ShowWindow(SW_HIDE);
HT_View view = HT_GetSelectedView(pNavFrame->GetHTPane());
CRDFOutliner* pOutliner = (CRDFOutliner*)(pNavFrame->GetContentView()->GetOutlinerParent()->GetOutliner());
pOutliner->SetIsPopup(TRUE);
// Display in the appropriate spot depending on our tree state (docked, standalone, or popup)
CString treeState = HT_GetTreeStateForButton(node);
if (treeState == "Popup" || treeState == "popup")
{
// Actually appear at the specified position and set the popup flag to be true.
pNavFrame->SetDockStyle(DOCKSTYLE_POPUP);
pNavFrame->SetWindowPos(&wndTopMost, xPos, yPos, width, height, 0);
pNavFrame->ShowWindow(SW_SHOW);
pOutliner->SetIsPopup(TRUE);
}
else if (treeState == "Docked" || treeState == "docked")
{
// We're supposed to come up docked to the window. Call DockFrame after setting
// the correct dock style
pNavFrame->SetDockStyle(DOCKSTYLE_DOCKEDLEFT);
// Use the toolbar button to get to the top-level frame.
CRDFToolbarButton* pButton = (CRDFToolbarButton*)HT_GetNodeFEData(node);
CFrameWnd* pBaseWnd = pButton->GetTopLevelFrame();
if(pBaseWnd && pBaseWnd->IsKindOf(RUNTIME_CLASS(CNSGenFrame)))
{
CNSGenFrame* pFrame = (CNSGenFrame *)pBaseWnd;
pNavFrame->DockFrame(pFrame, DOCKSTYLE_DOCKEDLEFT);
}
else pNavFrame->DeleteNavCenter(); // Somehow couldn't find the window. Should never happen.
}
/*else if (treeState == "Standalone" || treeState == "standalone")
{
pNavFrame->SetDockStyle(DOCKSTYLE_FLOATING);
pNavFrame->MoveWindow(pNavFrame->GetFloatRect());
pNavFrame->ForceFloat(TRUE);
}*/
pOutliner->SetFocus();
pNavFrame->ShowWindow(SW_SHOW);
return pNavFrame;
}
@ -406,8 +380,7 @@ void CNSNavFrame::Move(CPoint pt) // called when mouse has moved
short dwOverDockStyle = CanDock(pt);
m_dockingDragRect = m_parentRect;
if (dwOverDockStyle == DOCKSTYLE_VERTLEFT ||
dwOverDockStyle == DOCKSTYLE_VERTRIGHT)
if (dwOverDockStyle == DOCKSTYLE_DOCKEDLEFT)
{
int height = m_dockingDragRect.Height();
m_dockingDragRect.right = m_dockingDragRect.left + m_DockWidth;
@ -417,12 +390,6 @@ void CNSNavFrame::Move(CPoint pt) // called when mouse has moved
m_dockingDragRect.top = pt.y - yOffset;
m_dockingDragRect.bottom = m_dockingDragRect.top + height;
}
else if (dwOverDockStyle == DOCKSTYLE_HORZTOP ||
dwOverDockStyle == DOCKSTYLE_HORZBOTTOM)
{
m_dockingDragRect.top = pt.y - (int)m_DockHeight;
m_dockingDragRect.bottom = m_dockingDragRect.top + m_DockHeight;
}
else
{
int height = m_rectDrag.Height();
@ -554,32 +521,12 @@ void CNSNavFrame::ForceFloat(BOOL show)
if (pLayout)
pLayout->RecalcLayout();
// Select a new view if we were formerly collapsed.
if (m_pSelector && m_pSelector->GetCurrentButton() == NULL)
m_pSelector->SelectNthView(0);
/*
if (show)
{
m_nsContent->ShowWindow(SW_SHOW);
m_nsContent->CalcChildSizes();
}
*/
}
void CNSNavFrame::ComputeDockingSizes()
{
if (IsTreeVisible())
{
m_DockWidth = m_DockSize + 1; // Not sure what the error is here yet.
m_DockHeight = m_DockSize + 1;
}
else
{
m_DockWidth = MIN_CATEGORY_WIDTH;
m_DockHeight = MIN_CATEGORY_HEIGHT;
}
m_DockWidth = m_DockSize + 1; // Not sure what the error is here yet.
m_DockHeight = m_DockSize + 1;
}
@ -611,11 +558,14 @@ void CNSNavFrame::DockFrame(CNSGenFrame* pParent, short dockStyle)
}
}
// Notify HT of our new state.
HT_SetTreeStateForButton(HT_TopNode(HT_GetSelectedView(GetHTPane())), "Docked");
CRect rect = m_dockingDragRect;
// Hide the window before we move it.
m_dwOverDockStyle = dockStyle;
if (m_dwOverDockStyle == DOCKSTYLE_VERTLEFT || m_dwOverDockStyle == DOCKSTYLE_VERTRIGHT)
if (m_dwOverDockStyle == DOCKSTYLE_DOCKEDLEFT)
{
GetDesktopWindow()->MapWindowPoints( pView, &rect );
@ -651,35 +601,20 @@ void CNSNavFrame::DockFrame(CNSGenFrame* pParent, short dockStyle)
// Figure out the correct location to display the resize bar.
CRect dragBarRect(rect);
if (m_dwOverDockStyle == DOCKSTYLE_VERTLEFT) {
if (m_dwOverDockStyle == DOCKSTYLE_DOCKEDLEFT)
{
dragBarRect.left = rect.right;
dragBarRect.right = dragBarRect.left+ DRAGWIDTH;
}
else if (m_dwOverDockStyle == DOCKSTYLE_VERTRIGHT) {
dragBarRect.right = rect.left;
dragBarRect.left = dragBarRect.right - DRAGWIDTH;
}
else if (m_dwOverDockStyle == DOCKSTYLE_HORZTOP) {
dragBarRect.top = rect.bottom;
dragBarRect.bottom = dragBarRect.top + DRAGWIDTH;
}
else if (m_dwOverDockStyle == DOCKSTYLE_HORZBOTTOM) {
dragBarRect.bottom = rect.top;
dragBarRect.top = dragBarRect.bottom - DRAGWIDTH;
}
if (!m_DragWnd) {
if (!m_DragWnd)
{
m_DragWnd = new CDragBar(dragBarRect, this);
#ifdef XP_WIN32
m_DragWnd->CreateEx(0, NULL, "GridEdge", WS_CHILD | WS_VISIBLE,
dragBarRect.left, dragBarRect.top,
dragBarRect.right - dragBarRect.left,
dragBarRect.bottom - dragBarRect.top,
GetParentFrame()->GetSafeHwnd(), (HMENU)NC_IDW_DRAGEDGE, NULL);
#else
m_DragWnd->Create(0, "GridEdge", WS_CHILD | WS_VISIBLE,
dragBarRect,
GetParentFrame(), NC_IDW_DRAGEDGE);
#endif
}
// If we are not yet docked
m_DragWnd->SetOrientation(m_dwOverDockStyle);
@ -709,8 +644,7 @@ void CNSNavFrame::EndDrag(CPoint pt) // drop
CRect rect;
CRect parentRect;
if (dwOverDockStyle == DOCKSTYLE_VERTLEFT || dwOverDockStyle == DOCKSTYLE_VERTRIGHT ||
dwOverDockStyle == DOCKSTYLE_HORZTOP || dwOverDockStyle == DOCKSTYLE_HORZBOTTOM)
if (dwOverDockStyle == DOCKSTYLE_DOCKEDLEFT)
{
CNSGenFrame* pFrame = NULL;
CFrameGlue *pGlue = CFrameGlue::GetLastActiveFrame(MWContextBrowser, FEU_FINDBROWSERANDEDITOR);
@ -728,15 +662,7 @@ void CNSNavFrame::EndDrag(CPoint pt) // drop
MoveWindow( m_rectDrag);
// 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;
}
UnhookFromButton();
}
ShowWindow(SW_SHOW);
@ -804,23 +730,18 @@ void CNSNavFrame::DrawFocusRect(short dwOverDockStyle, BOOL bRemoveRect)
CRect rect;
CBrush* pWhiteBrush = CBrush::FromHandle((HBRUSH)::GetStockObject(WHITE_BRUSH));
CBrush* pBrush = pWhiteBrush;
if (dwOverDockStyle == DOCKSTYLE_HORZTOP || dwOverDockStyle == DOCKSTYLE_HORZBOTTOM) {
if (dwOverDockStyle == DOCKSTYLE_DOCKEDLEFT)
{
rect = m_dockingDragRect;
}
else if (dwOverDockStyle == DOCKSTYLE_VERTLEFT || dwOverDockStyle == DOCKSTYLE_VERTRIGHT) {
rect = m_dockingDragRect;
}
else {
else
{
rect = m_rectDrag;
}
if (bRemoveRect)
size.cx = size.cy = 0;
#ifdef XP_WIN32
CBrush* pDitherBrush = CDC::GetHalftoneBrush();
#else
CBrush* pDitherBrush = CBrush::FromHandle((HBRUSH)::GetStockObject(GRAY_BRUSH));
#endif
// draw it and remember last size
WFE_DrawDragRect(m_pDC, &rect, size, &m_rectLast, m_sizeLast,
@ -862,16 +783,7 @@ short CNSNavFrame::CanDock(CPoint pt, BOOL mapDesktop)
if (m_parentRect.PtInRect(pt)) {
if ((pt.x < (m_parentRect.left +m_DockWidth)) &&
pt.x > m_parentRect.left)
dockStyle = DOCKSTYLE_VERTLEFT;
// else if (( pt.x > (m_parentRect.right - m_DockWidth)) &&
// pt.x < m_parentRect.right)
// dockStyle = DOCKSTYLE_VERTRIGHT;
// else if ((pt.y < (m_parentRect.top +m_DockHeight)) &&
// pt.y > m_parentRect.top)
// dockStyle = DOCKSTYLE_HORZTOP;
// else if (( pt.y > (m_parentRect.bottom - m_DockHeight)) &&
// pt.y < m_parentRect.bottom)
// dockStyle = DOCKSTYLE_HORZBOTTOM;
dockStyle = DOCKSTYLE_DOCKEDLEFT;
}
}
else {
@ -954,34 +866,26 @@ LRESULT CNSNavFrame::OnSizeParent(WPARAM, LPARAM lParam)
CRect dragRect(resizeRect);
if (m_dwOverDockStyle == DOCKSTYLE_VERTLEFT) {
//dragRect.top += 10;
//dragRect.bottom -= 10;
if (m_dwOverDockStyle == DOCKSTYLE_DOCKEDLEFT)
{
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);
CWnd* pParent = GetParent();
CRect parentRect;
pParent->GetClientRect(&parentRect);
if (parentRect.Width() < resizeRect.Width() + DRAGWIDTH)
{
resizeRect.right = resizeRect.left + parentRect.Width() - DRAGWIDTH;
}
if (parentRect.Width() < resizeRect.Width() + DRAGWIDTH)
{
resizeRect.right = resizeRect.left + parentRect.Width() - DRAGWIDTH;
}
dragRect.left = resizeRect.right;
dragRect.right = dragRect.left + DRAGWIDTH;
if (IsTreeVisible())
lpLayout->rect.left = resizeRect.right + DRAGWIDTH;
else lpLayout->rect.left = resizeRect.right;
lpLayout->rect.left = resizeRect.right + DRAGWIDTH;
m_DragWnd->SetRect(dragRect);
m_DockWidth = resizeRect.Width();
}
@ -992,8 +896,7 @@ LRESULT CNSNavFrame::OnSizeParent(WPARAM, LPARAM lParam)
resizeRect.bottom - resizeRect.top, SWP_SHOWWINDOW );
m_dockingDragRect = resizeRect;
if (IsTreeVisible())
m_DragWnd->SetWindowPos( &wndBottom, dragRect.left, dragRect.top, dragRect.Width(),
m_DragWnd->SetWindowPos( &wndBottom, dragRect.left, dragRect.top, dragRect.Width(),
dragRect.Height(), SWP_SHOWWINDOW );
}
@ -1008,152 +911,7 @@ static void FillSolidRect(HDC hdc, RECT* rect, COLORREF clr)
}
//------------------------------------------------------------------------------
// void CNSNavFrame::OnPaint( )
//
// This function is used to paint the background on CNSNavFrame
//------------------------------------------------------------------------------
void CNSNavFrame::OnPaint( )
{
CRect rect;
GetClientRect(&rect);
CDC* pDC = GetDC();
HDC hdc = pDC->GetSafeHdc();
CRect rect1;
CRgn pRgn;
HBRUSH hBr = ::CreateSolidBrush((COLORREF)GetSysColor(COLOR_3DSHADOW));
HPEN hPen = ::CreatePen(PS_SOLID, 1,(COLORREF)GetSysColor(COLOR_3DLIGHT));
HPEN hOldPen;
hOldPen = (HPEN)::SelectObject(hdc, hPen);
if (m_dwOverDockStyle == DOCKSTYLE_FLOATING ||
m_dwOverDockStyle == DOCKSTYLE_VERTLEFT ||
m_dwOverDockStyle == DOCKSTYLE_VERTRIGHT) {
// paint the div line between selector pane and content pane.
rect1 = rect;
rect1.left = rect.left + MIN_CATEGORY_WIDTH;
rect1.right = rect1.left + 2;
::FillRect(hdc, &rect1, hBr);
::SelectObject(hdc, (HPEN)::GetStockObject(WHITE_PEN));
::MoveToEx(hdc, rect1.left+1, rect1.top, NULL);
::LineTo(hdc, rect1.left+1, rect1.bottom);
}
else {
// paint the div line between selector pane and content pane.
rect1 = rect;
rect1.top = rect.top + MIN_CATEGORY_HEIGHT;
rect1.bottom = rect1.top + 2;
::FillRect(hdc, &rect1, hBr);
::SelectObject(hdc, (HPEN)::GetStockObject(WHITE_PEN));
::MoveToEx(hdc, rect1.left, rect1.top+1, NULL);
::LineTo(hdc, rect1.right, rect1.top+1);
}
::SelectObject(hdc, hOldPen);
VERIFY(::DeleteObject(hPen));
VERIFY(::DeleteObject(hBr));
ReleaseDC(pDC);
CFrameWnd::OnPaint();
}
void CNSNavFrame::CollapseWindow()
{
if (m_dwOverDockStyle == DOCKSTYLE_FLOATING) {
// Handle floating window differently. Floating window does not have
// m_DragWnd and m_pParent.
}
else
{
// Move m_DragWnd when we want to collapse docking window.
CRect tempRect;
GetWindowRect(&tempRect);;
CRect dragBox;
m_DragWnd->GetRect(dragBox);
if (m_dwOverDockStyle == DOCKSTYLE_HORZTOP)
{
dragBox.top -= (tempRect.Height() - MIN_CATEGORY_HEIGHT - DRAGWIDTH);
dragBox.bottom = dragBox.top + DRAGWIDTH;
}
else if (m_dwOverDockStyle == DOCKSTYLE_HORZBOTTOM)
{
dragBox.top += (tempRect.Height() - MIN_CATEGORY_HEIGHT - DRAGWIDTH);
dragBox.bottom = dragBox.top + DRAGWIDTH;
}
else if (m_dwOverDockStyle == DOCKSTYLE_VERTLEFT)
{
dragBox.left -= (tempRect.Width() - MIN_CATEGORY_WIDTH);
dragBox.right = dragBox.left + DRAGWIDTH;
}
else
{
// docked to the right
dragBox.left += (tempRect.Width() - MIN_CATEGORY_WIDTH - DRAGWIDTH);
dragBox.right += dragBox.left + DRAGWIDTH;
}
m_pSelector->UnSelectAll();
if (GetParentFrame())
{
m_DragWnd->SetRect(dragBox);
m_DragWnd->MoveWindow(dragBox);
m_DragWnd->ShowWindow(SW_HIDE);
GetParentFrame()->RecalcLayout();
}
}
}
void CNSNavFrame::ExpandWindow()
{
if (m_dwOverDockStyle == DOCKSTYLE_FLOATING) {
// Handle floating window differently. Floating window does not have
// m_DragWnd and m_pParent.
}
else { // Move m_DragWnd when we want to expand docking window.
ComputeDockingSizes();
CRect tempRect;
GetClientRect(&tempRect);;
CRect dragBox;
m_DragWnd->GetRect(dragBox);
int step = 0;
if (m_dwOverDockStyle == DOCKSTYLE_HORZTOP || m_dwOverDockStyle == DOCKSTYLE_HORZBOTTOM)
step = m_DockHeight - MIN_CATEGORY_HEIGHT;
else
step = m_DockWidth - MIN_CATEGORY_WIDTH;
if (m_dwOverDockStyle == DOCKSTYLE_HORZTOP)
{
dragBox.top += step;
dragBox.bottom = dragBox.top + DRAGWIDTH;
}
else if (m_dwOverDockStyle == DOCKSTYLE_HORZBOTTOM) {
dragBox.bottom -= step;
dragBox.top = dragBox.bottom - DRAGWIDTH;
}
else if (m_dwOverDockStyle == DOCKSTYLE_VERTLEFT) {
dragBox.left += step;
dragBox.right = dragBox.left + DRAGWIDTH;
}
else if (m_dwOverDockStyle == DOCKSTYLE_VERTRIGHT) {
dragBox.right -= step;
dragBox.left = dragBox.right - DRAGWIDTH;
}
if (GetParentFrame()) {
m_DragWnd->ShowWindow(SW_HIDE);
m_DragWnd->SetRect(dragBox);
m_DragWnd->MoveWindow(dragBox);
GetParentFrame()->RecalcLayout();
}
}
}
/////////////////////////////////////////////////////////////////////////////
// CNSNavFrame diagnostics

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

@ -22,10 +22,19 @@
#ifndef NAVFRAM
#define NAVFRAM
#include "navbar.h"
#include "navcntr.h"
#include "navcontv.h"
#include "genframe.h"
#include "dragbar.h"
#include "rdfliner.h"
// Window Control IDs for NavCenter.
// Improves findability.
#define NC_IDW(ID) (AFX_IDW_PANE_LAST - (ID))
#define NC_IDW_MISCVIEW NC_IDW(0)
#define NC_IDW_SELECTOR NC_IDW(1)
#define NC_IDW_OUTLINER NC_IDW(2)
#define NC_IDW_HTMLPANE NC_IDW(3)
#define NC_IDW_DRAGEDGE NC_IDW(5)
#define NC_IDW_NAVMENU NC_IDW(6)
#ifdef XP_WIN32
#define EXPAND_STEP 10
@ -43,21 +52,19 @@
#define NAVFRAME_WIDTH 300
#define NAVFRAME_HEIGHT 480
#define DOCKSTYLE_FLOATING 0
#define DOCKSTYLE_VERTLEFT 1
#define DOCKSTYLE_VERTRIGHT 2
#define DOCKSTYLE_HORZTOP 3
#define DOCKSTYLE_HORZBOTTOM 4
#define DOCKSTYLE_DOCKEDLEFT 1
#define DOCKSTYLE_POPUP 2
// This is a CFrameWnd window that knows how to dock and float. This
// frame comtains 2 panes. The left pane is for the selector. The right pane is to
// display the content for the selector.
static CString gPrefDockOrientation = "browser.navcenter.dockstyle";
static CString gPrefDockPercentage = "browser.navcenter.docked.tree.width";
static CString gPrefFloatRect = "browser.navcenter.floating.rect";
static CString gPrefSelectorVisible = "browser.navcenter.docked.selector.visible";
BOOL nsModifyStyle(HWND hWnd, int nStyleOffset,DWORD dwRemove, DWORD dwAdd, UINT nFlags = 0);
class CRDFContentView;
class CNSNavFrame : public CFrameWnd
{
friend class CDragBar;
@ -102,23 +109,22 @@ public:
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);
CRect GetFloatRect() { return m_rectFloat; }
public:
HT_Pane GetHTPane();
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; }
void UnhookFromButton();
protected: // control bar embedded members
friend class CSelector;
BOOL m_bDragging; // TRUE if we are dragging this FRAME
BOOL m_bDitherLast; //
int32 m_dwOverDockStyle; // The orientation
@ -141,15 +147,12 @@ protected: // control bar embedded members
int m_DockWidth, m_DockHeight, m_DockSize; // Used to determine docking sizes.
int m_nXOffset, m_nYOffset;
CSelector* m_pSelector; // the selector pane.
CRDFContentView *m_nsContent; // the content pane.
CNavTitleBar* m_pNavTitle; // the embedded title strip.
// Generated message map functions
protected:
void CNSNavFrame::CalcClientArea(RECT* lpRectClient, CNSGenFrame * pParentFrame = NULL);
void CNSNavFrame::DockFrame(CNSGenFrame* pParent, short dockStyle);
afx_msg void OnPaint();
//{{AFX_MSG(CNSNavFrame)
virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext);
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);

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

@ -20,7 +20,7 @@
#include "netsvw.h"
#include "xp_ncent.h"
#include "pain.h"
#include "navcntr.h"
#include "navfram.h"
CPaneCX *wfe_CreateNavCenterHTMLPain(HWND hParent)
{

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

@ -208,7 +208,7 @@ CRDFOutliner::CRDFOutliner (CRDFOutlinerParent* theParent, HT_Pane thePane, HT_V
: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_NavTitleBar(NULL), m_bInNavigationMode(FALSE), m_bIsPopup(FALSE)
m_bDataSourceInWindow(FALSE), m_NavTitleBar(NULL), m_bIsPopup(FALSE)
{
ApiApiPtr(api);
m_pUnkUserImage = api->CreateClassInstance(APICLASS_IMAGEMAP,NULL,(APISIGNATURE)IDB_BOOKMARKS);
@ -246,7 +246,11 @@ void CRDFOutliner::OnSize( UINT nType, int cx, int cy )
void CRDFOutliner::HandleEvent(HT_Notification ns, HT_Resource n, HT_Event whatHappened)
{
if (whatHappened == HT_EVENT_NODE_OPENCLOSE_CHANGED)
if (whatHappened == HT_EVENT_VIEW_MODECHANGED)
{
ToggleModes();
}
else if (whatHappened == HT_EVENT_NODE_OPENCLOSE_CHANGED)
{
FinishExpansion(HT_GetNodeIndex(m_View, n));
}
@ -909,7 +913,7 @@ void CRDFOutliner::SelectItem(int iSel,int mode,UINT flags)
if (m_bNeedToClear)
{
HT_SetSelection(m_Node);
if (m_bNeedToEdit && !m_bDoubleClick && !m_bUseSingleClick)
if (m_bNeedToEdit && !m_bDoubleClick && m_bUseInlineEditing)
{
CRDFCommandMap& map = m_Parent->GetColumnCommandMap();
@ -1002,14 +1006,26 @@ BOOL CRDFOutliner::IsDocked()
return theFrame->IsChild(this);
}
void CRDFOutliner::SetNavigationMode(BOOL mode)
void CRDFOutliner::ToggleModes()
{
m_bInNavigationMode = mode;
((CRDFOutlinerParent*)GetParent())->EnableHeaders(!m_bInNavigationMode);
void* data;
// Whether or not to show column headers
HT_GetTemplateData(HT_TopNode(m_View), gNavCenter->showColumnHeaders, HT_COLUMN_STRING, &data);
BOOL show = TRUE;
if (data)
{
char* answer = (char*)data;
show = stricmp(answer, "No");
}
((CRDFOutlinerParent*)GetParent())->EnableHeaders(show);
// Need to invalidate the title strip.
CRDFContentView* pView = (CRDFContentView*)(GetParent()->GetParent());
pView->GetTitleBar()->Invalidate();
Invalidate();
}
void CRDFOutliner::OnSelDblClk(int iLine)
@ -1786,57 +1802,28 @@ void CRDFOutliner::OnPaint()
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;
}
// Options for management mode style by default.
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;
m_bUseInlineEditing = TRUE;
m_bUseSelection = TRUE;
// Foreground color
HT_GetNodeData(top, gNavCenter->viewFGColor, HT_COLUMN_STRING, &data);
HT_GetTemplateData(top, gNavCenter->viewFGColor, HT_COLUMN_STRING, &data);
if (data)
WFE_ParseColor((char*)data, &m_ForegroundColor);
// background color
HT_GetNodeData(top, gNavCenter->viewBGColor, HT_COLUMN_STRING, &data);
HT_GetTemplateData(top, gNavCenter->viewBGColor, HT_COLUMN_STRING, &data);
if (data)
WFE_ParseColor((char*)data, &m_BackgroundColor);
HT_GetNodeData(top, gNavCenter->showTreeConnections, HT_COLUMN_STRING, &data);
HT_GetTemplateData(top, gNavCenter->showTreeConnections, HT_COLUMN_STRING, &data);
if (data)
{
CString answer((char*)data);
@ -1845,12 +1832,12 @@ void CRDFOutliner::OnPaint()
}
// Sort foreground color
HT_GetNodeData(top, gNavCenter->sortColumnFGColor, HT_COLUMN_STRING, &data);
HT_GetTemplateData(top, gNavCenter->sortColumnFGColor, HT_COLUMN_STRING, &data);
if (data)
WFE_ParseColor((char*)data, &m_SortForegroundColor);
// Sort background color
HT_GetNodeData(top, gNavCenter->sortColumnBGColor, HT_COLUMN_STRING, &data);
HT_GetTemplateData(top, gNavCenter->sortColumnBGColor, HT_COLUMN_STRING, &data);
if (data)
WFE_ParseColor((char*)data, &m_SortBackgroundColor);
@ -1859,31 +1846,31 @@ void CRDFOutliner::OnPaint()
Compute3DColors(m_BackgroundColor, m_HighlightColor, m_ShadowColor);
// Selection foreground color
HT_GetNodeData(top, gNavCenter->selectionFGColor, HT_COLUMN_STRING, &data);
HT_GetTemplateData(top, gNavCenter->selectionFGColor, HT_COLUMN_STRING, &data);
if (data)
WFE_ParseColor((char*)data, &m_SelectionForegroundColor);
else m_SelectionForegroundColor = RGB(255,255,255);
// Selection background color
HT_GetNodeData(top, gNavCenter->selectionBGColor, HT_COLUMN_STRING, &data);
HT_GetTemplateData(top, gNavCenter->selectionBGColor, HT_COLUMN_STRING, &data);
if (data)
WFE_ParseColor((char*)data, &m_SelectionBackgroundColor);
else m_SelectionBackgroundColor = RGB(0,0,128);
// Background image URL
m_BackgroundImageURL = "";
HT_GetNodeData(top, gNavCenter->viewBGURL, HT_COLUMN_STRING, &data);
HT_GetTemplateData(top, gNavCenter->viewBGURL, HT_COLUMN_STRING, &data);
if (data)
m_BackgroundImageURL = (char*)data;
m_pBackgroundImage = NULL; // Clear out the BG image.
// Divider color
m_DividerColor = RGB(255,255,255);
HT_GetNodeData(top, gNavCenter->dividerColor, HT_COLUMN_STRING, &data);
HT_GetTemplateData(top, gNavCenter->dividerColor, HT_COLUMN_STRING, &data);
if (data)
WFE_ParseColor((char*)data, &m_DividerColor);
HT_GetNodeData(top, gNavCenter->showDivider, HT_COLUMN_STRING, &data);
HT_GetTemplateData(top, gNavCenter->showDivider, HT_COLUMN_STRING, &data);
if (data)
{
CString answer((char*)data);
@ -1891,6 +1878,30 @@ void CRDFOutliner::OnPaint()
m_bDrawDividers = FALSE;
}
HT_GetTemplateData(top, gNavCenter->useSelection, HT_COLUMN_STRING, &data);
if (data)
{
CString answer((char*)data);
if (answer.GetLength() > 0 && (answer.GetAt(0) == 'n' || answer.GetAt(0) == 'N'))
m_bUseSelection = FALSE;
}
HT_GetTemplateData(top, gNavCenter->useInlineEditing, HT_COLUMN_STRING, &data);
if (data)
{
CString answer((char*)data);
if (answer.GetLength() > 0 && (answer.GetAt(0) == 'n' || answer.GetAt(0) == 'N'))
m_bUseInlineEditing = FALSE;
}
HT_GetTemplateData(top, gNavCenter->useSingleClick, HT_COLUMN_STRING, &data);
if (data)
{
CString answer((char*)data);
if (answer.GetLength() > 0 && (answer.GetAt(0) == 'Y' || answer.GetAt(0) == 'y'))
m_bUseSingleClick = TRUE;
}
HPALETTE pOldPalette = NULL;
if (sysInfo.m_iBitsPerPixel < 16 && (::GetDeviceCaps(pdc.m_hDC, RASTERCAPS) & RC_PALETTE))
{
@ -3560,20 +3571,20 @@ void CRDFOutlinerParent::OnPaint ( )
// Foreground color
void* data;
HT_GetNodeData(top, gNavCenter->columnHeaderFGColor, HT_COLUMN_STRING, &data);
HT_GetTemplateData(top, gNavCenter->columnHeaderFGColor, 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->columnHeaderBGColor, HT_COLUMN_STRING, &data);
HT_GetTemplateData(top, gNavCenter->columnHeaderBGColor, HT_COLUMN_STRING, &data);
if (data)
WFE_ParseColor((char*)data, &m_BackgroundColor);
else m_BackgroundColor = RGB(192,192,192);
// Background image URL
m_BackgroundImageURL = "";
HT_GetNodeData(top, gNavCenter->columnHeaderBGURL, HT_COLUMN_STRING, &data);
HT_GetTemplateData(top, gNavCenter->columnHeaderBGURL, HT_COLUMN_STRING, &data);
if (data)
m_BackgroundImageURL = (char*)data;
m_pBackgroundImage = NULL; // Clear out the BG image.
@ -3772,6 +3783,8 @@ void CRDFOutlinerParent::CreateColumns ( void )
((CRDFOutliner*)m_pOutliner)->OnSize(0, rcClient.right, rcClient.bottom);
Invalidate();
theOutliner->ToggleModes();
}
BOOL CRDFOutlinerParent::RenderData( int iColumn, CRect & rect, CDC &dc, LPCTSTR text )
@ -3975,8 +3988,8 @@ void CRDFContentView::OnSize ( UINT nType, int cx, int cy )
CView::OnSize ( nType, cx, cy );
if (IsWindow(m_pOutlinerParent->m_hWnd))
{
m_pNavBar->MoveWindow(0,0, cx, NAVBAR_HEIGHT);
m_pOutlinerParent->MoveWindow ( 0, NAVBAR_HEIGHT, cx, cy-NAVBAR_HEIGHT);
m_pNavBar->MoveWindow(0,0, cx, NAVBAR_TOTAL_HEIGHT);
m_pOutlinerParent->MoveWindow ( 0, NAVBAR_TOTAL_HEIGHT, cx, cy-NAVBAR_TOTAL_HEIGHT);
}
}
@ -4028,9 +4041,6 @@ CRDFContentView* CRDFContentView::DisplayRDFTreeFromPane(CWnd* pParent, int xPos
// 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), pOutliner);

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

@ -127,18 +127,15 @@ private:
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.
COLORREF m_BarColor; // The color of the tree connections.
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_bUseSingleClick; // Are we single click?
BOOL m_bUseInlineEditing; // Do we allow inline editing?
BOOL m_bUseSelection; // Do we allow selection?
BOOL m_bIsPopup; // Whether or not we're a popup tree.
public:
@ -157,10 +154,9 @@ public:
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 ToggleModes();
void SetIsPopup(BOOL isPopup) { m_bIsPopup = isPopup; }
void SetHTView(HT_View v);

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

@ -21,6 +21,7 @@
#include "shcut.h"
#include "dropmenu.h"
#include "prefapi.h"
#include "xp_ncent.h"
#include "rdfliner.h"
#include "urlbar.h"
@ -308,7 +309,7 @@ void CRDFToolbarButton::DrawPicturesAndTextMode(HDC hDC, CRect rect)
{
CRDFToolbar* theToolbar = (CRDFToolbar*)GetParent();
void* data;
HT_GetNodeData(HT_TopNode(theToolbar->GetHTView()), gNavCenter->toolbarBitmapPosition, HT_COLUMN_STRING, &data);
HT_GetTemplateData(HT_TopNode(theToolbar->GetHTView()), gNavCenter->toolbarBitmapPosition, HT_COLUMN_STRING, &data);
if (data)
{
CString position((char*)data);
@ -329,7 +330,7 @@ void CRDFToolbarButton::DrawPicturesMode(HDC hDC, CRect rect)
{
CRDFToolbar* theToolbar = (CRDFToolbar*)GetParent();
void* data;
HT_GetNodeData(HT_TopNode(theToolbar->GetHTView()), gNavCenter->toolbarBitmapPosition, HT_COLUMN_STRING, &data);
HT_GetTemplateData(HT_TopNode(theToolbar->GetHTView()), gNavCenter->toolbarBitmapPosition, HT_COLUMN_STRING, &data);
if (data)
{
CString position((char*)data);
@ -384,7 +385,7 @@ CSize CRDFToolbarButton::GetButtonSizeFromChars(CString s, int c)
{
CRDFToolbar* theToolbar = (CRDFToolbar*)GetParent();
void* data;
HT_GetNodeData(HT_TopNode(theToolbar->GetHTView()), gNavCenter->toolbarBitmapPosition, HT_COLUMN_STRING, &data);
HT_GetTemplateData(HT_TopNode(theToolbar->GetHTView()), gNavCenter->toolbarBitmapPosition, HT_COLUMN_STRING, &data);
if (data)
{
CString position((char*)data);
@ -406,7 +407,7 @@ void CRDFToolbarButton::GetPicturesAndTextModeTextRect(CRect &rect)
{
CRDFToolbar* theToolbar = (CRDFToolbar*)GetParent();
void* data;
HT_GetNodeData(HT_TopNode(theToolbar->GetHTView()), gNavCenter->toolbarBitmapPosition, HT_COLUMN_STRING, &data);
HT_GetTemplateData(HT_TopNode(theToolbar->GetHTView()), gNavCenter->toolbarBitmapPosition, HT_COLUMN_STRING, &data);
if (data)
{
CString position((char*)data);
@ -427,7 +428,7 @@ void CRDFToolbarButton::GetPicturesModeTextRect(CRect &rect)
{
CRDFToolbar* theToolbar = (CRDFToolbar*)GetParent();
void* data;
HT_GetNodeData(HT_TopNode(theToolbar->GetHTView()), gNavCenter->toolbarBitmapPosition, HT_COLUMN_STRING, &data);
HT_GetTemplateData(HT_TopNode(theToolbar->GetHTView()), gNavCenter->toolbarBitmapPosition, HT_COLUMN_STRING, &data);
if (data)
{
CString position((char*)data);
@ -881,24 +882,29 @@ void CRDFToolbarButton::FillInMenu(HT_Resource theNode)
MapWindowPoints(frame, &point, 1);
*/
if (!m_bDepressed)
CRDFToolbarHolder* pHolder = (CRDFToolbarHolder*)(GetParent()->GetParent()->GetParent());
CRDFToolbarButton* pOldButton = pHolder->GetCurrentButton();
if (pOldButton != NULL)
{
pOldButton->GetTreeView()->DeleteNavCenter();
}
pHolder->SetCurrentButton(NULL);
if (!m_bDepressed && pOldButton != this)
{
CPoint point = RequestMenuPlacement();
m_pTreeView = CNSNavFrame::CreateFramedRDFViewFromResource(NULL, point.x, point.y, 300, 500, m_Node);
SetDepressed(TRUE);
m_pTreeView->SetRDFButton(this);
CRDFToolbarHolder* pHolder = (CRDFToolbarHolder*)(GetParent()->GetParent()->GetParent());
if (pHolder->GetCurrentButton() != NULL)
CRDFOutliner* pOutliner = (CRDFOutliner*)(m_pTreeView->GetContentView()->GetOutlinerParent()->GetOutliner());
if (pOutliner->IsPopup() || XP_IsNavCenterDocked(m_pTreeView->GetHTPane()))
{
pHolder->GetCurrentButton()->GetTreeView()->DeleteNavCenter();
SetDepressed(TRUE);
m_pTreeView->SetRDFButton(this);
pHolder->SetCurrentButton(this);
}
}
else
{
// Delete NavCenter.
m_pTreeView->DeleteNavCenter();
m_pTreeView = NULL;
else
{
m_pTreeView = NULL;
}
}
/*
@ -1436,7 +1442,7 @@ CRDFToolbar::CRDFToolbar(HT_View htView, int nMaxButtons, int nToolbarStyle, int
m_nNumberOfRows = 1;
m_nRowHeight = LINKTOOLBARHEIGHT;
void* data;
HT_GetNodeData(HT_TopNode(GetHTView()), gNavCenter->toolbarBitmapPosition, HT_COLUMN_STRING, &data);
HT_GetTemplateData(HT_TopNode(GetHTView()), gNavCenter->toolbarBitmapPosition, HT_COLUMN_STRING, &data);
if (data)
{
CString position((char*)data);
@ -1485,7 +1491,7 @@ int CRDFToolbar::Create(CWnd *pParent)
BOOL fixedSize = FALSE;
void* data;
HT_GetNodeData(topNode, gNavCenter->toolbarButtonsFixedSize, HT_COLUMN_STRING, &data);
HT_GetTemplateData(topNode, gNavCenter->toolbarButtonsFixedSize, HT_COLUMN_STRING, &data);
if (data)
{
CString answer((char*)data);
@ -1527,10 +1533,10 @@ void CRDFToolbar::AddHTButton(HT_Resource item)
// Fetch the button's tooltip and status bar text.
void* data;
HT_GetNodeData(item, gNavCenter->buttonTooltipText, HT_COLUMN_STRING, &data);
HT_GetTemplateData(item, gNavCenter->buttonTooltipText, HT_COLUMN_STRING, &data);
if (data)
tooltipText = (char*)data;
HT_GetNodeData(item, gNavCenter->buttonStatusbarText, HT_COLUMN_STRING, &data);
HT_GetTemplateData(item, gNavCenter->buttonStatusbarText, HT_COLUMN_STRING, &data);
if (data)
statusBarText = (char*)data;
@ -2137,6 +2143,26 @@ int CRDFToolbar::GetRowWidth()
return m_nWidth - RIGHT_TOOLBAR_MARGIN - LEFT_TOOLBAR_MARGIN - SPACE_BETWEEN_BUTTONS;
}
void CRDFToolbar::ComputeColorsForSeparators()
{
// background color
HT_Resource top = HT_TopNode(GetHTView());
void* data;
COLORREF backgroundColor = GetSysColor(COLOR_BTNFACE);
COLORREF shadowColor = backgroundColor;
COLORREF highlightColor = backgroundColor;
HT_GetTemplateData(top, gNavCenter->viewBGColor, HT_COLUMN_STRING, &data);
if (data)
{
WFE_ParseColor((char*)data, &backgroundColor);
}
Compute3DColors(backgroundColor, highlightColor, shadowColor);
SetBackgroundColor(backgroundColor);
SetHighlightColor(highlightColor);
SetShadowColor(shadowColor);
}
void CRDFToolbar::OnPaint(void)
{
CRect rcClient, updateRect, buttonRect, intersectRect;
@ -2153,7 +2179,7 @@ void CRDFToolbar::OnPaint(void)
COLORREF shadowColor = backgroundColor;
COLORREF highlightColor = backgroundColor;
HT_GetNodeData(top, gNavCenter->viewBGColor, HT_COLUMN_STRING, &data);
HT_GetTemplateData(top, gNavCenter->viewBGColor, HT_COLUMN_STRING, &data);
if (data)
{
WFE_ParseColor((char*)data, &backgroundColor);
@ -2172,7 +2198,7 @@ void CRDFToolbar::OnPaint(void)
// Foreground color
COLORREF foregroundColor = GetSysColor(COLOR_BTNTEXT);
HT_GetNodeData(top, gNavCenter->viewFGColor, HT_COLUMN_STRING, &data);
HT_GetTemplateData(top, gNavCenter->viewFGColor, HT_COLUMN_STRING, &data);
if (data)
{
WFE_ParseColor((char*)data, &foregroundColor);
@ -2181,7 +2207,7 @@ void CRDFToolbar::OnPaint(void)
// Rollover color
COLORREF rolloverColor = RGB(0, 0, 255);
HT_GetNodeData(top, gNavCenter->viewRolloverColor, HT_COLUMN_STRING, &data);
HT_GetTemplateData(top, gNavCenter->viewRolloverColor, HT_COLUMN_STRING, &data);
if (data)
{
WFE_ParseColor((char*)data, &rolloverColor);
@ -2190,7 +2216,7 @@ void CRDFToolbar::OnPaint(void)
// Pressed color
COLORREF pressedColor = RGB(0, 0, 128);
HT_GetNodeData(top, gNavCenter->viewPressedColor, HT_COLUMN_STRING, &data);
HT_GetTemplateData(top, gNavCenter->viewPressedColor, HT_COLUMN_STRING, &data);
if (data)
{
WFE_ParseColor((char*)data, &pressedColor);
@ -2199,7 +2225,7 @@ void CRDFToolbar::OnPaint(void)
// Disabled color
COLORREF disabledColor = -1;
HT_GetNodeData(top, gNavCenter->viewDisabledColor, HT_COLUMN_STRING, &data);
HT_GetTemplateData(top, gNavCenter->viewDisabledColor, HT_COLUMN_STRING, &data);
if (data)
{
WFE_ParseColor((char*)data, &disabledColor);
@ -2208,7 +2234,7 @@ void CRDFToolbar::OnPaint(void)
// Background image URL
CString backgroundImageURL = "";
HT_GetNodeData(top, gNavCenter->viewBGURL, HT_COLUMN_STRING, &data);
HT_GetTemplateData(top, gNavCenter->viewBGURL, HT_COLUMN_STRING, &data);
if (data)
backgroundImageURL = (char*)data;
SetBackgroundImage(NULL); // Clear out the BG image.
@ -2372,10 +2398,10 @@ void CRDFDragToolbar::OnPaint(void)
CPoint bitmapStart(!m_bMouseInTab ? 0 : OPEN_BUTTON_WIDTH ,HTAB_TOP_START);
//First do top of the tab
FEU_TransBlt( pDC->m_hDC, 0, 0, OPEN_BUTTON_WIDTH, HTAB_TOP_HEIGHT,
pBmpDC->m_hDC, bitmapStart.x, bitmapStart.y,WFE_GetUIPalette(NULL),
GetSysColor(COLOR_BTNFACE));
::BitBlt(pDC->m_hDC, 0, 0, OPEN_BUTTON_WIDTH, HTAB_TOP_HEIGHT,
pBmpDC->m_hDC, bitmapStart.x, bitmapStart.y, SRCCOPY);
//Now do the middle portion of the tab
int y = HTAB_TOP_HEIGHT;
@ -2383,8 +2409,9 @@ void CRDFDragToolbar::OnPaint(void)
while(y < rect.bottom - HTAB_BOTTOM_HEIGHT)
{
::BitBlt(pDC->m_hDC, 0, y, OPEN_BUTTON_WIDTH, HTAB_MIDDLE_HEIGHT,
pBmpDC->m_hDC, bitmapStart.x, bitmapStart.y, SRCCOPY);
FEU_TransBlt(pDC->m_hDC, 0, y, OPEN_BUTTON_WIDTH, HTAB_MIDDLE_HEIGHT,
pBmpDC->m_hDC, bitmapStart.x, bitmapStart.y, WFE_GetUIPalette(NULL),
GetSysColor(COLOR_BTNFACE));
y += HTAB_MIDDLE_HEIGHT;
@ -2395,8 +2422,9 @@ void CRDFDragToolbar::OnPaint(void)
bitmapStart.y = HTAB_BOTTOM_START;
::BitBlt(pDC->m_hDC, 0, y, OPEN_BUTTON_WIDTH, HTAB_BOTTOM_HEIGHT,
pBmpDC->m_hDC, bitmapStart.x, bitmapStart.y, SRCCOPY);
FEU_TransBlt(pDC->m_hDC, 0, y, OPEN_BUTTON_WIDTH, HTAB_BOTTOM_HEIGHT,
pBmpDC->m_hDC, bitmapStart.x, bitmapStart.y, WFE_GetUIPalette(NULL),
GetSysColor(COLOR_BTNFACE));
// Cleanup
@ -2443,6 +2471,51 @@ CRDFToolbarHolder::~CRDFToolbarHolder()
}
}
void CRDFToolbarHolder::DrawSeparator(int i, HDC hDC, int nStartX, int nEndX, int nStartY,
BOOL bToolbarSeparator)
{
// Get the toolbar and force it to compute its colors.
COLORREF highlightColor = ::GetSysColor(COLOR_BTNHIGHLIGHT);
COLORREF shadowColor = ::GetSysColor(COLOR_BTNSHADOW);
if (m_nNumOpen >= i)
{
CRDFToolbar* pToolbar = (CRDFToolbar*)(m_pToolbarArray[i]->GetToolbar());
pToolbar->ComputeColorsForSeparators();
shadowColor = pToolbar->GetShadowColor();
highlightColor = pToolbar->GetHighlightColor();
}
HPEN pen = ::CreatePen(PS_SOLID, 1, shadowColor);
HPEN pOldPen = (HPEN)::SelectObject(hDC, pen);
::MoveToEx(hDC, nStartX, nStartY, NULL);
::LineTo(hDC, nEndX, nStartY);
::SelectObject(hDC, pOldPen);
::DeleteObject(pen);
if(bToolbarSeparator)
{
pen = ::CreatePen(PS_SOLID, 1, highlightColor);
}
else
{
pen = ::CreatePen(PS_SOLID, 1, highlightColor);
}
::SelectObject(hDC, pen);
::MoveToEx(hDC, nStartX, nStartY + 1, NULL);
::LineTo(hDC, nEndX, nStartY + 1);
::SelectObject(hDC, pOldPen);
::DeleteObject(pen);
}
void CRDFToolbarHolder::InitializeRDFData()
{
HT_Notification ns = new HT_NotificationStruct;

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

@ -287,6 +287,8 @@ public:
COLORREF GetShadowColor() { return m_ShadowColor; }
COLORREF GetHighlightColor() { return m_HighlightColor; }
void ComputeColorsForSeparators();
CRDFImage* GetBackgroundImage() { return m_pBackgroundImage; }
void SetBackgroundColor(COLORREF c) { m_BackgroundColor = c; }
void SetForegroundColor(COLORREF c) { m_ForegroundColor = c; }
@ -352,6 +354,10 @@ public:
{
return new CRDFDragToolbar();
}
protected:
virtual void DrawSeparator(int i, HDC hDC, int nStartX, int nEndX, int nStartY, BOOL bToolbarSeparator = TRUE);
};
#endif