Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

toolbar bottom edge is not shown corectly under C::B build with wx git master

<< < (2/7) > >>

ollydbg:
I see the wxSize bitmapSize = m_toolbar->GetToolBitmapSize(); is 16*16, which is correct, since we use the 16*16 icons for the toolbar, but when wxChoice is added:


--- Code: ---...
        while (n)
        {
            if ((n->GetType() == wxXML_ELEMENT_NODE) &&
                (n->GetName() == _T("object") || n->GetName() == _T("object_ref")))
            {
                wxObject *created = CreateResFromNode(n, toolbar, NULL);
                wxControl *control = wxDynamicCast(created, wxControl);
                if (!IsOfClass(n, _T("tool")) &&
                    !IsOfClass(n, _T("separator")) &&
                    control != NULL &&
                    control != toolbar)
                {
                    //Manager::Get()->GetLogManager()->DebugLog(F(_T("control=%p, parent=%p, toolbar=%p"), control, control->GetParent(), toolbar));
                    toolbar->AddControl(control);
                }
            }
            n = n->GetNext();
        }
...

--- End code ---

After that, I see a line with 3 pixels height is added.

It looks like the toolbar's get size function return the wrong size?

Jenna:
I did not read all the posts, but the problem is (most likely), that we use our own implementation of the xmlresourcehandler for our toolbars, and if the codein wxwidgets changes we have to take care of these changes.

ollydbg:
I just build the aui sample code from wxWidget's trunk, and I see it use the same bitmap size (16*16), and I see the toolbar height is 26, but it use wxAuiToolbar. (Our 16.01's release toolbar height is 23).

I can't find the issues inside our C::B xml loader, I guess that some code in wx, such as the one:

--- Code: ---wxSize wxToolBar::DoGetBestSize() const
{
    wxSize sizeBest;

    SIZE size;
    if ( !::SendMessage(GetHwnd(), TB_GETMAXSIZE, 0, (LPARAM)&size) )
    {
        // maybe an old (< 0x400) Windows version? try to approximate the
        // toolbar size ourselves
        sizeBest = GetToolSize();
        sizeBest.y += 2 * ::GetSystemMetrics(SM_CYBORDER); // Add borders
        sizeBest.x *= GetToolsCount();

        // reverse horz and vertical components if necessary
        if ( IsVertical() )
        {
            wxSwap(sizeBest.x, sizeBest.y);
        }
    }
    else // TB_GETMAXSIZE succeeded
    {
        // but it could still return an incorrect result due to what appears to
        // be a bug in old comctl32.dll versions which don't handle controls in
        // the toolbar correctly, so work around it (see SF patch 1902358)
        if ( !IsVertical() && wxApp::GetComCtl32Version() < 600 )
        {
            // calculate the toolbar width in alternative way
            const RECT rcFirst = wxGetTBItemRect(GetHwnd(), 0);
            const RECT rcLast = wxGetTBItemRect(GetHwnd(), GetToolsCount() - 1);

            const int widthAlt = rcLast.right - rcFirst.left;
            if ( widthAlt > size.cx )
                size.cx = widthAlt;
        }

        sizeBest.x = size.cx;
        sizeBest.y = size.cy;
    }

    if ( !IsVertical() )
    {
        wxToolBarToolsList::compatibility_iterator node;
        for ( node = m_tools.GetFirst(); node; node = node->GetNext() )
        {
            wxToolBarTool * const
                tool = static_cast<wxToolBarTool *>(node->GetData());
            if (tool->IsControl())
            {
                int y = tool->GetControl()->GetSize().y;
                // Approximate border size
                if (y > (sizeBest.y - 4))
                    sizeBest.y = y + 4;
            }
        }

        // Without the extra height, DoGetBestSize can report a size that's
        // smaller than the actual window, causing windows to overlap slightly
        // in some circumstances, leading to missing borders (especially noticeable
        // in AUI layouts).
        if (!(GetWindowStyle() & wxTB_NODIVIDER))
            sizeBest.y += 2;
        sizeBest.y ++;
    }

    CacheBestSize(sizeBest);

    return sizeBest;
}

--- End code ---
is wrong here.

ollydbg:
OK, now I see the extra 3 pixels lines comes from the wx's code. See my detailed discussion here: wxToolbar managed by wxAui: why the bottom edge of the toolbar are not drawn correctly

ollydbg:
The workaround is that we can explicitly reduce the toolbar size if it contains a wxChoice.
From my point of view, I think the old way is quite compact( so I like the compact toolbar :) ), and save a lot of spaces for other windows(such as the notebook window)

Or, wx's source code need to be changed, I see it is introduced by this commit:

--- Code: ---Revision: 0185d61a2c6f91cf47932fce0d68d70b7e578b17
Author: JulianSmart <julian@anthemion.co.uk>
Date: 2015-11-25 5:28:09
Message:
Ensure toolbar fits controls that are taller than the buttons in wxMSW toolbar


----
Modified: src/msw/toolbar.cpp



--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version