Commit 6431e9c9 authored by charras's avatar charras

pcbnew, gerbview: print&plot: error message displayed when no layer selected.

parent 6cdf7e83
...@@ -5,6 +5,14 @@ Started 2007-June-11 ...@@ -5,6 +5,14 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2009-mar-10 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
++pcbnew:
++gerbview:
print,plot: error message displayed when no layer selected.
2009-Mar-5 UPDATE Vesa Solonen <vesa.solonen@hut.fi> 2009-Mar-5 UPDATE Vesa Solonen <vesa.solonen@hut.fi>
================================================================================ ================================================================================
++pcbnew: ++pcbnew:
......
...@@ -21,10 +21,6 @@ ...@@ -21,10 +21,6 @@
#include "id.h" #include "id.h"
#include "dialog_create_component.h" #include "dialog_create_component.h"
/* Routines locales */
/* Variables locales */
/**********************************************/ /**********************************************/
void WinEDA_LibeditFrame::DisplayLibInfos() void WinEDA_LibeditFrame::DisplayLibInfos()
...@@ -47,7 +43,7 @@ void WinEDA_LibeditFrame::DisplayLibInfos() ...@@ -47,7 +43,7 @@ void WinEDA_LibeditFrame::DisplayLibInfos()
if( !CurrentAliasName.IsEmpty() ) if( !CurrentAliasName.IsEmpty() )
msg << wxT( " Alias " ) << CurrentAliasName; msg << wxT( " Alias " ) << CurrentAliasName;
} }
wxChar UnitLetter[] = wxT( "?ABCDEFGHIJKLMNOPQRSTUVWXYZ" ); static wxChar UnitLetter[] = wxT( "?ABCDEFGHIJKLMNOPQRSTUVWXYZ" );
msg << wxT( " Unit " ) << UnitLetter[CurrentUnit]; msg << wxT( " Unit " ) << UnitLetter[CurrentUnit];
if( CurrentConvert > 1 ) if( CurrentConvert > 1 )
...@@ -66,7 +62,7 @@ void WinEDA_LibeditFrame::DisplayLibInfos() ...@@ -66,7 +62,7 @@ void WinEDA_LibeditFrame::DisplayLibInfos()
void WinEDA_LibeditFrame::SelectActiveLibrary() void WinEDA_LibeditFrame::SelectActiveLibrary()
/**************************************************/ /**************************************************/
/* Routine to Select Current library /* Function to select the current library (working library)
*/ */
{ {
LibraryStruct* Lib; LibraryStruct* Lib;
...@@ -80,10 +76,15 @@ void WinEDA_LibeditFrame::SelectActiveLibrary() ...@@ -80,10 +76,15 @@ void WinEDA_LibeditFrame::SelectActiveLibrary()
} }
/*************************************************/
/* Routine to Load one selected library content. */
/*************************************************/
bool WinEDA_LibeditFrame::LoadOneLibraryPart() bool WinEDA_LibeditFrame::LoadOneLibraryPart()
/**
* Function LoadOneLibraryPart()
* load a library component from the current selected library
* Prompt user for component name
* If there is no current selected library,
* prompt user for library name and make the selected library the current lib.
*/
{ {
int i; int i;
wxString msg; wxString msg;
...@@ -96,9 +97,10 @@ bool WinEDA_LibeditFrame::LoadOneLibraryPart() ...@@ -96,9 +97,10 @@ bool WinEDA_LibeditFrame::LoadOneLibraryPart()
return FALSE; return FALSE;
} }
if( CurrentLib == NULL ) if( CurrentLib == NULL ) // No current lib, ask user for the library to use
{ {
SelectActiveLibrary(); SelectActiveLibrary();
if( CurrentLib == NULL )
return FALSE; return FALSE;
} }
...@@ -109,13 +111,13 @@ bool WinEDA_LibeditFrame::LoadOneLibraryPart() ...@@ -109,13 +111,13 @@ bool WinEDA_LibeditFrame::LoadOneLibraryPart()
g_ScreenLib->ClrModify(); g_ScreenLib->ClrModify();
CurrentDrawItem = NULL; CurrentDrawItem = NULL;
// Effacement ancien composant affich� // Delete previous library component, if any
if( CurrentLibEntry ) if( CurrentLibEntry )
{ {
SAFE_DELETE( CurrentLibEntry ); SAFE_DELETE( CurrentLibEntry );
} }
/* Chargement du composant */ /* Load the new library component */
LibEntry = FindLibPart( CmpName.GetData(), CurrentLib->m_Name, FIND_ALIAS ); LibEntry = FindLibPart( CmpName.GetData(), CurrentLib->m_Name, FIND_ALIAS );
if( LibEntry == NULL ) if( LibEntry == NULL )
...@@ -199,7 +201,8 @@ int WinEDA_LibeditFrame::LoadOneLibraryPartAux( ...@@ -199,7 +201,8 @@ int WinEDA_LibeditFrame::LoadOneLibraryPartAux(
/*********************************************************************/ /*********************************************************************/
void WinEDA_LibeditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) void WinEDA_LibeditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
/*********************************************************************/ /*********************************************************************/
/* Routine generale d'affichage a l'ecran du "PartLib" en cours d'edition */ /* Function to redraw the current loaded library component
*/
{ {
if( GetScreen() == NULL ) if( GetScreen() == NULL )
return; return;
...@@ -208,9 +211,9 @@ void WinEDA_LibeditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -208,9 +211,9 @@ void WinEDA_LibeditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
DC->SetBackground( *wxBLACK_BRUSH ); DC->SetBackground( *wxBLACK_BRUSH );
DC->SetBackgroundMode( wxTRANSPARENT ); DC->SetBackgroundMode( wxTRANSPARENT );
GRResetPenAndBrush( DC ); // reinit de la brosse et plume courante GRResetPenAndBrush( DC );
DrawPanel->CursorOff( DC ); // effacement curseur DrawPanel->CursorOff( DC ); // erase cursor
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
{ {
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); // effacement affichage lie au curseur DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); // effacement affichage lie au curseur
...@@ -225,11 +228,11 @@ void WinEDA_LibeditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -225,11 +228,11 @@ void WinEDA_LibeditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
DrawLibEntry( DrawPanel, DC, CurrentLibEntry, wxPoint( 0, 0 ), DrawLibEntry( DrawPanel, DC, CurrentLibEntry, wxPoint( 0, 0 ),
CurrentUnit, CurrentConvert, GR_DEFAULT_DRAWMODE ); CurrentUnit, CurrentConvert, GR_DEFAULT_DRAWMODE );
DrawPanel->CursorOn( DC ); // reaffichage curseur DrawPanel->CursorOn( DC ); // redraw cursor
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
{ {
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); // reaffichage lie au curseur DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
} }
GetScreen()->ClrRefreshReq(); GetScreen()->ClrRefreshReq();
...@@ -242,8 +245,8 @@ void WinEDA_LibeditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -242,8 +245,8 @@ void WinEDA_LibeditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
void WinEDA_LibeditFrame::SaveActiveLibrary() void WinEDA_LibeditFrame::SaveActiveLibrary()
/*************************************************/ /*************************************************/
/* Sauvegarde en fichier la librairie pointee par CurrentLib /* Save (on disk) the current library
* une sauvegarde en .bak de l'ancien fichier est egalement cree * if exists the old file is renamed (.bak)
*/ */
{ {
wxString Name, msg; wxString Name, msg;
...@@ -576,7 +579,8 @@ void WinEDA_LibeditFrame::DeletePartInLib( LibraryStruct* Library, ...@@ -576,7 +579,8 @@ void WinEDA_LibeditFrame::DeletePartInLib( LibraryStruct* Library,
Library->m_Name, Library->m_Name,
FIND_ALIAS ); FIND_ALIAS );
if( AliasEntry == NULL ) if( AliasEntry == NULL )
{ // Should not occurs. If happens, this is an error (or bug) {
// Should not occurs. If happens, this is an error (or bug)
wxString msg; wxString msg;
msg.Printf( wxT( "Warning: Alias <%s> not found" ), msg.Printf( wxT( "Warning: Alias <%s> not found" ),
AliasName.GetData() ); AliasName.GetData() );
...@@ -584,7 +588,8 @@ void WinEDA_LibeditFrame::DeletePartInLib( LibraryStruct* Library, ...@@ -584,7 +588,8 @@ void WinEDA_LibeditFrame::DeletePartInLib( LibraryStruct* Library,
continue; continue;
} }
if( AliasEntry->Type != ALIAS ) if( AliasEntry->Type != ALIAS )
{ // Should not occurs. If happens, this is an error (or bug) {
// Should not occurs. If happens, this is an error (or bug)
wxString msg; wxString msg;
msg.Printf( wxT( "Warning: <%s> is not an Alias" ), msg.Printf( wxT( "Warning: <%s> is not an Alias" ),
AliasName.GetData() ); AliasName.GetData() );
......
No preview for this file type
This diff is collapsed.
...@@ -22,9 +22,9 @@ DEBUG = 0 ...@@ -22,9 +22,9 @@ DEBUG = 0
#Define the wxWidget path (if not found in environment variables): #Define the wxWidget path (if not found in environment variables):
ifndef WXWIN ifndef WXWIN
ifeq ($(DEBUG), 1) ifeq ($(DEBUG), 1)
WXWIN=f:/wxMSW-2.8.910-rc2/Debug WXWIN=d:/wxMSW-2.8.10/Debug
else else
WXWIN=f:/wxMSW-2.8.10-rc2/Release WXWIN=d:/wxMSW-2.8.10/Release
endif endif
endif endif
LIBVERSION = 2.8 LIBVERSION = 2.8
......
...@@ -54,7 +54,7 @@ class DIALOG_PRINT_USING_PRINTER : public DIALOG_PRINT_USING_PRINTER_base ...@@ -54,7 +54,7 @@ class DIALOG_PRINT_USING_PRINTER : public DIALOG_PRINT_USING_PRINTER_base
private: private:
WinEDA_DrawFrame* m_Parent; WinEDA_DrawFrame* m_Parent;
wxConfig* m_Config; wxConfig* m_Config;
wxCheckBox * m_BoxSelectLayer[32]; wxCheckBox* m_BoxSelectLayer[32];
public: public:
double m_XScaleAdjust, m_YScaleAdjust; double m_XScaleAdjust, m_YScaleAdjust;
...@@ -68,9 +68,11 @@ private: ...@@ -68,9 +68,11 @@ private:
void OnPrintSetup( wxCommandEvent& event ); void OnPrintSetup( wxCommandEvent& event );
void OnPrintPreview( wxCommandEvent& event ); void OnPrintPreview( wxCommandEvent& event );
void OnPrintButtonClick( wxCommandEvent& event ); void OnPrintButtonClick( wxCommandEvent& event );
void OnButtonCancelClick( wxCommandEvent& event ){ Close(); }
void OnButtonCancelClick( wxCommandEvent& event ) { Close(); }
void SetScale( wxCommandEvent& event ); void SetScale( wxCommandEvent& event );
void SetPenWidth(); void SetPenWidth();
public: public:
bool IsMirrored() { return m_Print_Mirror->IsChecked(); } bool IsMirrored() { return m_Print_Mirror->IsChecked(); }
bool ExcludeEdges() { return m_Exclude_Edges_Pcb->IsChecked(); } bool ExcludeEdges() { return m_Exclude_Edges_Pcb->IsChecked(); }
...@@ -152,16 +154,17 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( WinEDA_DrawFrame* parent ...@@ -152,16 +154,17 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( WinEDA_DrawFrame* parent
void DIALOG_PRINT_USING_PRINTER::OnInitDialog( wxInitDialogEvent& event ) void DIALOG_PRINT_USING_PRINTER::OnInitDialog( wxInitDialogEvent& event )
/************************************************************************/ /************************************************************************/
{ {
SetFont(*g_DialogFont); SetFont( *g_DialogFont );
SetFocus(); SetFocus();
int layer_max = NB_LAYERS; int layer_max = NB_LAYERS;
wxString msg; wxString msg;
#ifdef GERBVIEW #ifdef GERBVIEW
layer_max = 32; layer_max = 32;
m_Exclude_Edges_Pcb->SetValue(true); // no meaning in gerbview m_Exclude_Edges_Pcb->SetValue( true ); // no meaning in gerbview
m_Exclude_Edges_Pcb->Show(false); m_Exclude_Edges_Pcb->Show( false );
msg = _("Layers:"); msg = _( "Layers:" );
// Set wxRadioBox title to "Layers:" for copper layers and thechincal layers // Set wxRadioBox title to "Layers:" for copper layers and thechincal layers
// Because in Gerbview , al layers are only graphic layers (layer id has no meaning) // Because in Gerbview , al layers are only graphic layers (layer id has no meaning)
m_CopperLayersBoxSizer->GetStaticBox()->SetLabel( msg ); m_CopperLayersBoxSizer->GetStaticBox()->SetLabel( msg );
...@@ -170,11 +173,11 @@ void DIALOG_PRINT_USING_PRINTER::OnInitDialog( wxInitDialogEvent& event ) ...@@ -170,11 +173,11 @@ void DIALOG_PRINT_USING_PRINTER::OnInitDialog( wxInitDialogEvent& event )
/* Create layer list */ /* Create layer list */
int mask = 1, ii; int mask = 1, ii;
for( ii = 0; ii < layer_max ; ii++, mask <<= 1 ) for( ii = 0; ii < layer_max; ii++, mask <<= 1 )
{ {
#ifdef GERBVIEW #ifdef GERBVIEW
msg = _("Layer"); msg = _( "Layer" );
msg << wxT(" ") << ii+1; msg << wxT( " " ) << ii + 1;
#else #else
msg = ( (WinEDA_PcbFrame*) m_Parent )->GetBoard()->GetLayerName( ii ); msg = ( (WinEDA_PcbFrame*) m_Parent )->GetBoard()->GetLayerName( ii );
#endif #endif
...@@ -205,7 +208,8 @@ void DIALOG_PRINT_USING_PRINTER::OnInitDialog( wxInitDialogEvent& event ) ...@@ -205,7 +208,8 @@ void DIALOG_PRINT_USING_PRINTER::OnInitDialog( wxInitDialogEvent& event )
m_Config->Read( OPTKEY_PRINT_SCALE, &s_Scale_Select ); m_Config->Read( OPTKEY_PRINT_SCALE, &s_Scale_Select );
// Test for a reasonnable scale value. Set to 1 if problem // Test for a reasonnable scale value. Set to 1 if problem
if ( m_XScaleAdjust < MIN_SCALE || m_YScaleAdjust < MIN_SCALE || m_XScaleAdjust > MAX_SCALE || m_YScaleAdjust > MAX_SCALE ) if( m_XScaleAdjust < MIN_SCALE || m_YScaleAdjust < MIN_SCALE || m_XScaleAdjust >
MAX_SCALE || m_YScaleAdjust > MAX_SCALE )
m_XScaleAdjust = m_YScaleAdjust = 1.0; m_XScaleAdjust = m_YScaleAdjust = 1.0;
s_SelectedLayers = 0; s_SelectedLayers = 0;
...@@ -242,9 +246,9 @@ void DIALOG_PRINT_USING_PRINTER::OnInitDialog( wxInitDialogEvent& event ) ...@@ -242,9 +246,9 @@ void DIALOG_PRINT_USING_PRINTER::OnInitDialog( wxInitDialogEvent& event )
msg.Printf( wxT( "%lf" ), m_YScaleAdjust ); msg.Printf( wxT( "%lf" ), m_YScaleAdjust );
m_FineAdjustYscaleOpt->SetValue( msg ); m_FineAdjustYscaleOpt->SetValue( msg );
if (GetSizer()) if( GetSizer() )
{ {
GetSizer()->SetSizeHints(this); GetSizer()->SetSizeHints( this );
} }
} }
...@@ -255,7 +259,8 @@ int DIALOG_PRINT_USING_PRINTER::SetLayerMaskFromListSelection() ...@@ -255,7 +259,8 @@ int DIALOG_PRINT_USING_PRINTER::SetLayerMaskFromListSelection()
{ {
int page_count; int page_count;
int layers_count = NB_LAYERS; int layers_count = NB_LAYERS;
if (m_Parent->m_Ident == GERBER_FRAME)
if( m_Parent->m_Ident == GERBER_FRAME )
layers_count = 32; layers_count = 32;
s_PrintMaskLayer = 0; s_PrintMaskLayer = 0;
...@@ -273,7 +278,6 @@ int DIALOG_PRINT_USING_PRINTER::SetLayerMaskFromListSelection() ...@@ -273,7 +278,6 @@ int DIALOG_PRINT_USING_PRINTER::SetLayerMaskFromListSelection()
} }
/********************************************************************/ /********************************************************************/
void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event ) void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event )
/********************************************************************/ /********************************************************************/
...@@ -300,7 +304,7 @@ void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event ) ...@@ -300,7 +304,7 @@ void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event )
m_Config->Write( OPTKEY_PRINT_SCALE, s_Scale_Select ); m_Config->Write( OPTKEY_PRINT_SCALE, s_Scale_Select );
wxString layerKey; wxString layerKey;
int layers_count = NB_LAYERS; int layers_count = NB_LAYERS;
if (m_Parent->m_Ident == GERBER_FRAME) if( m_Parent->m_Ident == GERBER_FRAME )
layers_count = 32; layers_count = 32;
for( int layer = 0; layer<layers_count; ++layer ) for( int layer = 0; layer<layers_count; ++layer )
{ {
...@@ -348,7 +352,7 @@ void DIALOG_PRINT_USING_PRINTER::SetPenWidth() ...@@ -348,7 +352,7 @@ void DIALOG_PRINT_USING_PRINTER::SetPenWidth()
} }
m_DialogPenWidth->SetValue( m_DialogPenWidth->SetValue(
ReturnStringFromValue(g_UnitMetric, s_PrintPenMinWidth, m_Parent->m_InternalUnits ) ); ReturnStringFromValue( g_UnitMetric, s_PrintPenMinWidth, m_Parent->m_InternalUnits ) );
} }
...@@ -392,7 +396,7 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event ) ...@@ -392,7 +396,7 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
s_Print_Sheet_Ref = m_Print_Sheet_Ref->GetValue(); s_Print_Sheet_Ref = m_Print_Sheet_Ref->GetValue();
// Pass two printout objects: for preview, and possible printing. // Pass two printout objects: for preview, and possible printing.
wxString title = _("Print Preview"); wxString title = _( "Print Preview" );
wxPrintPreview* preview = wxPrintPreview* preview =
new wxPrintPreview( new EDA_Printout( this, m_Parent, title, s_Print_Sheet_Ref ), new wxPrintPreview( new EDA_Printout( this, m_Parent, title, s_Print_Sheet_Ref ),
new EDA_Printout( this, m_Parent, title, s_Print_Sheet_Ref ), new EDA_Printout( this, m_Parent, title, s_Print_Sheet_Ref ),
...@@ -403,9 +407,18 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event ) ...@@ -403,9 +407,18 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
DisplayError( this, wxT( "OnPrintPreview() problem" ) ); DisplayError( this, wxT( "OnPrintPreview() problem" ) );
return; return;
} }
if( s_OptionPrintPage )
SetLayerMaskFromListSelection(); SetLayerMaskFromListSelection();
// If no layer selected, we have no plot. prompt user if it happens
// because he could think there is a bug in pcbnew:
if( s_PrintMaskLayer == 0 )
{
DisplayError( this, _( "No layer selected" ) );
return;
}
// Uses the parent position and size. // Uses the parent position and size.
// @todo uses last position and size ans store them when exit in m_Config // @todo uses last position and size ans store them when exit in m_Config
wxPoint WPos = m_Parent->GetPosition(); wxPoint WPos = m_Parent->GetPosition();
...@@ -435,16 +448,24 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintButtonClick( wxCommandEvent& event ) ...@@ -435,16 +448,24 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintButtonClick( wxCommandEvent& event )
s_Print_Sheet_Ref = m_Print_Sheet_Ref->GetValue(); s_Print_Sheet_Ref = m_Print_Sheet_Ref->GetValue();
if( s_OptionPrintPage )
SetLayerMaskFromListSelection(); SetLayerMaskFromListSelection();
// If no layer selected, we have no plot. prompt user if it happens
// because he could think there is a bug in pcbnew:
if( s_PrintMaskLayer == 0 )
{
DisplayError( this, _( "No layer selected" ) );
return;
}
SetPenWidth(); SetPenWidth();
wxPrintDialogData printDialogData( *g_PrintData ); wxPrintDialogData printDialogData( *g_PrintData );
wxPrinter printer( &printDialogData ); wxPrinter printer( &printDialogData );
wxString title = _("Print"); wxString title = _( "Print" );
EDA_Printout printout( this, m_Parent, title, s_Print_Sheet_Ref ); EDA_Printout printout( this, m_Parent, title, s_Print_Sheet_Ref );
#ifndef __WINDOWS__ #ifndef __WINDOWS__
...@@ -473,15 +494,14 @@ bool EDA_Printout::OnPrintPage( int page ) ...@@ -473,15 +494,14 @@ bool EDA_Printout::OnPrintPage( int page )
msg.Printf( _( "Print page %d" ), page ); msg.Printf( _( "Print page %d" ), page );
m_Parent->Affiche_Message( msg ); m_Parent->Affiche_Message( msg );
int layers_count = NB_LAYERS; int layers_count = NB_LAYERS;
if (m_Parent->m_Ident == GERBER_FRAME) if( m_Parent->m_Ident == GERBER_FRAME )
layers_count = 32; layers_count = 32;
if( (m_Parent->m_Ident == PCB_FRAME) || (m_Parent->m_Ident == GERBER_FRAME) )
{
m_PrintFrame->SetLayerMaskFromListSelection(); m_PrintFrame->SetLayerMaskFromListSelection();
if( s_OptionPrintPage == 0 ) if( s_OptionPrintPage == 0 ) // compute layer mask from page number
{ {
// compute layer mask from page number
int ii, jj, mask = 1; int ii, jj, mask = 1;
for( ii = 0, jj = 0; ii < layers_count; ii++ ) for( ii = 0, jj = 0; ii < layers_count; ii++ )
{ {
...@@ -494,11 +514,11 @@ bool EDA_Printout::OnPrintPage( int page ) ...@@ -494,11 +514,11 @@ bool EDA_Printout::OnPrintPage( int page )
} }
mask <<= 1; mask <<= 1;
} }
if( ii == layers_count )
return FALSE;
}
} }
if( s_PrintMaskLayer == 0 )
return false;
DrawPage(); DrawPage();
return TRUE; return TRUE;
...@@ -588,7 +608,7 @@ void EDA_Printout::DrawPage() ...@@ -588,7 +608,7 @@ void EDA_Printout::DrawPage()
// Gerbview uses a very large sheet (called "World" in gerber language) // Gerbview uses a very large sheet (called "World" in gerber language)
// to print a sheet, uses A4 is better // to print a sheet, uses A4 is better
SheetSize = ActiveScreen->m_CurrentSheetDesc->m_Size; // size in 1/1000 inch SheetSize = ActiveScreen->m_CurrentSheetDesc->m_Size; // size in 1/1000 inch
if (m_Parent->m_Ident == GERBER_FRAME) if( m_Parent->m_Ident == GERBER_FRAME )
{ {
SheetSize = g_Sheet_A4.m_Size; // size in 1/1000 inch SheetSize = g_Sheet_A4.m_Size; // size in 1/1000 inch
} }
...@@ -622,11 +642,12 @@ void EDA_Printout::DrawPage() ...@@ -622,11 +642,12 @@ void EDA_Printout::DrawPage()
scaleY = (double) SheetSize.y / PlotAreaSize.y; scaleY = (double) SheetSize.y / PlotAreaSize.y;
scale = wxMax( scaleX, scaleY ) / userscale; // Use x or y scaling factor, whichever fits on the DC scale = wxMax( scaleX, scaleY ) / userscale; // Use x or y scaling factor, whichever fits on the DC
if ( m_PrintFrame->m_XScaleAdjust > MAX_SCALE || m_PrintFrame->m_YScaleAdjust > MAX_SCALE ) if( m_PrintFrame->m_XScaleAdjust > MAX_SCALE || m_PrintFrame->m_YScaleAdjust > MAX_SCALE )
DisplayInfo(NULL, _("Warning: Scale option set to a very large value") ); DisplayInfo( NULL, _( "Warning: Scale option set to a very large value" ) );
// Test for a reasonnable scale value // Test for a reasonnable scale value
if ( m_PrintFrame->m_XScaleAdjust < MIN_SCALE || m_PrintFrame->m_YScaleAdjust < MIN_SCALE ) if( m_PrintFrame->m_XScaleAdjust < MIN_SCALE || m_PrintFrame->m_YScaleAdjust < MIN_SCALE )
DisplayInfo(NULL, _("Warning: Scale option set to a very small value") ); DisplayInfo( NULL, _( "Warning: Scale option set to a very small value" ) );
// ajust the real draw scale // ajust the real draw scale
double accurate_Xscale, accurate_Yscale; double accurate_Xscale, accurate_Yscale;
...@@ -680,7 +701,7 @@ void EDA_Printout::DrawPage() ...@@ -680,7 +701,7 @@ void EDA_Printout::DrawPage()
// background color can left BLACK only when drawing the full board at once, in color mode // background color can left BLACK only when drawing the full board at once, in color mode
// Switch it to WHITE in others cases // Switch it to WHITE in others cases
if ( s_Print_Black_and_White || ( ! m_PrintFrame->PrintUsingSinglePage() ) ) if( s_Print_Black_and_White || ( !m_PrintFrame->PrintUsingSinglePage() ) )
g_DrawBgColor = WHITE; g_DrawBgColor = WHITE;
if( m_Print_Sheet_Ref ) if( m_Print_Sheet_Ref )
...@@ -692,7 +713,8 @@ void EDA_Printout::DrawPage() ...@@ -692,7 +713,8 @@ void EDA_Printout::DrawPage()
} }
if( s_PrintMirror ) if( s_PrintMirror )
{ // To plot mirror, we reverse the y axis, and modify the plot y origin {
// To plot mirror, we reverse the y axis, and modify the plot y origin
double sx, sy; double sx, sy;
dc->GetUserScale( &sx, &sy ); dc->GetUserScale( &sx, &sy );
......
...@@ -732,6 +732,11 @@ void WinEDA_PlotFrame::Plot( wxCommandEvent& event ) ...@@ -732,6 +732,11 @@ void WinEDA_PlotFrame::Plot( wxCommandEvent& event )
} }
} }
// If no layer selected, we have no plot. prompt user if it happens
// because he could think there is a bug in pcbnew:
if ( s_SelectedLayers == 0 )
DisplayError( this, _("No layer selected") );
// Close(true); // Close(true);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment