Author Topic: toolbar bottom edge is not shown corectly under C::B build with wx git master  (Read 31167 times)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5913
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
I have build C::B trunk wx30 project(the wxScintilla 3.6.x branch) against wx git master. (Under Windows XP with MinGW-W64 GCC 5.3 compiler)
The wx git head is:
Code
Revision: 0a555f3c833ab94c9ee3f9250778b113894e14e0
Author: Artur Wieczorek <artwik@wp.pl>
Date: 2016-2-13 3:06:47
Message:
Fix ToolsVersion value in minimal sample project file (VS 2010+).


Since minimal.vcxproj file is shared by VS 2010-15 solution files, ToolsVersion value should be set to the value supported by all VS versions since 2010 to avoid warning messages like "Project file contains ToolsVersion="14.0", which is not supported by this version of MSBuild.".
----
Modified: samples/minimal/minimal.vcxproj

But I see the toolbar does not shown correctly, the bottom edge is not drawn, see image shot below.



Did you see this issue in your environment?
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5913
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
It looks like the toolbar height is a big larger then the correct one(such as 16.01 release).
The former one has 5 vertical dots in the left edge of the toolbar, but the later has only four dots.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5913
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
It looks like our wxToolBarAddOnXmlHandler has some issues

See image below:
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5913
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Code
<?xml version="1.0" encoding="utf-8" ?>
<resource xmlns="http://www.wxwidgets.org/wxxrc" version="2.5.3.0">
  <object class="wxToolBarAddOn" name="compiler_toolbar">
    <object class="tool" name="idCompilerMenuCompile">
      <tooltip>Build</tooltip>
      <longhelp>Build the active project</longhelp>
      <bitmap>images/compile.png</bitmap>
    </object>
    <object class="tool" name="idCompilerMenuRun">
      <tooltip>Run</tooltip>
      <longhelp>Run the active project</longhelp>
      <bitmap>images/run.png</bitmap>
    </object>
    <object class="tool" name="idCompilerMenuCompileAndRun">
      <tooltip>Build and run</tooltip>
      <longhelp>Build and run the active project</longhelp>
      <bitmap>images/compilerun.png</bitmap>
    </object>
    <object class="tool" name="idCompilerMenuRebuild">
      <tooltip>Rebuild</tooltip>
      <longhelp>Rebuild all modules in the active project</longhelp>
      <bitmap>images/rebuild.png</bitmap>
    </object>
    <object class="tool" name="idCompilerMenuKillProcess">
      <tooltip>Abort</tooltip>
      <longhelp>Abort the running build process</longhelp>
      <bitmap>images/stop.png</bitmap>
      <disabled>1</disabled>
    </object>
    <object class="wxChoice" name="idToolTarget">
      <content/>
  <size>136,-1</size>
      <tooltip>Build target</tooltip>
      <longhelp>Select the current build target</longhelp>
    </object>
  </object>
</resource>
This is the toolbar's XRC file, and you see the left are 5 icons, and right is a wxChoice.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5913
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
The header file:

Code
class wxXmlResourceHandler;

class DLLIMPORT wxToolBarAddOnXmlHandler : public wxXmlResourceHandler
{
    public:
        wxToolBarAddOnXmlHandler();
        virtual wxObject *DoCreateResource();
        virtual bool CanHandle(wxXmlNode *node);

    protected:
        bool m_isInside;
        bool m_isAddon;
        wxToolBar *m_toolbar;

        wxBitmap GetCenteredBitmap(const wxString& param = wxT("bitmap"),
            const wxArtClient& defaultArtClient = wxART_OTHER,
            wxSize size = wxDefaultSize);
};

And the cpp file:
Code
#include <wx/xml/xml.h>

/////////////////////////////////////////////////////////////////////////////
// Name:        xh_toolb.cpp
// Purpose:     XRC resource for wxBoxSizer
// Author:      Vaclav Slavik
// Created:     2000/08/11
// RCS-ID:      $Id$
// Copyright:   (c) 2000 Vaclav Slavik
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// Modified by Ricardo Garcia for Code::Blocks
// Comment: Things would've been much easier if field m_isInside had been
//          protected instead of private! >:(
/////////////////////////////////////////////////////////////////////////////

