Commit c8ed3280 authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Pcbnew: Fix many minor issues in print dialog, mainly in modedit.

parent 742e1a7e
Loading
Loading
Loading
Loading
+3 −21
Original line number Original line Diff line number Diff line
@@ -151,30 +151,12 @@ void DIALOG_PRINT_USING_PRINTER::OnInitDialog( wxInitDialogEvent& event )
    if ( GetSizer() )
    if ( GetSizer() )
        GetSizer()->SetSizeHints( this );
        GetSizer()->SetSizeHints( this );


#if 0
    // Rely on the policy in class DIALOG_SHIM, which centers the dialog
    Does not work on a two monitor system when the 2nd monitor is not attached,
    // initially during a runtime session but gives user the ability to move it in
    and when the coords were saved to disk when the playground was bigger while the
    // that session.
    2nd monitor was attached.

    Simply rely on the policy in class DIALOG_SHIM, which centers the dialog
    initially during a runtime session but gives user the ability to move it in
    that session.

    if( parent->GetPrintDialogPosition() == wxDefaultPosition &&
        parent->GetPrintDialogSize() == wxDefaultSize )
    {
        Center();
    }
    else
    {
        SetPosition( parent->GetPrintDialogPosition() );
        SetSize( parent->GetPrintDialogSize() );
    }
#else
    // This dialog may get moved and resized in Show(), but in case this is
    // This dialog may get moved and resized in Show(), but in case this is
    // the first time, center it for starters.
    // the first time, center it for starters.
    Center();
    Center();
#endif


    m_buttonPrint->SetDefault();    // on linux, this is inadequate to determine
    m_buttonPrint->SetDefault();    // on linux, this is inadequate to determine
                                    // what ENTER does.  Must also SetFocus().
                                    // what ENTER does.  Must also SetFocus().
+18 −25
Original line number Original line Diff line number Diff line
@@ -3,7 +3,7 @@




// Set this to 1 if you want to test PostScript printing under MSW.
// Set this to 1 if you want to test PostScript printing under MSW.
#define wxTEST_POSTSCRIPT_IN_MSW 1
//#define wxTEST_POSTSCRIPT_IN_MSW 1


#include <fctsys.h>
#include <fctsys.h>
#include <appl_wxstruct.h>
#include <appl_wxstruct.h>
@@ -43,7 +43,7 @@ private:
    void OnCloseWindow( wxCloseEvent& event );
    void OnCloseWindow( wxCloseEvent& event );


    /// Open a dialog box for printer setup (printer options, page size ...)
    /// Open a dialog box for printer setup (printer options, page size ...)
    void OnPrintSetup( wxCommandEvent& event );
    void OnPageSetup( wxCommandEvent& event );


    void OnPrintPreview( wxCommandEvent& event );
    void OnPrintPreview( wxCommandEvent& event );


@@ -57,6 +57,8 @@ private:


