pcbnew, gerbview: print&plot: error message displayed when no layer selected.
This commit is contained in:
parent
6cdf7e836f
commit
6431e9c94d
|
@ -5,6 +5,14 @@ Started 2007-June-11
|
|||
Please add newer entries at the top, list the date and your name with
|
||||
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>
|
||||
================================================================================
|
||||
++pcbnew:
|
||||
|
|
|
@ -21,10 +21,6 @@
|
|||
#include "id.h"
|
||||
#include "dialog_create_component.h"
|
||||
|
||||
/* Routines locales */
|
||||
|
||||
/* Variables locales */
|
||||
|
||||
|
||||
/**********************************************/
|
||||
void WinEDA_LibeditFrame::DisplayLibInfos()
|
||||
|
@ -47,7 +43,7 @@ void WinEDA_LibeditFrame::DisplayLibInfos()
|
|||
if( !CurrentAliasName.IsEmpty() )
|
||||
msg << wxT( " Alias " ) << CurrentAliasName;
|
||||
}
|
||||
wxChar UnitLetter[] = wxT( "?ABCDEFGHIJKLMNOPQRSTUVWXYZ" );
|
||||
static wxChar UnitLetter[] = wxT( "?ABCDEFGHIJKLMNOPQRSTUVWXYZ" );
|
||||
msg << wxT( " Unit " ) << UnitLetter[CurrentUnit];
|
||||
|
||||
if( CurrentConvert > 1 )
|
||||
|
@ -66,7 +62,7 @@ void WinEDA_LibeditFrame::DisplayLibInfos()
|
|||
void WinEDA_LibeditFrame::SelectActiveLibrary()
|
||||
/**************************************************/
|
||||
|
||||
/* Routine to Select Current library
|
||||
/* Function to select the current library (working library)
|
||||
*/
|
||||
{
|
||||
LibraryStruct* Lib;
|
||||
|
@ -80,10 +76,15 @@ void WinEDA_LibeditFrame::SelectActiveLibrary()
|
|||
}
|
||||
|
||||
|
||||
/*************************************************/
|
||||
/* Routine to Load one selected library content. */
|
||||
/*************************************************/
|
||||
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;
|
||||
wxString msg;
|
||||
|
@ -96,10 +97,11 @@ bool WinEDA_LibeditFrame::LoadOneLibraryPart()
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if( CurrentLib == NULL )
|
||||
if( CurrentLib == NULL ) // No current lib, ask user for the library to use
|
||||
{
|
||||
SelectActiveLibrary();
|
||||
return FALSE;
|
||||
if( CurrentLib == NULL )
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
i = GetNameOfPartToLoad( this, CurrentLib, CmpName );
|
||||
|
@ -109,13 +111,13 @@ bool WinEDA_LibeditFrame::LoadOneLibraryPart()
|
|||
g_ScreenLib->ClrModify();
|
||||
CurrentDrawItem = NULL;
|
||||
|
||||
// Effacement ancien composant affich<63>
|
||||
// Delete previous library component, if any
|
||||
if( CurrentLibEntry )
|
||||
{
|
||||
SAFE_DELETE( CurrentLibEntry );
|
||||
}
|
||||
|
||||
/* Chargement du composant */
|
||||
/* Load the new library component */
|
||||
LibEntry = FindLibPart( CmpName.GetData(), CurrentLib->m_Name, FIND_ALIAS );
|
||||
|
||||
if( LibEntry == NULL )
|
||||
|
@ -199,7 +201,8 @@ int WinEDA_LibeditFrame::LoadOneLibraryPartAux(
|
|||
/*********************************************************************/
|
||||
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 )
|
||||
return;
|
||||
|
@ -208,9 +211,9 @@ void WinEDA_LibeditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
|||
|
||||
DC->SetBackground( *wxBLACK_BRUSH );
|
||||
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 )
|
||||
{
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); // effacement affichage lie au curseur
|
||||
|
@ -225,11 +228,11 @@ void WinEDA_LibeditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
|||
DrawLibEntry( DrawPanel, DC, CurrentLibEntry, wxPoint( 0, 0 ),
|
||||
CurrentUnit, CurrentConvert, GR_DEFAULT_DRAWMODE );
|
||||
|
||||
DrawPanel->CursorOn( DC ); // reaffichage curseur
|
||||
DrawPanel->CursorOn( DC ); // redraw cursor
|
||||
|
||||
if( DrawPanel->ManageCurseur )
|
||||
{
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); // reaffichage lie au curseur
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||
}
|
||||
|
||||
GetScreen()->ClrRefreshReq();
|
||||
|
@ -242,8 +245,8 @@ void WinEDA_LibeditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
|||
void WinEDA_LibeditFrame::SaveActiveLibrary()
|
||||
/*************************************************/
|
||||
|
||||
/* Sauvegarde en fichier la librairie pointee par CurrentLib
|
||||
* une sauvegarde en .bak de l'ancien fichier est egalement cree
|
||||
/* Save (on disk) the current library
|
||||
* if exists the old file is renamed (.bak)
|
||||
*/
|
||||
{
|
||||
wxString Name, msg;
|
||||
|
@ -321,8 +324,8 @@ void WinEDA_LibeditFrame::DeleteOnePart()
|
|||
* alias deviennent dependants de celui ci.
|
||||
*/
|
||||
{
|
||||
wxString CmpName;
|
||||
int NumOfParts;
|
||||
wxString CmpName;
|
||||
int NumOfParts;
|
||||
EDA_LibComponentStruct* LibEntry;
|
||||
WinEDAListBox* ListBox;
|
||||
const wxChar** ListNames;
|
||||
|
@ -365,7 +368,7 @@ void WinEDA_LibeditFrame::DeleteOnePart()
|
|||
}
|
||||
|
||||
ListBox = new WinEDAListBox( this, msg, ListNames, wxEmptyString, NULL,
|
||||
wxColour( 255, 255, 255 ) );
|
||||
wxColour( 255, 255, 255 ) );
|
||||
|
||||
|
||||
int ii = ListBox->ShowModal();
|
||||
|
@ -407,7 +410,7 @@ void WinEDA_LibeditFrame::CreateNewLibraryPart()
|
|||
int diag;
|
||||
|
||||
if( CurrentLibEntry
|
||||
&& !IsOK( this, _( "Clear old component from screen (changes will be lost)?" ) ) )
|
||||
&& !IsOK( this, _( "Clear old component from screen (changes will be lost)?" ) ) )
|
||||
return;
|
||||
|
||||
CurrentDrawItem = NULL;
|
||||
|
@ -429,8 +432,8 @@ void WinEDA_LibeditFrame::CreateNewLibraryPart()
|
|||
{
|
||||
wxString msg;
|
||||
msg << _( "Component \"" ) << Dialogbox.ReturnCmpName() <<
|
||||
_( "\" exists in library \"" ) << CurrentLib->m_Name <<
|
||||
_( "\"." );
|
||||
_( "\" exists in library \"" ) << CurrentLib->m_Name <<
|
||||
_( "\"." );
|
||||
DisplayError( this, msg );
|
||||
return;
|
||||
}
|
||||
|
@ -485,7 +488,7 @@ void WinEDA_LibeditFrame::DeletePartInLib( LibraryStruct* Library,
|
|||
if( Entry->Type == ALIAS )
|
||||
{
|
||||
RootEntry = FindLibPart(
|
||||
( (EDA_LibCmpAliasStruct*) Entry )->m_RootName.GetData(),
|
||||
( (EDA_LibCmpAliasStruct*) Entry )->m_RootName.GetData(),
|
||||
Library->m_Name, FIND_ROOT );
|
||||
/* Remove alias name from the root component alias list */
|
||||
if( RootEntry == NULL )
|
||||
|
@ -539,7 +542,7 @@ void WinEDA_LibeditFrame::DeletePartInLib( LibraryStruct* Library,
|
|||
{
|
||||
wxString msg;
|
||||
msg.Printf( wxT( "Warning: Alias <%s> not found" ),
|
||||
AliasName.GetData() );
|
||||
AliasName.GetData() );
|
||||
DisplayError( this, msg, 30 );
|
||||
}
|
||||
else
|
||||
|
@ -576,18 +579,20 @@ void WinEDA_LibeditFrame::DeletePartInLib( LibraryStruct* Library,
|
|||
Library->m_Name,
|
||||
FIND_ALIAS );
|
||||
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;
|
||||
msg.Printf( wxT( "Warning: Alias <%s> not found" ),
|
||||
AliasName.GetData() );
|
||||
AliasName.GetData() );
|
||||
DisplayError( this, msg, 30 );
|
||||
continue;
|
||||
}
|
||||
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;
|
||||
msg.Printf( wxT( "Warning: <%s> is not an Alias" ),
|
||||
AliasName.GetData() );
|
||||
AliasName.GetData() );
|
||||
DisplayError( this, msg, 30 );
|
||||
continue;
|
||||
}
|
||||
|
@ -635,7 +640,7 @@ void WinEDA_LibeditFrame::SaveOnePartInMemory()
|
|||
CurrentLib->m_Name, FIND_ROOT ) ) != NULL )
|
||||
{
|
||||
msg.Printf( _( "Component \"%s\" exists. Change it?" ),
|
||||
Entry->m_Name.m_Text.GetData() );
|
||||
Entry->m_Name.m_Text.GetData() );
|
||||
if( !IsOK( this, msg ) )
|
||||
return;
|
||||
NewCmp = FALSE;
|
||||
|
@ -685,6 +690,6 @@ void WinEDA_LibeditFrame::SaveOnePartInMemory()
|
|||
}
|
||||
|
||||
msg.Printf( _( "Component %s saved in %s" ),
|
||||
Entry->m_Name.m_Text.GetData(), CurrentLib->m_Name.GetData() );
|
||||
Entry->m_Name.m_Text.GetData(), CurrentLib->m_Name.GetData() );
|
||||
Affiche_Message( msg );
|
||||
}
|
||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
4
libs.win
4
libs.win
|
@ -22,9 +22,9 @@ DEBUG = 0
|
|||
#Define the wxWidget path (if not found in environment variables):
|
||||
ifndef WXWIN
|
||||
ifeq ($(DEBUG), 1)
|
||||
WXWIN=f:/wxMSW-2.8.910-rc2/Debug
|
||||
WXWIN=d:/wxMSW-2.8.10/Debug
|
||||
else
|
||||
WXWIN=f:/wxMSW-2.8.10-rc2/Release
|
||||
WXWIN=d:/wxMSW-2.8.10/Release
|
||||
endif
|
||||
endif
|
||||
LIBVERSION = 2.8
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
#include "pcbplot.h"
|
||||
|
||||
#define DEFAULT_ORIENTATION_PAPER wxLANDSCAPE // other option is wxPORTRAIT
|
||||
#define WIDTH_MAX_VALUE 1000
|
||||
#define WIDTH_MIN_VALUE 1
|
||||
#define WIDTH_MAX_VALUE 1000
|
||||
#define WIDTH_MIN_VALUE 1
|
||||
|
||||
static long s_SelectedLayers;
|
||||
static double s_ScaleList[] =
|
||||
|
@ -54,9 +54,9 @@ class DIALOG_PRINT_USING_PRINTER : public DIALOG_PRINT_USING_PRINTER_base
|
|||
private:
|
||||
WinEDA_DrawFrame* m_Parent;
|
||||
wxConfig* m_Config;
|
||||
wxCheckBox * m_BoxSelectLayer[32];
|
||||
wxCheckBox* m_BoxSelectLayer[32];
|
||||
public:
|
||||
double m_XScaleAdjust, m_YScaleAdjust;
|
||||
double m_XScaleAdjust, m_YScaleAdjust;
|
||||
|
||||
public:
|
||||
DIALOG_PRINT_USING_PRINTER( WinEDA_DrawFrame* parent );
|
||||
|
@ -68,9 +68,11 @@ private:
|
|||
void OnPrintSetup( wxCommandEvent& event );
|
||||
void OnPrintPreview( wxCommandEvent& event );
|
||||
void OnPrintButtonClick( wxCommandEvent& event );
|
||||
void OnButtonCancelClick( wxCommandEvent& event ){ Close(); }
|
||||
|
||||
void OnButtonCancelClick( wxCommandEvent& event ) { Close(); }
|
||||
void SetScale( wxCommandEvent& event );
|
||||
void SetPenWidth();
|
||||
|
||||
public:
|
||||
bool IsMirrored() { return m_Print_Mirror->IsChecked(); }
|
||||
bool ExcludeEdges() { return m_Exclude_Edges_Pcb->IsChecked(); }
|
||||
|
@ -88,17 +90,17 @@ public:
|
|||
bool m_Print_Sheet_Ref;
|
||||
|
||||
public:
|
||||
WinEDA_DrawFrame* m_Parent;
|
||||
WinEDA_DrawFrame* m_Parent;
|
||||
DIALOG_PRINT_USING_PRINTER* m_PrintFrame;
|
||||
|
||||
EDA_Printout( DIALOG_PRINT_USING_PRINTER* print_frame,
|
||||
WinEDA_DrawFrame* parent,
|
||||
const wxString& title,
|
||||
bool print_ref ) :
|
||||
WinEDA_DrawFrame* parent,
|
||||
const wxString& title,
|
||||
bool print_ref ) :
|
||||
wxPrintout( title )
|
||||
{
|
||||
m_PrintFrame = print_frame;
|
||||
m_Parent = parent;
|
||||
m_PrintFrame = print_frame;
|
||||
m_Parent = parent;
|
||||
s_PrintMaskLayer = 0xFFFFFFFF;
|
||||
m_Print_Sheet_Ref = print_ref;
|
||||
}
|
||||
|
@ -152,16 +154,17 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( WinEDA_DrawFrame* parent
|
|||
void DIALOG_PRINT_USING_PRINTER::OnInitDialog( wxInitDialogEvent& event )
|
||||
/************************************************************************/
|
||||
{
|
||||
SetFont(*g_DialogFont);
|
||||
SetFont( *g_DialogFont );
|
||||
SetFocus();
|
||||
int layer_max = NB_LAYERS;
|
||||
int layer_max = NB_LAYERS;
|
||||
wxString msg;
|
||||
|
||||
#ifdef GERBVIEW
|
||||
layer_max = 32;
|
||||
m_Exclude_Edges_Pcb->SetValue(true); // no meaning in gerbview
|
||||
m_Exclude_Edges_Pcb->Show(false);
|
||||
msg = _("Layers:");
|
||||
m_Exclude_Edges_Pcb->SetValue( true ); // no meaning in gerbview
|
||||
m_Exclude_Edges_Pcb->Show( false );
|
||||
msg = _( "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)
|
||||
m_CopperLayersBoxSizer->GetStaticBox()->SetLabel( msg );
|
||||
|
@ -170,11 +173,11 @@ void DIALOG_PRINT_USING_PRINTER::OnInitDialog( wxInitDialogEvent& event )
|
|||
|
||||
/* Create layer list */
|
||||
int mask = 1, ii;
|
||||
for( ii = 0; ii < layer_max ; ii++, mask <<= 1 )
|
||||
for( ii = 0; ii < layer_max; ii++, mask <<= 1 )
|
||||
{
|
||||
#ifdef GERBVIEW
|
||||
msg = _("Layer");
|
||||
msg << wxT(" ") << ii+1;
|
||||
msg = _( "Layer" );
|
||||
msg << wxT( " " ) << ii + 1;
|
||||
#else
|
||||
msg = ( (WinEDA_PcbFrame*) m_Parent )->GetBoard()->GetLayerName( ii );
|
||||
#endif
|
||||
|
@ -187,7 +190,7 @@ void DIALOG_PRINT_USING_PRINTER::OnInitDialog( wxInitDialogEvent& event )
|
|||
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE );
|
||||
else
|
||||
m_TechnicalLayersBoxSizer->Add( m_BoxSelectLayer[ii],
|
||||
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE );
|
||||
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE );
|
||||
}
|
||||
|
||||
// Option for excluding contents of "Edges Pcb" layer
|
||||
|
@ -205,7 +208,8 @@ void DIALOG_PRINT_USING_PRINTER::OnInitDialog( wxInitDialogEvent& event )
|
|||
m_Config->Read( OPTKEY_PRINT_SCALE, &s_Scale_Select );
|
||||
|
||||
// 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;
|
||||
|
||||
s_SelectedLayers = 0;
|
||||
|
@ -242,9 +246,9 @@ void DIALOG_PRINT_USING_PRINTER::OnInitDialog( wxInitDialogEvent& event )
|
|||
msg.Printf( wxT( "%lf" ), m_YScaleAdjust );
|
||||
m_FineAdjustYscaleOpt->SetValue( msg );
|
||||
|
||||
if (GetSizer())
|
||||
if( GetSizer() )
|
||||
{
|
||||
GetSizer()->SetSizeHints(this);
|
||||
GetSizer()->SetSizeHints( this );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -255,7 +259,8 @@ int DIALOG_PRINT_USING_PRINTER::SetLayerMaskFromListSelection()
|
|||
{
|
||||
int page_count;
|
||||
int layers_count = NB_LAYERS;
|
||||
if (m_Parent->m_Ident == GERBER_FRAME)
|
||||
|
||||
if( m_Parent->m_Ident == GERBER_FRAME )
|
||||
layers_count = 32;
|
||||
|
||||
s_PrintMaskLayer = 0;
|
||||
|
@ -273,7 +278,6 @@ int DIALOG_PRINT_USING_PRINTER::SetLayerMaskFromListSelection()
|
|||
}
|
||||
|
||||
|
||||
|
||||
/********************************************************************/
|
||||
void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event )
|
||||
/********************************************************************/
|
||||
|
@ -299,8 +303,8 @@ void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event )
|
|||
m_Config->Write( OPTKEY_PRINT_Y_FINESCALE_ADJ, m_YScaleAdjust );
|
||||
m_Config->Write( OPTKEY_PRINT_SCALE, s_Scale_Select );
|
||||
wxString layerKey;
|
||||
int layers_count = NB_LAYERS;
|
||||
if (m_Parent->m_Ident == GERBER_FRAME)
|
||||
int layers_count = NB_LAYERS;
|
||||
if( m_Parent->m_Ident == GERBER_FRAME )
|
||||
layers_count = 32;
|
||||
for( int layer = 0; layer<layers_count; ++layer )
|
||||
{
|
||||
|
@ -348,7 +352,7 @@ void DIALOG_PRINT_USING_PRINTER::SetPenWidth()
|
|||
}
|
||||
|
||||
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 )
|
|||
s_Print_Sheet_Ref = m_Print_Sheet_Ref->GetValue();
|
||||
|
||||
// Pass two printout objects: for preview, and possible printing.
|
||||
wxString title = _("Print Preview");
|
||||
wxString title = _( "Print Preview" );
|
||||
wxPrintPreview* preview =
|
||||
new wxPrintPreview( new EDA_Printout( this, m_Parent, title, s_Print_Sheet_Ref ),
|
||||
new EDA_Printout( this, m_Parent, title, s_Print_Sheet_Ref ),
|
||||
|
@ -403,13 +407,22 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
|
|||
DisplayError( this, wxT( "OnPrintPreview() problem" ) );
|
||||
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.
|
||||
// @todo uses last position and size ans store them when exit in m_Config
|
||||
wxPoint WPos = m_Parent->GetPosition();
|
||||
wxSize WSize = m_Parent->GetSize();
|
||||
wxPoint WPos = m_Parent->GetPosition();
|
||||
wxSize WSize = m_Parent->GetSize();
|
||||
|
||||
wxPreviewFrame* frame = new wxPreviewFrame( preview, this, title, WPos, WSize );
|
||||
|
||||
|
@ -435,8 +448,16 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintButtonClick( wxCommandEvent& event )
|
|||
|
||||
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();
|
||||
|
||||
|
@ -444,7 +465,7 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintButtonClick( wxCommandEvent& event )
|
|||
|
||||
wxPrinter printer( &printDialogData );
|
||||
|
||||
wxString title = _("Print");
|
||||
wxString title = _( "Print" );
|
||||
EDA_Printout printout( this, m_Parent, title, s_Print_Sheet_Ref );
|
||||
|
||||
#ifndef __WINDOWS__
|
||||
|
@ -473,32 +494,31 @@ bool EDA_Printout::OnPrintPage( int page )
|
|||
|
||||
msg.Printf( _( "Print page %d" ), page );
|
||||
m_Parent->Affiche_Message( msg );
|
||||
int layers_count = NB_LAYERS;
|
||||
if (m_Parent->m_Ident == GERBER_FRAME)
|
||||
layers_count = 32;
|
||||
if( (m_Parent->m_Ident == PCB_FRAME) || (m_Parent->m_Ident == GERBER_FRAME) )
|
||||
{
|
||||
m_PrintFrame->SetLayerMaskFromListSelection();
|
||||
if( s_OptionPrintPage == 0 )
|
||||
{
|
||||
// compute layer mask from page number
|
||||
int ii, jj, mask = 1;
|
||||
for( ii = 0, jj = 0; ii < layers_count; ii++ )
|
||||
{
|
||||
if( s_PrintMaskLayer & mask )
|
||||
jj++;
|
||||
if( jj == page )
|
||||
{
|
||||
s_PrintMaskLayer = mask;
|
||||
break;
|
||||
}
|
||||
mask <<= 1;
|
||||
}
|
||||
|
||||
if( ii == layers_count )
|
||||
return FALSE;
|
||||
int layers_count = NB_LAYERS;
|
||||
if( m_Parent->m_Ident == GERBER_FRAME )
|
||||
layers_count = 32;
|
||||
|
||||
m_PrintFrame->SetLayerMaskFromListSelection();
|
||||
if( s_OptionPrintPage == 0 ) // compute layer mask from page number
|
||||
{
|
||||
int ii, jj, mask = 1;
|
||||
for( ii = 0, jj = 0; ii < layers_count; ii++ )
|
||||
{
|
||||
if( s_PrintMaskLayer & mask )
|
||||
jj++;
|
||||
if( jj == page )
|
||||
{
|
||||
s_PrintMaskLayer = mask;
|
||||
break;
|
||||
}
|
||||
mask <<= 1;
|
||||
}
|
||||
}
|
||||
|
||||
if( s_PrintMaskLayer == 0 )
|
||||
return false;
|
||||
|
||||
DrawPage();
|
||||
|
||||
return TRUE;
|
||||
|
@ -567,7 +587,7 @@ void EDA_Printout::DrawPage()
|
|||
wxPoint old_org;
|
||||
wxPoint DrawOffset; // Offset de trace
|
||||
double userscale;
|
||||
double DrawZoom = 1;
|
||||
double DrawZoom = 1;
|
||||
wxDC* dc = GetDC();
|
||||
|
||||
s_PrintMirror = m_PrintFrame->IsMirrored();
|
||||
|
@ -587,8 +607,8 @@ void EDA_Printout::DrawPage()
|
|||
|
||||
// Gerbview uses a very large sheet (called "World" in gerber language)
|
||||
// to print a sheet, uses A4 is better
|
||||
SheetSize = ActiveScreen->m_CurrentSheetDesc->m_Size; // size in 1/1000 inch
|
||||
if (m_Parent->m_Ident == GERBER_FRAME)
|
||||
SheetSize = ActiveScreen->m_CurrentSheetDesc->m_Size; // size in 1/1000 inch
|
||||
if( m_Parent->m_Ident == GERBER_FRAME )
|
||||
{
|
||||
SheetSize = g_Sheet_A4.m_Size; // size in 1/1000 inch
|
||||
}
|
||||
|
@ -622,11 +642,12 @@ void EDA_Printout::DrawPage()
|
|||
scaleY = (double) SheetSize.y / PlotAreaSize.y;
|
||||
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 )
|
||||
DisplayInfo(NULL, _("Warning: Scale option set to a very large value") );
|
||||
if( m_PrintFrame->m_XScaleAdjust > MAX_SCALE || m_PrintFrame->m_YScaleAdjust > MAX_SCALE )
|
||||
DisplayInfo( NULL, _( "Warning: Scale option set to a very large value" ) );
|
||||
|
||||
// Test for a reasonnable scale value
|
||||
if ( m_PrintFrame->m_XScaleAdjust < MIN_SCALE || m_PrintFrame->m_YScaleAdjust < MIN_SCALE )
|
||||
DisplayInfo(NULL, _("Warning: Scale option set to a very small value") );
|
||||
if( m_PrintFrame->m_XScaleAdjust < MIN_SCALE || m_PrintFrame->m_YScaleAdjust < MIN_SCALE )
|
||||
DisplayInfo( NULL, _( "Warning: Scale option set to a very small value" ) );
|
||||
|
||||
// ajust the real draw scale
|
||||
double accurate_Xscale, accurate_Yscale;
|
||||
|
@ -680,7 +701,7 @@ void EDA_Printout::DrawPage()
|
|||
|
||||
// background color can left BLACK only when drawing the full board at once, in color mode
|
||||
// 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;
|
||||
|
||||
if( m_Print_Sheet_Ref )
|
||||
|
@ -692,7 +713,8 @@ void EDA_Printout::DrawPage()
|
|||
}
|
||||
|
||||
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;
|
||||
|
||||
dc->GetUserScale( &sx, &sy );
|
||||
|
@ -728,7 +750,7 @@ void EDA_Printout::DrawPage()
|
|||
|
||||
panel->PrintPage( dc, 0, s_PrintMaskLayer, s_PrintMirror );
|
||||
|
||||
g_DrawBgColor = bg_color;
|
||||
g_DrawBgColor = bg_color;
|
||||
g_IsPrinting = FALSE;
|
||||
panel->m_ClipBox = tmp;
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue