Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: Loaden on August 22, 2010, 03:00:44 pm

Title: Instead wxToolBar by wxAuiToolBar ?
Post by: Loaden on August 22, 2010, 03:00:44 pm
In Ubuntu 10.4, the wxToolBar is very ugly.
(http://forums.codeblocks.org/index.php?action=dlattach;topic=13153.0;attach=4831;image)
So, why not instead by wxAuiToolBar ?
(http://forums.codeblocks.org/index.php?action=dlattach;topic=13153.0;attach=4833;image)
Any comments are welcome ?
Title: Re: Instead wxToolBar by wxAuiToolBar ?
Post by: thynson on September 14, 2010, 10:46:59 pm
Agreed. I remember that I used to complained for it in "Using codeblocks" forum.
Title: Re: Instead wxToolBar by wxAuiToolBar ?
Post by: MortenMacFly on September 15, 2010, 06:55:53 am
So, why not instead by wxAuiToolBar ?
Any comments are welcome ?
That would be OK, however, it requires re-writing quite some portions, not to forget plugins (probably not in our own repo).
Title: Re: Instead wxToolBar by wxAuiToolBar ?
Post by: Loaden on September 24, 2010, 08:39:48 am
I am trying, but is seems so hard! Because since there is currently no XRC handler for wxAuiToolBar.
My current thinking like this.

include/cbtoolbar.h
Code
/*
 * This file is part of the Code::Blocks IDE and licensed under the GNU Lesser General Public License, version 3
 * http://www.gnu.org/licenses/lgpl-3.0.html
 */

#ifndef CBTOOLBAR_H
#define CBTOOLBAR_H

#define CB_USE_WXAUITOOLBAR

#ifdef CB_USE_WXTOOLBAR
#undef CB_USE_WXAUITOOLBAR
#endif

#ifdef CB_USE_WXAUITOOLBAR
#include <wx/aui/aui.h>
#else
#include <wx/toolbar.h>
#endif

class DLLIMPORT cbToolBar :
#ifdef CB_USE_WXAUITOOLBAR
    public wxAuiToolBar
#else
    public wxToolBar
#endif
{
public:
    cbToolBar(wxWindow* parent,
              wxWindowID id = wxID_ANY,
              const wxPoint& pos = wxDefaultPosition,
              const wxSize& size = wxDefaultSize,
#ifdef CB_USE_WXAUITOOLBAR
              long style = wxAUI_TB_DEFAULT_STYLE
#else
              long style = wxNO_BORDER | wxTB_HORIZONTAL
#endif
             ) :
#ifdef CB_USE_WXAUITOOLBAR
        wxAuiToolBar(parent, id, pos, size, style)
#else
        wxToolBar(parent, id, pos, size, style, wxToolBarNameStr)
#endif
    {
    }
};

#endif // CBTOOLBAR_H

I need more help, or any good idea.
This patch *JUST* for trying, and it's can not build success.
Title: Re: Instead wxToolBar by wxAuiToolBar ?
Post by: Jenna on September 24, 2010, 10:42:12 am
Creating an xrc-handler should not be too hard, I will try it, if I find the time.
Title: Re: Instead wxToolBar by wxAuiToolBar ?
Post by: eranif on September 24, 2010, 01:59:36 pm
Instead of replacing wxToolBar with wxAUIToolBar, you could inherit from wxAuiDefaultToolBarArt and override the method:

Code
virtual void DrawGripper( wxDC& dc, wxWindow* wnd, const wxRect& rect);

This will remove the 'ugliness' of the wxToolBar. You should also remember that wxAuiToolBar does not look native on the various themes of Ubuntu (especially the dark ones)

Eran

Title: Re: Instead wxToolBar by wxAuiToolBar ?
Post by: Loaden on November 08, 2010, 05:30:27 pm
Creating an xrc-handler should not be too hard, I will try it, if I find the time.
If it is not easy, I think we can give up xrc, just only C++ code instead?
Title: Re: Instead wxToolBar by wxAuiToolBar ?
Post by: Loaden on November 08, 2010, 05:31:16 pm
Instead of replacing wxToolBar with wxAUIToolBar, you could inherit from wxAuiDefaultToolBarArt and override the method:

Code
virtual void DrawGripper( wxDC& dc, wxWindow* wnd, const wxRect& rect);

This will remove the 'ugliness' of the wxToolBar. You should also remember that wxAuiToolBar does not look native on the various themes of Ubuntu (especially the dark ones)

Eran

Thank to eranif!
Title: Re: Instead wxToolBar by wxAuiToolBar ?
Post by: ironhead on November 08, 2010, 07:27:58 pm
Could this be extended to Windows as well?  The toolbars look OK in WinXP, but look ugly under Win7 (similar to the Ubuntu screenshots).

I noticed the SVN change was limited to Linux only...
Title: Re: Instead wxToolBar by wxAuiToolBar ?
Post by: Loaden on November 09, 2010, 01:04:51 am
Could this be extended to Windows as well?  The toolbars look OK in WinXP, but look ugly under Win7 (similar to the Ubuntu screenshots).

I noticed the SVN change was limited to Linux only...
No, the SVN change just for status bar.
In Linux, the status bar is very ugly, and not the default show like other GTK2 applications.
So, I'm set the style to wxSB_FLAT, it's looks better than before.

Maybe we can find another way?
Title: Re: Instead wxToolBar by wxAuiToolBar ?
Post by: polygon7 on November 12, 2010, 08:53:24 pm
I am trying, but is seems so hard! Because since there is currently no XRC handler for wxAuiToolBar.
My current thinking like this.

include/cbtoolbar.h
Code
/*
 * This file is part of the Code::Blocks IDE and licensed under the GNU Lesser General Public License, version 3
 * http://www.gnu.org/licenses/lgpl-3.0.html
 */

#ifndef CBTOOLBAR_H
#define CBTOOLBAR_H

#define CB_USE_WXAUITOOLBAR

#ifdef CB_USE_WXTOOLBAR
#undef CB_USE_WXAUITOOLBAR
#endif

#ifdef CB_USE_WXAUITOOLBAR
#include <wx/aui/aui.h>
#else
#include <wx/toolbar.h>
#endif

class DLLIMPORT cbToolBar :
#ifdef CB_USE_WXAUITOOLBAR
    public wxAuiToolBar
#else
    public wxToolBar
#endif
{
public:
    cbToolBar(wxWindow* parent,
              wxWindowID id = wxID_ANY,
              const wxPoint& pos = wxDefaultPosition,
              const wxSize& size = wxDefaultSize,
#ifdef CB_USE_WXAUITOOLBAR
              long style = wxAUI_TB_DEFAULT_STYLE
#else
              long style = wxNO_BORDER | wxTB_HORIZONTAL
#endif
             ) :
#ifdef CB_USE_WXAUITOOLBAR
        wxAuiToolBar(parent, id, pos, size, style)
#else
        wxToolBar(parent, id, pos, size, style, wxToolBarNameStr)
#endif
    {
    }
};

#endif // CBTOOLBAR_H

I need more help, or any good idea.
This patch *JUST* for trying, and it's can not build success.

Unfortunately this patch don't apply cleanly on rev. 6845 - there are problems in:
Code
src/include/cbplugin.h
src/plugins/autosave/autosave.h
src/plugins/codecompletion/codecompletion.h
with
Code
bool BuildToolBar(cbToolBar* /*toolBar*/)
and after hand-made modifications compilation breaks on Manager::LoadToolBar():
Code
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../../src/include -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread -I../../src/include -I../../src/sdk/wxscintilla/include -I../../src/sdk/wxpropgrid/include -I../../src/include/tinyxml -I../../src/include/scripting/include -I../../src/include/scripting/sqplus -I../../src/include/mozilla_chardet -Ulinux -Uunix -O2 -ffast-math -DCB_AUTOCONF -march=k8-sse3 -O3 -fomit-frame-pointer -ftracer -ftree-vectorize -fpeel-loops -funroll-loops -fsplit-ivs-in-unroller -DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -fexceptions -MT manager.lo -MD -MP -MF .deps/manager.Tpo -c manager.cpp  -fPIC -DPIC -o .libs/manager.o
manager.cpp: In static member function 'static cbToolBar* Manager::LoadToolBar(wxFrame*, wxString, bool)':
manager.cpp:276:92: error: invalid static_cast from type 'wxToolBar*' to type 'cbToolBar*'

After changing static_cast into reinterpret_cast there are another problems:
Code
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../../src/include -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread -I../../src/include -I../../src/sdk/wxscintilla/include -I../../src/sdk/wxpropgrid/include -I../../src/include/tinyxml -I../../src/include/scripting/include -I../../src/include/scripting/sqplus -I../../src/include/mozilla_chardet -Ulinux -Uunix -O2 -ffast-math -DCB_AUTOCONF -march=k8-sse3 -O3 -fomit-frame-pointer -ftracer -ftree-vectorize -fpeel-loops -funroll-loops -fsplit-ivs-in-unroller -DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -fexceptions -MT CharDistribution.lo -MD -MP -MF .deps/CharDistribution.Tpo -c mozilla_chardet/src/CharDistribution.cpp  -fPIC -DPIC -o .libs/CharDistribution.o
xtra_res.cpp: In member function 'virtual wxObject* cbToolBarAddOnXmlHandler::DoCreateResource()':
xtra_res.cpp:114:55: error: no matching function for call to 'cbToolBar::AddTool(int, wxBitmap, wxBitmap, bool, int, int, NULL, wxString, wxString)'
/usr/include/wx-2.8/wx/aui/auibar.h:438:10: note: candidates are: void wxAuiToolBar::AddTool(int, const wxString&, const wxBitmap&, const wxString&, wxItemKind)
/usr/include/wx-2.8/wx/aui/auibar.h:444:10: note:                 void wxAuiToolBar::AddTool(int, const wxString&, const wxBitmap&, const wxBitmap&, wxItemKind, const wxString&, const wxString&, wxObject*)
/usr/include/wx-2.8/wx/aui/auibar.h:453:10: note:                 void wxAuiToolBar::AddTool(int, const wxBitmap&, const wxBitmap&, bool, wxObject*, const wxString&, const wxString&)
xtra_res.cpp:138:55: error: no matching function for call to 'cbToolBar::AddTool(int, wxString, wxBitmap, wxBitmap, wxItemKind&, wxString, wxString)'
/usr/include/wx-2.8/wx/aui/auibar.h:438:10: note: candidates are: void wxAuiToolBar::AddTool(int, const wxString&, const wxBitmap&, const wxString&, wxItemKind)
/usr/include/wx-2.8/wx/aui/auibar.h:444:10: note:                 void wxAuiToolBar::AddTool(int, const wxString&, const wxBitmap&, const wxBitmap&, wxItemKind, const wxString&, const wxString&, wxObject*)
/usr/include/wx-2.8/wx/aui/auibar.h:453:10: note:                 void wxAuiToolBar::AddTool(int, const wxBitmap&, const wxBitmap&, bool, wxObject*, const wxString&, const wxString&)
xtra_res.cpp:170:13: error: no matching function for call to 'cbToolBar::cbToolBar()'
./cbtoolbar.h:29:5: note: candidates are: cbToolBar::cbToolBar(wxWindow*, wxWindowID, const wxPoint&, const wxSize&, long int)
./cbtoolbar.h:27:1: note:                 cbToolBar::cbToolBar(const cbToolBar&)
xtra_res.cpp:177:39: error: no matching function for call to 'cbToolBar::Create(wxWindow*&, int, wxPoint, wxSize, int&, wxString)'
/usr/include/wx-2.8/wx/gtk/control.h:40:10: note: candidate is: bool wxControl::Create(wxWindow*, wxWindowID, const wxPoint&, const wxSize&, long int, const wxValidator&, const wxString&)
xtra_res.cpp:233:52: error: no matching function for call to 'wxFrame::SetToolBar(cbToolBar*&)'
/usr/include/wx-2.8/wx/gtk/frame.h:69:10: note: candidate is: virtual void wxFrame::SetToolBar(wxToolBar*)

Arch Linux, g++ (GCC) 4.5.1, wx 2.8.11, C::B rev. 6845