56 std::vector<EMBEDDED_FILES*> embeddedFilesStack;
65 m_activeTextEntry = m_valueCombo;
66 SetInitialFocus( m_valueCombo->GetTextCtrl() );
68 m_labelSingleLine->Show( false );
69 m_valueSingleLine->Show( false );
73 m_activeTextEntry = m_valueSingleLine;
74 SetInitialFocus( m_valueSingleLine );
76 m_labelCombo->Show( false );
77 m_valueCombo->Show( false );
81 SetInitialFocus( m_grid );
82 m_delayedFocusRow = 0;
84 m_labelSingleLine->Show( false );
85 m_valueSingleLine->Show( false );
86 m_labelCombo->Show( false );
87 m_valueCombo->Show( false );
88 m_syntaxHelp->Show( false );
89 m_textEntrySizer->Show( false );
90 m_labelCombo->Show( false );
91 m_valueCombo->Show( false );
92 m_cbMultiLine->Show( false );
94 m_textSizeLabel->SetLabel( _(
"Pin length:" ) );
105 case SCH_GLOBAL_LABEL_T: SetTitle( _(
"Global Label Properties" ) ); break;
106 case SCH_HIER_LABEL_T: SetTitle( _(
"Hierarchical Label Properties" ) ); break;
107 case SCH_LABEL_T: SetTitle( _(
"Label Properties" ) ); break;
108 case SCH_DIRECTIVE_LABEL_T: SetTitle( _(
"Directive Label Properties" ) ); break;
109 case SCH_SHEET_PIN_T: SetTitle( _(
"Hierarchical Sheet Pin Properties" ) ); break;
110 default: UNIMPLEMENTED_FOR( m_currentLabel->GetClass() ); break;
115 [&]( wxCommandEvent& aEvent )
119 m_grid->SetSelectionMode( wxGrid::wxGridSelectRows );
120 m_grid->ShowHideColumns(
"0 1 2 3 4 5 6 7" );
131 m_bold->SetIsCheckButton();
156 m_spin0->SetBitmap( KiBitmapBundle( BITMAPS::label_align_left ) );
157 m_spin1->SetBitmap( KiBitmapBundle( BITMAPS::label_align_right ) );
158 m_spin2->SetBitmap( KiBitmapBundle( BITMAPS::label_align_bottom ) );
159 m_spin3->SetBitmap( KiBitmapBundle( BITMAPS::label_align_top ) );
165 m_bidirectional->Hide();
169 m_fontLabel->SetLabel( _(
"Orientation:" ) );
171 m_separator1->Hide();
174 m_separator2->Hide();
175 m_spin0->SetBitmap( KiBitmapBundle( BITMAPS::pinorient_down ) );
176 m_spin1->SetBitmap( KiBitmapBundle( BITMAPS::pinorient_up ) );
177 m_spin2->SetBitmap( KiBitmapBundle( BITMAPS::pinorient_right ) );
178 m_spin3->SetBitmap( KiBitmapBundle( BITMAPS::pinorient_left ) );
179 m_separator3->Hide();
181 m_formattingGB->Detach( m_fontCtrl );
182 m_formattingGB->Detach( m_iconBar );
183 m_formattingGB->Add( m_iconBar, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxEXPAND | wxRIGHT, 5 );
187 m_shapeSizer->Show( false );
189 m_spin0->SetBitmap( KiBitmapBundle( BITMAPS::text_align_left ) );
190 m_spin1->SetBitmap( KiBitmapBundle( BITMAPS::text_align_right ) );
191 m_spin2->SetBitmap( KiBitmapBundle( BITMAPS::text_align_bottom ) );
192 m_spin3->SetBitmap( KiBitmapBundle( BITMAPS::text_align_top ) );
197 m_autoRotate->Hide();
198 wxSizer* parentSizer = m_autoRotate->GetContainingSizer();
199 parentSizer->Detach( m_autoRotate );
200 parentSizer->Layout();
215 m_grid->Connect( wxEVT_GRID_CELL_CHANGING,
229 m_grid->Disconnect( wxEVT_GRID_CELL_CHANGING,
234 m_grid->PopEventHandler(
true );
243 if( !wxDialog::TransferDataToWindow() )
247 wxCommandEvent
dummy;
264 std::set<wxString> existingLabels;
311 for(
const std::shared_ptr<BUS_ALIAS>& busAlias :
m_Parent->Schematic().GetAllBusAliases() )
312 existingLabels.insert( wxT(
"{" ) + busAlias->GetName() + wxT(
"}" ) );
314 for(
const wxString& label : existingLabels )
337 wxGridTableMessage msg(
m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, (
int)
m_fields->size() );
338 m_grid->ProcessTableMessage( msg );
381 GetSizer()->SetSizeHints(
this );
384 wxSize curSize = GetSize();
387 SetSize( wxSize( std::max( curSize.x,
minSize.x ), std::max( curSize.y,
minSize.y ) ) );
389 SendSizeEvent( wxSEND_EVENT_POST );
397 wxPostEvent(
this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
406 if(( aEvent.GetKeyCode() == WXK_RETURN ) || (aEvent.GetKeyCode() == WXK_NUMPAD_ENTER))
408 wxPostEvent(
this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
410 else if( aEvent.GetKeyCode() == WXK_SPACE )
427 if( aEvent.GetKeyCode() == WXK_TAB )
429 if( aEvent.ShiftDown() )
435 m_grid->SetFocusFromKbd();
436 m_grid->MakeCellVisible( 0, 0 );
437 m_grid->SetGridCursor( 0, 0 );
462 for(
size_t i = 0; i < a->size() && i < b.size(); ++i )
474 if( !
m_grid->CommitPendingChanges() )
477 if( !wxDialog::TransferDataFromWindow() )
496 text.Replace( wxS(
"\r" ), wxS(
"\n" ) );
499 wxString visibleText =
text;
500 visibleText.Trim(
false ).Trim(
true );
502 if( visibleText.IsEmpty() )
527 if( field.GetUntranslatedName() == wxT(
"Netclass" ) )
533 if( field.IsVisible() !=
m_Parent->Schematic().Settings().m_IntersheetRefsShow )
535 DisplayInfoMessage(
this,
_(
"Intersheet reference visibility is controlled globally from "
536 "Schematic Setup > General > Formatting" ) );
550 for(
int ii =
m_fields->GetNumberRows() - 1; ii >= 0; ii-- )
554 const wxString& fieldText = field.
GetText();
556 if( fieldName.IsEmpty() && fieldText.IsEmpty() )
561 else if( fieldName == wxT(
"Netclass" ) && fieldText.IsEmpty() )
564 int netclassFieldCount = 0;
566 for(
int jj = 0; jj <
m_fields->GetNumberRows(); ++jj )
568 if(
m_fields->at( jj ).GetUntranslatedName() == wxT(
"Netclass" ) )
569 netclassFieldCount++;
572 if( netclassFieldCount > 1 )
575 else if( fieldName.IsEmpty() )
586 if( !field.IsMandatory() )
645 if( !commit.
Empty() )
647 commit.
Push(
_(
"Edit Label Properties" ) );
653 text.Replace( wxS(
"\r" ), wxS(
"\n" ) );
654 wxArrayString lines = wxSplit(
text,
'\n' );
656 for(
const wxString& line : lines )
659 text.Trim(
false ).Trim(
true );
674 m_labelList->push_back( std::unique_ptr<SCH_LABEL_BASE>( label ) );
682 m_labelList->push_back( std::unique_ptr<SCH_LABEL_BASE>( label ) );
690 m_labelList->push_back( std::unique_ptr<SCH_LABEL_BASE>( label ) );
701 m_labelList->push_back( std::unique_ptr<SCH_LABEL_BASE>( label ) );
712 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
726 wxGridCellEditor*
editor =
m_grid->GetCellEditor( event.GetRow(), event.GetCol() );
727 wxControl* control =
editor->GetControl();
729 if( control && control->GetValidator() && !control->GetValidator()->Validate( control ) )
735 else if( event.GetCol() ==
FDC_NAME )
737 wxString newName =
event.GetString();
740 for(
int i = 0; i <
m_grid->GetNumberRows(); ++i )
742 if( i == event.GetRow() )
755 DisplayError(
this, wxString::Format(
_(
"Field name '%s' already in use." ),
772 [&]() -> std::pair<int, int>
774 wxString fieldName = wxT(
"Netclass" );
780 fieldName = wxEmptyString;
804 wxGridTableMessage msg(
m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
805 m_grid->ProcessTableMessage( msg );
816 if( row < m_fields->GetMandatoryRowCount() )
830 wxGridTableMessage msg(
m_fields, wxGRIDTABLE_NOTIFY_ROWS_DELETED, row, 1 );
831 m_grid->ProcessTableMessage( msg );
841 return row >
m_fields->GetMandatoryRowCount();
856 return row >=
m_fields->GetMandatoryRowCount();
868 std::bitset<64> shownColumns =
m_grid->GetShownColumns();
874 if( !
m_grid->IsCellEditControlShown() )
875 m_grid->SetGridWidthsDirty();
911 m_valueCombo->SetValue( multiText.BeforeFirst(
'\n' ) );
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
Color settings are a bit different than most of the settings objects in that there can be more than o...
COLOR4D GetColor(int aLayer) const
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
wxStaticText * m_textSizeLabel
wxRadioButton * m_triState
COLOR_SWATCH * m_textColorSwatch
STD_BITMAP_BUTTON * m_bpMoveUp
wxStaticText * m_labelMultiLine
wxStaticBoxSizer * m_shapeSizer
wxRadioButton * m_diamond
BITMAP_BUTTON * m_separator3
wxTextCtrl * m_valueMultiLine
STD_BITMAP_BUTTON * m_bpAdd
wxRadioButton * m_rectangle
wxStaticText * m_labelCombo
wxStaticText * m_labelSingleLine
wxRadioButton * m_passive
wxCheckBox * m_cbMultiLine
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)
STD_BITMAP_BUTTON * m_bpMoveDown
STD_BITMAP_BUTTON * m_bpDelete
BITMAP_BUTTON * m_separator1
wxTextCtrl * m_textSizeCtrl
wxCheckBox * m_autoRotate
FILTER_COMBOBOX * m_valueCombo
wxRadioButton * m_bidirectional
BITMAP_BUTTON * m_separator2
wxTextCtrl * m_valueSingleLine
wxStaticText * m_textSizeUnits
HTML_MESSAGE_BOX * m_helpWindow
std::list< std::unique_ptr< SCH_LABEL_BASE > > * m_labelList
~DIALOG_LABEL_PROPERTIES()
wxTextEntry * m_activeTextEntry
SCH_LABEL_BASE * m_currentLabel
void OnMoveUp(wxCommandEvent &event) override
void OnMoveDown(wxCommandEvent &event) override
DIALOG_LABEL_PROPERTIES(SCH_EDIT_FRAME *parent, SCH_LABEL_BASE *aLabel, bool aNew)
void OnEnterKey(wxCommandEvent &aEvent) override
wxEVT_COMMAND_ENTER event handler for single-line control.
std::bitset< 64 > m_shownColumns
void OnAddField(wxCommandEvent &event) override
SCH_NETNAME_VALIDATOR m_netNameValidator
void OnFormattingHelp(wxHyperlinkEvent &aEvent) override
bool TransferDataFromWindow() override
void OnCBValueCharHook(wxKeyEvent &aEvent) override
wxArrayString m_existingLabelArray
void OnUpdateUI(wxUpdateUIEvent &event) override
void onSpinButton(wxCommandEvent &aEvent)
void onMultiLabelCheck(wxCommandEvent &aEvent) override
FIELDS_GRID_TABLE * m_fields
void OnDeleteField(wxCommandEvent &event) override
void OnGridCellChanging(wxGridEvent &event)
void OnValueCharHook(wxKeyEvent &aEvent) override
bool TransferDataToWindow() override
SCH_EDIT_FRAME * m_Parent
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
void SetupStandardButtons(std::map< int, wxString > aLabels={})
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
EDA_BASE_FRAME * m_parentFrame
virtual const wxString & GetText() const
Return the string associated with the text object.
void SetAttributes(const EDA_TEXT &aSrc, bool aSetPosition=true)
Set the text attributes from another instance.
virtual void Offset(const VECTOR2I &aOffset)
GR_TEXT_H_ALIGN_T GetHorizJustify() const
virtual void SetVisible(bool aVisible)
virtual EDA_ANGLE GetTextAngle() const
GR_TEXT_V_ALIGN_T GetVertJustify() const
virtual void SetText(const wxString &aText)
void SetItalic(bool aItalic)
Set the text to be italic - this will also update the font if needed.
A color representation with 4 components: red, green, blue, alpha.
Commit for the schematic and symbol editors.
void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Execute the changes.
Schematic editor (Eeschema) main window.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void AutoRotateItem(SCH_SCREEN *aScreen, SCH_ITEM *aItem)
Automatically set the rotation of an item (if the item supports it).
VECTOR2I GetPosition() const override
virtual const wxString & GetText() const override
Return the string associated with the text object.
wxString GetUntranslatedName() const
Get the untranslated field name for storage, variable look-up, etc.
void SetName(const wxString &aName)
Base class for any item which can be embedded within the SCHEMATIC container class,...
static const wxString GetDefaultFieldName(const wxString &aName, bool aUseDefaultName)
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
bool IsSymbolLikePowerGlobalLabel() const
bool IsSymbolLikePowerLocalLabel() const
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this symbol.
static HTML_MESSAGE_BOX * ShowSyntaxHelp(wxWindow *aParentWindow)
Spin style for labels of all kinds on schematics.
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
This file is part of the common library.
static bool positioningChanged(const SCH_FIELD &a, const SCH_FIELD &b)
const int minSize
Push and Shove router track width and via size dialog.
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
@ LAYER_SCHEMATIC_BACKGROUND
std::vector< FAB_LAYER_COLOR > dummy
wxString UnescapeString(const wxString &aSource)
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
bool FieldNamesAreDuplicates(const wxString &aLhs, const wxString &aRhs, std::initializer_list< FIELD_T > aMandatoryFields)
Test whether two field names should be treated as duplicates for the purposes of field name uniquenes...
@ USER
The field ID hasn't been set yet; field is invalid.
@ INTERSHEET_REFS
Global label cross-reference page numbers.
@ VALUE
Field Value of part, i.e. "3.3K".
#define GLOBALLABEL_MANDATORY_FIELDS
@ SCH_SYMBOL_LOCATE_POWER_T
VECTOR2< int32_t > VECTOR2I