wxToolBarAddOnXmlHandler::wxToolBarAddOnXmlHandler()
: wxXmlResourceHandler(), m_isInside(FALSE), m_isAddon(false), m_toolbar(NULL)
{
    XRC_ADD_STYLE(wxTB_FLAT);
    XRC_ADD_STYLE(wxTB_DOCKABLE);
    XRC_ADD_STYLE(wxTB_VERTICAL);
    XRC_ADD_STYLE(wxTB_HORIZONTAL);
    XRC_ADD_STYLE(wxTB_3DBUTTONS);
    XRC_ADD_STYLE(wxTB_TEXT);
    XRC_ADD_STYLE(wxTB_NOICONS);
    XRC_ADD_STYLE(wxTB_NODIVIDER);
    XRC_ADD_STYLE(wxTB_NOALIGN);
}

wxBitmap wxToolBarAddOnXmlHandler::GetCenteredBitmap(const wxString& param,
    const wxArtClient& defaultArtClient, wxSize size)
{
    wxBitmap bitmap = GetBitmap(param, defaultArtClient, wxDefaultSize);
    if (!bitmap.Ok()) // == wxNullBitmap
        return bitmap;

    int bw = bitmap.GetWidth();
    int bh = bitmap.GetHeight();
    if (size == wxSize(bw, bh))
        return bitmap;

    wxImage image = bitmap.ConvertToImage();

    int w = size.GetWidth();
    int h = size.GetHeight();
    int x = (w - bw) / 2;
    int y = (h - bh) / 2;

    if (image.HasAlpha()) // Resize doesn't handle Alpha... :-(
    {
        const unsigned char *data = image.GetData();
        const unsigned char *alpha = image.GetAlpha();
        unsigned char *rgb = (unsigned char *) calloc(w * h, 3);
        unsigned char *a = (unsigned char *) calloc(w * h, 1);

        // copy Data/Alpha from smaller bitmap to larger bitmap
        for (int row = 0; row < bh; row++)
        {
            memcpy(rgb + ((row + y) * w + x) * 3, data + (row * bw) * 3, bw * 3);
            memcpy(a + ((row + y) * w + x), alpha + (row * bw), bw);
        }

        image = wxImage(w, h, rgb, a);
    }
    else
        image.Resize(size, wxPoint(x,y));

    return wxBitmap(image);
}

wxObject *wxToolBarAddOnXmlHandler::DoCreateResource()
{
    wxToolBar* toolbar=NULL;
    if (m_class == _T("tool"))
    {
        wxCHECK_MSG(m_toolbar, NULL, _("Incorrect syntax of XRC resource: tool not within a toolbar!"));

        wxSize bitmapSize = m_toolbar->GetToolBitmapSize();

        if (GetPosition() != wxDefaultPosition)
        {
            m_toolbar->AddTool(GetID(),
            #if wxCHECK_VERSION(3, 0, 0)
                               wxEmptyString,
            #endif
                               GetCenteredBitmap(_T("bitmap"), wxART_TOOLBAR, bitmapSize),
                               GetCenteredBitmap(_T("bitmap2"), wxART_TOOLBAR, bitmapSize),
            #if !wxCHECK_VERSION(3, 0, 0)
                               GetBool(_T("toggle")),
                               GetPosition().x,
                               GetPosition().y,
                               NULL,
            #else
                               wxITEM_NORMAL,
            #endif
                               GetText(_T("tooltip")),
                               GetText(_T("longhelp")));
           if (GetBool(_T("disabled")))
           {
               m_toolbar->Realize();
               m_toolbar->EnableTool(GetID(),false);
           }
        }
        else
        {
            wxItemKind kind = wxITEM_NORMAL;
            if (GetBool(_T("radio")))
                kind = wxITEM_RADIO;
            if (GetBool(_T("toggle")))
            {
                wxASSERT_MSG( kind == wxITEM_NORMAL,
                              _("can't have both toggleable and radion button at once") );
                kind = wxITEM_CHECK;
            }
            m_toolbar->AddTool(GetID(),
                               GetText(_T("label")),
                               GetCenteredBitmap(_T("bitmap"), wxART_TOOLBAR, bitmapSize),
                               GetCenteredBitmap(_T("bitmap2"), wxART_TOOLBAR, bitmapSize),
                               kind,
                               GetText(_T("tooltip")),
                               GetText(_T("longhelp")));
           if (GetBool(_T("disabled")))
           {
               m_toolbar->Realize();
               m_toolbar->EnableTool(GetID(),false);
           }
        }
        return m_toolbar; // must return non-NULL
    }

    else if (m_class == _T("separator"))
    {
        wxCHECK_MSG(m_toolbar, NULL, _("Incorrect syntax of XRC resource: separator not within a toolbar!"));
        m_toolbar->AddSeparator();
        return m_toolbar; // must return non-NULL
    }

    else /*<object class="wxToolBar">*/
    {
        m_isAddon=(m_class == _T("wxToolBarAddOn"));
        if(m_isAddon)
        { // special case: Only add items to toolbar
          toolbar=(wxToolBar*)m_instance;
          // XRC_MAKE_INSTANCE(toolbar, wxToolBar);
        }
        else
        {
            int style = GetStyle(_T("style"), wxNO_BORDER | wxTB_HORIZONTAL);
            #ifdef __WXMSW__
            if (!(style & wxNO_BORDER)) style |= wxNO_BORDER;
            #endif

            // XRC_MAKE_INSTANCE(toolbar, wxToolBar)
            if (m_instance)
                toolbar = wxStaticCast(m_instance, wxToolBar);
            if (!toolbar)
                toolbar = new wxToolBar;

            toolbar->Create(m_parentAsWindow,
                             GetID(),
                             GetPosition(),
                             GetSize(),
                             style,
                             GetName());
            wxSize bmpsize = GetSize(_T("bitmapsize"));
            if (!(bmpsize == wxDefaultSize))
                toolbar->SetToolBitmapSize(bmpsize);
            wxSize margins = GetSize(_T("margins"));
            if (!(margins == wxDefaultSize))
                toolbar->SetMargins(margins.x, margins.y);
            long packing = GetLong(_T("packing"), -1);
            if (packing != -1)
                toolbar->SetToolPacking(packing);
            long separation = GetLong(_T("separation"), -1);
            if (separation != -1)
                toolbar->SetToolSeparation(separation);
        }

        wxXmlNode *children_node = GetParamNode(_T("object"));
        if (!children_node)
           children_node = GetParamNode(_T("object_ref"));

        if (children_node == NULL) return toolbar;

        m_isInside = TRUE;
        m_toolbar = toolbar;

        wxXmlNode *n = children_node;

        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();
        }

        toolbar->Realize();

        m_isInside = FALSE;
        m_toolbar = NULL;

        if(!m_isAddon)
        {
            if (m_parentAsWindow && !GetBool(_T("dontattachtoframe")))
            {
                wxFrame *parentFrame = wxDynamicCast(m_parent, wxFrame);
                if (parentFrame)
                    parentFrame->SetToolBar(toolbar);
            }
        }
        m_isAddon=false;
        return toolbar;
    }
}

