Fixes to the toolbar code.

This commit is contained in:
hyatt%netscape.com 1998-09-09 21:30:28 +00:00
parent 71ddfaa36d
commit 4693ba21a9
5 changed files with 67 additions and 20 deletions

View File

@ -84,12 +84,12 @@ void CNavTitleBar::OnPaint( )
// Foreground color
HT_GetTemplateData(topNode, gNavCenter->controlStripFGColor, HT_COLUMN_STRING, &data);
if (data)
WFE_ParseColor((char*)data, &m_ForegroundColor);
WFE_ParseColor((char*)data, &m_ControlStripForegroundColor);
// background color
HT_GetTemplateData(topNode, gNavCenter->controlStripBGColor, HT_COLUMN_STRING, &data);
if (data)
WFE_ParseColor((char*)data, &m_BackgroundColor);
WFE_ParseColor((char*)data, &m_ControlStripBackgroundColor);
// Background image URL
HT_GetTemplateData(topNode, gNavCenter->controlStripBGURL, HT_COLUMN_STRING, &data);
@ -221,7 +221,7 @@ void CNavTitleBar::OnPaint( )
::SelectObject(dc.m_hDC, smallFont);
// The ADD button
CString addText("Add"); // Will use an extensible HT mechanism eventually. Hardcode for now.
CString addText("Add Page"); // Will use an extensible HT mechanism eventually. Hardcode for now.
//HT_GetTemplateData(topNode, gNavCenter->controlStripModeText, HT_COLUMN_STRING, &data);
//if (data)
// modeText = (char*)data;
@ -248,7 +248,7 @@ void CNavTitleBar::OnPaint( )
cachedAddRect.right = addRect.right + 3;
// The MANAGE button
CString modeText("Manage"); // Will use an extensible HT mechanism eventually. Hardcode for now.
CString modeText("Edit Bookmarks"); // Will use an extensible HT mechanism eventually. Hardcode for now.
//HT_GetTemplateData(topNode, gNavCenter->controlStripModeText, HT_COLUMN_STRING, &data);
//if (data)
// modeText = (char*)data;
@ -261,8 +261,8 @@ void CNavTitleBar::OnPaint( )
// Don't write into the close box area!
modeRect.right = modeRect.left + (rect.Width() - 9);
}
modeRect.left += cachedAddRect.right + 6; // account for add rect and indent slightly horizontally
modeRect.right += cachedAddRect.right + 6;
modeRect.left += cachedAddRect.right + 10; // account for add rect and indent slightly horizontally
modeRect.right += cachedAddRect.right + 10;
// Center the text vertically.
modeRect.top = (controlStripRect.Height() - smallHeight) / 2;
@ -271,7 +271,7 @@ void CNavTitleBar::OnPaint( )
// Cache the rect
cachedModeRect.top = 0;
cachedModeRect.left = cachedAddRect.right + 2;
cachedModeRect.left = cachedAddRect.right + 6;
cachedModeRect.bottom = NAVBAR_CONTROLSTRIP_HEIGHT;
cachedModeRect.right = cachedModeRect.left + modeRect.Width() + 3;

View File

