eeschema: Add automatic rotate feature for placing global and

hierarchial labels
This commit is contained in:
Miklos Marton 2022-03-26 17:27:45 +01:00 committed by Seth Hillbrand
parent 193248e202
commit d30af7c164
11 changed files with 403 additions and 5 deletions

View File

@ -310,6 +310,16 @@ bool DIALOG_LABEL_PROPERTIES::TransferDataToWindow()
case TEXT_SPIN_STYLE::BOTTOM: m_spin3->Check( true ); break;
}
if( m_currentLabel->AutoRotateOnPlacementSupported() )
{
m_autoRotate->Show();
m_autoRotate->SetValue( m_currentLabel->AutoRotateOnPlacement() );
}
else
{
m_autoRotate->Hide();
}
return true;
}
@ -509,6 +519,11 @@ bool DIALOG_LABEL_PROPERTIES::TransferDataFromWindow()
else if( m_spin3->IsChecked() )
selectedSpinStyle = TEXT_SPIN_STYLE::BOTTOM;
if( m_currentLabel->AutoRotateOnPlacementSupported() )
m_currentLabel->SetAutoRotateOnPlacement( m_autoRotate->IsChecked() );
else
m_currentLabel->SetAutoRotateOnPlacement( false );
if( m_currentLabel->GetTextSpinStyle() != selectedSpinStyle )
m_currentLabel->SetTextSpinStyle( selectedSpinStyle );

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -82,7 +82,6 @@ DIALOG_LABEL_PROPERTIES_BASE::DIALOG_LABEL_PROPERTIES_BASE( wxWindow* parent, wx
m_grid->SetColSize( 12, 48 );
m_grid->EnableDragColMove( false );
m_grid->EnableDragColSize( true );
m_grid->SetColLabelSize( 22 );
m_grid->SetColLabelValue( 0, _("Name") );
m_grid->SetColLabelValue( 1, _("Value") );
m_grid->SetColLabelValue( 2, _("Show") );
@ -231,6 +230,9 @@ DIALOG_LABEL_PROPERTIES_BASE::DIALOG_LABEL_PROPERTIES_BASE( wxWindow* parent, wx
m_spin3 = new BITMAP_BUTTON( formatting->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
formattingSizer->Add( m_spin3, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_autoRotate = new wxCheckBox( formatting->GetStaticBox(), wxID_ANY, _("Auto"), wxDefaultPosition, wxDefaultSize, 0 );
formattingSizer->Add( m_autoRotate, 0, wxALL, 5 );
m_separator3 = new BITMAP_BUTTON( formatting->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_separator3->Enable( false );

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="15" />
<FileVersion major="1" minor="16" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
@ -14,6 +14,7 @@
<property name="file">dialog_label_properties_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">dialog_label_properties_base</property>
@ -25,6 +26,7 @@
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_array_enum">0</property>
<property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
@ -50,6 +52,7 @@
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Label Properties</property>
<property name="tooltip"></property>
<property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -529,6 +532,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@ -602,6 +606,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@ -675,6 +680,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@ -758,6 +764,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@ -1604,6 +1611,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@ -1676,6 +1684,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@ -1748,6 +1757,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@ -1820,6 +1830,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@ -1892,6 +1903,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@ -1964,6 +1976,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@ -2036,6 +2049,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@ -2108,6 +2122,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@ -2167,6 +2182,70 @@
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Auto</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_autoRotate</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
@ -2180,6 +2259,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -36,6 +36,7 @@ class WX_GRID;
#include <wx/radiobut.h>
#include <wx/choice.h>
#include <wx/panel.h>
#include <wx/checkbox.h>
#include <wx/gbsizer.h>
#include <wx/dialog.h>
@ -85,6 +86,7 @@ class DIALOG_LABEL_PROPERTIES_BASE : public DIALOG_SHIM
BITMAP_BUTTON* m_spin1;
BITMAP_BUTTON* m_spin2;
BITMAP_BUTTON* m_spin3;
wxCheckBox* m_autoRotate;
BITMAP_BUTTON* m_separator3;
wxStaticText* m_textSizeLabel;
wxTextCtrl* m_textSizeCtrl;
@ -96,7 +98,7 @@ class DIALOG_LABEL_PROPERTIES_BASE : public DIALOG_SHIM
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class
// Virtual event handlers, override them in your derived class
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnValueCharHook( wxKeyEvent& event ) { event.Skip(); }
virtual void OnEnterKey( wxCommandEvent& event ) { event.Skip(); }
@ -111,6 +113,7 @@ class DIALOG_LABEL_PROPERTIES_BASE : public DIALOG_SHIM
public:
DIALOG_LABEL_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Label Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_LABEL_PROPERTIES_BASE();
};

View File

@ -1349,13 +1349,43 @@ void SCH_EDIT_FRAME::AddItemToScreenAndUndoList( SCH_SCREEN* aScreen, SCH_ITEM*
{
std::vector<VECTOR2I> pts = aItem->GetConnectionPoints();
bool connected = true;
for( auto i = pts.begin(); i != pts.end(); i++ )
{
for( auto j = i + 1; j != pts.end(); j++ )
TrimWire( *i, *j );
if( aScreen->IsExplicitJunctionNeeded( *i ) )
{
AddJunction( aScreen, *i, true, false );
connected = true;
}
}
if( connected )
{
static KICAD_T autoRotatableLabelTypes[] = { SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T };
if( aItem->IsType( autoRotatableLabelTypes ) )
{
auto label = static_cast<SCH_LABEL_BASE*>( aItem );
if( label->AutoRotateOnPlacement() )
{
auto textSpin = aScreen->GetLabelOrientationForPoint(
label->GetPosition(), label->GetTextSpinStyle(), &GetCurrentSheet() );
if( textSpin != label->GetTextSpinStyle() )
{
label->SetTextSpinStyle( textSpin );
for( SCH_ITEM* item : aScreen->Items().OfType( SCH_GLOBAL_LABEL_T ) )
{
SCH_LABEL_BASE *otherLabel = static_cast<SCH_LABEL_BASE *>( item );
if ( otherLabel != label && otherLabel->GetText() == label->GetText() )
{
otherLabel->AutoplaceFields( aScreen, false );
}
}
}
}
}
}
TestDanglingEnds();

View File

@ -885,6 +885,15 @@ void SCH_LABEL_BASE::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aO
field.Print( aSettings, aOffset );
}
bool SCH_LABEL_BASE::AutoRotateOnPlacement() const
{
return m_autoRotateOnPlacement;
}
void SCH_LABEL_BASE::SetAutoRotateOnPlacement( bool autoRotate )
{
m_autoRotateOnPlacement = autoRotate;
}
SCH_LABEL::SCH_LABEL( const VECTOR2I& pos, const wxString& text ) :
SCH_LABEL_BASE( pos, text, SCH_LABEL_T )

View File

@ -168,6 +168,26 @@ public:
void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& offset ) override;
/**
* @brief autoRotateOnPlacement
* @return Returns true if the label rotation will be automatically set on the placement
*/
bool AutoRotateOnPlacement() const;
/**
* @brief setAutoRotateOnPlacement
* @param autoRotate If set to true when the label is placed in the connection to a
* pin/net the direction will be automatically set according to the positioning of the net/pin
*/
void SetAutoRotateOnPlacement( bool autoRotate = true );
/**
* @brief AutoRotateOnPlacementSupported
* @return true if the automated rotation of the label is supported after the placement
* At the moment it is supported for global and hierarchial labels
*/
virtual bool AutoRotateOnPlacementSupported() const = 0;
protected:
std::vector<SCH_FIELD> m_fields;
@ -175,6 +195,7 @@ protected:
CONNECTION_TYPE m_connectionType;
bool m_isDangling;
bool m_autoRotateOnPlacement = false;
};
@ -217,6 +238,8 @@ public:
return m_isDangling && GetPosition() == aPos;
}
bool AutoRotateOnPlacementSupported() const override { return false; }
private:
bool doIsConnected( const VECTOR2I& aPosition ) const override
{
@ -265,6 +288,8 @@ public:
bool IsConnectable() const override { return true; }
bool AutoRotateOnPlacementSupported() const override { return false; }
private:
int m_pinLength;
int m_symbolSize;
@ -324,6 +349,8 @@ public:
return m_isDangling && GetPosition() == aPos;
}
bool AutoRotateOnPlacementSupported() const override { return true; }
private:
bool doIsConnected( const VECTOR2I& aPosition ) const override
{
@ -379,6 +406,8 @@ public:
return m_isDangling && GetPosition() == aPos;
}
bool AutoRotateOnPlacementSupported() const override { return true; }
private:
bool doIsConnected( const VECTOR2I& aPosition ) const override
{

View File

@ -450,6 +450,223 @@ bool SCH_SCREEN::IsExplicitJunctionNeeded( const VECTOR2I& aPosition ) const
return isJunction && !hasBusEntry && !hasExplicitJunction;
}
TEXT_SPIN_STYLE SCH_SCREEN::GetLabelOrientationForPoint( const VECTOR2I& aPosition,
TEXT_SPIN_STYLE aDefaultOrientation,
const SCH_SHEET_PATH* aSheet ) const
{
auto ret = aDefaultOrientation;
for( SCH_ITEM* item : Items().Overlapping( aPosition ) )
{
if( item->GetEditFlags() & STRUCT_DELETED )
continue;
switch( item->Type() )
{
case SCH_BUS_WIRE_ENTRY_T:
{
auto busEntry = static_cast<const SCH_BUS_WIRE_ENTRY*>( item );
if( busEntry->m_connected_bus_item )
{
// bus connected, take the bus direction into consideration ony if it is
// vertical or horizontal
auto bus = static_cast<const SCH_LINE*>( busEntry->m_connected_bus_item );
if( bus->Angle().AsDegrees() == 90.0 )
{
// bus is vertical -> label shall be horizontal and
// shall be placed to the side where the bus entry is
if( aPosition.x < bus->GetPosition().x )
ret = TEXT_SPIN_STYLE::LEFT;
else if( aPosition.x > bus->GetPosition().x )
ret = TEXT_SPIN_STYLE::RIGHT;
}
else if( bus->Angle().AsDegrees() == 0.0 )
{
// bus is horizontal -> label shall be vertical and
// shall be placed to the side where the bus entry is
if( aPosition.y < bus->GetPosition().y )
ret = TEXT_SPIN_STYLE::UP;
else if( aPosition.y > bus->GetPosition().y )
ret = TEXT_SPIN_STYLE::BOTTOM;
}
}
}
break;
case SCH_LINE_T:
{
auto line = static_cast<const SCH_LINE*>( item );
// line angles goes between -90 and 90 degrees, but normalize
auto angle = line->Angle().Normalize90().AsDegrees();
if( -45 < angle && angle <= 45 )
{
if( line->GetStartPoint().x <= line->GetEndPoint().x )
{
ret = line->GetEndPoint() == aPosition ? TEXT_SPIN_STYLE::RIGHT
: TEXT_SPIN_STYLE::LEFT;
}
else
{
ret = line->GetEndPoint() == aPosition ? TEXT_SPIN_STYLE::LEFT
: TEXT_SPIN_STYLE::RIGHT;
}
}
else
{
if( line->GetStartPoint().y <= line->GetEndPoint().y )
{
ret = line->GetEndPoint() == aPosition ? TEXT_SPIN_STYLE::BOTTOM
: TEXT_SPIN_STYLE::UP;
}
else
{
ret = line->GetEndPoint() == aPosition ? TEXT_SPIN_STYLE::UP
: TEXT_SPIN_STYLE::BOTTOM;
}
}
}
break;
case SCH_SYMBOL_T:
{
auto symbol = static_cast<SCH_SYMBOL*>( item );
auto pins = symbol->GetPins( aSheet );
for( auto pin : pins )
{
if( pin->GetPosition() == aPosition )
{
if( pin->GetOrientation() == PIN_RIGHT )
{
ret = TEXT_SPIN_STYLE::LEFT;
}
else if( pin->GetOrientation() == PIN_LEFT )
{
ret = TEXT_SPIN_STYLE::RIGHT;
}
else if( pin->GetOrientation() == PIN_UP )
{
ret = TEXT_SPIN_STYLE::BOTTOM;
}
else if( pin->GetOrientation() == PIN_DOWN )
{
ret = TEXT_SPIN_STYLE::UP;
}
switch( static_cast<SYMBOL_ORIENTATION_T>(
symbol->GetOrientation() & ( ~( SYM_MIRROR_X | SYM_MIRROR_Y ) ) ) )
{
case SYM_ROTATE_CLOCKWISE:
case SYM_ORIENT_90:
if( ret == TEXT_SPIN_STYLE::UP )
ret = TEXT_SPIN_STYLE::LEFT;
else if( ret == TEXT_SPIN_STYLE::BOTTOM )
ret = TEXT_SPIN_STYLE::RIGHT;
else if( ret == TEXT_SPIN_STYLE::LEFT )
ret = TEXT_SPIN_STYLE::BOTTOM;
else if( ret == TEXT_SPIN_STYLE::RIGHT )
ret = TEXT_SPIN_STYLE::UP;
if( symbol->GetOrientation() & SYM_MIRROR_X )
{
if( ret == TEXT_SPIN_STYLE::UP )
ret = TEXT_SPIN_STYLE::BOTTOM;
else if( ret == TEXT_SPIN_STYLE::BOTTOM )
ret = TEXT_SPIN_STYLE::UP;
}
if( symbol->GetOrientation() & SYM_MIRROR_Y )
{
if( ret == TEXT_SPIN_STYLE::LEFT )
ret = TEXT_SPIN_STYLE::RIGHT;
else if( ret == TEXT_SPIN_STYLE::RIGHT )
ret = TEXT_SPIN_STYLE::LEFT;
}
break;
case SYM_ROTATE_COUNTERCLOCKWISE:
case SYM_ORIENT_270:
if( ret == TEXT_SPIN_STYLE::UP )
ret = TEXT_SPIN_STYLE::RIGHT;
else if( ret == TEXT_SPIN_STYLE::BOTTOM )
ret = TEXT_SPIN_STYLE::LEFT;
else if( ret == TEXT_SPIN_STYLE::LEFT )
ret = TEXT_SPIN_STYLE::UP;
else if( ret == TEXT_SPIN_STYLE::RIGHT )
ret = TEXT_SPIN_STYLE::BOTTOM;
if( symbol->GetOrientation() & SYM_MIRROR_X )
{
if( ret == TEXT_SPIN_STYLE::UP )
ret = TEXT_SPIN_STYLE::BOTTOM;
else if( ret == TEXT_SPIN_STYLE::BOTTOM )
ret = TEXT_SPIN_STYLE::UP;
}
if( symbol->GetOrientation() & SYM_MIRROR_Y )
{
if( ret == TEXT_SPIN_STYLE::LEFT )
ret = TEXT_SPIN_STYLE::RIGHT;
else if( ret == TEXT_SPIN_STYLE::RIGHT )
ret = TEXT_SPIN_STYLE::LEFT;
}
break;
case SYM_ORIENT_180:
if( ret == TEXT_SPIN_STYLE::UP )
ret = TEXT_SPIN_STYLE::BOTTOM;
else if( ret == TEXT_SPIN_STYLE::BOTTOM )
ret = TEXT_SPIN_STYLE::UP;
else if( ret == TEXT_SPIN_STYLE::LEFT )
ret = TEXT_SPIN_STYLE::RIGHT;
else if( ret == TEXT_SPIN_STYLE::RIGHT )
ret = TEXT_SPIN_STYLE::LEFT;
if( symbol->GetOrientation() & SYM_MIRROR_X )
{
if( ret == TEXT_SPIN_STYLE::UP )
ret = TEXT_SPIN_STYLE::BOTTOM;
else if( ret == TEXT_SPIN_STYLE::BOTTOM )
ret = TEXT_SPIN_STYLE::UP;
}
if( symbol->GetOrientation() & SYM_MIRROR_Y )
{
if( ret == TEXT_SPIN_STYLE::LEFT )
ret = TEXT_SPIN_STYLE::RIGHT;
else if( ret == TEXT_SPIN_STYLE::RIGHT )
ret = TEXT_SPIN_STYLE::LEFT;
}
break;
case SYM_ORIENT_0:
case SYM_NORMAL:
default:
if( symbol->GetOrientation() & SYM_MIRROR_X )
{
if( ret == TEXT_SPIN_STYLE::UP )
ret = TEXT_SPIN_STYLE::BOTTOM;
else if( ret == TEXT_SPIN_STYLE::BOTTOM )
ret = TEXT_SPIN_STYLE::UP;
}
if( symbol->GetOrientation() & SYM_MIRROR_Y )
{
if( ret == TEXT_SPIN_STYLE::LEFT )
ret = TEXT_SPIN_STYLE::RIGHT;
else if( ret == TEXT_SPIN_STYLE::RIGHT )
ret = TEXT_SPIN_STYLE::LEFT;
}
break;
}
break;
}
}
}
break;
default: break;
}
}
return ret;
}
bool SCH_SCREEN::IsExplicitJunctionAllowed( const VECTOR2I& aPosition ) const
{

View File

@ -49,6 +49,7 @@
#include <sch_reference_list.h>
#include <sch_rtree.h>
#include <sch_sheet.h>
#include <sch_text.h>
#include <sch_sheet_path.h>
class BUS_ALIAS;
@ -335,6 +336,9 @@ public:
*/
bool IsExplicitJunctionNeeded( const VECTOR2I& aPosition ) const;
TEXT_SPIN_STYLE GetLabelOrientationForPoint( const VECTOR2I& aPosition,
TEXT_SPIN_STYLE aDefaultOrientation,
const SCH_SHEET_PATH* aSheet ) const;
/**
* Indicates that a juction dot may be placed at the given location. See IsJunctionNeeded
* for more info.

View File

@ -80,6 +80,7 @@ SCH_DRAWING_TOOLS::SCH_DRAWING_TOOLS() :
m_inPlaceImage( false ),
m_inSingleClickPlace( false ),
m_inTwoClickPlace( false ),
m_lastAutoLabelRotateOnPlacement( false ),
m_inDrawSheet( false )
{
}
@ -934,6 +935,7 @@ SCH_TEXT* SCH_DRAWING_TOOLS::createNewText( const VECTOR2I& aPosition, int aType
case LAYER_HIERLABEL:
labelItem = new SCH_HIERLABEL( aPosition );
labelItem->SetShape( m_lastGlobalLabelShape );
labelItem->SetAutoRotateOnPlacement( m_lastAutoLabelRotateOnPlacement );
textItem = labelItem;
break;
@ -941,6 +943,7 @@ SCH_TEXT* SCH_DRAWING_TOOLS::createNewText( const VECTOR2I& aPosition, int aType
labelItem = new SCH_GLOBALLABEL( aPosition );
labelItem->SetShape( m_lastGlobalLabelShape );
labelItem->GetFields()[0].SetVisible( settings.m_IntersheetRefsShow );
labelItem->SetAutoRotateOnPlacement( m_lastAutoLabelRotateOnPlacement );
textItem = labelItem;
break;
@ -1002,9 +1005,14 @@ SCH_TEXT* SCH_DRAWING_TOOLS::createNewText( const VECTOR2I& aPosition, int aType
m_lastTextOrientation = textItem->GetTextSpinStyle();
if( aType == LAYER_GLOBLABEL || aType == LAYER_HIERLABEL )
{
m_lastGlobalLabelShape = labelItem->GetShape();
m_lastAutoLabelRotateOnPlacement = labelItem->AutoRotateOnPlacement();
}
else if( aType == LAYER_NETCLASS_REFS )
{
m_lastNetClassFlagShape = labelItem->GetShape();
}
return textItem;
}

View File

@ -99,6 +99,7 @@ private:
STROKE_PARAMS m_lastStroke;
STROKE_PARAMS m_lastTextboxStroke;
wxString m_mruPath;
bool m_lastAutoLabelRotateOnPlacement;
///< Re-entrancy guards
bool m_inPlaceSymbol;