2011-12-29 20:11:42 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2015-01-07 19:07:15 +00:00
|
|
|
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2018-07-12 13:36:13 +00:00
|
|
|
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
2011-12-29 20:11:42 +00:00
|
|
|
*
|
|
|
|
* 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 2
|
|
|
|
* 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, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2011-09-23 13:57:12 +00:00
|
|
|
/**
|
|
|
|
* @file edtxtmod.cpp
|
2018-01-28 21:02:31 +00:00
|
|
|
* @brief Edit texts in footprints.
|
2011-09-23 13:57:12 +00:00
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <gr_basic.h>
|
|
|
|
#include <common.h>
|
|
|
|
#include <class_drawpanel.h>
|
2018-01-28 21:02:31 +00:00
|
|
|
#include <draw_graphic_text.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <trigo.h>
|
2018-01-29 15:39:40 +00:00
|
|
|
#include <pcb_base_frame.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <macros.h>
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <pcbnew.h>
|
2018-01-29 20:58:58 +00:00
|
|
|
#include <pcb_edit_frame.h>
|
|
|
|
#include <footprint_edit_frame.h>
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_board.h>
|
|
|
|
#include <class_module.h>
|
|
|
|
#include <class_text_mod.h>
|
|
|
|
#include <class_pcb_text.h>
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-02-03 19:27:28 +00:00
|
|
|
static void Show_MoveTexte_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
|
|
|
|
bool aErase );
|
2011-01-21 19:30:59 +00:00
|
|
|
static void AbortMoveTextModule( EDA_DRAW_PANEL* Panel, wxDC* DC );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
wxPoint MoveVector; // Move vector for move edge, exported
|
|
|
|
// to dialog_edit mod_text.cpp
|
|
|
|
static wxPoint TextInitialPosition; // Mouse cursor initial position for
|
|
|
|
// undo/abort move command
|
2013-05-05 07:17:48 +00:00
|
|
|
static double TextInitialOrientation; // module text initial orientation for
|
2009-11-14 22:15:22 +00:00
|
|
|
// undo/abort move+rot command+rot
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/* Add a new graphical text to the active module (footprint)
|
2014-09-10 15:18:42 +00:00
|
|
|
* Note there always are 2 mandatory texts: reference and value.
|
2011-12-12 08:37:05 +00:00
|
|
|
* New texts have the member TEXTE_MODULE.GetType() set to TEXT_is_DIVERS
|
2007-08-20 01:20:48 +00:00
|
|
|
*/
|
2015-01-07 19:07:15 +00:00
|
|
|
TEXTE_MODULE* FOOTPRINT_EDIT_FRAME::CreateTextModule( MODULE* aModule, wxDC* aDC )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2015-01-07 19:07:15 +00:00
|
|
|
TEXTE_MODULE* text = new TEXTE_MODULE( aModule );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2015-01-07 19:07:15 +00:00
|
|
|
text->SetFlags( IS_NEW );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2015-01-07 19:07:15 +00:00
|
|
|
if( LSET::AllTechMask().test( GetActiveLayer() ) ) // i.e. a possible layer for a text
|
|
|
|
text->SetLayer( GetActiveLayer() );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2018-06-06 10:05:56 +00:00
|
|
|
InstallTextOptionsFrame( text, NULL );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2015-01-07 19:07:15 +00:00
|
|
|
if( text->GetText().IsEmpty() )
|
|
|
|
{
|
|
|
|
delete text;
|
|
|
|
return NULL;
|
|
|
|
}
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2015-01-07 19:07:15 +00:00
|
|
|
// Add the new text object to the beginning of the footprint draw list.
|
|
|
|
if( aModule )
|
2017-04-25 09:06:24 +00:00
|
|
|
aModule->GraphicalItemsList().PushFront( text );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2015-01-07 19:07:15 +00:00
|
|
|
text->ClearFlags();
|
|
|
|
|
|
|
|
if( aDC )
|
|
|
|
text->Draw( m_canvas, aDC, GR_OR );
|
|
|
|
|
|
|
|
SetMsgPanel( text );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2015-01-07 19:07:15 +00:00
|
|
|
return text;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_BASE_FRAME::RotateTextModule( TEXTE_MODULE* Text, wxDC* DC )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
if( Text == NULL )
|
|
|
|
return;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
MODULE* module = (MODULE*) Text->GetParent();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2019-04-22 08:58:06 +00:00
|
|
|
if( module && module->GetEditFlags() == 0 && Text->GetEditFlags() == 0 ) // prepare undo command
|
2009-11-14 22:15:22 +00:00
|
|
|
{
|
2014-04-19 18:47:20 +00:00
|
|
|
if( IsType( FRAME_PCB ) )
|
2009-11-14 22:15:22 +00:00
|
|
|
SaveCopyInUndoList( module, UR_CHANGED );
|
2009-08-11 10:27:21 +00:00
|
|
|
}
|
|
|
|
|
2008-04-29 03:18:02 +00:00
|
|
|
// we expect MoveVector to be (0,0) if there is no move in progress
|
2011-12-22 13:28:11 +00:00
|
|
|
Text->Draw( m_canvas, DC, GR_XOR, MoveVector );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2017-01-23 20:30:11 +00:00
|
|
|
Text->SetTextAngle( Text->GetTextAngle() + 900 );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
Text->Draw( m_canvas, DC, GR_XOR, MoveVector );
|
2013-01-12 17:32:24 +00:00
|
|
|
SetMsgPanel( Text );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-08-11 10:27:21 +00:00
|
|
|
if( module )
|
2012-09-05 12:13:33 +00:00
|
|
|
module->SetLastEditTime();
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2010-02-19 13:23:58 +00:00
|
|
|
OnModify();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2018-07-12 13:36:13 +00:00
|
|
|
void PCB_BASE_FRAME::DeleteTextModule( TEXTE_MODULE* aText )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2018-07-12 13:36:13 +00:00
|
|
|
MODULE* module;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2018-07-12 13:36:13 +00:00
|
|
|
if( aText == NULL )
|
2007-08-20 01:20:48 +00:00
|
|
|
return;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2018-07-12 13:36:13 +00:00
|
|
|
module = static_cast<MODULE*>( aText->GetParent() );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2018-07-12 13:36:13 +00:00
|
|
|
if( aText->GetType() == TEXTE_MODULE::TEXT_is_DIVERS )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2019-04-22 08:58:06 +00:00
|
|
|
if( module && module->GetEditFlags() == 0 && aText->GetEditFlags() == 0 )
|
|
|
|
{
|
|
|
|
if( IsType( FRAME_PCB ) )
|
|
|
|
SaveCopyInUndoList( module, UR_CHANGED );
|
|
|
|
}
|
2018-07-12 13:36:13 +00:00
|
|
|
|
|
|
|
m_canvas->RefreshDrawingRect( aText->GetBoundingBox() );
|
|
|
|
aText->DeleteStructure();
|
2010-02-19 13:23:58 +00:00
|
|
|
OnModify();
|
2019-03-07 16:43:21 +00:00
|
|
|
|
|
|
|
if( module )
|
|
|
|
module->SetLastEditTime();
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-07-12 13:36:13 +00:00
|
|
|
/**
|
2009-11-14 22:15:22 +00:00
|
|
|
* Abort text move in progress.
|
|
|
|
*
|
|
|
|
* If a text is selected, its initial coordinates are regenerated.
|
2007-08-20 01:20:48 +00:00
|
|
|
*/
|
2011-01-21 19:30:59 +00:00
|
|
|
static void AbortMoveTextModule( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
BASE_SCREEN* screen = Panel->GetScreen();
|
2014-09-10 15:18:42 +00:00
|
|
|
TEXTE_MODULE* Text = static_cast<TEXTE_MODULE*>( screen->GetCurItem() );
|
2007-08-20 01:20:48 +00:00
|
|
|
MODULE* Module;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-02-13 09:07:30 +00:00
|
|
|
Panel->SetMouseCapture( NULL, NULL );
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
if( Text == NULL )
|
|
|
|
return;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2014-09-10 15:18:42 +00:00
|
|
|
Module = static_cast<MODULE*>( Text->GetParent() );
|
2008-04-29 03:18:02 +00:00
|
|
|
|
2010-11-18 13:38:08 +00:00
|
|
|
Text->DrawUmbilical( Panel, DC, GR_XOR, -MoveVector );
|
2008-04-01 05:21:50 +00:00
|
|
|
Text->Draw( Panel, DC, GR_XOR, MoveVector );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-08-11 14:10:34 +00:00
|
|
|
// If the text was moved (the move does not change internal data)
|
|
|
|
// it could be rotated while moving. So set old value for orientation
|
2011-12-21 13:42:02 +00:00
|
|
|
if( Text->IsMoving() )
|
2017-01-23 20:30:11 +00:00
|
|
|
Text->SetTextAngle( TextInitialOrientation );
|
2009-08-11 14:10:34 +00:00
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
// Redraw the text
|
2011-01-30 22:22:38 +00:00
|
|
|
Panel->RefreshDrawingRect( Text->GetBoundingBox() );
|
2008-04-29 03:18:02 +00:00
|
|
|
|
|
|
|
// leave it at (0,0) so we can use it Rotate when not moving.
|
|
|
|
MoveVector.x = MoveVector.y = 0;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-12-21 13:42:02 +00:00
|
|
|
Text->ClearFlags();
|
|
|
|
Module->ClearFlags();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
screen->SetCurItem( NULL );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_BASE_FRAME::StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
if( Text == NULL )
|
|
|
|
return;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2014-09-10 15:18:42 +00:00
|
|
|
MODULE *Module = static_cast<MODULE*>( Text->GetParent() );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-12-21 13:42:02 +00:00
|
|
|
Text->SetFlags( IS_MOVED );
|
|
|
|
Module->SetFlags( IN_EDIT );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
MoveVector.x = MoveVector.y = 0;
|
2008-04-29 03:18:02 +00:00
|
|
|
|
2017-01-23 20:30:11 +00:00
|
|
|
TextInitialPosition = Text->GetTextPos();
|
|
|
|
TextInitialOrientation = Text->GetTextAngle();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-11-18 13:38:08 +00:00
|
|
|
// Center cursor on initial position of text
|
2013-08-03 05:15:23 +00:00
|
|
|
SetCrossHairPosition( TextInitialPosition );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2010-11-18 13:38:08 +00:00
|
|
|
|
2013-01-12 17:32:24 +00:00
|
|
|
SetMsgPanel( Text );
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( Text );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->SetMouseCapture( Show_MoveTexte_Module, AbortMoveTextModule );
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->CallMouseCapture( DC, wxDefaultPosition, true );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_BASE_FRAME::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
if( Text != NULL )
|
|
|
|
{
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->RefreshDrawingRect( Text->GetBoundingBox() );
|
|
|
|
Text->DrawUmbilical( m_canvas, DC, GR_XOR, -MoveVector );
|
2008-04-29 03:18:02 +00:00
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
// Update the coordinates for anchor.
|
2014-09-10 15:18:42 +00:00
|
|
|
MODULE* Module = static_cast<MODULE*>( Text->GetParent() );
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
if( Module )
|
|
|
|
{
|
2009-08-11 14:10:34 +00:00
|
|
|
// Prepare undo command (a rotation can be made while moving)
|
2017-01-23 20:30:11 +00:00
|
|
|
double tmp = Text->GetTextAngle();
|
|
|
|
Text->SetTextAngle( TextInitialOrientation );
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2014-04-19 18:47:20 +00:00
|
|
|
if( IsType( FRAME_PCB ) )
|
2009-11-14 22:15:22 +00:00
|
|
|
SaveCopyInUndoList( Module, UR_CHANGED );
|
2009-08-11 14:10:34 +00:00
|
|
|
else
|
2016-05-25 09:52:43 +00:00
|
|
|
SaveCopyInUndoList( Module, UR_CHANGED );
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2017-01-23 20:30:11 +00:00
|
|
|
Text->SetTextAngle( tmp );
|
2009-08-11 14:10:34 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
// Set the new position for text.
|
2017-01-23 20:30:11 +00:00
|
|
|
Text->SetTextPos( GetCrossHairPosition() );
|
|
|
|
wxPoint textRelPos = Text->GetTextPos() - Module->GetPosition();
|
2013-03-13 18:53:58 +00:00
|
|
|
RotatePoint( &textRelPos, -Module->GetOrientation() );
|
2011-12-12 08:37:05 +00:00
|
|
|
Text->SetPos0( textRelPos );
|
2011-12-21 13:42:02 +00:00
|
|
|
Text->ClearFlags();
|
|
|
|
Module->ClearFlags();
|
2012-09-05 12:13:33 +00:00
|
|
|
Module->SetLastEditTime();
|
2010-02-19 13:23:58 +00:00
|
|
|
OnModify();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
// Redraw text.
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->RefreshDrawingRect( Text->GetBoundingBox() );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2009-08-11 14:10:34 +00:00
|
|
|
else
|
2011-09-07 19:41:04 +00:00
|
|
|
{
|
2017-01-23 20:30:11 +00:00
|
|
|
Text->SetTextPos( GetCrossHairPosition() );
|
2011-09-07 19:41:04 +00:00
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
2008-04-29 03:18:02 +00:00
|
|
|
// leave it at (0,0) so we can use it Rotate when not moving.
|
|
|
|
MoveVector.x = MoveVector.y = 0;
|
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->SetMouseCapture( NULL, NULL );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-03 19:27:28 +00:00
|
|
|
static void Show_MoveTexte_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
|
|
|
|
bool aErase )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2011-02-03 19:27:28 +00:00
|
|
|
BASE_SCREEN* screen = aPanel->GetScreen();
|
2014-09-10 15:18:42 +00:00
|
|
|
TEXTE_MODULE* Text = static_cast<TEXTE_MODULE*>( screen->GetCurItem() );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
if( Text == NULL )
|
|
|
|
return;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-11-18 13:38:08 +00:00
|
|
|
// Erase umbilical and text if necessary
|
2011-02-03 19:27:28 +00:00
|
|
|
if( aErase )
|
2010-11-18 13:38:08 +00:00
|
|
|
{
|
2011-02-03 19:27:28 +00:00
|
|
|
Text->DrawUmbilical( aPanel, aDC, GR_XOR, -MoveVector );
|
|
|
|
Text->Draw( aPanel, aDC, GR_XOR, MoveVector );
|
2010-11-18 13:38:08 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
MoveVector = TextInitialPosition - aPanel->GetParent()->GetCrossHairPosition();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-11-18 13:38:08 +00:00
|
|
|
// Draw umbilical if text moved
|
|
|
|
if( MoveVector.x || MoveVector.y )
|
2011-02-03 19:27:28 +00:00
|
|
|
Text->DrawUmbilical( aPanel, aDC, GR_XOR, -MoveVector );
|
|
|
|
|
2010-11-18 13:38:08 +00:00
|
|
|
// Redraw text
|
2011-02-03 19:27:28 +00:00
|
|
|
Text->Draw( aPanel, aDC, GR_XOR, MoveVector );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
2011-01-09 11:17:28 +00:00
|
|
|
|
2018-07-12 13:36:13 +00:00
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_BASE_FRAME::ResetTextSize( BOARD_ITEM* aItem, wxDC* aDC )
|
2011-01-09 11:17:28 +00:00
|
|
|
{
|
2018-04-28 15:22:25 +00:00
|
|
|
wxSize newSize = GetDesignSettings().GetTextSize( aItem->GetLayer() );
|
|
|
|
int newThickness = GetDesignSettings().GetTextThickness( aItem->GetLayer() );
|
|
|
|
bool newItalic = GetDesignSettings().GetTextItalic( aItem->GetLayer() );
|
2011-01-09 11:17:28 +00:00
|
|
|
|
2015-04-02 11:18:19 +00:00
|
|
|
if( aItem->Type() == PCB_TEXT_T )
|
2011-01-09 11:17:28 +00:00
|
|
|
{
|
2015-04-02 11:18:19 +00:00
|
|
|
TEXTE_PCB* text = static_cast<TEXTE_PCB*>( aItem );
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2015-04-02 11:18:19 +00:00
|
|
|
// Exit if there's nothing to do
|
2017-01-23 20:30:11 +00:00
|
|
|
if( text->GetTextSize() == newSize && text->GetThickness() == newThickness )
|
2015-04-02 11:18:19 +00:00
|
|
|
return;
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2015-04-02 11:18:19 +00:00
|
|
|
SaveCopyInUndoList( text, UR_CHANGED );
|
2017-01-23 20:30:11 +00:00
|
|
|
text->SetTextSize( newSize );
|
2015-04-02 11:18:19 +00:00
|
|
|
text->SetThickness( newThickness );
|
2018-04-28 15:22:25 +00:00
|
|
|
text->SetItalic( newItalic );
|
2011-01-09 11:17:28 +00:00
|
|
|
}
|
|
|
|
|
2015-04-02 11:18:19 +00:00
|
|
|
else if( aItem->Type() == PCB_MODULE_TEXT_T )
|
2011-01-09 11:17:28 +00:00
|
|
|
{
|
2015-04-02 11:18:19 +00:00
|
|
|
TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( aItem );
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2015-04-02 11:18:19 +00:00
|
|
|
// Exit if there's nothing to do
|
2017-01-23 20:30:11 +00:00
|
|
|
if( text->GetTextSize() == newSize && text->GetThickness() == newThickness )
|
2015-04-02 11:18:19 +00:00
|
|
|
return;
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2015-04-02 11:18:19 +00:00
|
|
|
SaveCopyInUndoList( text->GetParent(), UR_CHANGED );
|
2017-01-23 20:30:11 +00:00
|
|
|
text->SetTextSize( newSize );
|
2015-04-02 11:18:19 +00:00
|
|
|
text->SetThickness( newThickness );
|
2018-04-28 15:22:25 +00:00
|
|
|
text->SetItalic( newItalic );
|
2011-01-09 11:17:28 +00:00
|
|
|
}
|
2015-04-02 11:18:19 +00:00
|
|
|
else
|
|
|
|
return;
|
2011-01-09 11:17:28 +00:00
|
|
|
|
|
|
|
if( aDC )
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->Refresh();
|
2011-01-09 11:17:28 +00:00
|
|
|
|
|
|
|
OnModify();
|
|
|
|
}
|