Add size control to HTML_MESSAGE_BOX. Fix incorrect default size of a few dialogs.

Clean code: remove useless code and not used parameters.
This commit is contained in:
jean-pierre charras 2018-01-11 09:08:55 +01:00
parent 7e6a6540c8
commit 47dfabc6c8
10 changed files with 40 additions and 36 deletions

View File

@ -119,16 +119,6 @@ void DisplayInfoMessage( wxWindow* aParent, const wxString& aMessage, const wxSt
}
void DisplayHtmlInfoMessage( wxWindow* parent, const wxString& title,
const wxString& text, const wxSize& size )
{
HTML_MESSAGE_BOX dlg( parent, title, wxDefaultPosition, size );
dlg.AddHTML_Text( text );
dlg.ShowModal();
}
bool IsOK( wxWindow* aParent, const wxString& aMessage )
{
wxMessageDialog dlg( aParent, aMessage, _( "Confirmation" ),

View File

@ -571,8 +571,8 @@ void DIALOG_ABOUT::onShowVersionInfo( wxCommandEvent& event )
wxString msg_version;
buildVersionInfoData( msg_version, true );
HTML_MESSAGE_BOX dlg( this, _( "Version Info" ), wxDefaultPosition,
wxSize( 550, 500 ) );
HTML_MESSAGE_BOX dlg( this, _( "Version Info" ));
dlg.SetDialogSizeInDU( 400, 350 );
dlg.AddHTML_Text( msg_version );
dlg.ShowModal();

View File

@ -311,7 +311,11 @@ void DIALOG_ENV_VAR_CONFIG::OnHelpButton( wxCommandEvent& event )
msg << _( "<b>KICAD_PTEMPLATES</b> is optional and can be defined if you want to "
"create your own project templates folder." );
DisplayHtmlInfoMessage( GetParent(), _( "Environment Variable Help" ), msg );
HTML_MESSAGE_BOX dlg( GetParent(), _( "Environment Variable Help" ) );
dlg.SetDialogSizeInDU( 400, 350 );
dlg.AddHTML_Text( msg );
dlg.ShowModal();
}
@ -473,5 +477,9 @@ void DIALOG_ENV_VAR_SINGLE::onHelpClick( wxCommandEvent& event )
"cannot start with a digit (0-9)."
);
DisplayHtmlInfoMessage( GetParent(), _( "Environment Variable Help" ), msg );
HTML_MESSAGE_BOX dlg( GetParent(), _( "Environment Variable Help" ) );
dlg.SetDialogSizeInDU( 400, 350 );
dlg.AddHTML_Text( msg );
dlg.ShowModal();
}

View File

@ -49,7 +49,7 @@ HOTKEYS_EDITOR_DIALOG::HOTKEYS_EDITOR_DIALOG( EDA_BASE_FRAME* aParent,
m_sdbSizerOK->SetDefault();
Layout();
SetSizeInDU( 240, 120 );
SetSizeInDU( 350, 300 );
Center();
}

View File

@ -482,8 +482,9 @@ void DisplayHotkeyList( EDA_BASE_FRAME* aFrame, struct EDA_HOTKEY_CONFIG* aDescL
// Create a non modal dialog, which shows the list of hotkeys until dismissed
// but does not block the parent window
HTML_MESSAGE_BOX *dlg = new HTML_MESSAGE_BOX( aFrame, _( "Hotkeys List" ),
wxDefaultPosition, wxSize( 340, 750 ) );
HTML_MESSAGE_BOX *dlg = new HTML_MESSAGE_BOX( aFrame, _( "Hotkeys List" ) );
dlg->SetDialogSizeInDU( 300, 250 );
dlg->AddHTML_Text( msg );
dlg->Show( true );
}

View File

@ -28,13 +28,15 @@
#include <common.h>
HTML_MESSAGE_BOX::HTML_MESSAGE_BOX( wxWindow* parent, const wxString& aTitle,
wxPoint aPos, wxSize aSize) :
DIALOG_DISPLAY_HTML_TEXT_BASE( parent, wxID_ANY, aTitle, aPos, aSize )
HTML_MESSAGE_BOX::HTML_MESSAGE_BOX( wxWindow* parent, const wxString& aTitle) :
DIALOG_DISPLAY_HTML_TEXT_BASE( parent, wxID_ANY, aTitle )
{
m_htmlWindow->SetLayoutDirection( wxLayout_LeftToRight );
ListClear();
SetSizeInDU( 240, 120 );
// Gives a default logical size (the actual size depends on the display definition)
SetSizeInDU( 240, 150 );
Center();
}

View File

@ -642,8 +642,8 @@ void DIALOG_BOM::OnEditPlugin( wxCommandEvent& event )
void DIALOG_BOM::OnHelp( wxCommandEvent& event )
{
HTML_MESSAGE_BOX help_Dlg( this, _("Bom Generation Help"),
wxDefaultPosition, wxSize( 750,550 ) );
HTML_MESSAGE_BOX help_Dlg( this, _("Bom Generation Help") );
help_Dlg.SetDialogSizeInDU( 500, 350 );
wxString msg = FROM_UTF8(s_bomHelpInfo);
help_Dlg.m_htmlWindow->AppendToPage( msg );

View File

@ -177,7 +177,7 @@ DIALOG_EDIT_COMPONENTS_LIBID::DIALOG_EDIT_COMPONENTS_LIBID( SCH_EDIT_FRAME* aPar
m_panelGrid->SetMinSize( wxSize( minwidth, -1) );
Layout();
SetSizeInDU( 360, 300 );
SetSizeInDU( 500, 400 );
Center();
}

View File

@ -113,14 +113,6 @@ int YesNoCancelDialog( wxWindow* aParent,
const wxString& aCancelButtonText = wxEmptyString );
/**
* Function DisplayHtmlInforMessage
* displays \a aMessage in HTML format.
*/
void DisplayHtmlInfoMessage( wxWindow* parent, const wxString& title,
const wxString& aMessage,
const wxSize& size = wxDefaultSize );
/**
* Displays a dialog with radioboxes asking the user to select an option.

View File

@ -47,9 +47,20 @@ public:
/**
* Constructor
*/
HTML_MESSAGE_BOX( wxWindow* parent, const wxString& aTitle,
wxPoint aPos = wxDefaultPosition,
wxSize aSize = wxSize( 450, 250 ) );
HTML_MESSAGE_BOX( wxWindow* parent, const wxString& aTitle );
/**
* set the dialog size, using a "logical value.
* the physical size in pixel will depend on the display definition
* so a value used here shoul be OK with any display (HDPI for instance)
* @param aWidth is a "logical" value of the dialog width.
* @param aHeight is a "logical" value of the dialog height.
*/
void SetDialogSizeInDU( int aWidth, int aHeight )
{
SetSizeInDU( aWidth, aHeight );
Center();
}
/**
* Function ListSet