@ -686,7 +686,7 @@ CRDFImage* DrawRDFImage(CRDFImage* pImage, int left, int top, int imageWidth, in
width, height,
0, 0, width, height,
pImage->bits, pImage->bmpInfo,
pImage->maskbits, FALSE, bkColor);
pImage->maskbits, FALSE, 0);
}
else
{
@ -1112,8 +1112,9 @@ void CRDFOutliner::DisplayURL()
if (HT_Launch(m_Node, pCX->GetContext()))
return;
// Shell execute all local file URLs.
if (IsLocalFile(url))
// Shell execute all local file URLs. (Disable for bookmarks until we have a concrete plan.)
if (IsLocalFile(url) && HT_GetParent(m_Node) != NULL
&& IsLocalFile(HT_GetNodeURL(HT_GetParent(m_Node))))
{
char* pLocalName = NULL;
XP_ConvertUrlToLocalFile(url, &pLocalName);

View File

@ -136,6 +136,9 @@ public:
void SetButtonsSameWidth(BOOL bButtonsSameWidth);
BOOL GetButtonsSameWidth(void) { return m_bButtonsSameWidth; }
BOOL CheckMaxButtonSizeChanged(CToolbarButton *pButton, BOOL bAdd);
void ChangeButtonSizes(void);
void ReplaceButtonBitmapIndex(UINT nID, UINT nIndex);
BOOL OnCommand( WPARAM wParam, LPARAM lParam );
@ -167,8 +170,6 @@ protected:
int FindButton(CWnd *pButton);
int FindButton(UINT nCommand);
void MoveButton(int nIndex);
BOOL CheckMaxButtonSizeChanged(CToolbarButton *pButton, BOOL bAdd);
void ChangeButtonSizes(void);
BOOL FindLargestButton(void);
//Given an index, this says where a button starts and where it ends
void GetButtonXPosition(int nSelection,int & nStart,int & nEnd);

View File

@ -1028,6 +1028,27 @@ BOOL CRDFToolbarButton::NeedsUpdate()
void CRDFToolbarButton::LoadComplete(HT_Resource r)
{
Invalidate();
if (foundOnRDFToolbar())
{
CRDFToolbar* pToolbar = (CRDFToolbar*)GetParent();
CSize buttonSize = GetMinimalButtonSize();
int nRowHeight = pToolbar->GetRowHeight();
if (buttonSize.cy > nRowHeight)
{
pToolbar->SetRowHeight(buttonSize.cy);
GetParentFrame()->RecalcLayout();
}
if(pToolbar->CheckMaxButtonSizeChanged(this, TRUE) && !HT_IsURLBar(m_Node) &&
!HT_IsSeparator(m_Node))
{
pToolbar->ChangeButtonSizes();
}
else pToolbar->LayoutButtons(-1);
}
}
void CRDFToolbarButton::DrawCustomIcon(HDC hDC, int x, int y)
@ -2241,6 +2262,14 @@ void CRDFToolbar::ComputeColorsForSeparators()
SetShadowColor(shadowColor);
}
void CRDFToolbar::LoadComplete(HT_Resource r)
{
Invalidate();
CWnd* pWnd = GetParent();
if (pWnd)
pWnd->Invalidate();
}
void CRDFToolbar::OnPaint(void)
{
CRect rcClient, updateRect, buttonRect, intersectRect;
@ -2327,7 +2356,10 @@ void CRDFToolbar::OnPaint(void)
if (GetBackgroundImage() &&
GetBackgroundImage()->FrameSuccessfullyLoaded())
{
PaintBackground(dcPaint.m_hDC, &rcClient, GetBackgroundImage(), 0);
CWnd* pParent = GetParent();
CRect offsetRect(rcClient);
MapWindowPoints(pParent, &offsetRect);
PaintBackground(dcPaint.m_hDC, &rcClient, GetBackgroundImage(), offsetRect.left, offsetRect.top);
}
else
{
@ -2510,12 +2542,23 @@ void CRDFDragToolbar::OnPaint(void)
// Use our toolbar background color (or background image TODO)
CRDFToolbar* pToolbar = (CRDFToolbar*)m_pToolbar->GetToolbar();
HBRUSH brFace = (HBRUSH) ::CreateSolidBrush(pToolbar->GetBackgroundColor());
::FillRect(dcPaint.m_hDC, &rect, brFace);
VERIFY(::DeleteObject(brFace));
HBRUSH hRegBrush = (HBRUSH) ::CreateSolidBrush(pToolbar->GetBackgroundColor());
if (pToolbar->GetBackgroundImage() == NULL ||
(pToolbar->GetBackgroundImage() != NULL &&
!pToolbar->GetBackgroundImage()->FrameSuccessfullyLoaded()))
{
// Fill with our background color.
::FillRect(dcPaint.m_hDC, rect, hRegBrush);
}
else
{
// There is a background. Let's do a tile on the rect.
// Now we want to fill the given rectangle.
PaintBackground(dcPaint.m_hDC, rect, pToolbar->GetBackgroundImage(), 0);
}
VERIFY(::DeleteObject(hRegBrush));
CDC *pDC = &dcPaint;
HPALETTE hOldPal = ::SelectPalette(pDC->m_hDC, WFE_GetUIPalette(GetParentFrame()), FALSE);
@ -2684,6 +2727,7 @@ CIsomorphicCommandMap* CIsomorphicCommandMap::InitializeCommandMap(const CString
result->AddItem("command:home", ID_GO_HOME);
result->AddItem("command:print", ID_FILE_PRINT);
result->AddItem("command:stop", ID_NAVIGATE_INTERRUPT);
result->AddItem("command:search", ID_NETSEARCH);
}
else if (initType == "Command Toolbar Bitmap Indices")
{
@ -2693,6 +2737,7 @@ CIsomorphicCommandMap* CIsomorphicCommandMap::InitializeCommandMap(const CString
result->AddItem("command:home", 3);
result->AddItem("command:print", 7);
result->AddItem("command:stop", 11);
result->AddItem("command:search", 4);
}
return result;
}

View File

@ -315,7 +315,7 @@ public:
void SetBackgroundImage(CRDFImage* p) { m_pBackgroundImage = p; }
void LoadComplete(HT_Resource r) { Invalidate(); }
void LoadComplete(HT_Resource r);
void ChangeButtonSizes(void); // Overridden to prevent separators and url bars from changing size.