From 29577a571d0b97b3a948b492e602b39cfa78c80c Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Sun, 18 Oct 2020 10:36:17 -0400 Subject: [PATCH] Add a custom dock art provider for aui manager with slight improvement --- common/CMakeLists.txt | 1 + common/eda_base_frame.cpp | 2 ++ common/widgets/wx_aui_dock_art.cpp | 34 ++++++++++++++++++++++++++++++ include/eda_base_frame.h | 2 ++ include/widgets/wx_aui_dock_art.h | 31 +++++++++++++++++++++++++++ 5 files changed, 70 insertions(+) create mode 100644 common/widgets/wx_aui_dock_art.cpp create mode 100644 include/widgets/wx_aui_dock_art.h diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 2050d1dc3f..7e10763764 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -235,6 +235,7 @@ set( COMMON_WIDGET_SRCS widgets/wx_busy_indicator.cpp widgets/wx_grid.cpp widgets/wx_angle_text.cpp + widgets/wx_aui_dock_art.cpp ) set( COMMON_PAGE_LAYOUT_SRCS diff --git a/common/eda_base_frame.cpp b/common/eda_base_frame.cpp index 937559d22d..633898ddb4 100644 --- a/common/eda_base_frame.cpp +++ b/common/eda_base_frame.cpp @@ -96,6 +96,8 @@ EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent, FRAME_T aFrameType, m_mruPath = wxStandardPaths::Get().GetDocumentsDir(); m_FrameSize = wxSize( s_minsize_x, s_minsize_y ); + m_auimgr.SetArtProvider( &m_auiDockArt ); + m_settingsManager = &Pgm().GetSettingsManager(); // Set a reasonable minimal size for the frame diff --git a/common/widgets/wx_aui_dock_art.cpp b/common/widgets/wx_aui_dock_art.cpp new file mode 100644 index 0000000000..9ef04db90f --- /dev/null +++ b/common/widgets/wx_aui_dock_art.cpp @@ -0,0 +1,34 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include +#include + + +WX_AUI_DOCK_ART::WX_AUI_DOCK_ART() : wxAuiDefaultDockArt() +{ + // Use normal control font, wx likes to use "small" + m_captionFont = *wxNORMAL_FONT; + + // Increase the box the caption rests in size a bit + m_captionSize = wxWindow::FromDIP( 25, NULL ); + + // Turn off the ridiculous looking gradient + m_gradientType = wxAUI_GRADIENT_NONE; +} \ No newline at end of file diff --git a/include/eda_base_frame.h b/include/eda_base_frame.h index 0185dc38ca..8577542262 100644 --- a/include/eda_base_frame.h +++ b/include/eda_base_frame.h @@ -47,6 +47,7 @@ #include #include #include +#include #include // Option for main frames @@ -135,6 +136,7 @@ protected: wxString m_AboutTitle; // Name of program displayed in About. + WX_AUI_DOCK_ART m_auiDockArt; // Our custom dock art provider we feed to the aui manager wxAuiManager m_auimgr; wxString m_perspective; // wxAuiManager perspective. diff --git a/include/widgets/wx_aui_dock_art.h b/include/widgets/wx_aui_dock_art.h new file mode 100644 index 0000000000..4de7673f40 --- /dev/null +++ b/include/widgets/wx_aui_dock_art.h @@ -0,0 +1,31 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef WX_AUI_DOCK_ART_H +#define WX_AUI_DOCK_ART_H + +#include + +class WX_AUI_DOCK_ART : public wxAuiDefaultDockArt +{ +public: + WX_AUI_DOCK_ART(); +}; + +#endif \ No newline at end of file