void FOOTPRINT_EDIT_FRAME::ToPrinter( wxCommandEvent& event )
void FOOTPRINT_EDIT_FRAME::ToPrinter( wxCommandEvent& event )
{
{
    const PAGE_INFO& pageInfo = GetPageSettings();

    if( s_PrintData == NULL )  // First print
    if( s_PrintData == NULL )  // First print
    {
    {
        s_PrintData = new wxPrintData();
        s_PrintData = new wxPrintData();
@@ -68,7 +70,15 @@ void FOOTPRINT_EDIT_FRAME::ToPrinter( wxCommandEvent& event )
        s_PrintData->SetQuality( wxPRINT_QUALITY_HIGH );      // Default resolution = HIGHT;
        s_PrintData->SetQuality( wxPRINT_QUALITY_HIGH );      // Default resolution = HIGHT;
    }
    }


    s_PrintData->SetOrientation( GetPageSettings().IsPortrait() ? wxPORTRAIT : wxLANDSCAPE );
    if( s_pageSetupData == NULL )
        s_pageSetupData = new wxPageSetupDialogData( *s_PrintData );

    s_pageSetupData->SetPaperId( pageInfo.GetPaperId() );
    s_pageSetupData->GetPrintData().SetOrientation( pageInfo.GetWxOrientation() );
    s_PrintData->SetOrientation( pageInfo.GetWxOrientation() );

    *s_PrintData = s_pageSetupData->GetPrintData();
    s_Parameters.m_PageSetupData = s_pageSetupData;


    DIALOG_PRINT_FOR_MODEDIT dlg( this );
    DIALOG_PRINT_FOR_MODEDIT dlg( this );


@@ -91,17 +101,6 @@ DIALOG_PRINT_FOR_MODEDIT::DIALOG_PRINT_FOR_MODEDIT( PCB_BASE_FRAME* parent ) :


void DIALOG_PRINT_FOR_MODEDIT::InitValues( )
void DIALOG_PRINT_FOR_MODEDIT::InitValues( )
{
{
    if( s_pageSetupData == NULL )
    {
        s_pageSetupData = new wxPageSetupDialogData;
        // Set initial page margins.
        // Margins are already set in Pcbnew, so we cans use 0
        s_pageSetupData->SetMarginTopLeft(wxPoint(0, 0));
        s_pageSetupData->SetMarginBottomRight(wxPoint(0, 0));
    }

    s_Parameters.m_PageSetupData = s_pageSetupData;

    // Read the scale adjust option
    // Read the scale adjust option
    int scale_Select = 3; // default selected scale = ScaleList[3] = 1
    int scale_Select = 3; // default selected scale = ScaleList[3] = 1
    if( m_config )
    if( m_config )
@@ -130,19 +129,13 @@ void DIALOG_PRINT_FOR_MODEDIT::OnCloseWindow( wxCloseEvent& event )
}
}





void DIALOG_PRINT_FOR_MODEDIT::OnPageSetup( wxCommandEvent& event )
void DIALOG_PRINT_FOR_MODEDIT::OnPrintSetup( wxCommandEvent& event )
{
{
    wxPrintDialogData printDialogData( *s_PrintData );
    wxPageSetupDialog pageSetupDialog( this, s_pageSetupData );
    pageSetupDialog.ShowModal();


    if( printDialogData.Ok() )
    (*s_PrintData) = pageSetupDialog.GetPageSetupDialogData().GetPrintData();
    {
    (*s_pageSetupData) = pageSetupDialog.GetPageSetupDialogData();
        wxPrintDialog printerDialog( this, &printDialogData );
        printerDialog.ShowModal();
        *s_PrintData = printerDialog.GetPrintDialogData().GetPrintData();
    }
    else
        DisplayError( this, _( "Printer Problem!" ) );
}
}




+87 −87
Original line number Original line Diff line number Diff line
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 19 2012)
// C++ code generated with wxFormBuilder (version Oct  8 2012)
// http://www.wxformbuilder.org/
// http://www.wxformbuilder.org/
//
//
// PLEASE DO "NOT" EDIT THIS FILE!
// PLEASE DO "NOT" EDIT THIS FILE!
@@ -69,7 +69,7 @@ DIALOG_PRINT_FOR_MODEDIT_BASE::DIALOG_PRINT_FOR_MODEDIT_BASE( wxWindow* parent,
	
	
	// Connect Events
	// Connect Events
	this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnCloseWindow ) );
	this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnCloseWindow ) );
	m_buttonOption->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnPrintSetup ), NULL, this );
	m_buttonOption->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnPageSetup ), NULL, this );
	m_buttonPreview->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnPrintPreview ), NULL, this );
	m_buttonPreview->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnPrintPreview ), NULL, this );
	m_buttonPrint->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnPrintButtonClick ), NULL, this );
	m_buttonPrint->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnPrintButtonClick ), NULL, this );
	m_buttonQuit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnButtonCancelClick ), NULL, this );
	m_buttonQuit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnButtonCancelClick ), NULL, this );
@@ -79,7 +79,7 @@ DIALOG_PRINT_FOR_MODEDIT_BASE::~DIALOG_PRINT_FOR_MODEDIT_BASE()
{
{
	// Disconnect Events
	// Disconnect Events
	this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnCloseWindow ) );
	this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnCloseWindow ) );
	m_buttonOption->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnPrintSetup ), NULL, this );
	m_buttonOption->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnPageSetup ), NULL, this );
	m_buttonPreview->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnPrintPreview ), NULL, this );
	m_buttonPreview->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnPrintPreview ), NULL, this );
	m_buttonPrint->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnPrintButtonClick ), NULL, this );
	m_buttonPrint->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnPrintButtonClick ), NULL, this );
	m_buttonQuit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnButtonCancelClick ), NULL, this );
	m_buttonQuit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnButtonCancelClick ), NULL, this );
+1 −1
Original line number Original line Diff line number Diff line
@@ -364,7 +364,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">OnPrintSetup</event>
                                <event name="OnButtonClick">OnPageSetup</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>
+66 −64
Original line number Original line Diff line number Diff line
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 19 2012)
// C++ code generated with wxFormBuilder (version Oct  8 2012)
// http://www.wxformbuilder.org/
// http://www.wxformbuilder.org/
//
//
// PLEASE DO "NOT" EDIT THIS FILE!
// PLEASE DO "NOT" EDIT THIS FILE!
@@ -11,6 +11,8 @@
#include <wx/artprov.h>
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/intl.h>
class DIALOG_SHIM;

#include "dialog_shim.h"
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/string.h>
#include <wx/radiobox.h>
#include <wx/radiobox.h>
@@ -48,7 +50,7 @@ class DIALOG_PRINT_FOR_MODEDIT_BASE : public DIALOG_SHIM
		
		
		// Virtual event handlers, overide them in your derived class
		// Virtual event handlers, overide them in your derived class
		virtual void OnCloseWindow( wxCloseEvent& event ) { event.Skip(); }
		virtual void OnCloseWindow( wxCloseEvent& event ) { event.Skip(); }
		virtual void OnPrintSetup( 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 OnButtonCancelClick( wxCommandEvent& event ) { event.Skip(); }
Loading