pagelayout_editor: minor fix and minor code cleanup

This commit is contained in:
jean-pierre charras 2022-03-02 10:01:54 +01:00
parent c5d85e0b7e
commit a8c29c47cf
5 changed files with 22 additions and 19 deletions

View File

@ -749,8 +749,6 @@ void PL_EDITOR_FRAME::UpdateStatusBar()
line.Printf( _("coord origin: %s"),
m_originSelectBox->GetString( m_originSelectChoice ).GetData() );
SetStatusText( line, 5 );
// Display units
}
@ -801,6 +799,7 @@ void PL_EDITOR_FRAME::HardRedraw()
m_propertiesPagelayout->CopyPrmsFromItemToPanel( item );
m_propertiesPagelayout->CopyPrmsFromGeneralToPanel();
UpdateMsgPanelInfo();
GetCanvas()->Refresh();
}
@ -925,3 +924,18 @@ bool PL_EDITOR_FRAME::GetPageNumberOption() const
{
return m_pageSelectBox->GetSelection() == 0;
}
#if 1
void PL_EDITOR_FRAME::UpdateMsgPanelInfo()
{
VECTOR2D size = GetPageSettings().GetSizeIU();
std::vector<MSG_PANEL_ITEM> msgItems;
msgItems.emplace_back( _( "Page Width" ), MessageTextFromValue( GetUserUnits(), size.x ) );
msgItems.emplace_back(
_( "Page Height" ), MessageTextFromValue( GetUserUnits(), size.y ) );
SetMsgPanel( msgItems );
}
#endif

View File

@ -164,6 +164,11 @@ public:
*/
void UpdateTitleAndInfo();
/**
* Display the size of the sheet to the message panel.
*/
void UpdateMsgPanelInfo();
void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;

View File

@ -53,14 +53,3 @@ EDA_RECT PL_EDITOR_LAYOUT::ComputeBoundingBox()
SetBoundingBox( bbox );
return bbox;
}
void PL_EDITOR_LAYOUT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
{
VECTOR2D size = GetPageSettings().GetSizeIU();
aList.emplace_back( _( "Page Width" ), MessageTextFromValue( aFrame->GetUserUnits(), size.x ) );
aList.emplace_back(
_( "Page Height" ), MessageTextFromValue( aFrame->GetUserUnits(), size.y ) );
}

View File

@ -74,8 +74,6 @@ public:
void SetBoundingBox( const EDA_RECT& aBox ) { m_boundingBox = aBox; }
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList );
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const;
#endif

View File

@ -161,10 +161,7 @@ int PL_EDITOR_CONTROL::UpdateMessagePanel( const TOOL_EVENT& aEvent )
}
else
{
std::vector<MSG_PANEL_ITEM> msgItems;
m_frame->GetPageLayout().GetMsgPanelInfo( m_frame, msgItems );
m_frame->SetMsgPanel( msgItems );
m_frame->UpdateMsgPanelInfo();
m_frame->GetPropertiesFrame()->CopyPrmsFromItemToPanel( nullptr );
}