mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Add paste length control to PCB Editor as well
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20732
This commit is contained in:
parent
c5fde2aeb5
commit
fd0b8fcc3c
@ -1714,13 +1714,14 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
|
||||
catch( IO_ERROR& )
|
||||
{
|
||||
// If it wasn't content, then paste as a text object.
|
||||
if( content.size() > ADVANCED_CFG::GetCfg().m_MaxPastedTextLength )
|
||||
if( content.size() > static_cast<size_t>( ADVANCED_CFG::GetCfg().m_MaxPastedTextLength ) )
|
||||
{
|
||||
int result = IsOK( m_frame, _( "Pasting a long text text string may be very slow. "
|
||||
"Do you want to continue?" ) );
|
||||
if( !result )
|
||||
return 0;
|
||||
}
|
||||
|
||||
SCH_TEXT* text_item = new SCH_TEXT( VECTOR2I( 0, 0 ), content );
|
||||
tempScreen->Append( text_item );
|
||||
}
|
||||
|
@ -1088,6 +1088,15 @@ int PCB_CONTROL::Paste( const TOOL_EVENT& aEvent )
|
||||
if( clipText.empty() )
|
||||
return 0;
|
||||
|
||||
// If it wasn't content, then paste as a text object.
|
||||
if( clipText.size() > static_cast<size_t>( ADVANCED_CFG::GetCfg().m_MaxPastedTextLength ) )
|
||||
{
|
||||
int result = IsOK( m_frame, _( "Pasting a long text text string may be very slow. "
|
||||
"Do you want to continue?" ) );
|
||||
if( !result )
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::unique_ptr<PCB_TEXT> item = std::make_unique<PCB_TEXT>( m_frame->GetModel() );
|
||||
item->SetText( clipText );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user