Gerbview: fiw a few issues in print dialog

This commit is contained in:
jean-pierre charras 2016-05-26 20:13:53 +02:00
parent 3c0859686b
commit 25c808b859
4 changed files with 44 additions and 27 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2010-2016 Jean-Pierre Charras jp.charras at wanadoo.fr * Copyright (C) 2010-2016 Jean-Pierre Charras jp.charras at wanadoo.fr
* Copyright (C) 1992-2016 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -74,7 +74,7 @@ private:
void OnPrintButtonClick( wxCommandEvent& event ); void OnPrintButtonClick( wxCommandEvent& event );
void OnScaleSelectionClick( wxCommandEvent& event ); void OnScaleSelectionClick( wxCommandEvent& event );
void OnButtonCancelClick( wxCommandEvent& event ) { Close(); } void OnButtonCloseClick( wxCommandEvent& event ) { Close(); }
void SetPrintParameters(); void SetPrintParameters();
void InitValues(); void InitValues();
@ -260,7 +260,7 @@ void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event )
} }
} }
event.Skip(); EndModal( 0 );
} }
@ -279,21 +279,36 @@ void DIALOG_PRINT_USING_PRINTER::SetPrintParameters()
int idx = m_ScaleOption->GetSelection(); int idx = m_ScaleOption->GetSelection();
s_Parameters.m_PrintScale = s_ScaleList[idx]; s_Parameters.m_PrintScale = s_ScaleList[idx];
if( m_FineAdjustXscaleOpt ) // Test for a reasonnable scale value
bool ok = true;
double scaleX;
m_FineAdjustXscaleOpt->GetValue().ToDouble( &scaleX );
double scaleY;
m_FineAdjustYscaleOpt->GetValue().ToDouble( &scaleY );
if( scaleX > MAX_SCALE || scaleY > MAX_SCALE )
{ {
if( s_Parameters.m_XScaleAdjust > MAX_SCALE || DisplayInfoMessage( NULL, _( "Warning: Scale option set to a very large value" ) );
s_Parameters.m_YScaleAdjust > MAX_SCALE ) ok = false;
DisplayInfoMessage( NULL, _( "Warning: Scale option set to a very large value" ) );
m_FineAdjustXscaleOpt->GetValue().ToDouble( &s_Parameters.m_XScaleAdjust );
} }
if( m_FineAdjustYscaleOpt ) if( scaleX < MIN_SCALE || scaleY < MIN_SCALE )
{ {
// Test for a reasonnable scale value DisplayInfoMessage( NULL, _( "Warning: Scale option set to a very small value" ) );
if( s_Parameters.m_XScaleAdjust < MIN_SCALE || ok = false;
s_Parameters.m_YScaleAdjust < MIN_SCALE ) }
DisplayInfoMessage( NULL, _( "Warning: Scale option set to a very small value" ) );
m_FineAdjustYscaleOpt->GetValue().ToDouble( &s_Parameters.m_YScaleAdjust ); if( ok )
{
s_Parameters.m_XScaleAdjust = scaleX;
s_Parameters.m_YScaleAdjust = scaleY;
}
else
{
// Update actual fine scale value
m_FineAdjustXscaleOpt->SetValue( wxString::Format( "%f", s_Parameters.m_XScaleAdjust ) );
m_FineAdjustYscaleOpt->SetValue( wxString::Format( "%f", s_Parameters.m_YScaleAdjust ) );
} }
} }

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 9 2015) // C++ code generated with wxFormBuilder (version May 21 2016)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
@ -22,12 +22,12 @@ DIALOG_PRINT_USING_PRINTER_BASE::DIALOG_PRINT_USING_PRINTER_BASE( wxWindow* pare
wxBoxSizer* bleftSizer; wxBoxSizer* bleftSizer;
bleftSizer = new wxBoxSizer( wxHORIZONTAL ); bleftSizer = new wxBoxSizer( wxHORIZONTAL );
m_leftLayersBoxSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Layers:") ), wxVERTICAL ); m_leftLayersBoxSizer = new wxStaticBoxSizer( new wxStaticBox( sbLayersSizer->GetStaticBox(), wxID_ANY, _("Graphic layers:") ), wxVERTICAL );
bleftSizer->Add( m_leftLayersBoxSizer, 1, wxALL, 5 ); bleftSizer->Add( m_leftLayersBoxSizer, 1, wxALL, 5 );
m_rightLayersBoxSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Layers:") ), wxVERTICAL ); m_rightLayersBoxSizer = new wxStaticBoxSizer( new wxStaticBox( sbLayersSizer->GetStaticBox(), wxID_ANY, _("Graphic layers:") ), wxVERTICAL );
bleftSizer->Add( m_rightLayersBoxSizer, 1, wxALL, 5 ); bleftSizer->Add( m_rightLayersBoxSizer, 1, wxALL, 5 );
@ -52,7 +52,6 @@ DIALOG_PRINT_USING_PRINTER_BASE::DIALOG_PRINT_USING_PRINTER_BASE( wxWindow* pare
bmiddleLeftSizer->Add( m_FineAdjustXscaleTitle, 0, wxRIGHT|wxLEFT, 5 ); bmiddleLeftSizer->Add( m_FineAdjustXscaleTitle, 0, wxRIGHT|wxLEFT, 5 );
m_FineAdjustXscaleOpt = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_FineAdjustXscaleOpt = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_FineAdjustXscaleOpt->SetMaxLength( 0 );
m_FineAdjustXscaleOpt->SetToolTip( _("Set X scale adjust for exact scale plotting") ); m_FineAdjustXscaleOpt->SetToolTip( _("Set X scale adjust for exact scale plotting") );
bmiddleLeftSizer->Add( m_FineAdjustXscaleOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); bmiddleLeftSizer->Add( m_FineAdjustXscaleOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
@ -62,7 +61,6 @@ DIALOG_PRINT_USING_PRINTER_BASE::DIALOG_PRINT_USING_PRINTER_BASE( wxWindow* pare
bmiddleLeftSizer->Add( m_FineAdjustYscaleTitle, 0, wxRIGHT|wxLEFT, 5 ); bmiddleLeftSizer->Add( m_FineAdjustYscaleTitle, 0, wxRIGHT|wxLEFT, 5 );
m_FineAdjustYscaleOpt = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_FineAdjustYscaleOpt = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_FineAdjustYscaleOpt->SetMaxLength( 0 );
m_FineAdjustYscaleOpt->SetToolTip( _("Set Y scale adjust for exact scale plotting") ); m_FineAdjustYscaleOpt->SetToolTip( _("Set Y scale adjust for exact scale plotting") );
bmiddleLeftSizer->Add( m_FineAdjustYscaleOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); bmiddleLeftSizer->Add( m_FineAdjustYscaleOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
@ -76,7 +74,7 @@ DIALOG_PRINT_USING_PRINTER_BASE::DIALOG_PRINT_USING_PRINTER_BASE( wxWindow* pare
wxStaticBoxSizer* sbOptionsSizer; wxStaticBoxSizer* sbOptionsSizer;
sbOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options:") ), wxVERTICAL ); sbOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options:") ), wxVERTICAL );
m_Print_Mirror = new wxCheckBox( this, wxID_ANY, _("Mirror"), wxDefaultPosition, wxDefaultSize, 0 ); m_Print_Mirror = new wxCheckBox( sbOptionsSizer->GetStaticBox(), wxID_ANY, _("Mirror"), wxDefaultPosition, wxDefaultSize, 0 );
sbOptionsSizer->Add( m_Print_Mirror, 0, wxALL, 5 ); sbOptionsSizer->Add( m_Print_Mirror, 0, wxALL, 5 );
@ -122,7 +120,7 @@ DIALOG_PRINT_USING_PRINTER_BASE::DIALOG_PRINT_USING_PRINTER_BASE( wxWindow* pare
m_buttonOption->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPageSetup ), NULL, this ); m_buttonOption->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPageSetup ), NULL, this );
m_buttonPreview->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPrintPreview ), NULL, this ); m_buttonPreview->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPrintPreview ), NULL, this );
m_buttonPrint->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPrintButtonClick ), NULL, this ); m_buttonPrint->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPrintButtonClick ), NULL, this );
m_buttonQuit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnButtonCancelClick ), NULL, this ); m_buttonQuit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnButtonCloseClick ), NULL, this );
} }
DIALOG_PRINT_USING_PRINTER_BASE::~DIALOG_PRINT_USING_PRINTER_BASE() DIALOG_PRINT_USING_PRINTER_BASE::~DIALOG_PRINT_USING_PRINTER_BASE()
@ -133,6 +131,6 @@ DIALOG_PRINT_USING_PRINTER_BASE::~DIALOG_PRINT_USING_PRINTER_BASE()
m_buttonOption->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPageSetup ), NULL, this ); m_buttonOption->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPageSetup ), NULL, this );
m_buttonPreview->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPrintPreview ), NULL, this ); m_buttonPreview->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPrintPreview ), NULL, this );
m_buttonPrint->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPrintButtonClick ), NULL, this ); m_buttonPrint->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPrintButtonClick ), NULL, this );
m_buttonQuit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnButtonCancelClick ), NULL, this ); m_buttonQuit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnButtonCloseClick ), NULL, this );
} }

