Support canceling initial global library table setup.

This commit is contained in:
Alex 2023-03-19 14:30:53 +03:00
parent 672c468342
commit 10c4b948cb
7 changed files with 24 additions and 10 deletions

View File

@ -56,6 +56,8 @@ DIALOG_GLOBAL_LIB_TABLE_CONFIG_BASE::DIALOG_GLOBAL_LIB_TABLE_CONFIG_BASE( wxWind
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK );
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize();
bSizer2->Add( m_sdbSizer1, 1, wxEXPAND|wxTOP, 5 );

View File

@ -48,7 +48,7 @@
<property name="name">DIALOG_GLOBAL_LIB_TABLE_CONFIG_BASE</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style">wxCAPTION|wxRESIZE_BORDER</property>
<property name="style">wxCAPTION|wxCLOSE_BOX|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Configure Global Library Table</property>
<property name="tooltip"></property>
@ -477,7 +477,7 @@
<property name="proportion">1</property>
<object class="wxStdDialogButtonSizer" expanded="0">
<property name="Apply">0</property>
<property name="Cancel">0</property>
<property name="Cancel">1</property>
<property name="ContextHelp">0</property>
<property name="Help">0</property>
<property name="No">0</property>

View File

@ -43,6 +43,7 @@ class DIALOG_GLOBAL_LIB_TABLE_CONFIG_BASE : public DIALOG_SHIM
wxFilePickerCtrl* m_filePicker1;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, override them in your derived class
virtual void onUpdateDefaultSelection( wxUpdateUIEvent& event ) { event.Skip(); }
@ -51,7 +52,7 @@ class DIALOG_GLOBAL_LIB_TABLE_CONFIG_BASE : public DIALOG_SHIM
public:
DIALOG_GLOBAL_LIB_TABLE_CONFIG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Configure Global Library Table"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCAPTION|wxRESIZE_BORDER );
DIALOG_GLOBAL_LIB_TABLE_CONFIG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Configure Global Library Table"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCAPTION|wxCLOSE_BOX|wxRESIZE_BORDER );
~DIALOG_GLOBAL_LIB_TABLE_CONFIG_BASE();

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2014-2021 KiCad Developers, see AUTHORS.TXT for contributors.
* Copyright (C) 2014-2023 KiCad Developers, see AUTHORS.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -296,6 +296,12 @@ KIFACE* KIWAY::KiFACE( FACE_T aFaceId, bool doLoad )
return m_kiface[aFaceId] = kiface;
}
else
{
// Usually means cancelled initial global library setup
return nullptr;
}
}
// In any of the failure cases above, dso.Unload() should be called here
@ -417,6 +423,9 @@ KIWAY_PLAYER* KIWAY::Player( FRAME_T aFrameType, bool doCreate, wxTopLevelWindow
FACE_T face_type = KifaceType( aFrameType );
KIFACE* kiface = KiFACE( face_type );
if( !kiface )
return nullptr;
frame = (KIWAY_PLAYER*) kiface->CreateKiWindow(
aParent, // Parent window of frame in modal mode,
// NULL in non modal mode

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2004-2020 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2004-2023 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -363,9 +363,10 @@ bool IFACE::loadGlobalLibTable()
{
if( !( m_start_flags & KFCTL_CLI ) )
{
DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG fpDialog( nullptr );
DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG symDialog( nullptr );
fpDialog.ShowModal();
if( symDialog.ShowModal() != wxID_OK )
return false;
}
}
else

View File

@ -760,7 +760,7 @@ int KICAD_MANAGER_CONTROL::ShowPlayer( const TOOL_EVENT& aEvent )
if ( !player )
{
wxLogError( _( "Application failed to load." ) );
wxLogError( _( "Application cannot start." ) );
return -1;
}

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -376,7 +376,8 @@ bool IFACE::loadGlobalLibTable()
{
DIALOG_GLOBAL_FP_LIB_TABLE_CONFIG fpDialog( nullptr );
fpDialog.ShowModal();
if( fpDialog.ShowModal() != wxID_OK )
return false;
}
}
else