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,11 +624,12 @@ 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 "
|
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 "
|
"are names that have been defined externally at the system or user "
|
||||||
|
@ -644,7 +641,7 @@ void DIALOG_CONFIGURE_PATHS::OnHelp( wxCommandEvent& event )
|
||||||
"will only accept upper case letters, digits, and the underscore characters." );
|
"will only accept upper case letters, digits, and the underscore characters." );
|
||||||
msg << "</b>";
|
msg << "</b>";
|
||||||
|
|
||||||
for( const auto& var : ENV_VAR::GetPredefinedEnvVars() )
|
for( const wxString& var : ENV_VAR::GetPredefinedEnvVars() )
|
||||||
{
|
{
|
||||||
msg << "<br><br><b>" << var << "</b>";
|
msg << "<br><br><b>" << var << "</b>";
|
||||||
|
|
||||||
|
@ -655,11 +652,27 @@ void DIALOG_CONFIGURE_PATHS::OnHelp( wxCommandEvent& event )
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_helpDialog = new HTML_MESSAGE_BOX( nullptr, _( "Environment Variable Help" ) );
|
m_helpBox->SetPage( msg );
|
||||||
m_helpDialog->SetDialogSizeInDU( 400, 250 );
|
m_helpBox->Show( false );
|
||||||
|
|
||||||
m_helpDialog->AddHTML_Text( msg );
|
sizerMain->Insert( sizerMain->GetItemCount() - 1, m_helpBox, 1, wxALL|wxEXPAND, 10 );
|
||||||
m_helpDialog->ShowModeless();
|
}
|
||||||
|
|
||||||
// m_helpDialog will be destroyed when closing the dialog
|
if( m_helpBox->IsShown() )
|
||||||
|
{
|
||||||
|
m_helpBox->Show( false );
|
||||||
|
SetClientSize( wxSize( GetClientSize().x, m_heightBeforeHelp ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_helpBox->Show( true );
|
||||||
|
m_heightBeforeHelp = GetClientSize().y;
|
||||||
|
|
||||||
|
int minHelpBoxHeight = GetTextExtent( wxT( "T" ) ).y * 20;
|
||||||
|
|
||||||
|
if( GetClientSize().y < minHelpBoxHeight * 2 )
|
||||||
|
SetClientSize( wxSize( GetClientSize().x, GetClientSize().y + minHelpBoxHeight ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
Layout();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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