Fixes dangling ends and rotation when labels/texts are converted into each other
CHANGED: Eeschema: Preserve text justification when switching text types Closes https://gitlab.com/kicad/code/kicad/-/merge_requests/86
This commit is contained in:
parent
8b3c0a941c
commit
5b58dbc980
|
@ -34,6 +34,7 @@
|
||||||
#include <sch_draw_panel.h>
|
#include <sch_draw_panel.h>
|
||||||
#include <confirm.h>
|
#include <confirm.h>
|
||||||
#include <sch_edit_frame.h>
|
#include <sch_edit_frame.h>
|
||||||
|
#include <sch_view.h>
|
||||||
#include <kicad_device_context.h>
|
#include <kicad_device_context.h>
|
||||||
|
|
||||||
#include <general.h>
|
#include <general.h>
|
||||||
|
@ -238,6 +239,34 @@ void SCH_EDIT_FRAME::OnConvertTextType( wxCommandEvent& aEvent )
|
||||||
if( screen->GetCurItem() == text )
|
if( screen->GetCurItem() == text )
|
||||||
screen->SetCurItem( newtext );
|
screen->SetCurItem( newtext );
|
||||||
|
|
||||||
|
// handle dangling end for the different label/text types
|
||||||
|
if( type == SCH_TEXT_T )
|
||||||
|
{
|
||||||
|
if( newtext->IsDangling() )
|
||||||
|
{
|
||||||
|
newtext->SetIsDangling( false );
|
||||||
|
GetCanvas()->GetView()->Update( newtext, KIGFX::REPAINT );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newtext->SetIsDangling( true );
|
||||||
|
}
|
||||||
|
|
||||||
|
TestDanglingEnds();
|
||||||
|
|
||||||
|
// fix rotation of the converted label, only needed for horizontal labels:
|
||||||
|
bool newTypeIsBig = newtext->Type() == SCH_GLOBAL_LABEL_T ||
|
||||||
|
newtext->Type() == SCH_HIERARCHICAL_LABEL_T;
|
||||||
|
bool oldTypeIsBig = text->Type() == SCH_GLOBAL_LABEL_T ||
|
||||||
|
text->Type() == SCH_HIERARCHICAL_LABEL_T;
|
||||||
|
|
||||||
|
if ( ( newTypeIsBig && !oldTypeIsBig ) ||
|
||||||
|
( !newTypeIsBig && oldTypeIsBig ) )
|
||||||
|
{
|
||||||
|
newtext->MirrorY( newtext->GetPosition().x );
|
||||||
|
}
|
||||||
|
|
||||||
if( text->IsNew() )
|
if( text->IsNew() )
|
||||||
{
|
{
|
||||||
// if the previous text is new, no undo command to prepare here
|
// if the previous text is new, no undo command to prepare here
|
||||||
|
|
Loading…
Reference in New Issue