Move Configure Paths help inside dialog.
This allows us to switch back to a standard modal dialog (instead of quasi-modal, which has problems with Ctrl-V in a search box inside a standard file dialog -- such as when picking a path). Fixes https://gitlab.com/kicad/code/kicad/issues/9473
This commit is contained in:
parent
5c9aed62aa
commit
51b905ba32
|
@ -62,7 +62,8 @@ DIALOG_CONFIGURE_PATHS::DIALOG_CONFIGURE_PATHS( wxWindow* aParent, FILENAME_RESO
|
||||||
m_resolver( aResolver ),
|
m_resolver( aResolver ),
|
||||||
m_gridWidth( 0 ),
|
m_gridWidth( 0 ),
|
||||||
m_gridWidthsDirty( true ),
|
m_gridWidthsDirty( true ),
|
||||||
m_helpDialog( nullptr )
|
m_helpBox( nullptr ),
|
||||||
|
m_heightBeforeHelp( 400 )
|
||||||
{
|
{
|
||||||
m_btnAddEnvVar->SetBitmap( KiBitmap( BITMAPS::small_plus ) );
|
m_btnAddEnvVar->SetBitmap( KiBitmap( BITMAPS::small_plus ) );
|
||||||
m_btnDeleteEnvVar->SetBitmap( KiBitmap( BITMAPS::small_trash ) );
|
m_btnDeleteEnvVar->SetBitmap( KiBitmap( BITMAPS::small_trash ) );
|
||||||
|
@ -128,9 +129,6 @@ DIALOG_CONFIGURE_PATHS::~DIALOG_CONFIGURE_PATHS()
|
||||||
m_SearchPaths->PopEventHandler( true );
|
m_SearchPaths->PopEventHandler( true );
|
||||||
m_EnvVars->PopEventHandler( true );
|
m_EnvVars->PopEventHandler( true );
|
||||||
|
|
||||||
if( m_helpDialog )
|
|
||||||
m_helpDialog->Destroy();
|
|
||||||
|
|
||||||
m_EnvVars->Disconnect( wxEVT_GRID_CELL_CHANGING,
|
m_EnvVars->Disconnect( wxEVT_GRID_CELL_CHANGING,
|
||||||
wxGridEventHandler( DIALOG_CONFIGURE_PATHS::OnGridCellChanging ),
|
wxGridEventHandler( DIALOG_CONFIGURE_PATHS::OnGridCellChanging ),
|
||||||
nullptr, this );
|
nullptr, this );
|
||||||
|
@ -594,14 +592,12 @@ void DIALOG_CONFIGURE_PATHS::OnUpdateUI( wxUpdateUIEvent& event )
|
||||||
m_gridWidthsDirty = false;
|
m_gridWidthsDirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle a grid error. This is delayed to OnUpdateUI so that we can change focus
|
// Handle a grid error. This is delayed to OnUpdateUI so that we can change focus even when
|
||||||
// even when the original validation was triggered from a killFocus event (and for
|
// the original validation was triggered from a killFocus event.
|
||||||
// dialog with notebooks, so that the corresponding notebook page can be shown in
|
|
||||||
// the background when triggered from an OK).
|
|
||||||
if( m_errorGrid )
|
if( m_errorGrid )
|
||||||
{
|
{
|
||||||
// We will re-enter this routine when the error dialog is displayed, so make
|
// We will re-enter this routine when the error dialog is displayed, so make sure we don't
|
||||||
// sure we don't keep putting up more dialogs.
|
// keep putting up more dialogs.
|
||||||
wxGrid* grid = m_errorGrid;
|
wxGrid* grid = m_errorGrid;
|
||||||
m_errorGrid = nullptr;
|
m_errorGrid = nullptr;
|
||||||
|
|
||||||
|
@ -628,38 +624,55 @@ void DIALOG_CONFIGURE_PATHS::OnGridSize( wxSizeEvent& event )
|
||||||
|
|
||||||
void DIALOG_CONFIGURE_PATHS::OnHelp( wxCommandEvent& event )
|
void DIALOG_CONFIGURE_PATHS::OnHelp( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
if( m_helpDialog )
|
wxSizer* sizerMain = GetSizer();
|
||||||
|
|
||||||
|
if( !m_helpBox )
|
||||||
{
|
{
|
||||||
m_helpDialog->ShowModeless();
|
m_helpBox = new HTML_WINDOW( this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
|
||||||
return;
|
wxHW_SCROLLBAR_AUTO );
|
||||||
|
|
||||||
|
wxString msg = _( "Enter the name and value for each environment variable. Grey entries "
|
||||||
|
"are names that have been defined externally at the system or user "
|
||||||
|
"level. Environment variables defined at the system or user level "
|
||||||
|
"take precedence over the ones defined in this table. This means the "
|
||||||
|
"values in this table are ignored." );
|
||||||
|
msg << "<br><br><b>";
|
||||||
|
msg << _( "To ensure environment variable names are valid on all platforms, the name field "
|
||||||
|
"will only accept upper case letters, digits, and the underscore characters." );
|
||||||
|
msg << "</b>";
|
||||||
|
|
||||||
|
for( const wxString& var : ENV_VAR::GetPredefinedEnvVars() )
|
||||||
|
{
|
||||||
|
msg << "<br><br><b>" << var << "</b>";
|
||||||
|
|
||||||
|
const auto desc = ENV_VAR::LookUpEnvVarHelp( var );
|
||||||
|
|
||||||
|
if( desc.size() > 0 )
|
||||||
|
msg << ": " << desc;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
m_helpBox->SetPage( msg );
|
||||||
|
m_helpBox->Show( false );
|
||||||
|
|
||||||
|
sizerMain->Insert( sizerMain->GetItemCount() - 1, m_helpBox, 1, wxALL|wxEXPAND, 10 );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString msg = _( "Enter the name and value for each environment variable. Grey entries "
|
if( m_helpBox->IsShown() )
|
||||||
"are names that have been defined externally at the system or user "
|
|
||||||
"level. Environment variables defined at the system or user level "
|
|
||||||
"take precedence over the ones defined in this table. This means the "
|
|
||||||
"values in this table are ignored." );
|
|
||||||
msg << "<br><br><b>";
|
|
||||||
msg << _( "To ensure environment variable names are valid on all platforms, the name field "
|
|
||||||
"will only accept upper case letters, digits, and the underscore characters." );
|
|
||||||
msg << "</b>";
|
|
||||||
|
|
||||||
for( const auto& var : ENV_VAR::GetPredefinedEnvVars() )
|
|
||||||
{
|
{
|
||||||
msg << "<br><br><b>" << var << "</b>";
|
m_helpBox->Show( false );
|
||||||
|
SetClientSize( wxSize( GetClientSize().x, m_heightBeforeHelp ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_helpBox->Show( true );
|
||||||
|
m_heightBeforeHelp = GetClientSize().y;
|
||||||
|
|
||||||
const auto desc = ENV_VAR::LookUpEnvVarHelp( var );
|
int minHelpBoxHeight = GetTextExtent( wxT( "T" ) ).y * 20;
|
||||||
|
|
||||||
if( desc.size() > 0 )
|
|
||||||
msg << ": " << desc;
|
|
||||||
|
|
||||||
|
if( GetClientSize().y < minHelpBoxHeight * 2 )
|
||||||
|
SetClientSize( wxSize( GetClientSize().x, GetClientSize().y + minHelpBoxHeight ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_helpDialog = new HTML_MESSAGE_BOX( nullptr, _( "Environment Variable Help" ) );
|
Layout();
|
||||||
m_helpDialog->SetDialogSizeInDU( 400, 250 );
|
|
||||||
|
|
||||||
m_helpDialog->AddHTML_Text( msg );
|
|
||||||
m_helpDialog->ShowModeless();
|
|
||||||
|
|
||||||
// m_helpDialog will be destroyed when closing the dialog
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,8 +113,7 @@ int COMMON_CONTROL::ConfigurePaths( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
DIALOG_CONFIGURE_PATHS dlg( m_frame, nullptr );
|
DIALOG_CONFIGURE_PATHS dlg( m_frame, nullptr );
|
||||||
|
|
||||||
// Use QuasiModal so that HTML help window will work
|
if( dlg.ShowModal() == wxID_OK )
|
||||||
if( dlg.ShowQuasiModal() == wxID_OK )
|
|
||||||
m_frame->Kiway().CommonSettingsChanged( true, false );
|
m_frame->Kiway().CommonSettingsChanged( true, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
|
|
||||||
class FILENAME_RESOLVER;
|
class FILENAME_RESOLVER;
|
||||||
class HTML_MESSAGE_BOX;
|
class HTML_WINDOW;
|
||||||
|
|
||||||
|
|
||||||
class DIALOG_CONFIGURE_PATHS: public DIALOG_CONFIGURE_PATHS_BASE
|
class DIALOG_CONFIGURE_PATHS: public DIALOG_CONFIGURE_PATHS_BASE
|
||||||
|
@ -74,7 +74,8 @@ private:
|
||||||
int m_gridWidth;
|
int m_gridWidth;
|
||||||
bool m_gridWidthsDirty;
|
bool m_gridWidthsDirty;
|
||||||
|
|
||||||
HTML_MESSAGE_BOX* m_helpDialog;
|
HTML_WINDOW* m_helpBox;
|
||||||
|
int m_heightBeforeHelp;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _DIALOG_CONFIGURE_PATHS_H_
|
#endif // _DIALOG_CONFIGURE_PATHS_H_
|
||||||
|
|
Loading…
Reference in New Issue