diff --git a/common/dialog_about/dialog_about.cpp b/common/dialog_about/dialog_about.cpp index 521ac0d9e4..664b13efb0 100644 --- a/common/dialog_about/dialog_about.cpp +++ b/common/dialog_about/dialog_about.cpp @@ -53,15 +53,20 @@ DIALOG_ABOUT::DIALOG_ABOUT( EDA_BASE_FRAME *aParent, ABOUT_APP_INFO& aAppInfo ) { wxASSERT( aParent != nullptr ); - m_picInformation = KiBitmap( info_xpm ); - m_picVersion = KiBitmap( recent_xpm ); - m_picDevelopers = KiBitmap( preference_xpm ); - m_picDocWriters = KiBitmap( editor_xpm ); - m_picLibrarians = KiBitmap( library_xpm ); - m_picArtists = KiBitmap( palette_xpm ); - m_picTranslators = KiBitmap( language_xpm ); - m_picLicense = KiBitmap( tools_xpm ); - m_picPackagers = KiBitmap( zip_xpm ); + // TODO: Change these to 16x16 versions when available + m_images = new wxImageList( 26, 26, false, 9 ); + + m_images->Add( KiBitmap( info_xpm ) ); // INFORMATION + m_images->Add( KiBitmap( recent_xpm ) ); // VERSION + m_images->Add( KiBitmap( preference_xpm ) ); // DEVELOPERS + m_images->Add( KiBitmap( editor_xpm ) ); // DOCWRITERS + m_images->Add( KiBitmap( library_xpm ) ); // LIBRARIANS + m_images->Add( KiBitmap( palette_xpm ) ); // ARTISTS + m_images->Add( KiBitmap( language_xpm ) ); // TRANSLATORS + m_images->Add( KiBitmap( zip_xpm ) ); // PACKAGERS + m_images->Add( KiBitmap( tools_xpm ) ); // LICENSE + + m_notebook->SetImageList( m_images ); if( m_info.GetAppIcon().IsOk() ) { @@ -86,7 +91,6 @@ DIALOG_ABOUT::DIALOG_ABOUT( EDA_BASE_FRAME *aParent, ABOUT_APP_INFO& aAppInfo ) createNotebooks(); GetSizer()->SetSizeHints( this ); - m_auiNotebook->Update(); SetFocus(); Centre(); } @@ -94,6 +98,7 @@ DIALOG_ABOUT::DIALOG_ABOUT( EDA_BASE_FRAME *aParent, ABOUT_APP_INFO& aAppInfo ) DIALOG_ABOUT::~DIALOG_ABOUT() { + delete m_images; } @@ -110,37 +115,40 @@ wxFlexGridSizer* DIALOG_ABOUT::createFlexGridSizer() void DIALOG_ABOUT::createNotebooks() { - createNotebookHtmlPage( m_auiNotebook, _( "About" ), m_picInformation, + createNotebookHtmlPage( m_notebook, _( "About" ), IMAGES::INFORMATION, m_info.GetDescription() ); wxString version = GetVersionInfoData( m_titleName, true ); - createNotebookHtmlPage( m_auiNotebook, _( "Version" ), m_picVersion, version, true ); + createNotebookHtmlPage( m_notebook, _( "Version" ), IMAGES::VERSION, version, true ); - createNotebookPageByCategory( m_auiNotebook, _( "Developers" ) , m_picDevelopers, + createNotebookPageByCategory( m_notebook, _( "Developers" ) , IMAGES::DEVELOPERS, m_info.GetDevelopers() ); - createNotebookPage( m_auiNotebook, _( "Doc Writers" ), m_picDocWriters, + createNotebookPage( m_notebook, _( "Doc Writers" ), IMAGES::DOCWRITERS, m_info.GetDocWriters() ); - createNotebookPageByCategory( m_auiNotebook, _( "Librarians" ), m_picLibrarians, + createNotebookPageByCategory( m_notebook, _( "Librarians" ), IMAGES::LIBRARIANS, m_info.GetLibrarians() ); - createNotebookPageByCategory( m_auiNotebook, _( "Artists" ), m_picArtists, + createNotebookPageByCategory( m_notebook, _( "Artists" ), IMAGES::ARTISTS, m_info.GetArtists() ); - createNotebookPageByCategory( m_auiNotebook, _( "Translators" ), m_picTranslators, + createNotebookPageByCategory( m_notebook, _( "Translators" ), IMAGES::TRANSLATORS, m_info.GetTranslators() ); - createNotebookPageByCategory( m_auiNotebook, _( "Packagers" ), m_picPackagers, + createNotebookPageByCategory( m_notebook, _( "Packagers" ), IMAGES::PACKAGERS, m_info.GetPackagers() ); - createNotebookHtmlPage( m_auiNotebook, _( "License" ), m_picLicense, m_info.GetLicense() ); + createNotebookHtmlPage( m_notebook, _( "License" ), IMAGES::LICENSE, m_info.GetLicense() ); } -void DIALOG_ABOUT::createNotebookPage( wxAuiNotebook* aParent, const wxString& aCaption, - const wxBitmap& aIcon, const CONTRIBUTORS& aContributors ) +void DIALOG_ABOUT::createNotebookPage( wxNotebook* aParent, const wxString& aCaption, + IMAGES aIconIndex, const CONTRIBUTORS& aContributors ) { + wxPanel* outerPanel = new wxPanel( aParent ); + wxBoxSizer* outerSizer = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* bSizer = new wxBoxSizer( wxHORIZONTAL ); - wxScrolledWindow* m_scrolledWindow1 = new wxScrolledWindow( aParent, wxID_ANY, + wxScrolledWindow* m_scrolledWindow1 = new wxScrolledWindow( outerPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL ); @@ -193,13 +201,17 @@ void DIALOG_ABOUT::createNotebookPage( wxAuiNotebook* aParent, const wxString& a m_scrolledWindow1->SetSizer( bSizer ); m_scrolledWindow1->Layout(); bSizer->Fit( m_scrolledWindow1 ); - aParent->AddPage( m_scrolledWindow1, aCaption, false, aIcon ); + + outerSizer->Add( m_scrolledWindow1, 1, wxEXPAND, 0 ); + outerPanel->SetSizer( outerSizer ); + + aParent->AddPage( outerPanel, aCaption, false, static_cast( aIconIndex ) ); } -void DIALOG_ABOUT::createNotebookPageByCategory( wxAuiNotebook* aParent, const wxString& aCaption, - const wxBitmap& aIcon, - const CONTRIBUTORS& aContributors) +void DIALOG_ABOUT::createNotebookPageByCategory( wxNotebook* aParent, const wxString& aCaption, + IMAGES aIconIndex, + const CONTRIBUTORS& aContributors ) { // The left justification between wxStaticText and wxHyperlinkCtrl is different so // we must pad to make the alignment look decent. @@ -212,10 +224,12 @@ void DIALOG_ABOUT::createNotebookPageByCategory( wxAuiNotebook* aParent, const w #if defined( __WXGTK__ ) padding += " "; #endif + wxPanel* outerPanel = new wxPanel( aParent ); + wxBoxSizer* outerSizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer* bSizer = new wxBoxSizer( wxHORIZONTAL ); - wxScrolledWindow* m_scrolledWindow1 = new wxScrolledWindow( aParent, wxID_ANY, + wxScrolledWindow* m_scrolledWindow1 = new wxScrolledWindow( outerPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL ); @@ -363,12 +377,16 @@ void DIALOG_ABOUT::createNotebookPageByCategory( wxAuiNotebook* aParent, const w m_scrolledWindow1->SetSizer( bSizer ); m_scrolledWindow1->Layout(); bSizer->Fit( m_scrolledWindow1 ); - aParent->AddPage( m_scrolledWindow1, aCaption, false, aIcon ); + + outerSizer->Add( m_scrolledWindow1, 1, wxEXPAND, 0 ); + outerPanel->SetSizer( outerSizer ); + + aParent->AddPage( outerPanel, aCaption, false, static_cast( aIconIndex ) ); } -void DIALOG_ABOUT::createNotebookHtmlPage( wxAuiNotebook* aParent, const wxString& aCaption, - const wxBitmap& aIcon, const wxString& html, +void DIALOG_ABOUT::createNotebookHtmlPage( wxNotebook* aParent, const wxString& aCaption, + IMAGES aIconIndex, const wxString& html, bool aSelection ) { wxPanel* panel = new wxPanel( aParent, wxID_ANY, wxDefaultPosition, wxDefaultSize, @@ -381,9 +399,13 @@ void DIALOG_ABOUT::createNotebookHtmlPage( wxAuiNotebook* aParent, const wxStrin // to have a unique look background color for HTML pages is set to the default as it is // used for all the other widgets wxString htmlColor = ( this->GetBackgroundColour() ).GetAsString( wxC2S_HTML_SYNTAX ); + wxString textColor = GetForegroundColour().GetAsString( wxC2S_HTML_SYNTAX ); + wxString linkColor = + wxSystemSettings::GetColour( wxSYS_COLOUR_HOTLIGHT ).GetAsString( wxC2S_HTML_SYNTAX ); // beginning of HTML structure - htmlPage.Append( wxT( "" ) ); + htmlPage.Append( wxString::Format( wxT( "" ), + htmlColor, textColor, linkColor ) ); htmlPage.Append( htmlContent ); @@ -407,11 +429,10 @@ void DIALOG_ABOUT::createNotebookHtmlPage( wxAuiNotebook* aParent, const wxStrin wxHtmlLinkEventHandler( DIALOG_ABOUT::onHtmlLinkClicked ), NULL, this ); // no additional space around the HTML window as it is also the case by the other notebook pages - bSizer->Add( htmlWindow, 1, wxALL|wxEXPAND, 0 ); + bSizer->Add( htmlWindow, 1, wxEXPAND, 0 ); panel->SetSizer( bSizer ); - panel->Layout(); - bSizer->Fit( panel ); - aParent->AddPage( panel, aCaption, false, aIcon ); + + aParent->AddPage( panel, aCaption, false, static_cast( aIconIndex ) ); } @@ -470,3 +491,15 @@ void DIALOG_ABOUT::onReportBug( wxCommandEvent& event ) if( TOOL_MANAGER* mgr = static_cast( GetParent() )->GetToolManager() ) mgr->RunAction( "common.SuiteControl.reportBug", true ); } + + +void DIALOG_ABOUT::OnNotebookPageChanged( wxNotebookEvent& aEvent ) +{ + // Work around wxMac issue where the notebook pages are blank +#ifdef __WXMAC__ + int page = aEvent.GetSelection(); + + if( page >= 0 ) + m_notebook->ChangeSelection( static_cast( page ) ); +#endif +} diff --git a/common/dialog_about/dialog_about.h b/common/dialog_about/dialog_about.h index aea9fac2f4..0a7546546c 100644 --- a/common/dialog_about/dialog_about.h +++ b/common/dialog_about/dialog_about.h @@ -33,6 +33,19 @@ #include "aboutinfo.h" #include "dialog_about_base.h" +// Used for the notebook image list +enum class IMAGES { + INFORMATION, + VERSION, + DEVELOPERS, + DOCWRITERS, + LIBRARIANS, + ARTISTS, + TRANSLATORS, + PACKAGERS, + LICENSE +}; + /** * About dialog to show application specific information. * Needs a ABOUT_APP_INFO object that contains the data to be displayed. @@ -40,17 +53,7 @@ class DIALOG_ABOUT : public DIALOG_ABOUT_BASE { private: - - // Icons for the various tabs of wxAuiNotebook - wxBitmap m_picInformation; - wxBitmap m_picVersion; - wxBitmap m_picDevelopers; - wxBitmap m_picDocWriters; - wxBitmap m_picLibrarians; - wxBitmap m_picArtists; - wxBitmap m_picTranslators; - wxBitmap m_picPackagers; - wxBitmap m_picLicense; + wxImageList* m_images; wxString m_titleName; ABOUT_APP_INFO& m_info; @@ -59,9 +62,10 @@ public: DIALOG_ABOUT( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aAppInfo ); ~DIALOG_ABOUT(); -private: - void initDialog(); +protected: + void OnNotebookPageChanged( wxNotebookEvent& aEvent ) override; +private: void onHtmlLinkClicked( wxHtmlLinkEvent& event ); void onCopyVersionInfo( wxCommandEvent& event ) override; @@ -71,17 +75,17 @@ private: // Notebook pages wxFlexGridSizer* createFlexGridSizer(); void createNotebooks(); - void createNotebookPage( wxAuiNotebook* aParent, + void createNotebookPage( wxNotebook* aParent, const wxString& aCaption, - const wxBitmap& aIcon, + IMAGES aIconIndex, const CONTRIBUTORS& aContributors ); - void createNotebookPageByCategory( wxAuiNotebook* aParent, + void createNotebookPageByCategory( wxNotebook* aParent, const wxString& aCaption, - const wxBitmap& aIcon, + IMAGES aIconIndex, const CONTRIBUTORS& aContributors ); - void createNotebookHtmlPage( wxAuiNotebook* aParent, + void createNotebookHtmlPage( wxNotebook* aParent, const wxString& aCaption, - const wxBitmap& aIcon, + IMAGES aIconIndex, const wxString& aHtmlMessage, bool aSelection = false ); diff --git a/common/dialog_about/dialog_about_base.cpp b/common/dialog_about/dialog_about_base.cpp index 5611322d15..d0a1dcea0e 100644 --- a/common/dialog_about/dialog_about_base.cpp +++ b/common/dialog_about/dialog_about_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jul 10 2019) +// C++ code generated with wxFormBuilder (version Oct 26 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -77,11 +77,11 @@ DIALOG_ABOUT_BASE::DIALOG_ABOUT_BASE( wxWindow* parent, wxWindowID id, const wxS bSizerMain->Add( bSizerTitle, 0, wxEXPAND, 5 ); - m_auiNotebook = new wxAuiNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_NB_SCROLL_BUTTONS ); - m_auiNotebook->SetMinSize( wxSize( 750,350 ) ); + m_notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + m_notebook->SetMinSize( wxSize( 750,350 ) ); - bSizerMain->Add( m_auiNotebook, 2, wxALL|wxEXPAND, 5 ); + bSizerMain->Add( m_notebook, 2, wxEXPAND | wxALL, 5 ); wxBoxSizer* bSizerButtons; bSizerButtons = new wxBoxSizer( wxHORIZONTAL ); @@ -101,6 +101,7 @@ DIALOG_ABOUT_BASE::DIALOG_ABOUT_BASE( wxWindow* parent, wxWindowID id, const wxS // Connect Events m_btCopyVersionInfo->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ABOUT_BASE::onCopyVersionInfo ), NULL, this ); m_btReportBug->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ABOUT_BASE::onReportBug ), NULL, this ); + m_notebook->Connect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( DIALOG_ABOUT_BASE::OnNotebookPageChanged ), NULL, this ); } DIALOG_ABOUT_BASE::~DIALOG_ABOUT_BASE() @@ -108,5 +109,6 @@ DIALOG_ABOUT_BASE::~DIALOG_ABOUT_BASE() // Disconnect Events m_btCopyVersionInfo->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ABOUT_BASE::onCopyVersionInfo ), NULL, this ); m_btReportBug->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ABOUT_BASE::onReportBug ), NULL, this ); + m_notebook->Disconnect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( DIALOG_ABOUT_BASE::OnNotebookPageChanged ), NULL, this ); } diff --git a/common/dialog_about/dialog_about_base.fbp b/common/dialog_about/dialog_about_base.fbp index 6c29e1e2d7..c34d6742d7 100644 --- a/common/dialog_about/dialog_about_base.fbp +++ b/common/dialog_about/dialog_about_base.fbp @@ -14,7 +14,6 @@ dialog_about_base 1000 none - 1 MyProject @@ -26,7 +25,6 @@ 1 1 UI - 0 1 0 @@ -581,11 +579,11 @@ - + 5 - wxALL|wxEXPAND + wxEXPAND | wxALL 2 - + 1 1 1 @@ -596,6 +594,7 @@ + 1 0 @@ -620,7 +619,7 @@ 0 750,350 1 - m_auiNotebook + m_notebook 1 @@ -630,15 +629,14 @@ Resizable 1 - wxAUI_NB_SCROLL_BUTTONS - - -1 + + ; ; forward_declare 0 - + OnNotebookPageChanged diff --git a/common/dialog_about/dialog_about_base.h b/common/dialog_about/dialog_about_base.h index 4dbc07852c..6a6f9e4604 100644 --- a/common/dialog_about/dialog_about_base.h +++ b/common/dialog_about/dialog_about_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jul 10 2019) +// C++ code generated with wxFormBuilder (version Oct 26 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include /////////////////////////////////////////////////////////////////////////// @@ -42,12 +42,13 @@ class DIALOG_ABOUT_BASE : public wxDialog wxStaticText* m_staticTextLibVersion; wxButton* m_btCopyVersionInfo; wxButton* m_btReportBug; - wxAuiNotebook* m_auiNotebook; + wxNotebook* m_notebook; wxButton* m_btOk; // Virtual event handlers, overide them in your derived class virtual void onCopyVersionInfo( wxCommandEvent& event ) { event.Skip(); } virtual void onReportBug( wxCommandEvent& event ) { event.Skip(); } + virtual void OnNotebookPageChanged( wxNotebookEvent& event ) { event.Skip(); } public: