diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt
index cdab253495..e5bd09ab2c 100644
--- a/common/CMakeLists.txt
+++ b/common/CMakeLists.txt
@@ -459,6 +459,7 @@ set( COMMON_SRCS
project/project_local_settings.cpp
properties/eda_angle_variant.cpp
+ properties/pg_cell_renderer.cpp
properties/pg_editors.cpp
properties/pg_properties.cpp
properties/property_mgr.cpp
diff --git a/common/properties/pg_cell_renderer.cpp b/common/properties/pg_cell_renderer.cpp
new file mode 100644
index 0000000000..33766e2ea1
--- /dev/null
+++ b/common/properties/pg_cell_renderer.cpp
@@ -0,0 +1,53 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2022 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
+#include
+
+
+PG_CELL_RENDERER::PG_CELL_RENDERER() :
+ wxPGDefaultRenderer()
+{}
+
+
+bool PG_CELL_RENDERER::Render( wxDC &aDC, const wxRect &aRect, const wxPropertyGrid *aGrid,
+ wxPGProperty *aProperty, int aColumn, int aItem, int aFlags ) const
+{
+ // Default behavior for value column
+ if( aColumn > 0 )
+ return wxPGDefaultRenderer::Render( aDC, aRect, aGrid, aProperty, aColumn, aItem, aFlags );
+
+ wxPGCell cell = aGrid->GetUnspecifiedValueAppearance();
+
+ wxString text;
+ int preDrawFlags = aFlags;
+
+ aProperty->GetDisplayInfo( aColumn, aItem, aFlags, &text, &cell );
+
+ text = wxControl::Ellipsize( text, aDC, wxELLIPSIZE_MIDDLE, aRect.GetWidth() );
+
+ int imageWidth = PreDrawCell( aDC, aRect, aGrid, cell, preDrawFlags );
+ int imageOffset = aProperty->GetImageOffset( imageWidth );
+
+ DrawEditorValue( aDC, aRect, imageOffset, text, aProperty, nullptr );
+
+ PostDrawCell( aDC, aGrid, cell, preDrawFlags );
+
+ return !text.IsEmpty();
+}
\ No newline at end of file
diff --git a/common/widgets/properties_panel.cpp b/common/widgets/properties_panel.cpp
index 9670a8ba7f..3b326611fc 100644
--- a/common/widgets/properties_panel.cpp
+++ b/common/widgets/properties_panel.cpp
@@ -23,6 +23,7 @@
#include
#include
#include
+#include
#include
#include
@@ -45,6 +46,9 @@ PROPERTIES_PANEL::PROPERTIES_PANEL( wxWindow* aParent, EDA_BASE_FRAME* aFrame )
if( !wxPGGlobalVars )
wxPGInitResourceModule();
+ delete wxPGGlobalVars->m_defaultRenderer;
+ wxPGGlobalVars->m_defaultRenderer = new PG_CELL_RENDERER();
+
m_caption = new wxStaticText( this, wxID_ANY, _( "No objects selected" ), wxDefaultPosition,
wxDefaultSize, 0 );
mainSizer->Add( m_caption, 0, wxALL | wxEXPAND, 5 );
diff --git a/include/eda_shape.h b/include/eda_shape.h
index 4d231a0c72..f93e861d56 100644
--- a/include/eda_shape.h
+++ b/include/eda_shape.h
@@ -110,7 +110,7 @@ public:
void SetShape( SHAPE_T aShape ) { m_shape = aShape; }
SHAPE_T GetShape() const { return m_shape; }
- wxString GetFriendlyName() const override;
+ wxString GetFriendlyName() const;
/**
* Return the starting point of the graphic.
diff --git a/include/properties/pg_cell_renderer.h b/include/properties/pg_cell_renderer.h
new file mode 100644
index 0000000000..0e91eccb3a
--- /dev/null
+++ b/include/properties/pg_cell_renderer.h
@@ -0,0 +1,34 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2022 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
+
+
+/**
+ * Enhanced renderer to work around some limitations in wxWidgets 3.0 capabilities
+ */
+class PG_CELL_RENDERER : public wxPGDefaultRenderer
+{
+public:
+ PG_CELL_RENDERER();
+ virtual ~PG_CELL_RENDERER() = default;
+
+ bool Render( wxDC &aDC, const wxRect &aRect, const wxPropertyGrid *aGrid,
+ wxPGProperty *aProperty, int aColumn, int aItem, int aFlags ) const override;
+};
\ No newline at end of file
diff --git a/pcbnew/pcb_shape.h b/pcbnew/pcb_shape.h
index 1d232bf64e..a6077a2b44 100644
--- a/pcbnew/pcb_shape.h
+++ b/pcbnew/pcb_shape.h
@@ -57,6 +57,8 @@ public:
return wxT( "PCB_SHAPE" );
}
+ wxString GetFriendlyName() const override { return EDA_SHAPE::GetFriendlyName(); }
+
bool IsType( const std::vector& aScanTypes ) const override;
void SetPosition( const VECTOR2I& aPos ) override { setPosition( aPos ); }