104 case SCH_LABEL_T: SetTitle(
_(
"Label Properties" ) );
break;
106 case SCH_SHEET_PIN_T: SetTitle(
_(
"Hierarchical Sheet Pin Properties" ) );
break;
112 [&]( wxCommandEvent& aEvent )
116 m_grid->SetSelectionMode( wxGrid::wxGridSelectRows );
117 m_grid->ShowHideColumns(
"0 1 2 3 4 5 6 7" );
128 m_bold->SetIsCheckButton();
195 wxSizer* parentSizer =
m_autoRotate->GetContainingSizer();
197 parentSizer->Layout();
212 m_grid->Connect( wxEVT_GRID_CELL_CHANGING,
226 m_grid->Disconnect( wxEVT_GRID_CELL_CHANGING,
231 m_grid->PopEventHandler(
true );
240 if( !wxDialog::TransferDataToWindow() )
244 wxCommandEvent
dummy;
261 std::set<wxString> existingLabels;
308 for(
const std::shared_ptr<BUS_ALIAS>& busAlias :
m_Parent->Schematic().GetAllBusAliases() )
309 existingLabels.insert( wxT(
"{" ) + busAlias->GetName() + wxT(
"}" ) );
311 for(
const wxString& label : existingLabels )
334 wxGridTableMessage msg(
m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, (
int)
m_fields->size() );
335 m_grid->ProcessTableMessage( msg );
378 GetSizer()->SetSizeHints(
this );
381 wxSize curSize = GetSize();
384 SetSize( wxSize( std::max( curSize.x,
minSize.x ), std::max( curSize.y,
minSize.y ) ) );
386 SendSizeEvent( wxSEND_EVENT_POST );
394 wxPostEvent(
this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
403 if(( aEvent.GetKeyCode() == WXK_RETURN ) || (aEvent.GetKeyCode() == WXK_NUMPAD_ENTER))
405 wxPostEvent(
this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
407 else if( aEvent.GetKeyCode() == WXK_SPACE )
424 if( aEvent.GetKeyCode() == WXK_TAB )
426 if( aEvent.ShiftDown() )
432 m_grid->SetFocusFromKbd();
433 m_grid->MakeCellVisible( 0, 0 );
434 m_grid->SetGridCursor( 0, 0 );
459 for(
size_t i = 0; i < a->size() && i < b.size(); ++i )
471 if( !
m_grid->CommitPendingChanges() )
474 if( !wxDialog::TransferDataFromWindow() )
493 text.Replace( wxS(
"\r" ), wxS(
"\n" ) );
496 wxString visibleText =
text;
497 visibleText.Trim(
false ).Trim(
true );
499 if( visibleText.IsEmpty() )
524 if( field.GetUntranslatedName() == wxT(
"Netclass" ) )
530 if( field.IsVisible() !=
m_Parent->Schematic().Settings().m_IntersheetRefsShow )
532 DisplayInfoMessage(
this,
_(
"Intersheet reference visibility is controlled globally from "
533 "Schematic Setup > General > Formatting" ) );
547 for(
int ii =
m_fields->GetNumberRows() - 1; ii >= 0; ii-- )
551 const wxString& fieldText = field.
GetText();
553 if( fieldName.IsEmpty() && fieldText.IsEmpty() )
558 else if( fieldName == wxT(
"Netclass" ) && fieldText.IsEmpty() )
561 int netclassFieldCount = 0;
563 for(
int jj = 0; jj <
m_fields->GetNumberRows(); ++jj )
565 if(
m_fields->at( jj ).GetUntranslatedName() == wxT(
"Netclass" ) )
566 netclassFieldCount++;
569 if( netclassFieldCount > 1 )
572 else if( fieldName.IsEmpty() )
583 if( !field.IsMandatory() )
642 if( !commit.
Empty() )
644 commit.
Push(
_(
"Edit Label Properties" ) );
650 text.Replace( wxS(
"\r" ), wxS(
"\n" ) );
651 wxArrayString lines = wxSplit(
text,
'\n' );
653 for(
const wxString& line : lines )
656 text.Trim(
false ).Trim(
true );
671 m_labelList->push_back( std::unique_ptr<SCH_LABEL_BASE>( label ) );
679 m_labelList->push_back( std::unique_ptr<SCH_LABEL_BASE>( label ) );
687 m_labelList->push_back( std::unique_ptr<SCH_LABEL_BASE>( label ) );
698 m_labelList->push_back( std::unique_ptr<SCH_LABEL_BASE>( label ) );
709 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
723 wxGridCellEditor*
editor =
m_grid->GetCellEditor( event.GetRow(), event.GetCol() );
724 wxControl* control =
editor->GetControl();
726 if( control && control->GetValidator() && !control->GetValidator()->Validate( control ) )
732 else if( event.GetCol() ==
FDC_NAME )
734 wxString newName =
event.GetString();
737 for(
int i = 0; i <
m_grid->GetNumberRows(); ++i )
739 if( i == event.GetRow() )
752 DisplayError(
this, wxString::Format(
_(
"Field name '%s' already in use." ),
769 [&]() -> std::pair<int, int>
771 wxString fieldName = wxT(
"Netclass" );
777 fieldName = wxEmptyString;
801 wxGridTableMessage msg(
m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
802 m_grid->ProcessTableMessage( msg );
813 if( row < m_fields->GetMandatoryRowCount() )
827 wxGridTableMessage msg(
m_fields, wxGRIDTABLE_NOTIFY_ROWS_DELETED, row, 1 );
828 m_grid->ProcessTableMessage( msg );
838 return row >
m_fields->GetMandatoryRowCount();
853 return row >=
m_fields->GetMandatoryRowCount();
865 std::bitset<64> shownColumns =
m_grid->GetShownColumns();
871 if( !
m_grid->IsCellEditControlShown() )
872 m_grid->SetGridWidthsDirty();
908 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
wxFlexGridSizer * m_textEntrySizer
wxStaticText * m_labelMultiLine
wxStaticBoxSizer * m_shapeSizer
wxRadioButton * m_diamond
BITMAP_BUTTON * m_separator3
wxTextCtrl * m_valueMultiLine
STD_BITMAP_BUTTON * m_bpAdd
wxHyperlinkCtrl * m_syntaxHelp
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
wxGridBagSizer * m_formattingGB
FILTER_COMBOBOX * m_valueCombo
wxRadioButton * m_bidirectional
BITMAP_BUTTON * m_separator2
wxStaticText * m_fontLabel
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
#define UNIMPLEMENTED_FOR(type)
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