bool wxToolBarAddOnXmlHandler::CanHandle(wxXmlNode *node)
{
// NOTE (mandrav#1#): wxXmlResourceHandler::IsOfClass() doesn't work in unicode (2.6.2)
// Don't ask why. It does this and doesn't work for our custom handler:
//    return node->GetPropVal(wxT("class"), wxEmptyString) == classname;
//
// This works though:
//    return node->GetPropVal(wxT("class"), wxEmptyString).Matches(classname);
//
// Don't ask me why... >:-|

    #if wxCHECK_VERSION(3, 0, 0)
    bool istbar = node->GetAttribute(wxT("class"), wxEmptyString).Matches(_T("wxToolBarAddOn"));
    bool istool = node->GetAttribute(wxT("class"), wxEmptyString).Matches(_T("tool"));
    bool issep = node->GetAttribute(wxT("class"), wxEmptyString).Matches(_T("separator"));
    #else
    bool istbar = node->GetPropVal(wxT("class"), wxEmptyString).Matches(_T("wxToolBarAddOn"));
    bool istool = node->GetPropVal(wxT("class"), wxEmptyString).Matches(_T("tool"));
    bool issep = node->GetPropVal(wxT("class"), wxEmptyString).Matches(_T("separator"));
    #endif

    return ((!m_isInside && istbar) ||
            (m_isInside && istool) ||
            (m_isInside && issep));
}

I guess that when wxChoice is added, some extra space is added.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5913
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
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();
        }
...

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?
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
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.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5913
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
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;
}
is wrong here.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5913
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
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
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5913
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
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


« Last Edit: February 14, 2016, 07:15:05 am by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5913
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
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



I just revert the above commit, and build wx library again, and I see the issue is gone!
(NOTE: please reset the layout files by click the menu->View->perspectives->Delete current, other wise, the wrong size is still used even you update the wx dll)
« Last Edit: February 14, 2016, 07:47:21 am by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5913
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
This is a screen shot of my own build C::B under Win7-64bit. I'm still using a 32 bit GCC, and C::B is build against wx 3.1 release.

So, we still see the wrong toolbar which has extra spaces in the bottom edge.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline cacb

  • Lives here!
  • ****
  • Posts: 536
I attach 2 screen shots. One of an older C::B on Windows built from wx2.8 and another new one on Linux/Kubuntu built from wx3.0.2
Notice the huge difference in toolbar size and size occupied by icons and especially wxChoice items. This is possibly the same issue as reported this thread. Notice that in the case of the Kubuntu version I edited the code completion XRC before building C::B to make it half the default size. It is still very large.


The windows version is one of the precompiled Nightly Builds I downloaded
svn build rev 10595 (2015-11-18 01:53:38) gcc 4.9.2 Windows/unicode - 32 bit
The Help about says Build: Nov 9 2015, 21:39:40 - wx2.8.12 (Windows, unicode) - 32 bit

The Kubuntu version is built from sourcee on Kubuntu 16.10 64bit using
https://apt.jenslody.de/stable/pool/main/codeblocks_16.01svn11019.orig.tar.gz
The Help about says Build: Feb 20 2016, 08:05:41 - wx3.0.2 (Linux, unicode) - 64 bit
I guess the year above should really be 2017, but it says 2016
Also note I really compiled it Mar 10, 2017 from that tar file




Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
What gtk are you using?
My toolbars look perfectly fine and slim with both wxgtk2.8 and wxgtk3.0.
Comparing wxmsw and wxgtk build is not a good idea - they use totally different rendering engines underneath.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline cacb

  • Lives here!
  • ****
  • Posts: 536
What gtk are you using?

I don't select that anywhere explicitly. I am building against the official wxWidgets in the Kubuntu repository, not a self-built one.  However, it looks like it is gtk2 from the list below?

ldd /usr/bin/codeblocks
        linux-vdso.so.1 =>  (0x00007ffd081aa000)
        libcodeblocks.so.0 => /usr/lib/libcodeblocks.so.0 (0x00007f6c491d7000)
        libwx_gtk2u_aui-3.0.so.0 => /usr/lib/x86_64-linux-gnu/libwx_gtk2u_aui-3.0.so.0 (0x00007f6c48f3e000)
        libwx_gtk2u_propgrid-3.0.so.0 => /usr/lib/x86_64-linux-gnu/libwx_gtk2u_propgrid-3.0.so.0 (0x00007f6c48c56000)
        libwx_gtk2u_xrc-3.0.so.0 => /usr/lib/x86_64-linux-gnu/libwx_gtk2u_xrc-3.0.so.0 (0x00007f6c488e5000)
        libwx_gtk2u_html-3.0.so.0 => /usr/lib/x86_64-linux-gnu/libwx_gtk2u_html-3.0.so.0 (0x00007f6c48607000)
        libwx_gtk2u_qa-3.0.so.0 => /usr/lib/x86_64-linux-gnu/libwx_gtk2u_qa-3.0.so.0 (0x00007f6c483d7000)
        libwx_gtk2u_adv-3.0.so.0 => /usr/lib/x86_64-linux-gnu/libwx_gtk2u_adv-3.0.so.0 (0x00007f6c47ff1000)
        libwx_gtk2u_core-3.0.so.0 => /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0 (0x00007f6c47778000)
        libwx_baseu_net-3.0.so.0 => /usr/lib/x86_64-linux-gnu/libwx_baseu_net-3.0.so.0 (0x00007f6c4752c000)
        libwx_baseu-3.0.so.0 => /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0 (0x00007f6c4709a000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f6c46e7a000)
        libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f6c46af2000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f6c467e9000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f6c465d2000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f6c4620b000)
        libwx_baseu_xml-3.0.so.0 => /usr/lib/x86_64-linux-gnu/libwx_baseu_xml-3.0.so.0 (0x00007f6c45ffb000)
        libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f6c45ce5000)
        libgtk-x11-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0 (0x00007f6c45699000)
        libgdk-x11-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0 (0x00007f6c453e4000)
        libgobject-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007f6c45191000)
        libgdk_pixbuf-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0 (0x00007f6c44f6f000)
        libpango-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libpango-1.0.so.0 (0x00007f6c44d21000)
        libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f6c449e8000)
        libnotify.so.4 => /usr/lib/x86_64-linux-gnu/libnotify.so.4 (0x00007f6c447e0000)
        libpangocairo-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so.0 (0x00007f6c445d3000)
        libcairo.so.2 => /usr/lib/x86_64-linux-gnu/libcairo.so.2 (0x00007f6c442c0000)
        libXxf86vm.so.1 => /usr/lib/x86_64-linux-gnu/libXxf86vm.so.1 (0x00007f6c440ba000)
        libSM.so.6 => /usr/lib/x86_64-linux-gnu/libSM.so.6 (0x00007f6c43eb0000)
        libpng16.so.16 => /usr/lib/x86_64-linux-gnu/libpng16.so.16 (0x00007f6c43c7e000)
        libjpeg.so.8 => /usr/lib/x86_64-linux-gnu/libjpeg.so.8 (0x00007f6c43a14000)
        libtiff.so.5 => /usr/lib/x86_64-linux-gnu/libtiff.so.5 (0x00007f6c437a1000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f6c43587000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f6c43383000)
        /lib64/ld-linux-x86-64.so.2 (0x000055c5c2829000)
        libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f6c43157000)
        libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f6c42ee4000)
        libgmodule-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgmodule-2.0.so.0 (0x00007f6c42ce0000)                                                                                                                             
        libXfixes.so.3 => /usr/lib/x86_64-linux-gnu/libXfixes.so.3 (0x00007f6c42ada000)                                                                                                                                       
        libatk-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libatk-1.0.so.0 (0x00007f6c428b5000)                                                                                                                                     
        libgio-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0 (0x00007f6c42520000)                                                                                                                                     
        libpangoft2-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0 (0x00007f6c42308000)                                                                                                                           
        libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007f6c420c5000)                                                                                                                               
        libXrender.so.1 => /usr/lib/x86_64-linux-gnu/libXrender.so.1 (0x00007f6c41ebb000)                                                                                                                                     
        libXinerama.so.1 => /usr/lib/x86_64-linux-gnu/libXinerama.so.1 (0x00007f6c41cb8000)                                                                                                                                   
        libXi.so.6 => /usr/lib/x86_64-linux-gnu/libXi.so.6 (0x00007f6c41aa8000)                                                                                                                                               
        libXrandr.so.2 => /usr/lib/x86_64-linux-gnu/libXrandr.so.2 (0x00007f6c4189d000)                                                                                                                                       
        libXcursor.so.1 => /usr/lib/x86_64-linux-gnu/libXcursor.so.1 (0x00007f6c41691000)                                                                                                                                     
        libXcomposite.so.1 => /usr/lib/x86_64-linux-gnu/libXcomposite.so.1 (0x00007f6c4148e000)                                                                                                                               
        libXdamage.so.1 => /usr/lib/x86_64-linux-gnu/libXdamage.so.1 (0x00007f6c4128b000)                                                                                                                                     
        libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007f6c41079000)                                                                                                                                           
        libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007f6c40e71000)                                                                                                                                             
        libthai.so.0 => /usr/lib/x86_64-linux-gnu/libthai.so.0 (0x00007f6c40c68000)                                                                                                                                           
        libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f6c40a44000)                                                                                                                                             
        libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007f6c40797000)                                                                                                                                   
        libpixman-1.so.0 => /usr/lib/x86_64-linux-gnu/libpixman-1.so.0 (0x00007f6c404ef000)                                                                                                                                   
        libxcb-shm.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-shm.so.0 (0x00007f6c402eb000)                                                                                                                                     
        libxcb-render.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-render.so.0 (0x00007f6c400e1000)                                                                                                                               
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f6c3fed9000)                                                                                                                                                   
        libICE.so.6 => /usr/lib/x86_64-linux-gnu/libICE.so.6 (0x00007f6c3fcbd000)                                                                                                                                             
        libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007f6c3fab8000)                                                                                                                                               
        liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f6c3f895000)                                                                                                                                               
        libjbig.so.0 => /usr/lib/x86_64-linux-gnu/libjbig.so.0 (0x00007f6c3f687000)                                                                                                                                           
        libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007f6c3f461000)                                                                                                                                         
        libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f6c3f244000)                                                                                                                                           
        libmount.so.1 => /lib/x86_64-linux-gnu/libmount.so.1 (0x00007f6c3effc000)                                                                                                                                             
        libharfbuzz.so.0 => /usr/lib/x86_64-linux-gnu/libharfbuzz.so.0 (0x00007f6c3ed7c000)
        libdatrie.so.1 => /usr/lib/x86_64-linux-gnu/libdatrie.so.1 (0x00007f6c3eb74000)
        libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f6c3e970000)
        libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f6c3e768000)
        libblkid.so.1 => /lib/x86_64-linux-gnu/libblkid.so.1 (0x00007f6c3e526000)
        libgraphite2.so.3 => /usr/lib/x86_64-linux-gnu/libgraphite2.so.3 (0x00007f6c3e301000)


My toolbars look perfectly fine and slim with both wxgtk2.8 and wxgtk3.0.
Comparing wxmsw and wxgtk build is not a good idea - they use totally different rendering engines underneath.

I agree they use different engines underneath, and I don't expect them to be identical. What I expect is that both are reasonably similar, and currently the toolbars as shown in my Kubuntu 16.10 build are not quite what I would expect (hence the comparison). I used to build C::B exactly the same way under Kubuntu 15.10 and before (implying wx2.8.12) and the toolbars were more compact and reasonable then.

For the record, all I do when building from the *.tar.gz is

1. Fix debian/rules to use add --with-wx-config=/usr/bin/wx-config  to DEB_CONFIGURE_EXTRA_FLAGS
2. sudo dpkg-buildpackage

That's it.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5913
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
@cacb: In your Linux's screen shot:

So, the toolbar have both spaces in the top and bottom edges, you expect those edges should be smaller, right?
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
@cacb: Sorry, I've asked the wrong question - it should have been - "What gtk theme are you using?"

This is what affects drawing of such controls.
Can you also try the auidemo sample or some other wxwidgets sample to verify that the problem happens there, too?
I'm sure it will happen.

Edit: What is the resolution of you display?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5913
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Can you also try the auidemo sample or some other wxwidgets sample to verify that the problem happens there, too?
The wx demo's should not have such issue(I have tested under Windows about one year before), because this issue is caused by our customized xrc loader, see discussion in this thread before(you can see the previous posts).

