Pcbnew: fix bug Bug #1101399 (Custom page size gets reset after restarting pcbnew) (bug also in eeschema)
Try to find a better fix for Bug #1100876
This commit is contained in:
parent
129f93b8d3
commit
81f9f743d3
|
@ -89,6 +89,7 @@ DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* parent ) :
|
||||||
m_modified = false;
|
m_modified = false;
|
||||||
m_page_bitmap = NULL;
|
m_page_bitmap = NULL;
|
||||||
m_tb = m_Parent->GetTitleBlock();
|
m_tb = m_Parent->GetTitleBlock();
|
||||||
|
m_customFmt = false;
|
||||||
|
|
||||||
initDialog();
|
initDialog();
|
||||||
|
|
||||||
|
@ -111,7 +112,7 @@ void DIALOG_PAGES_SETTINGS::initDialog()
|
||||||
double customSizeY;
|
double customSizeY;
|
||||||
|
|
||||||
// initalize page format choice box and page format list.
|
// initalize page format choice box and page format list.
|
||||||
// The first shows translated strings, the second contains not tralated strings
|
// The first shows translated strings, the second contains not translated strings
|
||||||
m_paperSizeComboBox->Clear();
|
m_paperSizeComboBox->Clear();
|
||||||
|
|
||||||
for( unsigned ii = 0; ; ii++ )
|
for( unsigned ii = 0; ; ii++ )
|
||||||
|
@ -146,11 +147,22 @@ void DIALOG_PAGES_SETTINGS::initDialog()
|
||||||
wxCommandEvent dummy;
|
wxCommandEvent dummy;
|
||||||
OnPaperSizeChoice( dummy );
|
OnPaperSizeChoice( dummy );
|
||||||
|
|
||||||
|
if( m_customFmt) // The custom value is defined by the page size
|
||||||
|
{
|
||||||
|
customSizeX = m_pageInfo.GetWidthMils();
|
||||||
|
customSizeY = m_pageInfo.GetHeightMils();
|
||||||
|
}
|
||||||
|
else // The custom value is set to a default value, or the last defined value
|
||||||
|
{
|
||||||
|
customSizeX = m_pageInfo.GetCustomWidthMils();
|
||||||
|
customSizeY = m_pageInfo.GetCustomHeightMils();
|
||||||
|
}
|
||||||
|
|
||||||
switch( g_UserUnit )
|
switch( g_UserUnit )
|
||||||
{
|
{
|
||||||
case MILLIMETRES:
|
case MILLIMETRES:
|
||||||
customSizeX = m_pageInfo.GetCustomWidthMils() * 25.4e-3;
|
customSizeX *= 25.4e-3;
|
||||||
customSizeY = m_pageInfo.GetCustomHeightMils()* 25.4e-3;
|
customSizeY *= 25.4e-3;
|
||||||
|
|
||||||
msg.Printf( wxT( "%.2f" ), customSizeX );
|
msg.Printf( wxT( "%.2f" ), customSizeX );
|
||||||
m_TextUserSizeX->SetValue( msg );
|
m_TextUserSizeX->SetValue( msg );
|
||||||
|
@ -161,8 +173,8 @@ void DIALOG_PAGES_SETTINGS::initDialog()
|
||||||
|
|
||||||
default:
|
default:
|
||||||
case INCHES:
|
case INCHES:
|
||||||
customSizeX = m_pageInfo.GetCustomWidthMils() / 1000.0;
|
customSizeX /= 1000.0;
|
||||||
customSizeY = m_pageInfo.GetCustomHeightMils() / 1000.0;
|
customSizeY /= 1000.0;
|
||||||
|
|
||||||
msg.Printf( wxT( "%.3f" ), customSizeX );
|
msg.Printf( wxT( "%.3f" ), customSizeX );
|
||||||
m_TextUserSizeX->SetValue( msg );
|
m_TextUserSizeX->SetValue( msg );
|
||||||
|
@ -172,15 +184,6 @@ void DIALOG_PAGES_SETTINGS::initDialog()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
m_TextRevision->SetValidator( wxTextValidator( wxFILTER_NONE, &m_Screen->m_Revision ) );
|
|
||||||
m_TextTitle->SetValidator( wxTextValidator( wxFILTER_NONE, &m_Screen->m_Title ) );
|
|
||||||
m_TextCompany->SetValidator( wxTextValidator( wxFILTER_NONE, &m_Screen->m_Company ) );
|
|
||||||
m_TextComment1->SetValidator( wxTextValidator( wxFILTER_NONE, &m_Screen->m_Commentaire1 ) );
|
|
||||||
m_TextComment2->SetValidator( wxTextValidator( wxFILTER_NONE, &m_Screen->m_Commentaire2 ) );
|
|
||||||
m_TextComment3->SetValidator( wxTextValidator( wxFILTER_NONE, &m_Screen->m_Commentaire3 ) );
|
|
||||||
m_TextComment4->SetValidator( wxTextValidator( wxFILTER_NONE, &m_Screen->m_Commentaire4 ) );
|
|
||||||
#else
|
|
||||||
m_TextRevision->SetValue( m_tb.GetRevision() );
|
m_TextRevision->SetValue( m_tb.GetRevision() );
|
||||||
m_TextTitle->SetValue( m_tb.GetTitle() );
|
m_TextTitle->SetValue( m_tb.GetTitle() );
|
||||||
m_TextCompany->SetValue( m_tb.GetCompany() );
|
m_TextCompany->SetValue( m_tb.GetCompany() );
|
||||||
|
@ -188,7 +191,6 @@ void DIALOG_PAGES_SETTINGS::initDialog()
|
||||||
m_TextComment2->SetValue( m_tb.GetComment2() );
|
m_TextComment2->SetValue( m_tb.GetComment2() );
|
||||||
m_TextComment3->SetValue( m_tb.GetComment3() );
|
m_TextComment3->SetValue( m_tb.GetComment3() );
|
||||||
m_TextComment4->SetValue( m_tb.GetComment4() );
|
m_TextComment4->SetValue( m_tb.GetComment4() );
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EESCHEMA
|
#ifndef EESCHEMA
|
||||||
m_RevisionExport->Show( false );
|
m_RevisionExport->Show( false );
|
||||||
|
@ -248,6 +250,7 @@ void DIALOG_PAGES_SETTINGS::OnPaperSizeChoice( wxCommandEvent& event )
|
||||||
m_orientationComboBox->Enable( false );
|
m_orientationComboBox->Enable( false );
|
||||||
m_TextUserSizeX->Enable( true );
|
m_TextUserSizeX->Enable( true );
|
||||||
m_TextUserSizeY->Enable( true );
|
m_TextUserSizeY->Enable( true );
|
||||||
|
m_customFmt = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -261,6 +264,7 @@ void DIALOG_PAGES_SETTINGS::OnPaperSizeChoice( wxCommandEvent& event )
|
||||||
|
|
||||||
m_TextUserSizeX->Enable( false );
|
m_TextUserSizeX->Enable( false );
|
||||||
m_TextUserSizeY->Enable( false );
|
m_TextUserSizeY->Enable( false );
|
||||||
|
m_customFmt = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetPageLayoutInfoFromDialog();
|
GetPageLayoutInfoFromDialog();
|
||||||
|
|
|
@ -1,8 +1,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) 1992-2010 <Creator>
|
* Copyright (C) 1992-2013 Kicad Developers, see AUTHORS.txt for contributors.
|
||||||
* Copyright (C) 1992-2010 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
|
||||||
|
@ -45,6 +44,7 @@ private:
|
||||||
wxBitmap* m_page_bitmap; /// Temporary bitmap for the page layout example.
|
wxBitmap* m_page_bitmap; /// Temporary bitmap for the page layout example.
|
||||||
wxSize m_layout_size; /// Logical page layout size.
|
wxSize m_layout_size; /// Logical page layout size.
|
||||||
PAGE_INFO m_pageInfo; /// Temporary page info.
|
PAGE_INFO m_pageInfo; /// Temporary page info.
|
||||||
|
bool m_customFmt; /// true if the page selection is custom
|
||||||
TITLE_BLOCK m_tb; /// Temporary title block (basic inscriptions).
|
TITLE_BLOCK m_tb; /// Temporary title block (basic inscriptions).
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -155,7 +155,7 @@ void DIALOG_GENERALOPTIONS::OnOkClick( wxCommandEvent& event )
|
||||||
void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
|
void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
int id = event.GetId();
|
int id = event.GetId();
|
||||||
bool state = m_optionsToolBar->GetToolToggled( id );
|
bool state = event.IsChecked();
|
||||||
|
|
||||||
switch( id )
|
switch( id )
|
||||||
{
|
{
|
||||||
|
@ -169,16 +169,13 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
|
||||||
else
|
else
|
||||||
m_canvas->SetCursor( wxCURSOR_QUESTION_ARROW );
|
m_canvas->SetCursor( wxCURSOR_QUESTION_ARROW );
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_TB_OPTIONS_SHOW_RATSNEST:
|
case ID_TB_OPTIONS_SHOW_RATSNEST:
|
||||||
SetElementVisibility( RATSNEST_VISIBLE, state );
|
SetElementVisibility( RATSNEST_VISIBLE, state );
|
||||||
|
|
||||||
if( state && (GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
|
if( state && (GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
|
||||||
{
|
|
||||||
Compile_Ratsnest( NULL, true );
|
Compile_Ratsnest( NULL, true );
|
||||||
}
|
|
||||||
|
|
||||||
m_canvas->Refresh();
|
m_canvas->Refresh();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -834,32 +834,21 @@ void PCB_EDIT_FRAME::OnSelectAutoPlaceMode( wxCommandEvent& aEvent )
|
||||||
// inside this function (seems happen on some Linux/wxWidgets versions)
|
// inside this function (seems happen on some Linux/wxWidgets versions)
|
||||||
// when the other tool is selected
|
// when the other tool is selected
|
||||||
|
|
||||||
int previous_state = m_autoPlaceModeId;
|
|
||||||
switch( aEvent.GetId() )
|
switch( aEvent.GetId() )
|
||||||
{
|
{
|
||||||
case ID_TOOLBARH_PCB_MODE_MODULE:
|
case ID_TOOLBARH_PCB_MODE_MODULE:
|
||||||
if( aEvent.IsChecked() )
|
if( aEvent.IsChecked() )
|
||||||
{
|
|
||||||
m_autoPlaceModeId = ID_TOOLBARH_PCB_MODE_MODULE;
|
m_autoPlaceModeId = ID_TOOLBARH_PCB_MODE_MODULE;
|
||||||
|
|
||||||
if( previous_state == ID_TOOLBARH_PCB_MODE_TRACKS )
|
|
||||||
m_mainToolBar->ToggleTool( ID_TOOLBARH_PCB_MODE_TRACKS, false );
|
|
||||||
}
|
|
||||||
else if( m_autoPlaceModeId == ID_TOOLBARH_PCB_MODE_MODULE )
|
else if( m_autoPlaceModeId == ID_TOOLBARH_PCB_MODE_MODULE )
|
||||||
// Deselect m_autoPlaceModeId only if it was selected by this tool
|
// clear m_autoPlaceModeId only if it was activated by this tool
|
||||||
m_autoPlaceModeId = 0;
|
m_autoPlaceModeId = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_TOOLBARH_PCB_MODE_TRACKS:
|
case ID_TOOLBARH_PCB_MODE_TRACKS:
|
||||||
if( aEvent.IsChecked() )
|
if( aEvent.IsChecked() )
|
||||||
{
|
|
||||||
m_autoPlaceModeId = ID_TOOLBARH_PCB_MODE_TRACKS;
|
m_autoPlaceModeId = ID_TOOLBARH_PCB_MODE_TRACKS;
|
||||||
|
|
||||||
if( previous_state == ID_TOOLBARH_PCB_MODE_MODULE )
|
|
||||||
m_mainToolBar->ToggleTool( ID_TOOLBARH_PCB_MODE_MODULE, false );
|
|
||||||
}
|
|
||||||
else if( m_autoPlaceModeId == ID_TOOLBARH_PCB_MODE_TRACKS )
|
else if( m_autoPlaceModeId == ID_TOOLBARH_PCB_MODE_TRACKS )
|
||||||
// Deselect m_autoPlaceModeId only if it was selected by this tool
|
// clear m_autoPlaceModeId only if it was activated by this tool
|
||||||
m_autoPlaceModeId = 0;
|
m_autoPlaceModeId = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,7 +113,8 @@ void PCB_EDIT_FRAME::OnUpdateZoneDisplayStyle( wxUpdateUIEvent& aEvent )
|
||||||
|
|
||||||
void PCB_EDIT_FRAME::OnUpdateDrcEnable( wxUpdateUIEvent& aEvent )
|
void PCB_EDIT_FRAME::OnUpdateDrcEnable( wxUpdateUIEvent& aEvent )
|
||||||
{
|
{
|
||||||
aEvent.Check( !Drc_On );
|
bool state = !Drc_On;
|
||||||
|
aEvent.Check( state );
|
||||||
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_DRC_OFF,
|
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_DRC_OFF,
|
||||||
Drc_On ?
|
Drc_On ?
|
||||||
_( "Disable design rule checking" ) :
|
_( "Disable design rule checking" ) :
|
||||||
|
@ -205,15 +206,12 @@ void PCB_EDIT_FRAME::OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent )
|
||||||
|
|
||||||
|
|
||||||
void PCB_EDIT_FRAME::OnUpdateAutoPlaceTracksMode( wxUpdateUIEvent& aEvent )
|
void PCB_EDIT_FRAME::OnUpdateAutoPlaceTracksMode( wxUpdateUIEvent& aEvent )
|
||||||
{
|
{return;
|
||||||
// Automatic placement of modules and tracks is a mutually exclusive operation
|
// Automatic placement of modules and tracks is a mutually exclusive operation
|
||||||
// So this tool is activated only if
|
// So this tool is activated only if
|
||||||
// m_autoPlaceModeId == ID_TOOLBARH_PCB_MODE_TRACKS.
|
// m_autoPlaceModeId == ID_TOOLBARH_PCB_MODE_TRACKS.
|
||||||
// To avoid creating erroneous events (seems happen on some Linux/wxWidgets versions)
|
|
||||||
// the tool state is changed only when it is incorrect
|
|
||||||
bool state = m_autoPlaceModeId == ID_TOOLBARH_PCB_MODE_TRACKS;
|
bool state = m_autoPlaceModeId == ID_TOOLBARH_PCB_MODE_TRACKS;
|
||||||
if( aEvent.IsChecked() != state )
|
m_mainToolBar->ToggleTool( ID_TOOLBARH_PCB_MODE_TRACKS, state );
|
||||||
aEvent.Check( state );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -222,9 +220,6 @@ void PCB_EDIT_FRAME::OnUpdateAutoPlaceModulesMode( wxUpdateUIEvent& aEvent )
|
||||||
// Automatic placement of modules and tracks is a mutually exclusive operation,
|
// Automatic placement of modules and tracks is a mutually exclusive operation,
|
||||||
// So this tool is activated only if
|
// So this tool is activated only if
|
||||||
// m_autoPlaceModeId == ID_TOOLBARH_PCB_MODE_MODULE.
|
// m_autoPlaceModeId == ID_TOOLBARH_PCB_MODE_MODULE.
|
||||||
// To avoid creating erroneous events (seems happen on some Linux/wxWidgets versions)
|
|
||||||
// the tool state is changed only when it is incorrect
|
|
||||||
bool state = m_autoPlaceModeId == ID_TOOLBARH_PCB_MODE_MODULE;
|
bool state = m_autoPlaceModeId == ID_TOOLBARH_PCB_MODE_MODULE;
|
||||||
if( aEvent.IsChecked() != state )
|
m_mainToolBar->ToggleTool( ID_TOOLBARH_PCB_MODE_MODULE, state );
|
||||||
aEvent.Check( state );
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue