2014-10-19 20:20:16 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2010 Rafael Sokolowski <Rafael.Sokolowski@web.de>
|
2021-10-06 02:46:53 +00:00
|
|
|
* Copyright (C) 2017-2021 KiCad Developers, see AUTHORS.TXT for contributors.
|
2014-10-19 20:20:16 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2016-03-11 16:40:24 +00:00
|
|
|
|
|
|
|
#include <config.h>
|
2017-09-04 10:05:08 +00:00
|
|
|
#include <string>
|
2016-04-18 18:15:44 +00:00
|
|
|
|
2016-03-11 16:40:24 +00:00
|
|
|
#include <wx/clipbrd.h>
|
|
|
|
#include <wx/msgdlg.h>
|
2017-12-11 13:56:32 +00:00
|
|
|
#include <wx/hyperlink.h>
|
2016-03-11 16:40:24 +00:00
|
|
|
|
2017-08-18 06:06:45 +00:00
|
|
|
/* All KiCad icons are linked into shared library 'libbitmaps.a'.
|
2016-03-11 16:40:24 +00:00
|
|
|
* Icons:
|
2020-12-24 19:37:30 +00:00
|
|
|
* preference_xpm; // Icon for 'Developers' tab
|
|
|
|
* editor_xpm; // Icon for 'Doc Writers' tab
|
|
|
|
* color_materials_xpm; // Icon for 'Artists' tab
|
|
|
|
* language_xpm; // Icon for 'Translators' tab
|
|
|
|
* right_xpm; // Right arrow icon for list items
|
|
|
|
* info_xpm; // Bulb for description tab
|
|
|
|
* tools_xpm; // Sheet of paper icon for license info tab
|
2016-03-11 16:40:24 +00:00
|
|
|
*/
|
|
|
|
#include <bitmaps.h>
|
|
|
|
#include <build_version.h>
|
2021-09-14 18:26:03 +00:00
|
|
|
#include <dialogs/html_message_box.h>
|
2020-05-25 00:39:15 +00:00
|
|
|
#include <tool/tool_manager.h>
|
2016-03-11 16:40:24 +00:00
|
|
|
|
2017-08-18 14:56:49 +00:00
|
|
|
#include "dialog_about.h"
|
2016-03-11 16:40:24 +00:00
|
|
|
|
2013-05-26 04:36:44 +00:00
|
|
|
|
2017-08-18 06:06:45 +00:00
|
|
|
DIALOG_ABOUT::DIALOG_ABOUT( EDA_BASE_FRAME *aParent, ABOUT_APP_INFO& aAppInfo )
|
|
|
|
: DIALOG_ABOUT_BASE( aParent ), m_info( aAppInfo )
|
2013-05-26 04:36:44 +00:00
|
|
|
{
|
2019-05-13 18:33:30 +00:00
|
|
|
wxASSERT( aParent != nullptr );
|
|
|
|
|
2020-10-10 16:38:04 +00:00
|
|
|
// TODO: Change these to 16x16 versions when available
|
2020-12-12 17:27:06 +00:00
|
|
|
m_images = new wxImageList( 24, 24, false, 9 );
|
2020-10-10 16:38:04 +00:00
|
|
|
|
2021-03-08 02:59:07 +00:00
|
|
|
m_images->Add( KiBitmap( BITMAPS::info ) ); // INFORMATION
|
|
|
|
m_images->Add( KiBitmap( BITMAPS::recent ) ); // VERSION
|
|
|
|
m_images->Add( KiBitmap( BITMAPS::preference ) ); // DEVELOPERS
|
|
|
|
m_images->Add( KiBitmap( BITMAPS::editor ) ); // DOCWRITERS
|
|
|
|
m_images->Add( KiBitmap( BITMAPS::library ) ); // LIBRARIANS
|
|
|
|
m_images->Add( KiBitmap( BITMAPS::color_materials ) ); // ARTISTS
|
|
|
|
m_images->Add( KiBitmap( BITMAPS::language ) ); // TRANSLATORS
|
|
|
|
m_images->Add( KiBitmap( BITMAPS::zip ) ); // PACKAGERS
|
|
|
|
m_images->Add( KiBitmap( BITMAPS::tools ) ); // LICENSE
|
2020-10-10 16:38:04 +00:00
|
|
|
|
|
|
|
m_notebook->SetImageList( m_images );
|
2017-08-18 06:06:45 +00:00
|
|
|
|
|
|
|
if( m_info.GetAppIcon().IsOk() )
|
|
|
|
{
|
|
|
|
SetIcon( m_info.GetAppIcon() );
|
|
|
|
m_bitmapApp->SetBitmap( m_info.GetAppIcon() );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
wxIcon icon;
|
2021-03-08 02:59:07 +00:00
|
|
|
icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_kicad ) );
|
2017-08-18 06:06:45 +00:00
|
|
|
SetIcon( icon );
|
|
|
|
m_bitmapApp->SetBitmap( icon );
|
|
|
|
}
|
2013-05-26 04:36:44 +00:00
|
|
|
|
2019-05-13 18:33:30 +00:00
|
|
|
m_titleName = aParent->GetAboutTitle();
|
|
|
|
m_staticTextAppTitle->SetLabel( m_titleName );
|
2017-08-18 06:06:45 +00:00
|
|
|
m_staticTextCopyright->SetLabel( m_info.GetCopyright() );
|
|
|
|
m_staticTextBuildVersion->SetLabel( "Version: " + m_info.GetBuildVersion() );
|
|
|
|
m_staticTextLibVersion->SetLabel( m_info.GetLibVersion() );
|
2013-05-26 04:36:44 +00:00
|
|
|
|
2019-05-13 18:33:30 +00:00
|
|
|
SetTitle( wxString::Format( _( "About %s" ), m_titleName ) );
|
2017-08-18 06:06:45 +00:00
|
|
|
createNotebooks();
|
2014-04-24 18:54:49 +00:00
|
|
|
|
2014-10-19 20:20:16 +00:00
|
|
|
GetSizer()->SetSizeHints( this );
|
2013-05-26 04:36:44 +00:00
|
|
|
SetFocus();
|
|
|
|
Centre();
|
|
|
|
}
|
|
|
|
|
2014-10-19 20:20:16 +00:00
|
|
|
|
2017-08-18 06:06:45 +00:00
|
|
|
DIALOG_ABOUT::~DIALOG_ABOUT()
|
2013-05-26 04:36:44 +00:00
|
|
|
{
|
2020-10-10 16:38:04 +00:00
|
|
|
delete m_images;
|
2013-05-26 04:36:44 +00:00
|
|
|
}
|
|
|
|
|
2014-10-19 20:20:16 +00:00
|
|
|
|
2017-08-18 06:06:45 +00:00
|
|
|
wxFlexGridSizer* DIALOG_ABOUT::createFlexGridSizer()
|
2013-05-26 04:36:44 +00:00
|
|
|
{
|
2015-11-19 20:03:02 +00:00
|
|
|
// three columns with vertical and horizontal extra space of two pixels
|
2017-08-18 06:06:45 +00:00
|
|
|
wxFlexGridSizer* fgSizer = new wxFlexGridSizer( 3, 2, 2 );
|
|
|
|
fgSizer->SetFlexibleDirection( wxHORIZONTAL );
|
|
|
|
fgSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
2013-05-26 04:36:44 +00:00
|
|
|
|
2017-08-18 06:06:45 +00:00
|
|
|
return fgSizer;
|
2013-05-26 04:36:44 +00:00
|
|
|
}
|
|
|
|
|
2014-10-19 20:20:16 +00:00
|
|
|
|
2017-08-18 06:06:45 +00:00
|
|
|
void DIALOG_ABOUT::createNotebooks()
|
2013-05-26 04:36:44 +00:00
|
|
|
{
|
2020-10-10 16:38:04 +00:00
|
|
|
createNotebookHtmlPage( m_notebook, _( "About" ), IMAGES::INFORMATION,
|
2020-02-21 02:17:32 +00:00
|
|
|
m_info.GetDescription() );
|
|
|
|
|
2020-05-25 00:39:15 +00:00
|
|
|
wxString version = GetVersionInfoData( m_titleName, true );
|
2020-02-21 02:17:32 +00:00
|
|
|
|
2020-10-10 16:38:04 +00:00
|
|
|
createNotebookHtmlPage( m_notebook, _( "Version" ), IMAGES::VERSION, version, true );
|
2013-05-26 04:36:44 +00:00
|
|
|
|
2020-10-10 16:38:04 +00:00
|
|
|
createNotebookPageByCategory( m_notebook, _( "Developers" ) , IMAGES::DEVELOPERS,
|
2019-05-13 18:33:30 +00:00
|
|
|
m_info.GetDevelopers() );
|
2020-10-10 16:38:04 +00:00
|
|
|
createNotebookPage( m_notebook, _( "Doc Writers" ), IMAGES::DOCWRITERS,
|
2019-05-13 18:33:30 +00:00
|
|
|
m_info.GetDocWriters() );
|
2013-05-26 04:36:44 +00:00
|
|
|
|
2020-10-10 16:38:04 +00:00
|
|
|
createNotebookPageByCategory( m_notebook, _( "Librarians" ), IMAGES::LIBRARIANS,
|
2020-10-08 23:47:06 +00:00
|
|
|
m_info.GetLibrarians() );
|
|
|
|
|
2020-10-10 16:38:04 +00:00
|
|
|
createNotebookPageByCategory( m_notebook, _( "Artists" ), IMAGES::ARTISTS,
|
2019-05-13 18:33:30 +00:00
|
|
|
m_info.GetArtists() );
|
2020-10-10 16:38:04 +00:00
|
|
|
createNotebookPageByCategory( m_notebook, _( "Translators" ), IMAGES::TRANSLATORS,
|
2017-08-18 06:06:45 +00:00
|
|
|
m_info.GetTranslators() );
|
2020-10-10 16:38:04 +00:00
|
|
|
createNotebookPageByCategory( m_notebook, _( "Packagers" ), IMAGES::PACKAGERS,
|
2017-08-18 06:06:45 +00:00
|
|
|
m_info.GetPackagers() );
|
2013-05-26 04:36:44 +00:00
|
|
|
|
2020-10-10 16:38:04 +00:00
|
|
|
createNotebookHtmlPage( m_notebook, _( "License" ), IMAGES::LICENSE, m_info.GetLicense() );
|
2013-05-26 04:36:44 +00:00
|
|
|
}
|
|
|
|
|
2020-10-10 16:38:04 +00:00
|
|
|
void DIALOG_ABOUT::createNotebookPage( wxNotebook* aParent, const wxString& aCaption,
|
|
|
|
IMAGES aIconIndex, const CONTRIBUTORS& aContributors )
|
2013-05-26 04:36:44 +00:00
|
|
|
{
|
2020-10-10 16:38:04 +00:00
|
|
|
wxPanel* outerPanel = new wxPanel( aParent );
|
|
|
|
wxBoxSizer* outerSizer = new wxBoxSizer( wxVERTICAL );
|
|
|
|
|
2013-05-26 04:36:44 +00:00
|
|
|
wxBoxSizer* bSizer = new wxBoxSizer( wxHORIZONTAL );
|
|
|
|
|
2020-10-10 16:38:04 +00:00
|
|
|
wxScrolledWindow* m_scrolledWindow1 = new wxScrolledWindow( outerPanel, wxID_ANY,
|
2014-10-19 20:20:16 +00:00
|
|
|
wxDefaultPosition,
|
|
|
|
wxDefaultSize,
|
|
|
|
wxHSCROLL|wxVSCROLL );
|
2013-05-26 04:36:44 +00:00
|
|
|
m_scrolledWindow1->SetScrollRate( 5, 5 );
|
|
|
|
|
|
|
|
/* Panel for additional space at the left,
|
|
|
|
* but can also be used to show an additional bitmap.
|
|
|
|
*/
|
2014-10-19 20:20:16 +00:00
|
|
|
wxPanel* panel1 = new wxPanel( m_scrolledWindow1 );
|
2013-05-26 04:36:44 +00:00
|
|
|
|
2017-08-18 06:06:45 +00:00
|
|
|
wxFlexGridSizer* fgSizer1 = createFlexGridSizer();
|
2013-05-26 04:36:44 +00:00
|
|
|
|
2016-04-18 18:15:44 +00:00
|
|
|
for( size_t i=0; i<aContributors.GetCount(); ++i )
|
2013-05-26 04:36:44 +00:00
|
|
|
{
|
2017-08-18 06:06:45 +00:00
|
|
|
CONTRIBUTOR* contributor = &aContributors.Item( i );
|
2013-05-26 04:36:44 +00:00
|
|
|
|
|
|
|
// Icon at first column
|
2017-08-18 06:06:45 +00:00
|
|
|
wxStaticBitmap* m_bitmap1 = createStaticBitmap( m_scrolledWindow1, contributor->GetIcon() );
|
2013-05-26 04:36:44 +00:00
|
|
|
fgSizer1->Add( m_bitmap1, 0, wxALIGN_CENTER|wxLEFT|wxRIGHT, 5 );
|
|
|
|
|
|
|
|
// Name of contributor at second column
|
|
|
|
if ( contributor->GetName() != wxEmptyString )
|
|
|
|
{
|
2014-10-19 20:20:16 +00:00
|
|
|
wxStaticText* m_staticText1 = new wxStaticText( m_scrolledWindow1, wxID_ANY,
|
|
|
|
contributor->GetName(),
|
|
|
|
wxDefaultPosition, wxDefaultSize, 0 );
|
2013-05-26 04:36:44 +00:00
|
|
|
m_staticText1->Wrap( -1 );
|
|
|
|
fgSizer1->Add( m_staticText1, 0, wxALIGN_LEFT|wxBOTTOM, 2 );
|
|
|
|
}
|
2014-10-19 20:20:16 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
fgSizer1->AddSpacer( 5 );
|
2013-05-26 04:36:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Email address of contributor at third column
|
2021-02-10 01:25:11 +00:00
|
|
|
if ( contributor->GetExtra() != wxEmptyString )
|
2013-05-26 04:36:44 +00:00
|
|
|
{
|
2021-02-10 01:25:11 +00:00
|
|
|
wxStaticText* hyperlink = wxStaticTextRef( m_scrolledWindow1,
|
|
|
|
contributor->GetExtra() );
|
2013-05-26 04:36:44 +00:00
|
|
|
fgSizer1->Add( hyperlink, 0, wxALIGN_LEFT|wxBOTTOM, 2 );
|
|
|
|
}
|
2014-10-19 20:20:16 +00:00
|
|
|
else
|
|
|
|
{
|
2015-11-19 20:03:02 +00:00
|
|
|
fgSizer1->AddSpacer( 5 );
|
2013-05-26 04:36:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bSizer->Add( panel1, 1, wxEXPAND|wxALL, 10 );
|
|
|
|
bSizer->Add( fgSizer1, 7, wxEXPAND|wxALL, 10 ); // adjust width of panel with first int value
|
|
|
|
m_scrolledWindow1->SetSizer( bSizer );
|
|
|
|
m_scrolledWindow1->Layout();
|
|
|
|
bSizer->Fit( m_scrolledWindow1 );
|
2020-10-10 16:38:04 +00:00
|
|
|
|
|
|
|
outerSizer->Add( m_scrolledWindow1, 1, wxEXPAND, 0 );
|
|
|
|
outerPanel->SetSizer( outerSizer );
|
|
|
|
|
|
|
|
aParent->AddPage( outerPanel, aCaption, false, static_cast<int>( aIconIndex ) );
|
2013-05-26 04:36:44 +00:00
|
|
|
}
|
|
|
|
|
2014-10-19 20:20:16 +00:00
|
|
|
|
2020-10-10 16:38:04 +00:00
|
|
|
void DIALOG_ABOUT::createNotebookPageByCategory( wxNotebook* aParent, const wxString& aCaption,
|
|
|
|
IMAGES aIconIndex,
|
|
|
|
const CONTRIBUTORS& aContributors )
|
2013-05-26 04:36:44 +00:00
|
|
|
{
|
2020-07-11 22:42:46 +00:00
|
|
|
// The left justification between wxStaticText and wxHyperlinkCtrl is different so
|
|
|
|
// we must pad to make the alignment look decent.
|
|
|
|
//
|
|
|
|
// @todo Just make all of the contributor lists HTML so the alignment is consistent.
|
|
|
|
wxString padding;
|
|
|
|
|
|
|
|
// Of course the padding is different depending on the platform so we adjust the
|
|
|
|
// padding accordingly.
|
|
|
|
#if defined( __WXGTK__ )
|
|
|
|
padding += " ";
|
|
|
|
#endif
|
2020-10-10 16:38:04 +00:00
|
|
|
wxPanel* outerPanel = new wxPanel( aParent );
|
|
|
|
wxBoxSizer* outerSizer = new wxBoxSizer( wxVERTICAL );
|
2020-07-11 22:42:46 +00:00
|
|
|
|
2013-05-26 04:36:44 +00:00
|
|
|
wxBoxSizer* bSizer = new wxBoxSizer( wxHORIZONTAL );
|
|
|
|
|
2020-10-10 16:38:04 +00:00
|
|
|
wxScrolledWindow* m_scrolledWindow1 = new wxScrolledWindow( outerPanel, wxID_ANY,
|
2014-10-19 20:20:16 +00:00
|
|
|
wxDefaultPosition,
|
|
|
|
wxDefaultSize,
|
|
|
|
wxHSCROLL|wxVSCROLL );
|
2013-05-26 04:36:44 +00:00
|
|
|
m_scrolledWindow1->SetScrollRate( 5, 5 );
|
|
|
|
|
|
|
|
/* Panel for additional space at the left,
|
|
|
|
* but can also be used to show an additional bitmap.
|
|
|
|
*/
|
2014-10-19 20:20:16 +00:00
|
|
|
wxPanel* panel1 = new wxPanel( m_scrolledWindow1 );
|
2013-05-26 04:36:44 +00:00
|
|
|
|
2017-08-18 06:06:45 +00:00
|
|
|
wxFlexGridSizer* fgSizer1 = createFlexGridSizer();
|
2013-05-26 04:36:44 +00:00
|
|
|
|
2016-04-18 18:15:44 +00:00
|
|
|
for( size_t i=0; i < aContributors.GetCount(); ++i )
|
2013-05-26 04:36:44 +00:00
|
|
|
{
|
2017-08-18 06:06:45 +00:00
|
|
|
CONTRIBUTOR* contributor = &aContributors.Item( i );
|
2013-05-26 04:36:44 +00:00
|
|
|
|
|
|
|
wxBitmap* icon = contributor->GetIcon();
|
|
|
|
wxString category = contributor->GetCategory();
|
|
|
|
|
|
|
|
/* to construct the next row we expect to have
|
|
|
|
* a category and a contributor that was not considered up to now
|
|
|
|
*/
|
2014-10-19 20:20:16 +00:00
|
|
|
if( ( category != wxEmptyString ) && !( contributor->IsChecked() ) )
|
2013-05-26 04:36:44 +00:00
|
|
|
{
|
|
|
|
// Icon at first column
|
2017-08-18 06:06:45 +00:00
|
|
|
wxStaticBitmap* m_bitmap1 = createStaticBitmap( m_scrolledWindow1, icon );
|
2013-05-26 04:36:44 +00:00
|
|
|
fgSizer1->Add( m_bitmap1, 0, wxALIGN_CENTER|wxLEFT|wxRIGHT, 5 );
|
|
|
|
|
|
|
|
// Category name at second column
|
2014-10-19 20:20:16 +00:00
|
|
|
wxStaticText* m_staticText1 = new wxStaticText( m_scrolledWindow1, wxID_ANY,
|
|
|
|
contributor->GetCategory() + wxT( ":" ),
|
|
|
|
wxDefaultPosition, wxDefaultSize, 0 );
|
2021-09-12 11:17:22 +00:00
|
|
|
m_staticText1->SetFont( m_staticText1->GetFont().Bold() );
|
2013-05-26 04:36:44 +00:00
|
|
|
m_staticText1->Wrap( -1 );
|
2020-10-08 23:47:06 +00:00
|
|
|
fgSizer1->Add( m_staticText1, 0, wxALIGN_LEFT|wxBOTTOM|wxEXPAND, 2 );
|
2013-05-26 04:36:44 +00:00
|
|
|
|
|
|
|
// Nothing at third column
|
2014-10-19 20:20:16 +00:00
|
|
|
fgSizer1->AddSpacer( 5 );
|
2013-05-26 04:36:44 +00:00
|
|
|
|
|
|
|
// Now, all contributors of the same category will follow
|
2016-04-18 18:15:44 +00:00
|
|
|
for( size_t j=0; j < aContributors.GetCount(); ++j )
|
2013-05-26 04:36:44 +00:00
|
|
|
{
|
2017-08-18 06:06:45 +00:00
|
|
|
CONTRIBUTOR* sub_contributor = &aContributors.Item( j );
|
2013-05-26 04:36:44 +00:00
|
|
|
|
2016-04-18 18:15:44 +00:00
|
|
|
if ( sub_contributor->GetCategory() == category )
|
2013-05-26 04:36:44 +00:00
|
|
|
{
|
|
|
|
// First column is empty
|
2020-07-08 16:56:05 +00:00
|
|
|
fgSizer1->AddSpacer( 5 );
|
2013-05-26 04:36:44 +00:00
|
|
|
|
2017-12-11 13:56:32 +00:00
|
|
|
wxControl* ctrl;
|
|
|
|
|
|
|
|
// No URL supplied, display normal text control
|
|
|
|
if( sub_contributor->GetUrl().IsEmpty() )
|
|
|
|
{
|
|
|
|
ctrl = new wxStaticText( m_scrolledWindow1, wxID_ANY,
|
2020-07-11 22:42:46 +00:00
|
|
|
padding + wxT( "• " ) + sub_contributor->GetName(),
|
2017-12-11 13:56:32 +00:00
|
|
|
wxDefaultPosition,
|
|
|
|
wxDefaultSize, 0 );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Display a hyperlink control instead
|
|
|
|
ctrl = new wxHyperlinkCtrl( m_scrolledWindow1, wxID_ANY,
|
|
|
|
wxT( "• " ) + sub_contributor->GetName(),
|
|
|
|
sub_contributor->GetUrl(),
|
|
|
|
wxDefaultPosition,
|
2020-07-11 22:42:46 +00:00
|
|
|
wxDefaultSize,
|
|
|
|
wxBORDER_NONE | wxHL_CONTEXTMENU | wxHL_ALIGN_LEFT );
|
2017-12-11 13:56:32 +00:00
|
|
|
}
|
|
|
|
|
2013-05-26 04:36:44 +00:00
|
|
|
m_staticText1->Wrap( -1 );
|
2017-12-11 13:56:32 +00:00
|
|
|
|
|
|
|
fgSizer1->Add( ctrl, 0, wxALIGN_LEFT|wxBOTTOM, 2 );
|
2013-05-26 04:36:44 +00:00
|
|
|
|
|
|
|
// Email address of contributor at third column
|
2021-02-10 01:25:11 +00:00
|
|
|
if( sub_contributor->GetExtra() != wxEmptyString )
|
2013-05-26 04:36:44 +00:00
|
|
|
{
|
2021-02-10 01:25:11 +00:00
|
|
|
wxStaticText* mail = wxStaticTextRef( m_scrolledWindow1,
|
|
|
|
sub_contributor->GetExtra() );
|
2017-08-18 06:06:45 +00:00
|
|
|
fgSizer1->Add( mail, 0, wxALIGN_LEFT|wxBOTTOM, 2 );
|
2013-05-26 04:36:44 +00:00
|
|
|
}
|
2014-10-19 20:20:16 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
fgSizer1->AddSpacer( 5 );
|
2013-05-26 04:36:44 +00:00
|
|
|
}
|
|
|
|
|
2015-11-19 20:03:02 +00:00
|
|
|
/* this contributor was added to the GUI,
|
2013-05-26 04:36:44 +00:00
|
|
|
* thus can be ignored next time
|
|
|
|
*/
|
2016-04-18 18:15:44 +00:00
|
|
|
sub_contributor->SetChecked( true );
|
2013-05-26 04:36:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-10-19 20:20:16 +00:00
|
|
|
else
|
|
|
|
{
|
2013-05-26 04:36:44 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Now, lets list the remaining contributors that have not been considered
|
|
|
|
* because they were not assigned to any category.
|
|
|
|
*/
|
2016-04-18 18:15:44 +00:00
|
|
|
for ( size_t k=0; k < aContributors.GetCount(); ++k )
|
2013-05-26 04:36:44 +00:00
|
|
|
{
|
2017-08-18 06:06:45 +00:00
|
|
|
CONTRIBUTOR* contributor = &aContributors.Item( k );
|
2013-05-26 04:36:44 +00:00
|
|
|
|
|
|
|
if ( contributor->IsChecked() )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
// Icon at first column
|
2017-08-18 06:06:45 +00:00
|
|
|
wxStaticBitmap* m_bitmap1 = createStaticBitmap( m_scrolledWindow1, contributor->GetIcon() );
|
2013-05-26 04:36:44 +00:00
|
|
|
fgSizer1->Add( m_bitmap1, 0, wxALIGN_CENTER|wxLEFT|wxRIGHT, 5 );
|
|
|
|
|
|
|
|
// Name of contributor at second column
|
2014-10-19 20:20:16 +00:00
|
|
|
if( contributor->GetName() != wxEmptyString )
|
2013-05-26 04:36:44 +00:00
|
|
|
{
|
2014-10-19 20:20:16 +00:00
|
|
|
wxStaticText* m_staticText1 = new wxStaticText( m_scrolledWindow1, wxID_ANY,
|
|
|
|
contributor->GetName(),
|
|
|
|
wxDefaultPosition, wxDefaultSize, 0 );
|
2013-05-26 04:36:44 +00:00
|
|
|
m_staticText1->Wrap( -1 );
|
|
|
|
fgSizer1->Add( m_staticText1, 0, wxALIGN_LEFT|wxBOTTOM, 2 );
|
|
|
|
}
|
2014-10-19 20:20:16 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
fgSizer1->AddSpacer( 5 );
|
2013-05-26 04:36:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Email address of contributor at third column
|
2021-02-10 01:25:11 +00:00
|
|
|
if ( contributor->GetExtra() != wxEmptyString )
|
2013-05-26 04:36:44 +00:00
|
|
|
{
|
2021-02-10 01:25:11 +00:00
|
|
|
wxStaticText* mail = wxStaticTextRef( m_scrolledWindow1,
|
|
|
|
contributor->GetExtra() );
|
2017-08-18 06:06:45 +00:00
|
|
|
fgSizer1->Add( mail, 0, wxALIGN_LEFT|wxBOTTOM, 2 );
|
2013-05-26 04:36:44 +00:00
|
|
|
}
|
2014-10-19 20:20:16 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
fgSizer1->AddSpacer( 5 );
|
2013-05-26 04:36:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bSizer->Add( panel1, 1, wxEXPAND|wxALL, 10 );
|
|
|
|
bSizer->Add( fgSizer1, 7, wxEXPAND|wxALL, 10 ); // adjust width of panel with first int value
|
|
|
|
m_scrolledWindow1->SetSizer( bSizer );
|
|
|
|
m_scrolledWindow1->Layout();
|
|
|
|
bSizer->Fit( m_scrolledWindow1 );
|
2020-10-10 16:38:04 +00:00
|
|
|
|
|
|
|
outerSizer->Add( m_scrolledWindow1, 1, wxEXPAND, 0 );
|
|
|
|
outerPanel->SetSizer( outerSizer );
|
|
|
|
|
|
|
|
aParent->AddPage( outerPanel, aCaption, false, static_cast<int>( aIconIndex ) );
|
2013-05-26 04:36:44 +00:00
|
|
|
}
|
|
|
|
|
2014-10-19 20:20:16 +00:00
|
|
|
|
2020-10-10 16:38:04 +00:00
|
|
|
void DIALOG_ABOUT::createNotebookHtmlPage( wxNotebook* aParent, const wxString& aCaption,
|
|
|
|
IMAGES aIconIndex, const wxString& html,
|
2020-02-22 16:23:47 +00:00
|
|
|
bool aSelection )
|
2013-05-26 04:36:44 +00:00
|
|
|
{
|
2016-04-18 18:15:44 +00:00
|
|
|
wxPanel* panel = new wxPanel( aParent, wxID_ANY, wxDefaultPosition, wxDefaultSize,
|
2014-10-19 20:20:16 +00:00
|
|
|
wxTAB_TRAVERSAL );
|
2013-05-26 04:36:44 +00:00
|
|
|
|
|
|
|
wxBoxSizer* bSizer = new wxBoxSizer( wxVERTICAL );
|
|
|
|
|
|
|
|
wxString htmlPage = wxEmptyString, htmlContent = html;
|
|
|
|
|
2014-10-19 20:20:16 +00:00
|
|
|
// to have a unique look background color for HTML pages is set to the default as it is
|
|
|
|
// used for all the other widgets
|
2021-02-09 16:35:43 +00:00
|
|
|
wxString htmlColor = ( GetBackgroundColour() ).GetAsString( wxC2S_HTML_SYNTAX );
|
2020-10-10 16:38:04 +00:00
|
|
|
wxString textColor = GetForegroundColour().GetAsString( wxC2S_HTML_SYNTAX );
|
|
|
|
wxString linkColor =
|
|
|
|
wxSystemSettings::GetColour( wxSYS_COLOUR_HOTLIGHT ).GetAsString( wxC2S_HTML_SYNTAX );
|
2013-05-26 04:36:44 +00:00
|
|
|
|
2015-11-19 20:03:02 +00:00
|
|
|
// beginning of HTML structure
|
2020-10-10 16:38:04 +00:00
|
|
|
htmlPage.Append( wxString::Format( wxT( "<html><body bgcolor='%s' text='%s' link='%s'>" ),
|
|
|
|
htmlColor, textColor, linkColor ) );
|
2013-05-26 04:36:44 +00:00
|
|
|
|
|
|
|
htmlPage.Append( htmlContent );
|
|
|
|
|
2015-11-19 20:03:02 +00:00
|
|
|
// end of HTML structure indicated by closing tags
|
2014-10-19 20:20:16 +00:00
|
|
|
htmlPage.Append( wxT( "</body></html>" ) );
|
2013-05-26 04:36:44 +00:00
|
|
|
|
2020-02-22 16:23:47 +00:00
|
|
|
int flags = aSelection ? wxHW_SCROLLBAR_AUTO : ( wxHW_SCROLLBAR_AUTO | wxHW_NO_SELECTION );
|
|
|
|
|
2015-11-19 20:03:02 +00:00
|
|
|
// the HTML page is going to be created with previously created HTML content
|
2020-02-22 16:23:47 +00:00
|
|
|
auto htmlWindow = new wxHtmlWindow( panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, flags );
|
2013-05-26 04:36:44 +00:00
|
|
|
|
2014-10-19 20:20:16 +00:00
|
|
|
// HTML font set to font properties as they are used for widgets to have an unique look
|
|
|
|
// under different platforms with HTML
|
2021-02-09 16:35:43 +00:00
|
|
|
wxFont font = GetFont();
|
2013-05-26 04:36:44 +00:00
|
|
|
htmlWindow->SetStandardFonts( font.GetPointSize(), font.GetFaceName(), font.GetFaceName() );
|
|
|
|
htmlWindow->SetPage( htmlPage );
|
|
|
|
|
2014-10-19 20:20:16 +00:00
|
|
|
// the HTML window shall not be used to open external links, thus this task is delegated
|
|
|
|
// to users default browser
|
|
|
|
htmlWindow->Connect( wxEVT_COMMAND_HTML_LINK_CLICKED,
|
2017-08-18 06:06:45 +00:00
|
|
|
wxHtmlLinkEventHandler( DIALOG_ABOUT::onHtmlLinkClicked ), NULL, this );
|
2013-05-26 04:36:44 +00:00
|
|
|
|
2015-11-19 20:03:02 +00:00
|
|
|
// no additional space around the HTML window as it is also the case by the other notebook pages
|
2020-10-10 16:38:04 +00:00
|
|
|
bSizer->Add( htmlWindow, 1, wxEXPAND, 0 );
|
2013-05-26 04:36:44 +00:00
|
|
|
panel->SetSizer( bSizer );
|
2020-10-10 16:38:04 +00:00
|
|
|
|
|
|
|
aParent->AddPage( panel, aCaption, false, static_cast<int>( aIconIndex ) );
|
2013-05-26 04:36:44 +00:00
|
|
|
}
|
|
|
|
|
2014-10-19 20:20:16 +00:00
|
|
|
|
2021-02-10 01:25:11 +00:00
|
|
|
wxStaticText* DIALOG_ABOUT::wxStaticTextRef( wxScrolledWindow* aParent, const wxString& aReference )
|
2013-05-26 04:36:44 +00:00
|
|
|
{
|
2017-08-18 06:06:45 +00:00
|
|
|
wxStaticText* text = new wxStaticText( aParent, wxID_ANY,
|
2021-02-10 01:25:11 +00:00
|
|
|
wxT( "(" ) + aReference + wxT( ")" ) );
|
2017-08-18 06:06:45 +00:00
|
|
|
|
|
|
|
return text;
|
2013-05-26 04:36:44 +00:00
|
|
|
}
|
|
|
|
|
2014-10-19 20:20:16 +00:00
|
|
|
|
2020-07-08 16:56:05 +00:00
|
|
|
wxStaticBitmap* DIALOG_ABOUT::createStaticBitmap( wxScrolledWindow* aParent, wxBitmap* aIcon )
|
2013-05-26 04:36:44 +00:00
|
|
|
{
|
2016-04-18 18:15:44 +00:00
|
|
|
wxStaticBitmap* bitmap = new wxStaticBitmap( aParent, wxID_ANY, wxNullBitmap,
|
2014-10-19 20:20:16 +00:00
|
|
|
wxDefaultPosition, wxDefaultSize, 0 );
|
2013-05-26 04:36:44 +00:00
|
|
|
|
2016-04-18 18:15:44 +00:00
|
|
|
if( aIcon )
|
2013-05-26 04:36:44 +00:00
|
|
|
{
|
2016-04-18 18:15:44 +00:00
|
|
|
bitmap->SetBitmap( *aIcon );
|
2013-05-26 04:36:44 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-03-08 02:59:07 +00:00
|
|
|
bitmap->SetBitmap( KiBitmap( BITMAPS::right ) );
|
2013-05-26 04:36:44 +00:00
|
|
|
}
|
2014-10-19 20:20:16 +00:00
|
|
|
|
2013-05-26 04:36:44 +00:00
|
|
|
return bitmap;
|
|
|
|
}
|
|
|
|
|
2014-10-19 20:20:16 +00:00
|
|
|
|
2017-08-18 06:06:45 +00:00
|
|
|
void DIALOG_ABOUT::onHtmlLinkClicked( wxHtmlLinkEvent& event )
|
2013-05-26 04:36:44 +00:00
|
|
|
{
|
2017-08-18 06:06:45 +00:00
|
|
|
::wxLaunchDefaultBrowser( event.GetLinkInfo().GetHref() );
|
2013-05-26 04:36:44 +00:00
|
|
|
}
|
|
|
|
|
2014-10-19 20:20:16 +00:00
|
|
|
|
2017-08-18 06:06:45 +00:00
|
|
|
void DIALOG_ABOUT::onCopyVersionInfo( wxCommandEvent& event )
|
|
|
|
{
|
2021-01-29 19:13:12 +00:00
|
|
|
wxLogNull doNotLog; // disable logging of failed clipboard actions
|
|
|
|
|
2017-08-18 06:06:45 +00:00
|
|
|
if( !wxTheClipboard->Open() )
|
|
|
|
{
|
|
|
|
wxMessageBox( _( "Could not open clipboard to write version information." ),
|
|
|
|
_( "Clipboard Error" ), wxOK | wxICON_EXCLAMATION, this );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-05-25 00:39:15 +00:00
|
|
|
wxString msg_version = GetVersionInfoData( m_titleName );
|
2016-09-03 18:36:20 +00:00
|
|
|
|
2016-03-11 16:40:24 +00:00
|
|
|
wxTheClipboard->SetData( new wxTextDataObject( msg_version ) );
|
2021-01-30 15:43:26 +00:00
|
|
|
wxTheClipboard->Flush(); // Allow clipboard data to be available after KiCad closes
|
2016-03-11 16:40:24 +00:00
|
|
|
wxTheClipboard->Close();
|
2017-08-18 06:06:45 +00:00
|
|
|
m_btCopyVersionInfo->SetLabel( _( "Copied..." ) );
|
2016-03-11 16:40:24 +00:00
|
|
|
}
|
2020-02-21 02:17:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_ABOUT::onReportBug( wxCommandEvent& event )
|
|
|
|
{
|
2020-05-25 00:39:15 +00:00
|
|
|
if( TOOL_MANAGER* mgr = static_cast<EDA_BASE_FRAME*>( GetParent() )->GetToolManager() )
|
|
|
|
mgr->RunAction( "common.SuiteControl.reportBug", true );
|
2020-02-21 02:17:32 +00:00
|
|
|
}
|
2020-10-10 16:38:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
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<unsigned>( page ) );
|
|
|
|
#endif
|
|
|
|
}
|