The wx guys are adding more vertical spaces as in wx 3.0+ compared with wx 2.8.12. This is because we more large screen resolutions nowadays(for me, I'm using a 1920x1080 for 14 inch screen), so people don't care about the added one or two pixels. But for a low resolution screen(as I have an old laptop which is 1280x800 for 14 inch screen), adding one or two space pixesl in the vertical edge may not look good, since the toolbar may looks too high in the vertical direction.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline cacb

  • Lives here!
  • ****
  • Posts: 536
So, the toolbar have both spaces in the top and bottom edges, you expect those edges should be smaller, right?
Yes, that is correct. This becomes problematic when there is also extra space used left & right of each toolbar item, making the toolbars extra wide. Because they are extra wide, you really need two rows of toolbars, but then you lose twice as much vertical space. So it really adds up.

Ideally, I would like something much more compact (like on Windows). The toolbars were always using more space on linux than windows but it became much more noticeable when I moved from Kubuntu 15.10 (+C::B compiled with wx 2.8.12) to Kubuntu 16.10 (+C::B compiled with wx 3.0)

Offline cacb

  • Lives here!
  • ****
  • Posts: 536
@cacb: Sorry, I've asked the wrong question - it should have been - "What gtk theme are you using?"
This is what affects drawing of such controls.

It is just the default KDE desktop under Kubuntu 16.10, I think that is "plasma". Is that an answer? I don't have that computer available right now, will try to check tonight.

Can you also try the auidemo sample or some other wxwidgets sample to verify that the problem happens there, too?
I'm sure it will happen.

I will check this and get back to you. Btw, I have a couple of wx GUI applications I have written myself that is using AUI toolbars, and I do not see such issues there, the toolbars are ok. But I will try the auidemo also.

As far as I could tell from browsing the C::B source for the code completion plugin, the C::B toolbars are based on wxToolbar, not wxAuiToolbar, not sure if it makes any difference.

Edit: What is the resolution of you display?

I believe it is 1920x1200, will check later.

Offline cacb

  • Lives here!
  • ****
  • Posts: 536
It is just the default KDE desktop under Kubuntu 16.10, I think that is "plasma". Is that an answer? I don't have that computer available right now, will try to check tonight.

The desktop theme is "Breeze"

I will check this and get back to you. Btw, I have a couple of wx GUI applications I have written myself that is using AUI toolbars, and I do not see such issues there, the toolbars are ok. But I will try the auidemo also.

See attached image (how do you embed images here??). At the top the C::B toolbar, below is the wxWidgets 3.0 auidemo with much more compact toolbar. At the bottom an application I have made with wxSmith and AUI.

Edit: What is the resolution of you display?

I believe it is 1920x1200, will check later.

Confirmed 1920x1200

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Here is how they look on my machine and theme: (both wx3 and 2.8 )



It is obvious that the toolbar with wxChoice control is bigger than the one without it.
Also it is obvious that our toolbars and the ones in the auidemo/your sample are different. Now we need someone to dig a big in the code and try to make them look the same.

p.s. it is better idea to use image sharing site instead of image attacments here.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline cacb

  • Lives here!
  • ****
  • Posts: 536
I found out something interesting

When using wxAuiToolbar, if you add the code below, the toolbar items are much more packed. If you don't call it, the default is similar to calling it with a paddeing value = 3. My toolbars are created with wxSmith and I tried to find such an option in the properties, with no luck. So I added the code below outside the auto-generated code:

    AuiToolBar1->SetToolBorderPadding(0);
    AuiToolBar1->Realize();


As mentioned, I think Code::Blocks is not using wxAuiToolbar, but wxToolbar? I could not find the SetToolBorderPadding(int padding) for wxToolbar, but there is something similar
   
    wxToolBar::SetToolSeparation(int separation);

In the documentation it says "The default value is 5.". Maybe this is a clue, although it does nothing for the vertical size.

EDIT: there is also
   wxToolBar::SetToolPacking(int packing);

PS. ok I see what you are saying about images, will consider

« Last Edit: March 13, 2017, 09:12:33 pm by cacb »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Can you try to modify C::B and test it with your theme? Then tell us if it makes a difference?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline cacb

  • Lives here!
  • ****
  • Posts: 536
Can you try to modify C::B and test it with your theme? Then tell us if it makes a difference?

I can try, but I don't have a setup to build C::B other than running the build command as mentioned. Do you know where the wxToolbar objects are created (which source file)?  Then I can try to manipulate those things.

Maybe I could set up a virtual machine for building C::B with the IDE, if there is a good link on how to do that, please share.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Search the wiki for tutorials about building. For experiments you can use autotools. Just set the --prefix to something in your home folder.
This method Manager::CreateEmptyToolbar is probably the place to start the investigation.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline cacb

  • Lives here!
  • ****
  • Posts: 536
Search the wiki for tutorials about building. For experiments you can use autotools. Just set the --prefix to something in your home folder.
This method Manager::CreateEmptyToolbar is probably the place to start the investigation.

I added
    toolbar->SetToolPacking(0);
    toolbar->SetToolSeparation(0);

in Manager::CreateEmptyToolbar and rebuilt C::B, but I could not observe any visual difference.

Then I tried
    toolbar->SetMargins(0,0);
This also did not make any difference that I could observe.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Then the next step is to replace wxToolbar with wxAuiToolbar in C::B or vice-versa in auidemo and see if this fixes/reproduces it.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5913
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
For this issue, I create a simple demo code to demonstrate.

Code

#include <wx/wx.h>
#include <wx/frame.h>
#include <wx/artprov.h>
#include <wx/aui/aui.h>

/*---------------------------------------------------------------------------------------------------------*/
// HEADER

enum
{
ID_ShowNormal = wxID_HIGHEST,
    ID_ShowBug,
    ID_ShowWorkaround,
};

class MyApp : public wxApp
{
public:
bool OnInit();
};

class MyFrame : public wxFrame
{
public:
MyFrame(wxFrame *parent,
wxWindowID id = wxID_ANY,
const wxString& title = _T("wxToolBar Bug Demo"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE|wxCLIP_CHILDREN|wxNO_FULL_REPAINT_ON_RESIZE);
virtual ~MyFrame();

wxToolBar *m_tb;
wxToolBar *m_tb2;
    wxToolBar *m_tb3;
wxAuiManager m_mngr;

DECLARE_EVENT_TABLE()
};

/*---------------------------------------------------------------------------------------------------------*/
// SOURCE

IMPLEMENT_APP(MyApp)

bool MyApp::OnInit()
{
MyFrame* frame = new MyFrame((wxFrame *) NULL, wxID_ANY,
_T("wxToolbar Bug Demo"),
wxPoint(100, 100), wxSize(550, 300));

frame->Show(true);

wxInitAllImageHandlers();

SetTopWindow(frame);

return true;
}

BEGIN_EVENT_TABLE(MyFrame,wxFrame)
END_EVENT_TABLE()

MyFrame::MyFrame(wxFrame* parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos,
const wxSize& size,
long style)
: wxFrame(parent, id, title, pos, size, style)
,m_tb(0), m_tb2(0),m_tb3(0)
{
m_mngr.SetManagedWindow(this);
wxMenu *menuFile=new wxMenu;
menuFile->Append(ID_ShowNormal,wxT("Show Normal"));
menuFile->Append(ID_ShowBug,wxT("Show Bug"));
menuFile->Append(ID_ShowWorkaround,wxT("Show Workaround"));
wxMenuBar *menuBar = new wxMenuBar();
menuBar->Append(menuFile,wxT("Mode"));
SetMenuBar(menuBar);
//m_mngr.Update();



m_tb=new wxToolBar(this,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxTB_FLAT|wxTB_NODIVIDER);
//m_tb->AddTool(wxID_ANY,wxT("tool1"),wxArtProvider::GetBitmap(wxART_FILE_OPEN,wxART_TOOLBAR));
//m_tb->AddTool(wxID_ANY,wxT("tool2"),wxArtProvider::GetBitmap(wxART_FILE_SAVE,wxART_TOOLBAR));
    m_tb->AddTool(wxID_ANY,wxT("tool1"),wxBitmap(16,15));
m_tb->AddTool(wxID_ANY,wxT("tool2"),wxBitmap(16,15));

m_tb->Realize();
wxAuiPaneInfo pi = wxAuiPaneInfo() .Name(wxT("toolbar"))
.Caption(wxT("toolbar"))
.ToolbarPane()
.Floatable()
.Direction(wxAUI_DOCK_TOP) // see also ticket #9722
.LeftDockable(false)
.RightDockable(false);
m_mngr.AddPane(m_tb,pi);

    m_tb2=new wxToolBar(this,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxTB_FLAT|wxTB_NODIVIDER);
//m_tb2->AddTool(wxID_ANY,wxT("tool1"),wxArtProvider::GetBitmap(wxART_FILE_OPEN,wxART_TOOLBAR));
//m_tb2->AddTool(wxID_ANY,wxT("tool2"),wxArtProvider::GetBitmap(wxART_FILE_SAVE,wxART_TOOLBAR));
m_tb2->AddTool(wxID_ANY,wxT("tool1"),wxBitmap(16,15));
m_tb2->AddTool(wxID_ANY,wxT("tool2"),wxBitmap(16,15));
m_tb2->Realize();
wxAuiPaneInfo pi2 = wxAuiPaneInfo() .Name(wxT("toolbar2"))
.Caption(wxT("toolbar2"))
.ToolbarPane()
.Floatable()
.Direction(wxAUI_DOCK_TOP) // see also ticket #9722
.LeftDockable(false)
.RightDockable(false);
m_mngr.AddPane(m_tb2,pi2);


    m_tb3=new wxToolBar(this,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxTB_FLAT|wxTB_NODIVIDER);
//m_tb3->AddTool(wxID_ANY,wxT("tool1"),wxArtProvider::GetBitmap(wxART_FILE_OPEN,wxART_TOOLBAR));
//m_tb3->AddTool(wxID_ANY,wxT("tool2"),wxArtProvider::GetBitmap(wxART_FILE_SAVE,wxART_TOOLBAR));
m_tb3->AddTool(wxID_ANY,wxT("tool1"),wxBitmap(16,15));
m_tb3->AddTool(wxID_ANY,wxT("tool2"),wxBitmap(16,15));
wxChoice* choice = new wxChoice(m_tb3, wxID_ANY);
    choice->AppendString(wxT("One choice"));
    choice->AppendString(wxT("Another choice"));
    m_tb3->AddControl(choice);
m_tb3->Realize();
wxAuiPaneInfo pi3 = wxAuiPaneInfo() .Name(wxT("toolbar3"))
.Caption(wxT("toolbar3"))
.ToolbarPane()
.Floatable()
.Direction(wxAUI_DOCK_TOP) // see also ticket #9722
.LeftDockable(false)
.RightDockable(false);
m_mngr.AddPane(m_tb3,pi3);

m_mngr.Update();
}

MyFrame::~MyFrame()
{
m_mngr.UnInit();
}


When the toolbar button is small, such as "16*15", then you drag the toolbar to move horizontally, you see the screen shot as attachment.

If you use the standard toolbar size, such as the commented line, you don't have such issue.



If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5913
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1557
This bug has just been fixed on wxWidgets trunk, commit ce903da

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5913
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5913
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Hi, I reread this thread again today.

I think in this thread, I have two main issues:
1, in wx3.x, the toolbar height is higher than wx2.x, but the bottom edge is not drawn correctly, which is already fixed in wx trunk now(see https://trac.wxwidgets.org/ticket/18138) by repaint the toolbar background when repainted.

2, the reason why the toolbar becomes higher is that in wx3.x, the wxChoice is higher than in wx 2.8. It is 3 pixels higher under Windows. Thus, the whole wxToolbar is 3 pixels higher. But it cause another two issues: issue 2.1, if you look at the screen shot, it normal toolbar bottom is top aligned in the toolbar, is it possible make them vertical center aligned. issue 2.2, is it possible to reduce the wxChoice to be a bit smaller height just like wx2.8? I see that this commit cause such issue(see this commit: Ensure toolbar fits controls that are taller than the buttons in wxMS… · wxWidgets/wxWidgets@0185d61)

Any suggestions?

EDIT:
I add a screen shot of the current c::b trunk build against wx3.1.2.
You see the two arrows pointing to the toolbar. The first row toolbar is higher, because it has wxChoice. The second row toolbar is compact(because it only contains toolbar buttons), which is the same height as c::b build against wx2.8.
« Last Edit: February 16, 2019, 03:58:29 pm by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.