Add "unlock" property to footprint texts
This property decouples the text orientation from the board orientation, removing the restriction that it face the bottom or right side of the board.
This commit is contained in:
parent
8a32243b89
commit
f576596375
|
@ -2,6 +2,7 @@
|
|||
# This program source code file is part of KiCad, a free EDA CAD application.
|
||||
#
|
||||
# Copyright (C) 2012 CERN.
|
||||
# Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
@ -184,6 +185,7 @@ thru
|
|||
thru_hole
|
||||
thru_hole_only
|
||||
tstamp
|
||||
unlocked
|
||||
user
|
||||
user_trace_width
|
||||
user_via
|
||||
|
@ -214,4 +216,4 @@ zone_45_only
|
|||
zone_clearance
|
||||
zone_connect
|
||||
zone_type
|
||||
zones
|
||||
zones
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -57,6 +57,7 @@ TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, TEXT_TYPE text_type ) :
|
|||
MODULE* module = static_cast<MODULE*>( m_Parent );
|
||||
|
||||
m_Type = text_type;
|
||||
m_unlocked = false;
|
||||
|
||||
// Set text thickness to a default value
|
||||
SetThickness( Millimeter2iu( 0.15 ) );
|
||||
|
@ -328,7 +329,19 @@ double TEXTE_MODULE::GetDrawRotation() const
|
|||
if( module )
|
||||
rotation += module->GetOrientation();
|
||||
|
||||
NORMALIZE_ANGLE_POS( rotation );
|
||||
if( m_unlocked )
|
||||
{
|
||||
NORMALIZE_ANGLE_POS( rotation );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Keep angle between -90 .. 90 deg. Otherwise the text is not easy to read
|
||||
while( rotation > 900 )
|
||||
rotation -= 1800;
|
||||
|
||||
while( rotation < -900 )
|
||||
rotation += 1800;
|
||||
}
|
||||
|
||||
return rotation;
|
||||
}
|
||||
|
|
|
@ -87,6 +87,16 @@ public:
|
|||
|
||||
void SetTextAngle( double aAngle );
|
||||
|
||||
bool IsUnlocked()
|
||||
{
|
||||
return m_unlocked;
|
||||
}
|
||||
|
||||
void SetUnlocked( bool unlocked )
|
||||
{
|
||||
m_unlocked = unlocked;
|
||||
}
|
||||
|
||||
/// Rotate text, in footprint editor
|
||||
/// (for instance in footprint rotation transform)
|
||||
void Rotate( const wxPoint& aOffset, double aAngle ) override;
|
||||
|
@ -230,6 +240,8 @@ private:
|
|||
|
||||
wxPoint m_Pos0; ///< text coordinates relative to the footprint anchor, orient 0.
|
||||
///< text coordinate ref point is the text center
|
||||
|
||||
bool m_unlocked;
|
||||
};
|
||||
|
||||
#endif // TEXT_MODULE_H_
|
||||
|
|
|
@ -188,6 +188,8 @@ bool DialogEditModuleText::TransferDataToWindow()
|
|||
m_OrientValue = text_orient / 10.0;
|
||||
m_OrientValidator.TransferToWindow();
|
||||
|
||||
m_unlock->SetValue( m_currentText->IsUnlocked() );
|
||||
|
||||
// Configure the layers list selector
|
||||
if( !m_parent->GetBoard()->IsLayerEnabled( m_currentText->GetLayer() ) )
|
||||
// Footprints are built outside the current board, so items cann be
|
||||
|
@ -327,6 +329,8 @@ bool DialogEditModuleText::TransferDataFromWindow()
|
|||
|
||||
m_currentText->SetDrawCoord();
|
||||
|
||||
m_currentText->SetUnlocked( m_unlock->GetValue() );
|
||||
|
||||
LAYER_NUM layer = m_LayerSelectionCtrl->GetLayerSelection();
|
||||
m_currentText->SetLayer( ToLAYER_ID( layer ) );
|
||||
m_currentText->SetMirrored( IsBackLayer( m_currentText->GetLayer() ) );
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Oct 17 2016)
|
||||
// C++ code generated with wxFormBuilder (version Feb 6 2017)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
|
@ -24,7 +24,7 @@ DialogEditModuleText_base::DialogEditModuleText_base( wxWindow* parent, wxWindow
|
|||
|
||||
m_ModuleInfoText = new wxStaticText( this, wxID_ANY, _("Footprint %s (%s) orientation %.1f"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_ModuleInfoText->Wrap( -1 );
|
||||
m_ModuleInfoText->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
|
||||
m_ModuleInfoText->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
|
||||
|
||||
bMainSizer->Add( m_ModuleInfoText, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
|
||||
|
||||
|
@ -129,6 +129,11 @@ DialogEditModuleText_base::DialogEditModuleText_base( wxWindow* parent, wxWindow
|
|||
m_OrientValueCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer4->Add( m_OrientValueCtrl, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_unlock = new wxCheckBox( this, wxID_ANY, _("Unlock text orientation"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_unlock->SetToolTip( _("If orientation is locked, the text will always face near the bottom or right edge of the board.") );
|
||||
|
||||
bSizer4->Add( m_unlock, 0, wxALL, 5 );
|
||||
|
||||
|
||||
bSizer10->Add( bSizer4, 2, wxBOTTOM|wxEXPAND|wxRIGHT, 5 );
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
<property name="minimum_size"></property>
|
||||
<property name="name">DialogEditModuleText_base</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">589,351</property>
|
||||
<property name="size">607,445</property>
|
||||
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
|
||||
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
|
||||
<property name="title">Footprint Text Properties</property>
|
||||
|
@ -1985,6 +1985,94 @@
|
|||
<event name="OnUpdateUI"></event>
|
||||
</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">Unlock text orientation</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_unlock</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"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip">If orientation is locked, the text will always face near the bottom or right edge of the board.</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>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCheckBox"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Oct 17 2016)
|
||||
// C++ code generated with wxFormBuilder (version Feb 6 2017)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
|
@ -27,6 +27,7 @@ class TEXT_CTRL_EVAL;
|
|||
#include <wx/bmpcbox.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/radiobox.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
|
@ -61,6 +62,7 @@ class DialogEditModuleText_base : public DIALOG_SHIM
|
|||
wxRadioBox* m_Orient;
|
||||
wxStaticText* m_staticTextRotation;
|
||||
wxTextCtrl* m_OrientValueCtrl;
|
||||
wxCheckBox* m_unlock;
|
||||
wxStaticLine* m_staticline2;
|
||||
wxStdDialogButtonSizer* m_sdbSizer;
|
||||
wxButton* m_sdbSizerOK;
|
||||
|
@ -74,7 +76,7 @@ class DialogEditModuleText_base : public DIALOG_SHIM
|
|||
|
||||
public:
|
||||
|
||||
DialogEditModuleText_base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Footprint Text Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 589,351 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
DialogEditModuleText_base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Footprint Text Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 607,445 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
~DialogEditModuleText_base();
|
||||
|
||||
};
|
||||
|
|
|
@ -1547,6 +1547,9 @@ void PCB_IO::format( TEXTE_MODULE* aText, int aNestLevel ) const
|
|||
if( orient != 0.0 )
|
||||
m_out->Print( 0, " %s", FMT_ANGLE( orient ).c_str() );
|
||||
|
||||
if( aText->IsUnlocked() )
|
||||
m_out->Print( 0, " unlocked" );
|
||||
|
||||
m_out->Print( 0, ")" );
|
||||
formatLayer( aText );
|
||||
|
||||
|
|
|
@ -45,7 +45,8 @@ class NETINFO_MAPPING;
|
|||
//#define SEXPR_BOARD_FILE_VERSION 20170123 // EDA_TEXT refactor, moved 'hide'
|
||||
//#define SEXPR_BOARD_FILE_VERSION 20170920 // long pad names and custom pad shape
|
||||
//#define SEXPR_BOARD_FILE_VERSION 20170922 // Keepout zones can exist on multiple layers
|
||||
#define SEXPR_BOARD_FILE_VERSION 20171114 // Save 3D model offset in mm, instead of inches
|
||||
//#define SEXPR_BOARD_FILE_VERSION 20171114 // Save 3D model offset in mm, instead of inches
|
||||
#define SEXPR_BOARD_FILE_VERSION 20171125 // Locked/unlocked TEXTE_MODULE
|
||||
|
||||
#define CTL_STD_LAYER_NAMES (1 << 0) ///< Use English Standard layer names
|
||||
#define CTL_OMIT_NETS (1 << 1) ///< Omit pads net names (useless in library)
|
||||
|
|
|
@ -2048,15 +2048,22 @@ TEXTE_MODULE* PCB_PARSER::parseTEXTE_MODULE()
|
|||
pt.x = parseBoardUnits( "X coordinate" );
|
||||
pt.y = parseBoardUnits( "Y coordinate" );
|
||||
text->SetPos0( pt );
|
||||
token = NextTok();
|
||||
|
||||
// If there is no orientation defined, then it is the default value of 0 degrees.
|
||||
if( token == T_NUMBER )
|
||||
NextTok();
|
||||
|
||||
if( CurTok() == T_NUMBER )
|
||||
{
|
||||
text->SetTextAngle( parseDouble() * 10.0 );
|
||||
NeedRIGHT();
|
||||
NextTok();
|
||||
}
|
||||
else if( token != T_RIGHT )
|
||||
|
||||
if( CurTok() == T_unlocked )
|
||||
{
|
||||
text->SetUnlocked( true );
|
||||
NextTok();
|
||||
}
|
||||
|
||||
if( CurTok() != T_RIGHT )
|
||||
{
|
||||
Unexpected( CurText() );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue