Bug fixes to animated gifs in the tree view and in the dropdown menus.

This commit is contained in:
hyatt 1998-06-04 01:45:42 +00:00
parent eb44f81303
commit a822605d8d
4 changed files with 49 additions and 2 deletions

View File

@ -2519,6 +2519,23 @@ void CDropMenu::InvalidateMenuItemRect(CDropMenuItem *pMenuItem)
InvalidateRect(rect, TRUE);
}
void CDropMenu::InvalidateMenuItemIconRect(CDropMenuItem *pMenuItem)
{
CRect rcClient;
CRect rect;
GetClientRect(&rcClient);
pMenuItem->GetMenuItemRect(rect);
int nColumn = pMenuItem->GetColumn();
CDropMenuColumn *pColumn= (CDropMenuColumn*)m_pColumnArray[nColumn];
rect.left += nIMG_SPACE;
rect.right = rect.left + 16;
InvalidateRect(rect, TRUE);
}
void CDropMenu::KeepMenuAroundIfClosing(void)
{
@ -2578,5 +2595,15 @@ CWnd *CDropMenu::GetTopLevelParent(void)
void CDropMenu::LoadComplete(HT_Resource r)
{
// Need to invalidate the line that corresponds to this particular resource.
Invalidate();
HT_Resource parent = HT_GetParent(r);
if (parent)
{
// The offset of this node from its direct parent determines the line that should be
// 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];
InvalidateMenuItemIconRect(item);
}
}

View File

@ -313,6 +313,7 @@ protected:
void ShowSubmenu(CDropMenuItem * pItem);
int FindMenuItemPosition(CDropMenuItem* pMenuItem);
void InvalidateMenuItemRect(CDropMenuItem *pMenuItem);
void InvalidateMenuItemIconRect(CDropMenuItem *pMenuItem);
void KeepMenuAroundIfClosing(void);
void SetSubmenuBitmaps(HBITMAP hSelectedBitmap, HBITMAP hUnselectedBitmap);
CWnd *GetTopLevelParent(void);

View File

@ -341,6 +341,22 @@ void CRDFOutliner::HandleEvent(HT_Notification ns, HT_Resource n, HT_Event whatH
}
}
void CRDFOutliner::InvalidateIconForResource(HT_Resource r)
{
int iLineNo = HT_GetNodeIndex(m_View, r);
CRect rect, out;
GetClientRect ( &rect );
RectFromLine ( iLineNo - m_iTopLine, rect, out );
int iImageWidth = GetIndentationWidth();
int indent = HT_GetItemIndentation(r);
out.left = indent*iImageWidth;
out.right = out.left + iImageWidth;
InvalidateRect ( &out );
}
LPCTSTR CRDFOutliner::GetColumnText ( UINT iColumn, void * pLineData )
{
@ -555,7 +571,7 @@ void CRDFOutliner::LoadComplete(HT_Resource pResource)
{
if (pResource == NULL) // Background image loaded.
Invalidate();
else InvalidateLine(HT_GetNodeIndex(m_View, pResource)); // Individual line had an image load.
else InvalidateIconForResource(pResource); // Individual line had an image load.
}
// Functions used to draw custom images (either local file system icons or arbitrary image URLs)

View File

@ -267,6 +267,9 @@ public:
BOOL hasFocus = FALSE);
// Used instead of the outliner DrawColumnText. Same reason.
void InvalidateIconForResource(HT_Resource r);
// Invalidates only the icon for a given node. The rest of the line is left alone.
CRect ConstructDragRect(const CPoint& pt1, const CPoint& pt2);
// Constructs a new rectangle with the two points specified as opposing corners.