Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Bad collapsed group image display
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Bad collapsed group image display

 Post Reply Post Reply
Author
Message
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 867
Post Options Post Options   Thanks (1) Thanks(1)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Topic: Bad collapsed group image display
    Posted: 12 October 2015 at 1:05pm
Running CJ 17 Beta 3. Using the Office 2010/2007 ribbon themes when a group has an image associated with it and the group is collapsed, CJ is not drawing the frame around the image in the correct spot (or is drawing a frame that should not be drawn. This only occurs with small icons. If we have large icons for the group, CJ uses it and we don't see the display issue. The display issues doesn't show up in the Office 2013 White theme we use. I can show this in the sample. I skipped registering the large icons and then stopped in debug and deposited the file new ID into the control group popup created when I resized the frame so the view tab's window group was collapsed. Here is the image. Note the "frame" drawn just above (and intersecting) the group icon. Looks like either the icon is in the wrong place or the "frame" is (but why even draw the frame). Comparing our ribbon with some collapsed groups using a large icon and some a small, I see the top edge of the "frame" aligns with the top edge of our large collapsed group icons. So the small icon is probably just dropped too low to cover up this "frame" we see.




We could use a fix for this.
Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Answer Answer
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 14 June 2017 at 6:42am
Originally posted by rdhd rdhd wrote:

Running CJ 17 Beta 3. Using the Office 2010/2007 ribbon themes when a group has an image associated with it and the group is collapsed, CJ is not drawing the frame around the image in the correct spot (or is drawing a frame that should not be drawn. This only occurs with small icons. If we have large icons for the group, CJ uses it and we don't see the display issue. The display issues doesn't show up in the Office 2013 White theme we use. I can show this in the sample. I skipped registering the large icons and then stopped in debug and deposited the file new ID into the control group popup created when I resized the frame so the view tab's window group was collapsed. Here is the image. Note the "frame" drawn just above (and intersecting) the group icon. Looks like either the icon is in the wrong place or the "frame" is (but why even draw the frame). Comparing our ribbon with some collapsed groups using a large icon and some a small, I see the top edge of the "frame" aligns with the top edge of our large collapsed group icons. So the small icon is probably just dropped too low to cover up this "frame" we see.


We could use a fix for this.


Hello rdhd,

I found solution for this issue. Mistake was in the same method DrawControlGroupPopup() 
CSize CXTPRibbonThemeResource::DrawControlGroupPopup(CDC* pDC, CXTPControlPopup* pControlGroupPopup, BOOL bDraw)
{
    ASSERT(pDC);
    ASSERT(pControlGroupPopup);
    CXTPRibbonGroup *pRibbonGroup = pControlGroupPopup->GetRibbonGroup();

    if (!pRibbonGroup)
    {
    ....
    }

    if (bDraw)
    {
    ....
    }
....
if (bDraw) { CXTPImageManagerIcon* pImageIcon = pControlGroupPopup->GetImage(pControlGroupPopup->GetIconSize().cx); BOOL bDrawImage = (pImageIcon != NULL); CRect rcButton = pControlGroupPopup->GetRect(); if (bDrawImage)
        {
            CSize sz(m_pPaintManager->m_bAutoResizeIcons ? m_pPaintManager->GetAutoIconSize(TRUE) : pImageIcon->GetExtent());
            
            if (m_pPaintManager->IsDPIIconsScallingEnabled(pControlGroupPopup))
                sz = XTP_DPI(sz);
            
            CPoint pt = CPoint(rcButton.CenterPoint().x - sz.cx / 2, rcButton.top + XTP_DPI_Y(9));

if (sz.cx < XTP_DPI_X(20)) { CXTPResourceImage* pImageButton = LoadImage(FormatName(_T("RIBBONGROUPBUTTONICON"))); CSize szImageButton(pImageButton != NULL ? pImageButton->GetExtent() : sz);
//Increase ImageButton if it is smaller than icon const int nImageButtonMarginX = XTP_DPI_X(5) * 2; if ((szImageButton.cx - sz.cx) < nImageButtonMarginX) szImageButton.cx = sz.cx + nImageButtonMarginX; const int nImageButtonMarginY = XTP_DPI_Y(5) * 2; if ((szImageButton.cy - sz.cy) < nImageButtonMarginY) szImageButton.cy = sz.cy + nImageButtonMarginY;
CRect rc(CPoint(rcButton.CenterPoint().x - szImageButton.cx / 2, rcButton.top + XTP_DPI_Y(2)), szImageButton); if (pImageButton) pImageButton->DrawImage(pDC, rc, pImageButton->GetSource(0, 1), CXTPEmptyRect()); pt.x = rc.CenterPoint().x - sz.cx / 2; pt.y = rc.CenterPoint().y - sz.cy / 2; }

            m_pPaintManager->DrawImage(pDC, pt, sz, pImageIcon,
                pControlGroupPopup->GetSelected(), pControlGroupPopup->GetPressed(),
                pControlGroupPopup->GetEnabled(), FALSE, pControlGroupPopup->GetPopuped());
        }
....
}
Regards,
 Oleksandr Lebed
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 867
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Posted: 12 October 2015 at 1:06pm
Inserted two images but only one showed up ( the PNG) but both were in the post before I submitted. Trying again.
Back to Top
cpede View Drop Down
Senior Member
Senior Member


Joined: 13 August 2004
Location: Denmark
Status: Offline
Points: 645
Post Options Post Options   Thanks (1) Thanks(1)   Quote cpede Quote  Post ReplyReply Direct Link To This Post Posted: 02 September 2016 at 4:08am
When using v17.20 the collapsed group images in the Ribbon bar are displayed scaled (using a DPI of 125%) even m_bAutoResizeIcons is set to false. The normal icons are displayed correctly non scaled.

This is clearly a bug, where this m_bAutoResizeIcons flag is not taken into account when groups are collapsed in the Ribbon bar.

-cpede
Product: Xtreme ToolkitPro (20.3.0)
Platform: Windows 10 (x64)
Language: Visual Studio 2017 (C++)
Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 06 September 2016 at 7:54am
Hi,
I found that these icons of collapsed groups  are drawn in  CXTPRibbonPaintManager::DrawControlGroupPopup (pure virtual which are implemented in  CXTPRibbonThemeResource and CXTPRibbonMarkupTheme).

There used only XTP_DPI macros
CSize sz(XTP_DPI(pImageIcon->GetExtent()));
no m_bAutoResizeIcons.

I think it should depend on pCommandBar->GetCommandBars()->GetCommandBarsOptions()->GetToolbarsIconsScalling(). It can be checked with IsDPIIconsScallingEnabled(), but now this is standalone function, which should be  member of paintManager. After these changes  calculation icons of collapsed groups is

    CSize sz(pImageIcon->GetExtent());

    if (m_pPaintManager->IsDPIIconsScallingEnabled(pControlGroupPopup))
        sz = XTP_DPI(sz);


I'm not sure of using 
m_bAutoResizeIcons there. I think it is task to  refactoring Ribbon/CommandBar for using icons set for different DPIs.

Regards,
 Oleksandr Lebed
Back to Top
cpede View Drop Down
Senior Member
Senior Member


Joined: 13 August 2004
Location: Denmark
Status: Offline
Points: 645
Post Options Post Options   Thanks (0) Thanks(0)   Quote cpede Quote  Post ReplyReply Direct Link To This Post Posted: 06 September 2016 at 8:55am
Of cause the group icons should follow the m_bAutoResizeIcons flag.

So will this be corrected for v17.3.0?

-cpede
Product: Xtreme ToolkitPro (20.3.0)
Platform: Windows 10 (x64)
Language: Visual Studio 2017 (C++)
Back to Top
cpede View Drop Down
Senior Member
Senior Member


Joined: 13 August 2004
Location: Denmark
Status: Offline
Points: 645
Post Options Post Options   Thanks (0) Thanks(0)   Quote cpede Quote  Post ReplyReply Direct Link To This Post Posted: 26 September 2016 at 10:25am
Can anyone confirm that this will be fixed in v17.3?

-cpede
Product: Xtreme ToolkitPro (20.3.0)
Platform: Windows 10 (x64)
Language: Visual Studio 2017 (C++)
Back to Top
cpede View Drop Down
Senior Member
Senior Member


Joined: 13 August 2004
Location: Denmark
Status: Offline
Points: 645
Post Options Post Options   Thanks (0) Thanks(0)   Quote cpede Quote  Post ReplyReply Direct Link To This Post Posted: 31 October 2016 at 4:42am
Still not fixed in v17.3!

See Ribbon Sample, set Ribbon icons to not Auto Size Icons, and collaps the INSERT group and look at the Symbols group icon when collapsed.



-cpede
Product: Xtreme ToolkitPro (20.3.0)
Platform: Windows 10 (x64)
Language: Visual Studio 2017 (C++)
Back to Top
cpede View Drop Down
Senior Member
Senior Member


Joined: 13 August 2004
Location: Denmark
Status: Offline
Points: 645
Post Options Post Options   Thanks (0) Thanks(0)   Quote cpede Quote  Post ReplyReply Direct Link To This Post Posted: 09 February 2017 at 4:08pm
After the fix for the images on the tooltips, please also fix the problem with icons on the collapsed ribbon group tabs.

-cpede 
Product: Xtreme ToolkitPro (20.3.0)
Platform: Windows 10 (x64)
Language: Visual Studio 2017 (C++)
Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 09 June 2017 at 9:11am
Hello,

I'm glad to inform your that issues with scaling of group icons have fixed.
Added dependency from m_pPaintManager->m_bAutoResizeIcons and m_pPaintManager->IsDPIIconsScallingEnabled()  in  CXTPRibbonMarkupTheme::DrawControlGroupPopup()  and CXTPRibbonThemeResource::DrawControlGroupPopup

/*code moved to next post to prevent duplication.*/

Fix will be available soon in final v18.0

Regards,
 Oleksandr Lebed
Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Answer Answer
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 14 June 2017 at 6:42am
Originally posted by rdhd rdhd wrote:

Running CJ 17 Beta 3. Using the Office 2010/2007 ribbon themes when a group has an image associated with it and the group is collapsed, CJ is not drawing the frame around the image in the correct spot (or is drawing a frame that should not be drawn. This only occurs with small icons. If we have large icons for the group, CJ uses it and we don't see the display issue. The display issues doesn't show up in the Office 2013 White theme we use. I can show this in the sample. I skipped registering the large icons and then stopped in debug and deposited the file new ID into the control group popup created when I resized the frame so the view tab's window group was collapsed. Here is the image. Note the "frame" drawn just above (and intersecting) the group icon. Looks like either the icon is in the wrong place or the "frame" is (but why even draw the frame). Comparing our ribbon with some collapsed groups using a large icon and some a small, I see the top edge of the "frame" aligns with the top edge of our large collapsed group icons. So the small icon is probably just dropped too low to cover up this "frame" we see.


We could use a fix for this.


Hello rdhd,

I found solution for this issue. Mistake was in the same method DrawControlGroupPopup() 
CSize CXTPRibbonThemeResource::DrawControlGroupPopup(CDC* pDC, CXTPControlPopup* pControlGroupPopup, BOOL bDraw)
{
    ASSERT(pDC);
    ASSERT(pControlGroupPopup);
    CXTPRibbonGroup *pRibbonGroup = pControlGroupPopup->GetRibbonGroup();

    if (!pRibbonGroup)
    {
    ....
    }

    if (bDraw)
    {
    ....
    }
....
if (bDraw) { CXTPImageManagerIcon* pImageIcon = pControlGroupPopup->GetImage(pControlGroupPopup->GetIconSize().cx); BOOL bDrawImage = (pImageIcon != NULL); CRect rcButton = pControlGroupPopup->GetRect(); if (bDrawImage)
        {
            CSize sz(m_pPaintManager->m_bAutoResizeIcons ? m_pPaintManager->GetAutoIconSize(TRUE) : pImageIcon->GetExtent());
            
            if (m_pPaintManager->IsDPIIconsScallingEnabled(pControlGroupPopup))
                sz = XTP_DPI(sz);
            
            CPoint pt = CPoint(rcButton.CenterPoint().x - sz.cx / 2, rcButton.top + XTP_DPI_Y(9));

if (sz.cx < XTP_DPI_X(20)) { CXTPResourceImage* pImageButton = LoadImage(FormatName(_T("RIBBONGROUPBUTTONICON"))); CSize szImageButton(pImageButton != NULL ? pImageButton->GetExtent() : sz);
//Increase ImageButton if it is smaller than icon const int nImageButtonMarginX = XTP_DPI_X(5) * 2; if ((szImageButton.cx - sz.cx) < nImageButtonMarginX) szImageButton.cx = sz.cx + nImageButtonMarginX; const int nImageButtonMarginY = XTP_DPI_Y(5) * 2; if ((szImageButton.cy - sz.cy) < nImageButtonMarginY) szImageButton.cy = sz.cy + nImageButtonMarginY;
CRect rc(CPoint(rcButton.CenterPoint().x - szImageButton.cx / 2, rcButton.top + XTP_DPI_Y(2)), szImageButton); if (pImageButton) pImageButton->DrawImage(pDC, rc, pImageButton->GetSource(0, 1), CXTPEmptyRect()); pt.x = rc.CenterPoint().x - sz.cx / 2; pt.y = rc.CenterPoint().y - sz.cy / 2; }

            m_pPaintManager->DrawImage(pDC, pt, sz, pImageIcon,
                pControlGroupPopup->GetSelected(), pControlGroupPopup->GetPressed(),
                pControlGroupPopup->GetEnabled(), FALSE, pControlGroupPopup->GetPopuped());
        }
....
}
Regards,
 Oleksandr Lebed
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 867
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Posted: 15 June 2017 at 5:45pm
Hi Oleksandr,

That's good news. I assume we will have a fix in an upcoming release.

By the way, I used to get e-mails for replies. I just happened to log in today for another reason and saw the recent activity UI and recognized that it was a reply to this issue I posted. Not sure why I'm not getting e-mails.
Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 16 June 2017 at 3:43am
Hello rdhd,

I think your e-mail is correct,  and can suppose that you press "Un-Watch this topic" in "Topic Options" in upper left corner of this page. (icon with red gear). To return back notification press "Watch this topic", however if you post here something then it should turns on notifications again.

Also I have fixed one another issue - ribbon group icons are drawn only with the smallest available size. It is unacceptable in HighDPI monitors. Changes in the same methods CXTPRibbonMarkupTheme::DrawControlGroupPopup()  and CXTPRibbonThemeResource::DrawControlGroupPopup(). I have changed code snippet in post above.
CXTPImageManagerIcon* pImageIcon = pControlGroupPopup->GetImage(pControlGroupPopup->GetIconSize().cx);

Regards,
 Oleksandr Lebed
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.141 seconds.