View File

@ -103,6 +103,7 @@
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">sbLayersSizer</property> <property name="name">sbLayersSizer</property>
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property> <property name="permission">none</property>
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
@ -120,10 +121,11 @@
<property name="proportion">1</property> <property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="1"> <object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Layers:</property> <property name="label">Graphic layers:</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_leftLayersBoxSizer</property> <property name="name">m_leftLayersBoxSizer</property>
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">protected</property> <property name="permission">protected</property>
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
</object> </object>
@ -134,10 +136,11 @@
<property name="proportion">1</property> <property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="1"> <object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Layers:</property> <property name="label">Graphic layers:</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_rightLayersBoxSizer</property> <property name="name">m_rightLayersBoxSizer</property>
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">protected</property> <property name="permission">protected</property>
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
</object> </object>
@ -614,6 +617,7 @@
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">sbOptionsSizer</property> <property name="name">sbOptionsSizer</property>
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property> <property name="permission">none</property>
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
@ -1133,7 +1137,7 @@
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
<event name="OnButtonClick">OnButtonCancelClick</event> <event name="OnButtonClick">OnButtonCloseClick</event>
<event name="OnChar"></event> <event name="OnChar"></event>
<event name="OnEnterWindow"></event> <event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event> <event name="OnEraseBackground"></event>

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 9 2015) // C++ code generated with wxFormBuilder (version May 21 2016)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
@ -65,7 +65,7 @@ class DIALOG_PRINT_USING_PRINTER_BASE : public DIALOG_SHIM
virtual void OnPageSetup( wxCommandEvent& event ) { event.Skip(); } virtual void OnPageSetup( wxCommandEvent& event ) { event.Skip(); }
virtual void OnPrintPreview( wxCommandEvent& event ) { event.Skip(); } virtual void OnPrintPreview( wxCommandEvent& event ) { event.Skip(); }
virtual void OnPrintButtonClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnPrintButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnButtonCancelClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnButtonCloseClick( wxCommandEvent& event ) { event.Skip(); }
public: public: