Honour originTransforms in search panels.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15031
This commit is contained in:
Jeff Young 2023-11-09 18:40:47 +00:00
parent 5cd1a4674f
commit 6ecfc89a4a
4 changed files with 16 additions and 12 deletions

View File

@ -25,7 +25,6 @@
*/ */
#include <bezier_curves.h> #include <bezier_curves.h>
#include <base_units.h>
#include <convert_basic_shapes_to_polygon.h> #include <convert_basic_shapes_to_polygon.h>
#include <eda_draw_frame.h> #include <eda_draw_frame.h>
#include <geometry/shape_simple.h> #include <geometry/shape_simple.h>
@ -710,8 +709,7 @@ wxString EDA_SHAPE::GetFriendlyName() const
void EDA_SHAPE::ShapeGetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) void EDA_SHAPE::ShapeGetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
{ {
ORIGIN_TRANSFORMS originTransforms = aFrame->GetOriginTransforms(); wxString msg;
wxString msg;
wxString shape = _( "Shape" ); wxString shape = _( "Shape" );
aList.emplace_back( shape, GetFriendlyName() ); aList.emplace_back( shape, GetFriendlyName() );

View File

@ -26,7 +26,7 @@
#ifndef PCB_BASE_FRAME_H #ifndef PCB_BASE_FRAME_H
#define PCB_BASE_FRAME_H #define PCB_BASE_FRAME_H
#include <eda_units.h>
#include <eda_item.h> #include <eda_item.h>
#include <board.h> #include <board.h>
#include <eda_draw_frame.h> #include <eda_draw_frame.h>
@ -144,6 +144,11 @@ public:
*/ */
ORIGIN_TRANSFORMS& GetOriginTransforms() override; ORIGIN_TRANSFORMS& GetOriginTransforms() override;
wxString MessageTextFromCoord( int aValue, ORIGIN_TRANSFORMS::COORD_TYPES_T aCoordType ) const
{
return MessageTextFromValue( m_originTransforms.ToDisplay( aValue, aCoordType ) );
}
const TITLE_BLOCK& GetTitleBlock() const override; const TITLE_BLOCK& GetTitleBlock() const override;
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) override; void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) override;

View File

@ -430,7 +430,7 @@ void PCB_DIMENSION_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame,
aList.emplace_back( _( "Text Width" ), unitsProvider.MessageTextFromValue( GetTextWidth() ) ); aList.emplace_back( _( "Text Width" ), unitsProvider.MessageTextFromValue( GetTextWidth() ) );
aList.emplace_back( _( "Text Height" ), unitsProvider.MessageTextFromValue( GetTextHeight() ) ); aList.emplace_back( _( "Text Height" ), unitsProvider.MessageTextFromValue( GetTextHeight() ) );
ORIGIN_TRANSFORMS originTransforms = aFrame->GetOriginTransforms(); ORIGIN_TRANSFORMS& originTransforms = aFrame->GetOriginTransforms();
if( Type() == PCB_DIM_CENTER_T ) if( Type() == PCB_DIM_CENTER_T )
{ {
@ -1184,7 +1184,7 @@ void PCB_DIM_LEADER::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PA
// Don't use GetShownText(); we want to see the variable references here // Don't use GetShownText(); we want to see the variable references here
aList.emplace_back( _( "Leader" ), KIUI::EllipsizeStatusText( aFrame, GetText() ) ); aList.emplace_back( _( "Leader" ), KIUI::EllipsizeStatusText( aFrame, GetText() ) );
ORIGIN_TRANSFORMS originTransforms = aFrame->GetOriginTransforms(); ORIGIN_TRANSFORMS& originTransforms = aFrame->GetOriginTransforms();
VECTOR2I startCoord = originTransforms.ToDisplayAbs( GetStart() ); VECTOR2I startCoord = originTransforms.ToDisplayAbs( GetStart() );
wxString start = wxString::Format( wxT( "@(%s, %s)" ), wxString start = wxString::Format( wxT( "@(%s, %s)" ),

View File

@ -124,9 +124,9 @@ wxString FOOTPRINT_SEARCH_HANDLER::getResultCell( BOARD_ITEM* aItem, int aCol )
else if( aCol == 2 ) else if( aCol == 2 )
return fp->GetLayerName(); return fp->GetLayerName();
else if( aCol == 3 ) else if( aCol == 3 )
return m_frame->MessageTextFromValue( fp->GetX() ); return m_frame->MessageTextFromCoord( fp->GetX(), ORIGIN_TRANSFORMS::ABS_X_COORD );
else if( aCol == 4 ) else if( aCol == 4 )
return m_frame->MessageTextFromValue( fp->GetY() ); return m_frame->MessageTextFromCoord( fp->GetY(), ORIGIN_TRANSFORMS::ABS_Y_COORD );
return wxEmptyString; return wxEmptyString;
} }
@ -188,9 +188,10 @@ wxString ZONE_SEARCH_HANDLER::getResultCell( BOARD_ITEM* aItem, int aCol )
else if( aCol == 3 ) else if( aCol == 3 )
return wxString::Format( "%d", zone->GetAssignedPriority() ); return wxString::Format( "%d", zone->GetAssignedPriority() );
else if( aCol == 4 ) else if( aCol == 4 )
return m_frame->MessageTextFromValue( zone->GetX() ); return m_frame->MessageTextFromCoord( zone->GetX(), ORIGIN_TRANSFORMS::ABS_X_COORD );
else if( aCol == 5 ) else if( aCol == 5 )
return m_frame->MessageTextFromValue( zone->GetY() ); return m_frame->MessageTextFromCoord( zone->GetY(), ORIGIN_TRANSFORMS::ABS_Y_COORD );
return wxEmptyString; return wxEmptyString;
} }
@ -252,9 +253,9 @@ wxString TEXT_SEARCH_HANDLER::getResultCell( BOARD_ITEM* aItem, int aCol )
else if( aCol == 2 ) else if( aCol == 2 )
return aItem->GetLayerName(); return aItem->GetLayerName();
else if( aCol == 3 ) else if( aCol == 3 )
return m_frame->MessageTextFromValue( aItem->GetX() ); return m_frame->MessageTextFromCoord( aItem->GetX(), ORIGIN_TRANSFORMS::ABS_X_COORD );
else if( aCol == 4 ) else if( aCol == 4 )
return m_frame->MessageTextFromValue( aItem->GetY() ); return m_frame->MessageTextFromCoord( aItem->GetY(), ORIGIN_TRANSFORMS::ABS_Y_COORD );
return wxEmptyString; return wxEmptyString;
} }