From c508c89a8108cf64b0d72649e1d372b7a1e42687 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 27 Sep 2021 13:24:53 +0100 Subject: [PATCH] Pretty-up some warning messages. --- eeschema/dialogs/dialog_field_properties.cpp | 12 +- .../dialogs/dialog_lib_text_properties.cpp | 5 +- .../dialog_lib_text_properties_base.cpp | 15 +- .../dialog_lib_text_properties_base.fbp | 187 ++++++------------ .../dialogs/dialog_lib_text_properties_base.h | 5 +- 5 files changed, 82 insertions(+), 142 deletions(-) diff --git a/eeschema/dialogs/dialog_field_properties.cpp b/eeschema/dialogs/dialog_field_properties.cpp index f40948746a..81f282a718 100644 --- a/eeschema/dialogs/dialog_field_properties.cpp +++ b/eeschema/dialogs/dialog_field_properties.cpp @@ -55,6 +55,9 @@ DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES( SCH_BASE_FRAME* aParent, const SetTitle( aTitle ); + m_note->SetFont( KIUI::GetInfoFont( this ).Italic() ); + m_note->Show( false ); + // The field ID and power status are Initialized in the derived object's ctor. m_fieldId = VALUE_FIELD; m_isPower = false; @@ -124,12 +127,13 @@ void DIALOG_FIELD_PROPERTIES::init() // the text box and display an explanation. if( m_fieldId == VALUE_FIELD && m_isPower ) { - m_PowerComponentValues->Show( true ); + m_note->SetLabel( wxString::Format( m_note->GetLabel(), + _( "Power symbol value field text cannot be changed." ) ) ); + m_note->Show( true ); m_TextCtrl->Enable( false ); } else { - m_PowerComponentValues->Show( false ); m_TextCtrl->Enable( true ); } @@ -332,7 +336,9 @@ DIALOG_SCH_FIELD_PROPERTIES::DIALOG_SCH_FIELD_PROPERTIES( SCH_BASE_FRAME* aParen case SHEETFILENAME: m_isSheetFilename = true; m_fieldId = SHEETFILENAME_V; - m_stSheetFnWarning->Show( true ); + m_note->SetLabel( wxString::Format( m_note->GetLabel(), + _( "Sheet filename can only be modified in Sheet Properties dialog." ) ) ); + m_note->Show( true ); break; default: diff --git a/eeschema/dialogs/dialog_lib_text_properties.cpp b/eeschema/dialogs/dialog_lib_text_properties.cpp index 21840d6e74..039c551a05 100644 --- a/eeschema/dialogs/dialog_lib_text_properties.cpp +++ b/eeschema/dialogs/dialog_lib_text_properties.cpp @@ -39,14 +39,13 @@ DIALOG_LIB_TEXT_PROPERTIES::DIALOG_LIB_TEXT_PROPERTIES( SYMBOL_EDIT_FRAME* aPare { m_parent = aParent; m_graphicText = aText; - m_stSheetFnWarning->Show( false ); // Shown only for sheet filename // Disable options for fieldedit, not existing in graphic text m_visible->Show( false ); m_TextValueSelectButton->Hide(); - m_PowerComponentValues->Show( false ); - m_PowerComponentValues->SetFont( KIUI::GetInfoFont( this ).Italic() ); + m_note->SetFont( KIUI::GetInfoFont( this ).Italic() ); + m_note->Show( false ); SetInitialFocus( m_TextCtrl ); m_StyledTextCtrl->Show( false ); diff --git a/eeschema/dialogs/dialog_lib_text_properties_base.cpp b/eeschema/dialogs/dialog_lib_text_properties_base.cpp index 170a85ea73..a975ee735d 100644 --- a/eeschema/dialogs/dialog_lib_text_properties_base.cpp +++ b/eeschema/dialogs/dialog_lib_text_properties_base.cpp @@ -16,15 +16,11 @@ DIALOG_LIB_TEXT_PROPERTIES_BASE::DIALOG_LIB_TEXT_PROPERTIES_BASE( wxWindow* pare wxBoxSizer* bMainSizer; bMainSizer = new wxBoxSizer( wxVERTICAL ); - m_stSheetFnWarning = new wxStaticText( this, wxID_ANY, _("Warning: Sheet filename can be modified only in sheet properties dialog."), wxDefaultPosition, wxDefaultSize, 0 ); - m_stSheetFnWarning->Wrap( -1 ); - bMainSizer->Add( m_stSheetFnWarning, 0, wxALL, 5 ); - wxBoxSizer* bPropertiesSizer; bPropertiesSizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer* bUpperBoxSizer; - bUpperBoxSizer = new wxBoxSizer( wxHORIZONTAL ); + bUpperBoxSizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer* bTextValueBoxSizer; bTextValueBoxSizer = new wxBoxSizer( wxHORIZONTAL ); @@ -67,16 +63,16 @@ DIALOG_LIB_TEXT_PROPERTIES_BASE::DIALOG_LIB_TEXT_PROPERTIES_BASE( wxWindow* pare m_StyledTextCtrl->SetSelForeground( true, wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHTTEXT ) ); bTextValueBoxSizer->Add( m_StyledTextCtrl, 1, wxRIGHT|wxLEFT, 5 ); - m_PowerComponentValues = new wxStaticText( this, wxID_ANY, _("(Power symbol value field text cannot be changed.)"), wxDefaultPosition, wxDefaultSize, 0 ); - m_PowerComponentValues->Wrap( -1 ); - bTextValueBoxSizer->Add( m_PowerComponentValues, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - m_TextValueSelectButton = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 ); bTextValueBoxSizer->Add( m_TextValueSelectButton, 0, wxALIGN_CENTER_VERTICAL, 5 ); bUpperBoxSizer->Add( bTextValueBoxSizer, 1, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 5 ); + m_note = new wxStaticText( this, wxID_ANY, _("(%s)"), wxDefaultPosition, wxDefaultSize, 0 ); + m_note->Wrap( -1 ); + bUpperBoxSizer->Add( m_note, 0, wxBOTTOM|wxRIGHT|wxLEFT, 10 ); + bPropertiesSizer->Add( bUpperBoxSizer, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); @@ -217,6 +213,7 @@ DIALOG_LIB_TEXT_PROPERTIES_BASE::DIALOG_LIB_TEXT_PROPERTIES_BASE( wxWindow* pare this->SetSizer( bMainSizer ); this->Layout(); + bMainSizer->Fit( this ); // Connect Events this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_LIB_TEXT_PROPERTIES_BASE::OnCloseDialog ) ); diff --git a/eeschema/dialogs/dialog_lib_text_properties_base.fbp b/eeschema/dialogs/dialog_lib_text_properties_base.fbp index 2cf6e7f4a7..5fcd5cdeff 100644 --- a/eeschema/dialogs/dialog_lib_text_properties_base.fbp +++ b/eeschema/dialogs/dialog_lib_text_properties_base.fbp @@ -45,7 +45,7 @@ DIALOG_LIB_TEXT_PROPERTIES_BASE - 739,340 + -1,-1 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h Text Item Properties @@ -59,67 +59,6 @@ bMainSizer wxVERTICAL none - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Warning: Sheet filename can be modified only in sheet properties dialog. - 0 - - 0 - - - 0 - - 1 - m_stSheetFnWarning - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - -1 - - 5 wxEXPAND|wxTOP|wxRIGHT|wxLEFT @@ -136,7 +75,7 @@ bUpperBoxSizer - wxHORIZONTAL + wxVERTICAL none 5 @@ -340,67 +279,6 @@ OnSetFocusText - - 5 - wxALIGN_CENTER_VERTICAL|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - (Power symbol value field text cannot be changed.) - 0 - - 0 - - - 0 - - 1 - m_PowerComponentValues - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - 5 wxALIGN_CENTER_VERTICAL @@ -476,6 +354,67 @@ + + 10 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + (%s) + 0 + + 0 + + + 0 + + 1 + m_note + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + diff --git a/eeschema/dialogs/dialog_lib_text_properties_base.h b/eeschema/dialogs/dialog_lib_text_properties_base.h index 5bc387cf51..8ed3f4b36c 100644 --- a/eeschema/dialogs/dialog_lib_text_properties_base.h +++ b/eeschema/dialogs/dialog_lib_text_properties_base.h @@ -40,12 +40,11 @@ class DIALOG_LIB_TEXT_PROPERTIES_BASE : public DIALOG_SHIM private: protected: - wxStaticText* m_stSheetFnWarning; wxStaticText* m_textLabel; wxTextCtrl* m_TextCtrl; wxStyledTextCtrl* m_StyledTextCtrl; - wxStaticText* m_PowerComponentValues; wxBitmapButton* m_TextValueSelectButton; + wxStaticText* m_note; wxCheckBox* m_visible; wxStaticText* m_xPosLabel; wxTextCtrl* m_xPosCtrl; @@ -79,7 +78,7 @@ class DIALOG_LIB_TEXT_PROPERTIES_BASE : public DIALOG_SHIM public: - DIALOG_LIB_TEXT_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Text Item Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 739,340 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + DIALOG_LIB_TEXT_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Text Item Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_LIB_TEXT_PROPERTIES_BASE(); };